react-tiptap-base-editor 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,214 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),Ne=require("react"),A=require("@tiptap/react"),Fn=require("@tiptap/starter-kit"),Pn=require("@tiptap/extension-image"),at=require("@tiptap/extension-list"),Jn=require("@tiptap/extension-text-align"),qn=require("@tiptap/extension-typography"),$n=require("@tiptap/extension-highlight"),Kn=require("@tiptap/extension-subscript"),Wn=require("@tiptap/extension-superscript"),Gn=require("@tiptap/extensions"),T=require("@floating-ui/react"),Yn=require("@tiptap/extension-horizontal-rule"),Xn=require("@radix-ui/react-dropdown-menu"),mt=require("react-hotkeys-hook"),Qn=require("@radix-ui/react-popover"),_n=require("lodash.throttle");function Be(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const u=Be(Ne),P=Be(Xn),ge=Be(Qn);function er({initialOpen:n=!1,placement:e="top",open:t,onOpenChange:r,delay:o=600,closeDelay:s=0}={}){const[a,l]=u.useState(n),c=t??a,d=r??l,f=T.useFloating({placement:e,open:c,onOpenChange:d,whileElementsMounted:T.autoUpdate,middleware:[T.offset(4),T.flip({crossAxis:e.includes("-"),fallbackAxisSideDirection:"start",padding:4}),T.shift({padding:4})]}),h=f.context,p=T.useHover(h,{mouseOnly:!0,move:!1,restMs:o,enabled:t==null,delay:{close:s}}),C=T.useFocus(h,{enabled:t==null}),g=T.useDismiss(h),m=T.useRole(h,{role:"tooltip"}),x=T.useInteractions([p,C,g,m]);return u.useMemo(()=>({open:c,setOpen:d,...x,...f}),[c,d,x,f])}const Ee=u.createContext(null);function xt(){const n=u.useContext(Ee);if(n==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return n}function vt({children:n,...e}){const t=er(e);return e.useDelayGroup?i.jsx(T.FloatingDelayGroup,{delay:{open:e.delay??0,close:e.closeDelay??0},timeoutMs:e.timeout,children:i.jsx(Ee.Provider,{value:t,children:n})}):i.jsx(Ee.Provider,{value:t,children:n})}const wt=u.forwardRef(function({children:e,asChild:t=!1,...r},o){const s=xt(),a=u.isValidElement(e)?parseInt(u.version,10)>=19?e.props.ref:e.ref:void 0,l=T.useMergeRefs([s.refs.setReference,o,a]);if(t&&u.isValidElement(e)){const c={"data-tooltip-state":s.open?"open":"closed"};return u.cloneElement(e,s.getReferenceProps({ref:l,...r,...typeof e.props=="object"?e.props:{},...c}))}return i.jsx("button",{ref:l,"data-tooltip-state":s.open?"open":"closed",...s.getReferenceProps(r),children:e})}),bt=u.forwardRef(function({style:e,children:t,portal:r=!0,portalProps:o={},...s},a){const l=xt(),c=T.useMergeRefs([l.refs.setFloating,a]);if(!l.open)return null;const d=i.jsx("div",{ref:c,style:{...l.floatingStyles,...e},...l.getFloatingProps(s),className:"tiptap-tooltip",children:t});return r?i.jsx(T.FloatingPortal,{...o,children:d}):d});vt.displayName="Tooltip";wt.displayName="TooltipTrigger";bt.displayName="TooltipContent";function yt(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),s=e.child(r);if(o==s){t+=o.nodeSize;continue}if(!o.sameMarkup(s))return t;if(o.isText&&o.text!=s.text){for(let a=0;o.text[a]==s.text[a];a++)t++;return t}if(o.content.size||s.content.size){let a=yt(o.content,s.content,t+1);if(a!=null)return a}t+=o.nodeSize}}function kt(n,e,t,r){for(let o=n.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:t,b:r};let a=n.child(--o),l=e.child(--s),c=a.nodeSize;if(a==l){t-=c,r-=c;continue}if(!a.sameMarkup(l))return{a:t,b:r};if(a.isText&&a.text!=l.text){let d=0,f=Math.min(a.text.length,l.text.length);for(;d<f&&a.text[a.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,r--;return{a:t,b:r}}if(a.content.size||l.content.size){let d=kt(a.content,l.content,t-1,r-1);if(d)return d}t-=c,r-=c}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,s){for(let a=0,l=0;l<t;a++){let c=this.content[a],d=l+c.nodeSize;if(d>e&&r(c,o+l,s||null,a)!==!1&&c.content.size){let f=l+1;c.nodesBetween(Math.max(0,e-f),Math.min(c.content.size,t-f),r,o+f)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let s="",a=!0;return this.nodesBetween(e,t,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,t-c):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&r&&(a?a=!1:s+=r),s+=d},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new k(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let s=0,a=0;a<t;s++){let l=this.content[s],c=a+l.nodeSize;c>e&&((a<e||c>t)&&(l.isText?l=l.cut(Math.max(0,e-a),Math.min(l.text.length,t-a)):l=l.cut(Math.max(0,e-a-1),Math.min(l.content.size,t-a-1))),r.push(l),o+=l.nodeSize),a=c}return new k(r,o)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new k(o,s)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return yt(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return kt(this,e,t,r)}findIndex(e){if(e==0)return de(0,e);if(e==this.size)return de(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let o=this.child(t),s=r+o.nodeSize;if(s>=e)return s==e?de(t+1,s):de(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(t||(t=e.slice(0,o)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const Ie={index:0,offset:0};function de(n,e){return Ie.index=n,Ie.offset=e,Ie}class tr extends Error{}class v{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=St(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(jt(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return v.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new v(k.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)o++;return new v(e,r,o)}}v.empty=new v(k.empty,0,0);function jt(n,e,t){let{index:r,offset:o}=n.findIndex(e),s=n.maybeChild(r),{index:a,offset:l}=n.findIndex(t);if(o==e||s.isText){if(l!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(jt(s.content,e-o-1,t-o-1)))}function St(n,e,t,r){let{index:o,offset:s}=n.findIndex(e),a=n.maybeChild(o);if(s==e||a.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=St(a.content,e-s-1,t,a);return l&&n.replaceChild(o,a.copy(l))}const Lt=65535,It=Math.pow(2,16);function nr(n,e){return n+e*It}function ct(n){return n&Lt}function rr(n){return(n-(n&Lt))/It}const Rt=1,Ht=2,pe=4,Nt=8;class ut{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Nt)>0}get deletedBefore(){return(this.delInfo&(Rt|pe))>0}get deletedAfter(){return(this.delInfo&(Ht|pe))>0}get deletedAcross(){return(this.delInfo&pe)>0}}class M{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&M.empty)return M.empty}recover(e){let t=0,r=ct(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+rr(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,s=this.inverted?2:1,a=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[l+s],f=this.ranges[l+a],h=c+d;if(e<=h){let p=d?e==c?-1:e==h?1:t:t,C=c+o+(p<0?0:f);if(r)return C;let g=e==(t<0?c:h)?null:nr(l/3,e-c),m=e==c?Ht:e==h?Rt:pe;return(t<0?e!=c:e!=h)&&(m|=Nt),new ut(C,m,g)}o+=f-d}return r?e+o:new ut(e+o,0,null)}touches(e,t){let r=0,o=ct(t),s=this.inverted?2:1,a=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[l+s],f=c+d;if(e<=f&&l==o*3)return!0;r+=this.ranges[l+a]-d}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let a=this.ranges[o],l=a-(this.inverted?s:0),c=a+(this.inverted?0:s),d=this.ranges[o+t],f=this.ranges[o+r];e(l,l+d,c,c+f),s+=f-d}}invert(){return new M(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?M.empty:new M(e<0?[0,-e,0]:[0,0,e])}}M.empty=new M([]);const Re=Object.create(null);class E{getMap(){return M.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Re[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Re)throw new RangeError("Duplicate use of step JSON ID "+e);return Re[e]=t,t.prototype.jsonID=e,t}}class S{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new S(e,null)}static fail(e){return new S(null,e)}static fromReplace(e,t,r,o){try{return S.ok(e.replace(t,r,o))}catch(s){if(s instanceof tr)return S.fail(s.message);throw s}}}function Ve(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let s=n.child(o);s.content.size&&(s=s.copy(Ve(s.content,e,s))),s.isInline&&(s=e(s,t,o)),r.push(s)}return k.fromArray(r)}class G extends E{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),s=new v(Ve(t.content,(a,l)=>!a.isAtom||!l.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),o),t.openStart,t.openEnd);return S.fromReplace(e,this.from,this.to,s)}invert(){return new Y(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new G(t.pos,r.pos,this.mark)}merge(e){return e instanceof G&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new G(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new G(t.from,t.to,e.markFromJSON(t.mark))}}E.jsonID("addMark",G);class Y extends E{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new v(Ve(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return S.fromReplace(e,this.from,this.to,r)}invert(){return new G(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Y(t.pos,r.pos,this.mark)}merge(e){return e instanceof Y&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Y(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Y(t.from,t.to,e.markFromJSON(t.mark))}}E.jsonID("removeMark",Y);class X extends E{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return S.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return S.fromReplace(e,this.pos,this.pos+1,new v(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new X(this.pos,t.marks[o]);return new X(this.pos,this.mark)}}return new se(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new X(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new X(t.pos,e.markFromJSON(t.mark))}}E.jsonID("addNodeMark",X);class se extends E{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return S.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return S.fromReplace(e,this.pos,this.pos+1,new v(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new X(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new se(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new se(t.pos,e.markFromJSON(t.mark))}}E.jsonID("removeNodeMark",se);class z extends E{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&Te(e,this.from,this.to)?S.fail("Structure replace would overwrite content"):S.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new M([this.from,this.to-this.from,this.slice.size])}invert(e){return new z(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new z(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof z)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?v.empty:new v(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new z(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?v.empty:new v(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new z(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new z(t.from,t.to,v.fromJSON(e,t.slice),!!t.structure)}}E.jsonID("replace",z);class te extends E{constructor(e,t,r,o,s,a,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=a,this.structure=l}apply(e){if(this.structure&&(Te(e,this.from,this.gapFrom)||Te(e,this.gapTo,this.to)))return S.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return S.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?S.fromReplace(e,this.from,this.to,r):S.fail("Content does not fit in gap")}getMap(){return new M([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new te(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||s>r.pos?null:new te(t.pos,r.pos,o,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new te(t.from,t.to,t.gapFrom,t.gapTo,v.fromJSON(e,t.slice),t.insert,!!t.structure)}}E.jsonID("replaceAround",te);function Te(n,e,t){let r=n.resolve(e),o=t-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let a=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,o--}}return!1}class ie extends E{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return S.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return S.fromReplace(e,this.pos,this.pos+1,new v(k.from(o),0,t.isLeaf?0:1))}getMap(){return M.empty}invert(e){return new ie(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ie(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ie(t.pos,t.attr,t.value)}}E.jsonID("attr",ie);class me extends E{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return S.ok(r)}getMap(){return M.empty}invert(e){return new me(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new me(t.attr,t.value)}}E.jsonID("docAttr",me);let le=class extends Error{};le=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};le.prototype=Object.create(Error.prototype);le.prototype.constructor=le;le.prototype.name="TransformError";const He=Object.create(null);class I{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new or(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=v.empty){let r=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=r,r=r.lastChild;let s=e.steps.length,a=this.ranges;for(let l=0;l<a.length;l++){let{$from:c,$to:d}=a[l],f=e.mapping.slice(s);e.replaceRange(f.map(c.pos),f.map(d.pos),l?v.empty:t),l==0&&ht(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],c=e.mapping.slice(r),d=c.map(a.pos),f=c.map(l.pos);s?e.deleteRange(d,f):(e.replaceRangeWith(d,f,t),ht(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new R(e):_(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let a=t<0?_(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):_(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new F(e.node(0))}static atStart(e){return _(e,e,0,0,1)||new F(e)}static atEnd(e){return _(e,e,e.content.size,e.childCount,-1)||new F(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=He[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in He)throw new RangeError("Duplicate use of selection JSON ID "+e);return He[e]=t,t.prototype.jsonID=e,t}getBookmark(){return R.between(this.$anchor,this.$head).getBookmark()}}I.prototype.visible=!0;class or{constructor(e,t){this.$from=e,this.$to=t}}let dt=!1;function ft(n){!dt&&!n.parent.inlineContent&&(dt=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class R extends I{constructor(e,t=e){ft(e),ft(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return I.near(r);let o=e.resolve(t.map(this.anchor));return new R(o.parent.inlineContent?o:r,r)}replace(e,t=v.empty){if(super.replace(e,t),t==v.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof R&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new we(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new R(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let s=I.findFrom(t,r,!0)||I.findFrom(t,-r,!0);if(s)t=s.$head;else return I.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(I.findFrom(e,-r,!0)||I.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new R(e,t)}}I.jsonID("text",R);class we{constructor(e,t){this.anchor=e,this.head=t}map(e){return new we(e.map(this.anchor),e.map(this.head))}resolve(e){return R.between(e.resolve(this.anchor),e.resolve(this.head))}}class L extends I{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),s=e.resolve(o);return r?I.near(s):new L(s)}content(){return new v(k.from(this.node),0,0)}eq(e){return e instanceof L&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Oe(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new L(e.resolve(t.anchor))}static create(e,t){return new L(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}L.prototype.visible=!1;I.jsonID("node",L);class Oe{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new we(r,r):new Oe(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&L.isSelectable(r)?new L(t):I.near(t)}}class F extends I{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=v.empty){if(t==v.empty){e.delete(0,e.doc.content.size);let r=I.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new F(e)}map(e){return new F(e)}eq(e){return e instanceof F}getBookmark(){return ir}}I.jsonID("all",F);const ir={map(){return this},resolve(n){return new F(n)}};function _(n,e,t,r,o,s=!1){if(e.inlineContent)return R.create(n,t);for(let a=r-(o>0?0:1);o>0?a<e.childCount:a>=0;a+=o){let l=e.child(a);if(l.isAtom){if(!s&&L.isSelectable(l))return L.create(n,t-(o<0?l.nodeSize:0))}else{let c=_(n,l,t+o,o<0?l.childCount:0,o,s);if(c)return c}t+=l.nodeSize*o}return null}function ht(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof z||o instanceof te))return;let s=n.mapping.maps[r],a;s.forEach((l,c,d,f)=>{a==null&&(a=f)}),n.setSelection(I.near(n.doc.resolve(a),t))}function pt(n,e){return!e||!n?n:n.bind(e)}class fe{constructor(e,t,r){this.name=e,this.init=pt(t.init,r),this.apply=pt(t.apply,r)}}new fe("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new fe("selection",{init(n,e){return n.selection||I.atStart(e.doc)},apply(n){return n.selection}}),new fe("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new fe("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});const xe=5*1024*1024,sr={mod:"⌘",command:"⌘",meta:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",option:"⌥",shift:"⇧",backspace:"Del",delete:"⌦",enter:"⏎",escape:"⎋",capslock:"⇪"};function H(...n){return n.filter(Boolean).join(" ")}function lr(){return typeof navigator<"u"&&navigator.platform.toLowerCase().includes("mac")}const ar=(n,e,t=!0)=>{if(e){const r=n.toLowerCase();return sr[r]||(t?n.toUpperCase():n)}return t?n.charAt(0).toUpperCase()+n.slice(1):n},B=n=>{const{shortcutKeys:e,delimiter:t="+",capitalize:r=!0}=n;return e?e.split(t).map(o=>o.trim()).map(o=>ar(o,lr(),r)):[]},ce=(n,e)=>e?.schema?e.schema.spec.marks.get(n)!==void 0:!1,J=(n,e)=>e?.schema?e.schema.spec.nodes.get(n)!==void 0:!1;function cr(n){const{state:e,view:t}=n,{doc:r,selection:o}=e,s=I.findFrom(o.$to,1,!0);if(s)return t.dispatch(e.tr.setSelection(s).scrollIntoView()),!0;const a=e.schema.nodes.paragraph;if(!a)return console.warn("No paragraph node type found in schema."),!1;const l=r.content.size,c=a.create();let d=e.tr.insert(l,c);const f=d.doc.resolve(l+1);return d=d.setSelection(R.near(f)).scrollIntoView(),t.dispatch(d),!0}function V(n){return typeof n=="number"&&n>=0}function be(n,e){if(!n)return!1;const t=Array.isArray(e)?e:[e],r=t.some(o=>n.extensionManager.extensions.some(s=>s.name===o));return r||console.warn(`None of the extensions [${t.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`),r}function ur(n,e){try{const t=n.state.doc.nodeAt(e);return t||(console.warn(`No node found at position ${e}`),null)}catch(t){return console.error(`Error getting node at position ${e}:`,t),null}}function K(n){const{editor:e,node:t,nodePos:r}=n;if(!e||!e.state?.doc)return null;const o=t!=null,s=V(r);if(!o&&!s)return null;if(o){let a=-1,l=null;if(e.state.doc.descendants((c,d)=>c===t?(a=d,l=c,!1):!0),a!==-1&&l!==null)return{pos:a,node:l}}if(s){const a=ur(e,r);if(a)return{pos:r,node:a}}return null}function q(n,e=[]){if(!n||!n.state.selection)return!1;const{state:t}=n,{selection:r}=t;if(r.empty)return!1;if(r instanceof L){const o=r.node;return o?e.includes(o.type.name):!1}return!1}const Et=async(n,e,t)=>{if(!n)throw new Error("No file provided");if(n.size>xe)throw new Error(`File size exceeds maximum allowed (${xe/(1024*1024)}MB)`);for(let r=0;r<=100;r+=10){if(t?.aborted)throw new Error("Upload cancelled");await new Promise(o=>setTimeout(o,500)),e?.({progress:r})}return"/images/tiptap-ui-placeholder-image.jpg"},dr=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function fr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return!n||n.replace(dr,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}function hr(n,e,t){try{const r=new URL(n,e);if(fr(r.href,t))return r.href}catch{}return"#"}const pr=({shortcuts:n})=>n.length===0?null:i.jsx("div",{children:n.map((e,t)=>i.jsxs(u.Fragment,{children:[t>0&&i.jsx("kbd",{children:"+"}),i.jsx("kbd",{children:e})]},t))}),j=u.forwardRef(({className:n,children:e,tooltip:t,showTooltip:r=!0,shortcutKeys:o,"aria-label":s,...a},l)=>{const c=u.useMemo(()=>B({shortcutKeys:o}),[o]);return!t||!r?i.jsx("button",{className:H("tiptap-button",n),ref:l,"aria-label":s,...a,children:e}):i.jsxs(vt,{delay:200,children:[i.jsx(wt,{className:H("tiptap-button",n),ref:l,"aria-label":s,...a,children:e}),i.jsxs(bt,{children:[t,i.jsx(pr,{shortcuts:c})]})]})});j.displayName="Button";const Q=u.forwardRef(({className:n,children:e,orientation:t="vertical",...r},o)=>i.jsx("div",{ref:o,className:H("tiptap-button-group",n),"data-orientation":t,role:"group",...r,children:e}));Q.displayName="ButtonGroup";function Ct({orientation:n="horizontal",size:e,style:t={},...r}){const o={...t,...n==="horizontal"&&!e&&{flex:1},...e&&{width:n==="vertical"?"1px":e,height:n==="horizontal"?"1px":e}};return i.jsx("div",{...r,style:o})}const ye=u.forwardRef(({decorative:n,orientation:e="vertical",className:t,...r},o)=>{const a=n?{role:"none"}:{"aria-orientation":e==="vertical"?e:void 0,role:"separator"};return i.jsx("div",{className:H("tiptap-separator",t),"data-orientation":e,...a,...r,ref:o})});ye.displayName="Separator";function Tt({editor:n,containerRef:e,query:t,items:r,onSelect:o,onClose:s,orientation:a="vertical",autoSelectFirstItem:l=!0}){const[c,d]=u.useState(l?0:-1);return u.useEffect(()=>{const f=p=>{if(!r.length)return!1;const C=()=>d(m=>m===-1?0:(m+1)%r.length),g=()=>d(m=>m===-1?r.length-1:(m-1+r.length)%r.length);switch(p.key){case"ArrowUp":return a==="horizontal"?!1:(p.preventDefault(),g(),!0);case"ArrowDown":return a==="horizontal"?!1:(p.preventDefault(),C(),!0);case"ArrowLeft":return a==="vertical"?!1:(p.preventDefault(),g(),!0);case"ArrowRight":return a==="vertical"?!1:(p.preventDefault(),C(),!0);case"Tab":return p.preventDefault(),p.shiftKey?g():C(),!0;case"Home":return p.preventDefault(),d(0),!0;case"End":return p.preventDefault(),d(r.length-1),!0;case"Enter":return p.isComposing?!1:(p.preventDefault(),c!==-1&&r[c]&&o?.(r[c]),!0);case"Escape":return p.preventDefault(),s?.(),!0;default:return!1}};let h=null;if(n?h=n.view.dom:e?.current&&(h=e.current),h)return h.addEventListener("keydown",f,!0),()=>{h?.removeEventListener("keydown",f,!0)}},[n,e,r,c,o,s,a]),u.useEffect(()=>{t&&d(l?0:-1)},[t,l]),{selectedIndex:r.length?c:void 0,setSelectedIndex:d}}const gt=(n,e)=>{typeof n=="function"?n(e):n&&typeof n=="object"&&"current"in n&&(n.current=e)},Cr=(n,e)=>{const t=u.useRef(null);return u.useCallback(r=>{n&&"current"in n&&(n.current=r),t.current&&gt(t.current,null),t.current=e,e&&gt(e,r)},[n,e])},gr=n=>{const[e,t]=u.useState([]),r=u.useCallback(()=>n.current?Array.from(n.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[n]);u.useEffect(()=>{const s=n.current;if(!s)return;const a=()=>t(r());a();const l=new MutationObserver(a);return l.observe(s,{childList:!0,subtree:!0}),()=>l.disconnect()},[r,n]);const{selectedIndex:o}=Tt({containerRef:n,items:e,orientation:"horizontal",onSelect:s=>s.click(),autoSelectFirstItem:!1});u.useEffect(()=>{const s=n.current;if(!s)return;const a=c=>{const d=c.target;s.contains(d)&&d.setAttribute("data-focus-visible","true")},l=c=>{const d=c.target;s.contains(d)&&d.removeAttribute("data-focus-visible")};return s.addEventListener("focus",a,!0),s.addEventListener("blur",l,!0),()=>{s.removeEventListener("focus",a,!0),s.removeEventListener("blur",l,!0)}},[n]),u.useEffect(()=>{o!==void 0&&e[o]&&e[o].focus()},[o,e])},Ue=u.forwardRef(({children:n,className:e,variant:t="fixed",...r},o)=>{const s=u.useRef(null),a=Cr(s,o);return gr(s),i.jsx("div",{ref:a,role:"toolbar","aria-label":"toolbar","data-variant":t,className:H("tiptap-toolbar",e),...r,children:n})});Ue.displayName="Toolbar";const D=u.forwardRef(({children:n,className:e,...t},r)=>i.jsx("div",{ref:r,role:"group",className:H("tiptap-toolbar-group",e),...t,children:n}));D.displayName="ToolbarGroup";const Z=u.forwardRef(({...n},e)=>i.jsx(ye,{ref:e,orientation:"vertical",decorative:!0,...n}));Z.displayName="ToolbarSeparator";const Mt=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z",fill:"currentColor"})}));Mt.displayName="CloseIcon";function mr(n){const[e,t]=u.useState([]),r=async l=>{if(l.size>n.maxSize){const h=new Error(`File size exceeds maximum allowed (${n.maxSize/1024/1024}MB)`);return n.onError?.(h),null}const c=new AbortController,d=crypto.randomUUID(),f={id:d,file:l,progress:0,status:"uploading",abortController:c};t(h=>[...h,f]);try{if(!n.upload)throw new Error("Upload function is not defined");const h=await n.upload(l,p=>{t(C=>C.map(g=>g.id===d?{...g,progress:p.progress}:g))},c.signal);if(!h)throw new Error("Upload failed: No URL returned");return c.signal.aborted?null:(t(p=>p.map(C=>C.id===d?{...C,status:"success",url:h,progress:100}:C)),n.onSuccess?.(h),h)}catch(h){return c.signal.aborted||(t(p=>p.map(C=>C.id===d?{...C,status:"error",progress:0}:C)),n.onError?.(h instanceof Error?h:new Error("Upload failed"))),null}};return{fileItems:e,uploadFiles:async l=>{if(!l||l.length===0)return n.onError?.(new Error("No files to upload")),[];if(n.limit&&l.length>n.limit)return n.onError?.(new Error(`Maximum ${n.limit} file${n.limit===1?"":"s"} allowed`)),[];const c=l.map(f=>r(f));return(await Promise.all(c)).filter(f=>f!==null)},removeFileItem:l=>{t(c=>{const d=c.find(f=>f.id===l);return d?.abortController&&d.abortController.abort(),d?.url&&URL.revokeObjectURL(d.url),c.filter(f=>f.id!==l)})},clearAllFiles:()=>{e.forEach(l=>{l.abortController&&l.abortController.abort(),l.url&&URL.revokeObjectURL(l.url)}),t([])}}}const At=()=>i.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"tiptap-image-upload-icon",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),i.jsx("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]}),xr=()=>i.jsx("svg",{width:"43",height:"57",viewBox:"0 0 43 57",fill:"currentColor",className:"tiptap-image-upload-dropzone-rect-primary",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z",fill:"currentColor",fillOpacity:"0.11",stroke:"currentColor",strokeWidth:"1.5"})}),vr=()=>i.jsx("svg",{width:"10",height:"10",className:"tiptap-image-upload-dropzone-rect-secondary",viewBox:"0 0 10 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z",fill:"currentColor"})}),wr=({onFile:n,children:e})=>{const[t,r]=u.useState(!1),[o,s]=u.useState(!1),a=f=>{f.preventDefault(),f.stopPropagation(),s(!0)},l=f=>{f.preventDefault(),f.stopPropagation(),f.currentTarget.contains(f.relatedTarget)||(s(!1),r(!1))},c=f=>{f.preventDefault(),f.stopPropagation(),r(!0)},d=f=>{f.preventDefault(),f.stopPropagation(),s(!1),r(!1);const h=Array.from(f.dataTransfer.files);h.length>0&&n(h)};return i.jsx("div",{className:`tiptap-image-upload-drag-area ${o?"drag-active":""} ${t?"drag-over":""}`,onDragEnter:a,onDragLeave:l,onDragOver:c,onDrop:d,children:e})},br=({fileItem:n,onRemove:e})=>{const t=r=>{if(r===0)return"0 Bytes";const o=1024,s=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(r)/Math.log(o));return`${parseFloat((r/Math.pow(o,a)).toFixed(2))} ${s[a]}`};return i.jsxs("div",{className:"tiptap-image-upload-preview",children:[n.status==="uploading"&&i.jsx("div",{className:"tiptap-image-upload-progress",style:{width:`${n.progress}%`}}),i.jsxs("div",{className:"tiptap-image-upload-preview-content",children:[i.jsxs("div",{className:"tiptap-image-upload-file-info",children:[i.jsx("div",{className:"tiptap-image-upload-file-icon",children:i.jsx(At,{})}),i.jsxs("div",{className:"tiptap-image-upload-details",children:[i.jsx("span",{className:"tiptap-image-upload-text",children:n.file.name}),i.jsx("span",{className:"tiptap-image-upload-subtext",children:t(n.file.size)})]})]}),i.jsxs("div",{className:"tiptap-image-upload-actions",children:[n.status==="uploading"&&i.jsxs("span",{className:"tiptap-image-upload-progress-text",children:[n.progress,"%"]}),i.jsx(j,{type:"button","data-style":"ghost",onClick:r=>{r.stopPropagation(),e()},children:i.jsx(Mt,{className:"tiptap-button-icon"})})]})]})]})},yr=({maxSize:n,limit:e})=>i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"tiptap-image-upload-dropzone",children:[i.jsx(xr,{}),i.jsx(vr,{}),i.jsx("div",{className:"tiptap-image-upload-icon-container",children:i.jsx(At,{})})]}),i.jsxs("div",{className:"tiptap-image-upload-content",children:[i.jsxs("span",{className:"tiptap-image-upload-text",children:[i.jsx("em",{children:"Click to upload"})," or drag and drop"]}),i.jsxs("span",{className:"tiptap-image-upload-subtext",children:["Maximum ",e," file",e===1?"":"s",", ",n/1024/1024,"MB each."]})]})]}),kr=n=>{const{accept:e,limit:t,maxSize:r}=n.node.attrs,o=u.useRef(null),s=n.extension,a={maxSize:r,limit:t,accept:e,upload:s.options.upload,onSuccess:s.options.onSuccess,onError:s.options.onError},{fileItems:l,uploadFiles:c,removeFileItem:d,clearAllFiles:f}=mr(a),h=async m=>{const x=await c(m);if(x.length>0){const b=n.getPos();if(V(b)){const y=x.map((N,$)=>{const W=m[$]?.name.replace(/\.[^/.]+$/,"")||"unknown";return{type:s.options.type,attrs:{...s.options,src:N,alt:W,title:W}}});n.editor.chain().focus().deleteRange({from:b,to:b+n.node.nodeSize}).insertContentAt(b,y).run(),cr(n.editor)}}},p=m=>{const x=m.target.files;if(!x||x.length===0){s.options.onError?.(new Error("No file selected"));return}h(Array.from(x))},C=()=>{o.current&&l.length===0&&(o.current.value="",o.current.click())},g=l.length>0;return i.jsxs(A.NodeViewWrapper,{className:"tiptap-image-upload",tabIndex:0,onClick:C,children:[!g&&i.jsx(wr,{onFile:h,children:i.jsx(yr,{maxSize:r,limit:t})}),g&&i.jsxs("div",{className:"tiptap-image-upload-previews",children:[l.length>1&&i.jsxs("div",{className:"tiptap-image-upload-header",children:[i.jsxs("span",{children:["Uploading ",l.length," files"]}),i.jsx(j,{type:"button","data-style":"ghost",onClick:m=>{m.stopPropagation(),f()},children:"Clear All"})]}),l.map(m=>i.jsx(br,{fileItem:m,onRemove:()=>d(m.id)},m.id))]}),i.jsx("input",{ref:o,name:"file",accept:e,type:"file",multiple:t>1,onChange:p,onClick:m=>m.stopPropagation()})]})},jr=A.Node.create({name:"imageUpload",group:"block",draggable:!0,atom:!0,addOptions(){return{type:"image",accept:"image/*",limit:1,maxSize:0,upload:void 0,onError:void 0,onSuccess:void 0,HTMLAttributes:{}}},addAttributes(){return{accept:{default:this.options.accept},limit:{default:this.options.limit},maxSize:{default:this.options.maxSize}}},parseHTML(){return[{tag:'div[data-type="image-upload"]'}]},renderHTML({HTMLAttributes:n}){return["div",A.mergeAttributes({"data-type":"image-upload"},n)]},addNodeView(){return A.ReactNodeViewRenderer(kr)},addCommands(){return{setImageUploadNode:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addKeyboardShortcuts(){return{Enter:({editor:n})=>{const{selection:e}=n.state,{nodeAfter:t}=e.$from;if(t&&t.type.name==="imageUpload"&&n.isActive("imageUpload")){const r=n.view.nodeDOM(e.$from.pos);if(r&&r instanceof HTMLElement){const o=r.firstChild;if(o&&o instanceof HTMLElement)return o.click(),!0}}return!1}}}}),Sr=Yn.extend({renderHTML(){return["div",A.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),ze=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",fill:"currentColor"})}));ze.displayName="ChevronDownIcon";function w(n){const{editor:e}=A.useCurrentEditor(),t=u.useMemo(()=>n||e,[n,e]);return A.useEditorState({editor:t,selector(o){return o.editor?{editor:o.editor,editorState:o.editor.state,canCommand:o.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}const O=u.forwardRef(({variant:n,size:e="default",appearance:t="default",trimText:r=!1,className:o,children:s,...a},l)=>i.jsx("div",{ref:l,className:`tiptap-badge ${o||""}`,"data-style":n,"data-size":e,"data-appearance":t,"data-text-trim":r?"on":"off",...a,children:s}));O.displayName="Badge";function Lr({level:n,shortcutKeys:e=Pt[n]}){return i.jsx(O,{children:B({shortcutKeys:e})})}const Bt=u.forwardRef(({editor:n,level:e,text:t,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:s=!1,onClick:a,children:l,...c},d)=>{const{editor:f}=w(n),{isVisible:h,canToggle:p,isActive:C,handleToggle:g,label:m,Icon:x,shortcutKeys:b}=Rr({editor:f,level:e,hideWhenUnavailable:r,onToggled:o}),y=u.useCallback(N=>{a?.(N),!N.defaultPrevented&&g()},[g,a]);return h?i.jsx(j,{type:"button","data-style":"ghost","data-active-state":C?"on":"off",role:"button",tabIndex:-1,disabled:!p,"data-disabled":!p,"aria-label":m,"aria-pressed":C,tooltip:m,onClick:y,...c,ref:d,children:l??i.jsxs(i.Fragment,{children:[i.jsx(x,{className:"tiptap-button-icon"}),t&&i.jsx("span",{className:"tiptap-button-text",children:t}),s&&i.jsx(Lr,{level:e,shortcutKeys:b})]})}):null});Bt.displayName="HeadingButton";const Vt=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),i.jsx("path",{d:"M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",fill:"currentColor"})]}));Vt.displayName="HeadingOneIcon";const Ot=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),i.jsx("path",{d:"M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",fill:"currentColor"})]}));Ot.displayName="HeadingTwoIcon";const Ut=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",fill:"currentColor"})]}));Ut.displayName="HeadingThreeIcon";const zt=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),i.jsx("path",{d:"M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",fill:"currentColor"})]}));zt.displayName="HeadingFourIcon";const Dt=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),i.jsx("path",{d:"M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z",fill:"currentColor"})]}));Dt.displayName="HeadingFiveIcon";const Zt=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z",fill:"currentColor"})]}));Zt.displayName="HeadingSixIcon";const Ft={1:Vt,2:Ot,3:Ut,4:zt,5:Dt,6:Zt},Pt={1:"ctrl+alt+1",2:"ctrl+alt+2",3:"ctrl+alt+3",4:"ctrl+alt+4",5:"ctrl+alt+5",6:"ctrl+alt+6"};function ae(n,e,t=!0){if(!n||!n.isEditable||!J("heading",n)||q(n,["image"]))return!1;if(!t)return e?n.can().setNode("heading",{level:e}):n.can().setNode("heading");try{const o=n.view.state,s=o.selection;if(s.empty||s instanceof R){const a=K({editor:n,node:o.selection.$anchor.node(1)})?.pos;if(!V(a))return!1}return!0}catch{return!1}}function De(n,e){return!n||!n.isEditable?!1:Array.isArray(e)?e.some(t=>n.isActive("heading",{level:t})):e?n.isActive("heading",{level:e}):n.isActive("heading")}function Ir(n,e){if(!n||!n.isEditable)return!1;const t=Array.isArray(e)?e:[e],r=t.find(o=>ae(n,o));if(!r)return!1;try{const o=n.view;let s=o.state,a=s.tr;if(s.selection.empty||s.selection instanceof R){const h=K({editor:n,node:s.selection.$anchor.node(1)})?.pos;if(!V(h))return!1;a=a.setSelection(L.create(s.doc,h)),o.dispatch(a),s=o.state}const l=s.selection;let c=n.chain().focus();if(l instanceof L){const h=l.node.firstChild?.firstChild,p=l.node.lastChild?.lastChild,C=h?l.from+h.nodeSize:l.from+1,g=p?l.to-p.nodeSize:l.to-1;c=c.setTextSelection({from:C,to:g}).clearNodes()}return(t.some(h=>n.isActive("heading",{level:h}))?c.setNode("paragraph"):c.setNode("heading",{level:r})).run(),n.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function Jt(n){const{editor:e,level:t,hideWhenUnavailable:r}=n;return!e||!e.isEditable||!J("heading",e)?!1:r&&!e.isActive("code")?Array.isArray(t)?t.some(o=>ae(e,o)):ae(e,t):!0}function Rr(n){const{editor:e,level:t,hideWhenUnavailable:r=!1,onToggled:o}=n,{editor:s}=w(e),[a,l]=u.useState(!0),c=ae(s,t),d=De(s,t);u.useEffect(()=>{if(!s)return;const h=()=>{l(Jt({editor:s,level:t,hideWhenUnavailable:r}))};return h(),s.on("selectionUpdate",h),()=>{s.off("selectionUpdate",h)}},[s,t,r]);const f=u.useCallback(()=>{if(!s)return!1;const h=Ir(s,t);return h&&o?.(),h},[s,t,o]);return{isVisible:a,isActive:d,handleToggle:f,canToggle:c,label:`Heading ${t}`,shortcutKeys:Pt[t],Icon:Ft[t]}}function qt({...n}){return i.jsx(P.Root,{modal:!1,...n})}function $t({...n}){return i.jsx(P.Portal,{...n})}const Ze=u.forwardRef(({...n},e)=>i.jsx(P.Trigger,{ref:e,...n}));Ze.displayName=P.Trigger.displayName;const Kt=P.Item,Hr=u.forwardRef(({className:n,portal:e=!0,...t},r)=>{const o=i.jsx(P.SubContent,{ref:r,className:H("tiptap-dropdown-menu",n),...t});return e?i.jsx($t,{...typeof e=="object"?e:{},children:o}):o});Hr.displayName=P.SubContent.displayName;const Fe=u.forwardRef(({className:n,sideOffset:e=4,portal:t=!1,...r},o)=>{const s=i.jsx(P.Content,{ref:o,sideOffset:e,onCloseAutoFocus:a=>a.preventDefault(),className:H("tiptap-dropdown-menu",n),...r});return t?i.jsx($t,{...typeof t=="object"?t:{},children:s}):s});Fe.displayName=P.Content.displayName;const ne=u.forwardRef(({className:n,...e},t)=>i.jsx("div",{ref:t,className:H("tiptap-card",n),...e}));ne.displayName="Card";const Nr=u.forwardRef(({className:n,...e},t)=>i.jsx("div",{ref:t,className:H("tiptap-card-header",n),...e}));Nr.displayName="CardHeader";const ue=u.forwardRef(({className:n,...e},t)=>i.jsx("div",{ref:t,className:H("tiptap-card-body",n),...e}));ue.displayName="CardBody";const Pe=u.forwardRef(({className:n,orientation:e="vertical",...t},r)=>i.jsx("div",{ref:r,"data-orientation":e,className:H("tiptap-card-item-group",n),...t}));Pe.displayName="CardItemGroup";const Er=u.forwardRef(({className:n,...e},t)=>i.jsx("div",{ref:t,className:H("tiptap-card-group-label",n),...e}));Er.displayName="CardGroupLabel";const Tr=u.forwardRef(({className:n,...e},t)=>i.jsx("div",{ref:t,className:H("tiptap-card-footer",n),...e}));Tr.displayName="CardFooter";const Je=u.forwardRef(({editor:n,levels:e=[1,2,3,4,5,6],hideWhenUnavailable:t=!1,portal:r=!1,onOpenChange:o,...s},a)=>{const{editor:l}=w(n),[c,d]=u.useState(!1),{isVisible:f,isActive:h,canToggle:p,Icon:C}=Ar({editor:l,levels:e,hideWhenUnavailable:t}),g=u.useCallback(m=>{!l||!p||(d(m),o?.(m))},[p,l,o]);return f?i.jsxs(qt,{modal:!0,open:c,onOpenChange:g,children:[i.jsx(Ze,{asChild:!0,children:i.jsxs(j,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!p,"data-disabled":!p,"aria-label":"Format text as heading","aria-pressed":h,tooltip:"Heading",...s,ref:a,children:[i.jsx(C,{className:"tiptap-button-icon"}),i.jsx(ze,{className:"tiptap-button-dropdown-small"})]})}),i.jsx(Fe,{align:"start",portal:r,children:i.jsx(ne,{children:i.jsx(ue,{children:i.jsx(Q,{children:e.map(m=>i.jsx(Kt,{asChild:!0,children:i.jsx(Bt,{editor:l,level:m,text:`Heading ${m}`,showTooltip:!1})},`heading-${m}`))})})})})]}):null});Je.displayName="HeadingDropdownMenu";const Wt=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{d:"M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",fill:"currentColor"})}));Wt.displayName="HeadingIcon";function Mr(n,e=[1,2,3,4,5,6]){if(!(!n||!n.isEditable))return e.find(t=>De(n,t))}function Ar(n){const{editor:e,levels:t=[1,2,3,4,5,6],hideWhenUnavailable:r=!1}=n||{},{editor:o}=w(e),[s,a]=u.useState(!0),l=Mr(o,t),c=De(o),d=ae(o);return u.useEffect(()=>{if(!o)return;const f=()=>{a(Jt({editor:o,hideWhenUnavailable:r,level:t}))};return f(),o.on("selectionUpdate",f),()=>{o.off("selectionUpdate",f)}},[o,r,t]),{isVisible:s,activeLevel:l,isActive:c,canToggle:d,levels:t,label:"Heading",Icon:l?Ft[l]:Wt}}function Br({shortcutKeys:n=Me}){return i.jsx(O,{children:B({shortcutKeys:n})})}const qe=u.forwardRef(({editor:n,text:e,hideWhenUnavailable:t=!1,onInserted:r,showShortcut:o=!1,onClick:s,children:a,...l},c)=>{const{editor:d}=w(n),{isVisible:f,canInsert:h,handleImage:p,label:C,isActive:g,shortcutKeys:m,Icon:x}=zr({editor:d,hideWhenUnavailable:t,onInserted:r}),b=u.useCallback(y=>{s?.(y),!y.defaultPrevented&&p()},[p,s]);return f?i.jsx(j,{type:"button","data-style":"ghost","data-active-state":g?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":C,"aria-pressed":g,tooltip:C,onClick:b,...l,ref:c,children:a??i.jsxs(i.Fragment,{children:[i.jsx(x,{className:"tiptap-button-icon"}),e&&i.jsx("span",{className:"tiptap-button-text",children:e}),o&&i.jsx(Br,{shortcutKeys:m})]})}):null});qe.displayName="ImageUploadButton";function re(n=768){const[e,t]=u.useState(void 0);return u.useEffect(()=>{const r=window.matchMedia(`(max-width: ${n-1}px)`),o=()=>{t(window.innerWidth<n)};return r.addEventListener("change",o),t(window.innerWidth<n),()=>r.removeEventListener("change",o)},[n]),!!e}const Gt=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 2C20 1.44772 19.5523 1 19 1C18.4477 1 18 1.44772 18 2V4H16C15.4477 4 15 4.44772 15 5C15 5.55228 15.4477 6 16 6H18V8C18 8.55228 18.4477 9 19 9C19.5523 9 20 8.55228 20 8V6H22C22.5523 6 23 5.55228 23 5C23 4.44772 22.5523 4 22 4H20V2ZM5 4C4.73478 4 4.48043 4.10536 4.29289 4.29289C4.10536 4.48043 4 4.73478 4 5V19C4 19.2652 4.10536 19.5196 4.29289 19.7071C4.48043 19.8946 4.73478 20 5 20H5.58579L14.379 11.2068C14.9416 10.6444 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584 10.6444 18.621 11.2068L20 12.5858V12C20 11.4477 20.4477 11 21 11C21.5523 11 22 11.4477 22 12V14.998C22 14.9994 22 15.0007 22 15.002V19C22 19.7957 21.6839 20.5587 21.1213 21.1213C20.5587 21.6839 19.7957 22 19 22H6.00219C6.00073 22 5.99927 22 5.99781 22H5C4.20435 22 3.44129 21.6839 2.87868 21.1213C2.31607 20.5587 2 19.7957 2 19V5C2 4.20435 2.31607 3.44129 2.87868 2.87868C3.44129 2.31607 4.20435 2 5 2H12C12.5523 2 13 2.44772 13 3C13 3.55228 12.5523 4 12 4H5ZM8.41422 20H19C19.2652 20 19.5196 19.8946 19.7071 19.7071C19.8946 19.5196 20 19.2652 20 19V15.4142L17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211L8.41422 20ZM6.87868 6.87868C7.44129 6.31607 8.20435 6 9 6C9.79565 6 10.5587 6.31607 11.1213 6.87868C11.6839 7.44129 12 8.20435 12 9C12 9.79565 11.6839 10.5587 11.1213 11.1213C10.5587 11.6839 9.79565 12 9 12C8.20435 12 7.44129 11.6839 6.87868 11.1213C6.31607 10.5587 6 9.79565 6 9C6 8.20435 6.31607 7.44129 6.87868 6.87868ZM9 8C8.73478 8 8.48043 8.10536 8.29289 8.29289C8.10536 8.48043 8 8.73478 8 9C8 9.26522 8.10536 9.51957 8.29289 9.70711C8.48043 9.89464 8.73478 10 9 10C9.26522 10 9.51957 9.89464 9.70711 9.70711C9.89464 9.51957 10 9.26522 10 9C10 8.73478 9.89464 8.48043 9.70711 8.29289C9.51957 8.10536 9.26522 8 9 8Z",fill:"currentColor"})}));Gt.displayName="ImagePlusIcon";const Me="mod+shift+i";function $e(n){return!n||!n.isEditable||!be(n,"imageUpload")||q(n,["image"])?!1:n.can().insertContent({type:"imageUpload"})}function Vr(n){return!n||!n.isEditable?!1:n.isActive("imageUpload")}function Or(n){if(!n||!n.isEditable||!$e(n))return!1;try{return n.chain().focus().insertContent({type:"imageUpload"}).run()}catch{return!1}}function Ur(n){const{editor:e,hideWhenUnavailable:t}=n;return!e||!e.isEditable||!be(e,"imageUpload")?!1:t&&!e.isActive("code")?$e(e):!0}function zr(n){const{editor:e,hideWhenUnavailable:t=!1,onInserted:r}=n||{},{editor:o}=w(e),s=re(),[a,l]=u.useState(!0),c=$e(o),d=Vr(o);u.useEffect(()=>{if(!o)return;const h=()=>{l(Ur({editor:o,hideWhenUnavailable:t}))};return h(),o.on("selectionUpdate",h),()=>{o.off("selectionUpdate",h)}},[o,t]);const f=u.useCallback(()=>{if(!o)return!1;const h=Or(o);return h&&r?.(),h},[o,r]);return mt.useHotkeys(Me,h=>{h.preventDefault(),f()},{enabled:a&&c,enableOnContentEditable:!s,enableOnFormTags:!0}),{isVisible:a,isActive:d,handleImage:f,canInsert:c,label:"Add image",shortcutKeys:Me,Icon:Gt}}function Dr({type:n,shortcutKeys:e=Qt[n]}){return i.jsx(O,{children:B({shortcutKeys:e})})}const Yt=u.forwardRef(({editor:n,type:e,text:t,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:s=!1,onClick:a,children:l,...c},d)=>{const{editor:f}=w(n),{isVisible:h,canToggle:p,isActive:C,handleToggle:g,label:m,shortcutKeys:x,Icon:b}=Jr({editor:f,type:e,hideWhenUnavailable:r,onToggled:o}),y=u.useCallback(N=>{a?.(N),!N.defaultPrevented&&g()},[g,a]);return h?i.jsx(j,{type:"button","data-style":"ghost","data-active-state":C?"on":"off",role:"button",tabIndex:-1,disabled:!p,"data-disabled":!p,"aria-label":m,"aria-pressed":C,tooltip:m,onClick:y,...c,ref:d,children:l??i.jsxs(i.Fragment,{children:[i.jsx(b,{className:"tiptap-button-icon"}),t&&i.jsx("span",{className:"tiptap-button-text",children:t}),s&&i.jsx(Dr,{type:e,shortcutKeys:x})]})}):null});Yt.displayName="ListButton";const ke=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));ke.displayName="ListIcon";const Ke=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",fill:"currentColor"})]}));Ke.displayName="ListOrderedIcon";const We=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",fill:"currentColor"})]}));We.displayName="ListTodoIcon";const Xt={bulletList:ke,orderedList:Ke,taskList:We},Zr={bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List"},Qt={bulletList:"mod+shift+8",orderedList:"mod+shift+7",taskList:"mod+shift+9"};function je(n,e,t=!0){if(!n||!n.isEditable||!J(e,n)||q(n,["image"]))return!1;if(!t)switch(e){case"bulletList":return n.can().toggleBulletList();case"orderedList":return n.can().toggleOrderedList();case"taskList":return n.can().toggleList("taskList","taskItem");default:return!1}try{const o=n.view.state,s=o.selection;if(s.empty||s instanceof R){const a=K({editor:n,node:o.selection.$anchor.node(1)})?.pos;if(!V(a))return!1}return!0}catch{return!1}}function Ge(n,e){if(!n||!n.isEditable)return!1;switch(e){case"bulletList":return n.isActive("bulletList");case"orderedList":return n.isActive("orderedList");case"taskList":return n.isActive("taskList");default:return!1}}function Fr(n,e){if(!n||!n.isEditable||!je(n,e))return!1;try{const t=n.view;let r=t.state,o=r.tr;if(r.selection.empty||r.selection instanceof R){const l=K({editor:n,node:r.selection.$anchor.node(1)})?.pos;if(!V(l))return!1;o=o.setSelection(L.create(r.doc,l)),t.dispatch(o),r=t.state}const s=r.selection;let a=n.chain().focus();if(s instanceof L){const l=s.node.firstChild?.firstChild,c=s.node.lastChild?.lastChild,d=l?s.from+l.nodeSize:s.from+1,f=c?s.to-c.nodeSize:s.to-1;a=a.setTextSelection({from:d,to:f}).clearNodes()}if(n.isActive(e))a.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();else{const c={bulletList:()=>a.toggleBulletList(),orderedList:()=>a.toggleOrderedList(),taskList:()=>a.toggleList("taskList","taskItem")}[e];if(!c)return!1;c().run()}return n.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function Pr(n){const{editor:e,type:t,hideWhenUnavailable:r}=n;return!e||!e.isEditable||!J(t,e)?!1:r&&!e.isActive("code")?je(e,t):!0}function Jr(n){const{editor:e,type:t,hideWhenUnavailable:r=!1,onToggled:o}=n,{editor:s}=w(e),[a,l]=u.useState(!0),c=je(s,t),d=Ge(s,t);u.useEffect(()=>{if(!s)return;const h=()=>{l(Pr({editor:s,type:t,hideWhenUnavailable:r}))};return h(),s.on("selectionUpdate",h),()=>{s.off("selectionUpdate",h)}},[s,t,r]);const f=u.useCallback(()=>{if(!s)return!1;const h=Fr(s,t);return h&&o?.(),h},[s,t,o]);return{isVisible:a,isActive:d,handleToggle:f,canToggle:c,label:Zr[t],shortcutKeys:Qt[t],Icon:Xt[t]}}const qr=[{label:"Bullet List",type:"bulletList",icon:ke},{label:"Ordered List",type:"orderedList",icon:Ke},{label:"Task List",type:"taskList",icon:We}];function $r(n,e){return!n||!n.isEditable?!1:e.some(t=>je(n,t))}function Kr(n,e){return!n||!n.isEditable?!1:e.some(t=>Ge(n,t))}function Wr(n){return qr.filter(e=>!e.type||n.includes(e.type))}function Gr(n){const{editor:e,hideWhenUnavailable:t,listInSchema:r,canToggleAny:o}=n;return!r||!e?!1:t&&!e.isActive("code")?o:!0}function Yr(n,e){if(!(!n||!n.isEditable))return e.find(t=>Ge(n,t))}function Xr(n){const{editor:e,types:t=["bulletList","orderedList","taskList"],hideWhenUnavailable:r=!1}=n||{},{editor:o}=w(e),[s,a]=u.useState(!1),l=t.some(C=>J(C,o)),c=u.useMemo(()=>Wr(t),[t]),d=$r(o,t),f=Kr(o,t),h=Yr(o,t),p=c.find(C=>C.type===h);return u.useEffect(()=>{if(!o)return;const C=()=>{a(Gr({editor:o,hideWhenUnavailable:r,listInSchema:l,canToggleAny:d}))};return C(),o.on("selectionUpdate",C),()=>{o.off("selectionUpdate",C)}},[d,o,r,l,t]),{isVisible:s,activeType:h,isActive:f,canToggle:d,types:t,filteredLists:c,label:"List",Icon:p?Xt[p.type]:ke}}function _t({editor:n,types:e=["bulletList","orderedList","taskList"],hideWhenUnavailable:t=!1,onOpenChange:r,portal:o=!1,...s}){const{editor:a}=w(n),[l,c]=u.useState(!1),{filteredLists:d,canToggle:f,isActive:h,isVisible:p,Icon:C}=Xr({editor:a,types:e,hideWhenUnavailable:t}),g=u.useCallback(m=>{c(m),r?.(m)},[r]);return!p||!a||!a.isEditable?null:i.jsxs(qt,{open:l,onOpenChange:g,children:[i.jsx(Ze,{asChild:!0,children:i.jsxs(j,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":"List options",tooltip:"List",...s,children:[i.jsx(C,{className:"tiptap-button-icon"}),i.jsx(ze,{className:"tiptap-button-dropdown-small"})]})}),i.jsx(Fe,{align:"start",portal:o,children:i.jsx(ne,{children:i.jsx(ue,{children:i.jsx(Q,{children:d.map(m=>i.jsx(Kt,{asChild:!0,children:i.jsx(Yt,{editor:a,type:m.type,text:m.label,showTooltip:!1})},m.type))})})})})]})}function Qr({shortcutKeys:n=tn}){return i.jsx(O,{children:B({shortcutKeys:n})})}const Ye=u.forwardRef(({editor:n,text:e,hideWhenUnavailable:t=!1,onToggled:r,showShortcut:o=!1,onClick:s,children:a,...l},c)=>{const{editor:d}=w(n),{isVisible:f,canToggle:h,isActive:p,handleToggle:C,label:g,shortcutKeys:m,Icon:x}=t1({editor:d,hideWhenUnavailable:t,onToggled:r}),b=u.useCallback(y=>{s?.(y),!y.defaultPrevented&&C()},[C,s]);return f?i.jsx(j,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":g,"aria-pressed":p,tooltip:"Blockquote",onClick:b,...l,ref:c,children:a??i.jsxs(i.Fragment,{children:[i.jsx(x,{className:"tiptap-button-icon"}),e&&i.jsx("span",{className:"tiptap-button-text",children:e}),o&&i.jsx(Qr,{shortcutKeys:m})]})}):null});Ye.displayName="BlockquoteButton";const en=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z",fill:"currentColor"})]}));en.displayName="BlockquoteIcon";const tn="mod+shift+b";function Xe(n,e=!0){if(!n||!n.isEditable||!J("blockquote",n)||q(n,["image"]))return!1;if(!e)return n.can().toggleWrap("blockquote");try{const r=n.view.state,o=r.selection;if(o.empty||o instanceof R){const s=K({editor:n,node:r.selection.$anchor.node(1)})?.pos;if(!V(s))return!1}return!0}catch{return!1}}function _r(n){if(!n||!n.isEditable||!Xe(n))return!1;try{const e=n.view;let t=e.state,r=t.tr;if(t.selection.empty||t.selection instanceof R){const l=K({editor:n,node:t.selection.$anchor.node(1)})?.pos;if(!V(l))return!1;r=r.setSelection(L.create(t.doc,l)),e.dispatch(r),t=e.state}const o=t.selection;let s=n.chain().focus();if(o instanceof L){const l=o.node.firstChild?.firstChild,c=o.node.lastChild?.lastChild,d=l?o.from+l.nodeSize:o.from+1,f=c?o.to-c.nodeSize:o.to-1;s=s.setTextSelection({from:d,to:f}).clearNodes()}return(n.isActive("blockquote")?s.lift("blockquote"):s.wrapIn("blockquote")).run(),n.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function e1(n){const{editor:e,hideWhenUnavailable:t}=n;return!e||!e.isEditable||!J("blockquote",e)?!1:t&&!e.isActive("code")?Xe(e):!0}function t1(n){const{editor:e,hideWhenUnavailable:t=!1,onToggled:r}=n||{},{editor:o}=w(e),[s,a]=u.useState(!0),l=Xe(o),c=o?.isActive("blockquote")||!1;u.useEffect(()=>{if(!o)return;const f=()=>{a(e1({editor:o,hideWhenUnavailable:t}))};return f(),o.on("selectionUpdate",f),()=>{o.off("selectionUpdate",f)}},[o,t]);const d=u.useCallback(()=>{if(!o)return!1;const f=_r(o);return f&&r?.(),f},[o,r]);return{isVisible:s,isActive:c,handleToggle:d,canToggle:l,label:"Blockquote",shortcutKeys:tn,Icon:en}}function n1({shortcutKeys:n=rn}){return i.jsx(O,{children:B({shortcutKeys:n})})}const Qe=u.forwardRef(({editor:n,text:e,hideWhenUnavailable:t=!1,onToggled:r,showShortcut:o=!1,onClick:s,children:a,...l},c)=>{const{editor:d}=w(n),{isVisible:f,canToggle:h,isActive:p,handleToggle:C,label:g,shortcutKeys:m,Icon:x}=i1({editor:d,hideWhenUnavailable:t,onToggled:r}),b=u.useCallback(y=>{s?.(y),!y.defaultPrevented&&C()},[C,s]);return f?i.jsx(j,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",disabled:!h,"data-disabled":!h,tabIndex:-1,"aria-label":g,"aria-pressed":p,tooltip:"Code Block",onClick:b,...l,ref:c,children:a??i.jsxs(i.Fragment,{children:[i.jsx(x,{className:"tiptap-button-icon"}),e&&i.jsx("span",{className:"tiptap-button-text",children:e}),o&&i.jsx(n1,{shortcutKeys:m})]})}):null});Qe.displayName="CodeBlockButton";const nn=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z",fill:"currentColor"})]}));nn.displayName="CodeBlockIcon";const rn="mod+alt+c";function _e(n,e=!0){if(!n||!n.isEditable||!J("codeBlock",n)||q(n,["image"]))return!1;if(!e)return n.can().toggleNode("codeBlock","paragraph");try{const r=n.view.state,o=r.selection;if(o.empty||o instanceof R){const s=K({editor:n,node:r.selection.$anchor.node(1)})?.pos;if(!V(s))return!1}return!0}catch{return!1}}function r1(n){if(!n||!n.isEditable||!_e(n))return!1;try{const e=n.view;let t=e.state,r=t.tr;if(t.selection.empty||t.selection instanceof R){const l=K({editor:n,node:t.selection.$anchor.node(1)})?.pos;if(!V(l))return!1;r=r.setSelection(L.create(t.doc,l)),e.dispatch(r),t=e.state}const o=t.selection;let s=n.chain().focus();if(o instanceof L){const l=o.node.firstChild?.firstChild,c=o.node.lastChild?.lastChild,d=l?o.from+l.nodeSize:o.from+1,f=c?o.to-c.nodeSize:o.to-1;s=s.setTextSelection({from:d,to:f}).clearNodes()}return(n.isActive("codeBlock")?s.setNode("paragraph"):s.toggleNode("codeBlock","paragraph")).run(),n.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function o1(n){const{editor:e,hideWhenUnavailable:t}=n;return!e||!e.isEditable||!J("codeBlock",e)?!1:t&&!e.isActive("code")?_e(e):!0}function i1(n){const{editor:e,hideWhenUnavailable:t=!1,onToggled:r}=n||{},{editor:o}=w(e),[s,a]=u.useState(!0),l=_e(o),c=o?.isActive("codeBlock")||!1;u.useEffect(()=>{if(!o)return;const f=()=>{a(o1({editor:o,hideWhenUnavailable:t}))};return f(),o.on("selectionUpdate",f),()=>{o.off("selectionUpdate",f)}},[o,t]);const d=u.useCallback(()=>{if(!o)return!1;const f=r1(o);return f&&r?.(),f},[o,r]);return{isVisible:s,isActive:c,handleToggle:d,canToggle:l,label:"Code Block",shortcutKeys:rn,Icon:nn}}const on=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.43471 4.01458C4.34773 4.06032 4.26607 4.11977 4.19292 4.19292C4.11977 4.26607 4.06032 4.34773 4.01458 4.43471C2.14611 6.40628 1 9.0693 1 12C1 18.0751 5.92487 23 12 23C14.9306 23 17.5936 21.854 19.5651 19.9856C19.6522 19.9398 19.7339 19.8803 19.8071 19.8071C19.8803 19.7339 19.9398 19.6522 19.9856 19.5651C21.854 17.5936 23 14.9306 23 12C23 5.92487 18.0751 1 12 1C9.0693 1 6.40628 2.14611 4.43471 4.01458ZM6.38231 4.9681C7.92199 3.73647 9.87499 3 12 3C16.9706 3 21 7.02944 21 12C21 14.125 20.2635 16.078 19.0319 17.6177L6.38231 4.9681ZM17.6177 19.0319C16.078 20.2635 14.125 21 12 21C7.02944 21 3 16.9706 3 12C3 9.87499 3.73647 7.92199 4.9681 6.38231L17.6177 19.0319Z",fill:"currentColor"})}));on.displayName="BanIcon";const Se=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.3167 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z",fill:"currentColor"})}));Se.displayName="HighlighterIcon";function sn({...n}){return i.jsx(ge.Root,{...n})}function ln({...n}){return i.jsx(ge.Trigger,{...n})}function an({className:n,align:e="center",sideOffset:t=4,...r}){return i.jsx(ge.Portal,{children:i.jsx(ge.Content,{align:e,sideOffset:t,className:H("tiptap-popover",n),...r})})}function s1({shortcutKeys:n=Ae}){return i.jsx(O,{children:B({shortcutKeys:n})})}const cn=u.forwardRef(({editor:n,highlightColor:e,text:t,hideWhenUnavailable:r=!1,onApplied:o,showShortcut:s=!1,onClick:a,children:l,style:c,...d},f)=>{const{editor:h}=w(n),{isVisible:p,canColorHighlight:C,isActive:g,handleColorHighlight:m,label:x,shortcutKeys:b}=tt({editor:h,highlightColor:e,label:t||`Toggle highlight (${e})`,hideWhenUnavailable:r,onApplied:o}),y=u.useCallback($=>{a?.($),!$.defaultPrevented&&m()},[m,a]),N=u.useMemo(()=>({...c,"--highlight-color":e}),[e,c]);return p?i.jsx(j,{type:"button","data-style":"ghost","data-active-state":g?"on":"off",role:"button",tabIndex:-1,disabled:!C,"data-disabled":!C,"aria-label":x,"aria-pressed":g,tooltip:x,onClick:y,style:N,...d,ref:f,children:l??i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"tiptap-button-highlight",style:{"--highlight-color":e}}),t&&i.jsx("span",{className:"tiptap-button-text",children:t}),s&&i.jsx(s1,{shortcutKeys:b})]})}):null});cn.displayName="ColorHighlightButton";const Ae="mod+shift+h",l1=[{label:"Default background",value:"var(--tt-bg-color)",border:"var(--tt-bg-color-contrast)"},{label:"Gray background",value:"var(--tt-color-highlight-gray)",border:"var(--tt-color-highlight-gray-contrast)"},{label:"Brown background",value:"var(--tt-color-highlight-brown)",border:"var(--tt-color-highlight-brown-contrast)"},{label:"Orange background",value:"var(--tt-color-highlight-orange)",border:"var(--tt-color-highlight-orange-contrast)"},{label:"Yellow background",value:"var(--tt-color-highlight-yellow)",border:"var(--tt-color-highlight-yellow-contrast)"},{label:"Green background",value:"var(--tt-color-highlight-green)",border:"var(--tt-color-highlight-green-contrast)"},{label:"Blue background",value:"var(--tt-color-highlight-blue)",border:"var(--tt-color-highlight-blue-contrast)"},{label:"Purple background",value:"var(--tt-color-highlight-purple)",border:"var(--tt-color-highlight-purple-contrast)"},{label:"Pink background",value:"var(--tt-color-highlight-pink)",border:"var(--tt-color-highlight-pink-contrast)"},{label:"Red background",value:"var(--tt-color-highlight-red)",border:"var(--tt-color-highlight-red-contrast)"}];function un(n){const e=new Map(l1.map(t=>[t.value,t]));return n.map(t=>e.get(t)).filter(t=>!!t)}function et(n){return!n||!n.isEditable||!ce("highlight",n)||q(n,["image"])?!1:n.can().setMark("highlight")}function a1(n,e){return!n||!n.isEditable?!1:e?n.isActive("highlight",{color:e}):n.isActive("highlight")}function c1(n){return!n||!n.isEditable||!et(n)?!1:n.chain().focus().unsetMark("highlight").run()}function u1(n){const{editor:e,hideWhenUnavailable:t}=n;return!e||!e.isEditable||!ce("highlight",e)?!1:t&&!e.isActive("code")?et(e):!0}function tt(n){const{editor:e,label:t,highlightColor:r,hideWhenUnavailable:o=!1,onApplied:s}=n,{editor:a}=w(e),l=re(),[c,d]=u.useState(!0),f=et(a),h=a1(a,r);u.useEffect(()=>{if(!a)return;const g=()=>{d(u1({editor:a,hideWhenUnavailable:o}))};return g(),a.on("selectionUpdate",g),()=>{a.off("selectionUpdate",g)}},[a,o]);const p=u.useCallback(()=>{if(!a||!f||!r||!t)return!1;if(a.state.storedMarks){const g=a.schema.marks.highlight;g&&a.view.dispatch(a.state.tr.removeStoredMark(g))}setTimeout(()=>{const g=a.chain().focus().toggleMark("highlight",{color:r}).run();return g&&s?.({color:r,label:t}),g},0)},[f,r,a,t,s]),C=u.useCallback(()=>{const g=c1(a);return g&&s?.({color:"",label:"Remove highlight"}),g},[a,s]);return mt.useHotkeys(Ae,g=>{g.preventDefault(),p()},{enabled:c&&f,enableOnContentEditable:!l,enableOnFormTags:!0}),{isVisible:c,isActive:h,handleColorHighlight:p,handleRemoveHighlight:C,canColorHighlight:f,label:t||"Highlight",shortcutKeys:Ae,Icon:Se}}const nt=u.forwardRef(({className:n,children:e,...t},r)=>i.jsx(j,{type:"button",className:n,"data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Highlight text",tooltip:"Highlight",ref:r,...t,children:e??i.jsx(Se,{className:"tiptap-button-icon"})}));nt.displayName="ColorHighlightPopoverButton";function dn({editor:n,colors:e=un(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"])}){const{handleRemoveHighlight:t}=tt({editor:n}),r=re(),o=u.useRef(null),s=u.useMemo(()=>[...e,{label:"Remove highlight",value:"none"}],[e]),{selectedIndex:a}=Tt({containerRef:o,items:s,orientation:"both",onSelect:l=>{if(!o.current)return!1;const c=o.current.querySelector('[data-highlighted="true"]');c&&c.click(),l.value==="none"&&t()},autoSelectFirstItem:!1});return i.jsx(ne,{ref:o,tabIndex:0,style:r?{boxShadow:"none",border:0}:{},children:i.jsx(ue,{style:r?{padding:0}:{},children:i.jsxs(Pe,{orientation:"horizontal",children:[i.jsx(Q,{orientation:"horizontal",children:e.map((l,c)=>i.jsx(cn,{editor:n,highlightColor:l.value,tooltip:l.label,"aria-label":`${l.label} highlight color`,tabIndex:c===a?0:-1,"data-highlighted":a===c},l.value))}),i.jsx(ye,{}),i.jsx(Q,{orientation:"horizontal",children:i.jsx(j,{onClick:t,"aria-label":"Remove highlight",tooltip:"Remove highlight",tabIndex:a===e.length?0:-1,type:"button",role:"menuitem","data-style":"ghost","data-highlighted":a===e.length,children:i.jsx(on,{className:"tiptap-button-icon"})})})]})})})}function d1({editor:n,colors:e=un(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"]),hideWhenUnavailable:t=!1,onApplied:r,...o}){const{editor:s}=w(n),[a,l]=u.useState(!1),{isVisible:c,canColorHighlight:d,isActive:f,label:h,Icon:p}=tt({editor:s,hideWhenUnavailable:t,onApplied:r});return c?i.jsxs(sn,{open:a,onOpenChange:l,children:[i.jsx(ln,{asChild:!0,children:i.jsx(nt,{disabled:!d,"data-active-state":f?"on":"off","data-disabled":!d,"aria-pressed":f,"aria-label":h,tooltip:h,...o,children:i.jsx(p,{className:"tiptap-button-icon"})})}),i.jsx(an,{"aria-label":"Highlight colors",children:i.jsx(dn,{editor:s,colors:e})})]}):null}const fn=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",fill:"currentColor"})}));fn.displayName="CornerDownLeftIcon";const hn=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{d:"M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",fill:"currentColor"}),i.jsx("path",{d:"M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",fill:"currentColor"})]}));hn.displayName="ExternalLinkIcon";const Le=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{d:"M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",fill:"currentColor"}),i.jsx("path",{d:"M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",fill:"currentColor"})]}));Le.displayName="LinkIcon";const pn=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",fill:"currentColor"})}));pn.displayName="TrashIcon";function f1({className:n,type:e,...t}){return i.jsx("input",{type:e,className:H("tiptap-input",n),...t})}function h1({className:n,children:e,...t}){return i.jsx("div",{className:H("tiptap-input-group",n),...t,children:e})}const rt=u.forwardRef(({className:n,children:e,...t},r)=>i.jsx(j,{type:"button",className:n,"data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Link",tooltip:"Link",ref:r,...t,children:e||i.jsx(Le,{className:"tiptap-button-icon"})}));rt.displayName="LinkButton";const Cn=({url:n,setUrl:e,setLink:t,removeLink:r,openLink:o,isActive:s})=>{const a=re(),l=c=>{c.key==="Enter"&&(c.preventDefault(),t())};return i.jsx(ne,{style:{...a?{boxShadow:"none",border:0}:{}},children:i.jsx(ue,{style:{...a?{padding:0}:{}},children:i.jsxs(Pe,{orientation:"horizontal",children:[i.jsx(h1,{children:i.jsx(f1,{type:"url",placeholder:"Paste a link...",value:n,onChange:c=>e(c.target.value),onKeyDown:l,autoFocus:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})}),i.jsx(Q,{orientation:"horizontal",children:i.jsx(j,{type:"button",onClick:t,title:"Apply link",disabled:!n&&!s,"data-style":"ghost",children:i.jsx(fn,{className:"tiptap-button-icon"})})}),i.jsx(ye,{}),i.jsxs(Q,{orientation:"horizontal",children:[i.jsx(j,{type:"button",onClick:o,title:"Open in new window",disabled:!n&&!s,"data-style":"ghost",children:i.jsx(hn,{className:"tiptap-button-icon"})}),i.jsx(j,{type:"button",onClick:r,title:"Remove link",disabled:!n&&!s,"data-style":"ghost",children:i.jsx(pn,{className:"tiptap-button-icon"})})]})]})})})},p1=({editor:n})=>{const e=vn({editor:n});return i.jsx(Cn,{...e})},gn=u.forwardRef(({editor:n,hideWhenUnavailable:e=!1,onSetLink:t,onOpenChange:r,autoOpenOnLinkActive:o=!0,onClick:s,children:a,...l},c)=>{const{editor:d}=w(n),[f,h]=u.useState(!1),{isVisible:p,canSet:C,isActive:g,url:m,setUrl:x,setLink:b,removeLink:y,openLink:N,label:$,Icon:W}=vn({editor:d,hideWhenUnavailable:e,onSetLink:t}),zn=u.useCallback(oe=>{h(oe),r?.(oe)},[r]),Dn=u.useCallback(()=>{b(),h(!1)},[b]),Zn=u.useCallback(oe=>{s?.(oe),!oe.defaultPrevented&&h(!f)},[s,f]);return u.useEffect(()=>{o&&g&&h(!0)},[o,g]),p?i.jsxs(sn,{open:f,onOpenChange:zn,children:[i.jsx(ln,{asChild:!0,children:i.jsx(rt,{disabled:!C,"data-active-state":g?"on":"off","data-disabled":!C,"aria-label":$,"aria-pressed":g,onClick:Zn,...l,ref:c,children:a??i.jsx(W,{className:"tiptap-button-icon"})})}),i.jsx(an,{children:i.jsx(Cn,{url:m,setUrl:x,setLink:Dn,removeLink:y,openLink:N,isActive:g})})]}):null});gn.displayName="LinkPopover";function mn(n){return!n||!n.isEditable?!1:n.can().setMark("link")}function xn(n){return!n||!n.isEditable?!1:n.isActive("link")}function C1(n){const{editor:e,hideWhenUnavailable:t}=n;return!ce("link",e)||!e?!1:t&&!e.isActive("code")?mn(e):!0}function g1(n){const{editor:e,onSetLink:t}=n,[r,o]=u.useState(null);u.useEffect(()=>{if(!e)return;const{href:c}=e.getAttributes("link");xn(e)&&r===null&&o(c||"")},[e,r]),u.useEffect(()=>{if(!e)return;const c=()=>{const{href:d}=e.getAttributes("link");o(d||"")};return e.on("selectionUpdate",c),()=>{e.off("selectionUpdate",c)}},[e]);const s=u.useCallback(()=>{if(!r||!e)return;const{selection:c}=e.state,d=c.empty;let f=e.chain().focus();f=f.extendMarkRange("link").setLink({href:r}),d&&(f=f.insertContent({type:"text",text:r})),f.run(),o(null),t?.()},[e,t,r]),a=u.useCallback(()=>{e&&(e.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink",!0).run(),o(""))},[e]),l=u.useCallback((c="_blank",d="noopener,noreferrer")=>{if(!r)return;const f=hr(r,window.location.href);f!=="#"&&window.open(f,c,d)},[r]);return{url:r||"",setUrl:o,setLink:s,removeLink:a,openLink:l}}function m1(n){const{editor:e,hideWhenUnavailable:t=!1}=n,r=mn(e),o=xn(e),[s,a]=u.useState(!1);return u.useEffect(()=>{if(!e)return;const l=()=>{a(C1({editor:e,hideWhenUnavailable:t}))};return l(),e.on("selectionUpdate",l),()=>{e.off("selectionUpdate",l)}},[e,t]),{isVisible:s,canSet:r,isActive:o}}function vn(n){const{editor:e,hideWhenUnavailable:t=!1,onSetLink:r}=n||{},{editor:o}=w(e),{isVisible:s,canSet:a,isActive:l}=m1({editor:o,hideWhenUnavailable:t}),c=g1({editor:o,onSetLink:r});return{isVisible:s,canSet:a,isActive:l,label:"Link",Icon:Le,...c}}function x1({type:n,shortcutKeys:e=In[n]}){return i.jsx(O,{children:B({shortcutKeys:e})})}const U=u.forwardRef(({editor:n,type:e,text:t,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:s=!1,onClick:a,children:l,...c},d)=>{const{editor:f}=w(n),{isVisible:h,handleMark:p,label:C,canToggle:g,isActive:m,Icon:x,shortcutKeys:b}=j1({editor:f,type:e,hideWhenUnavailable:r,onToggled:o}),y=u.useCallback(N=>{a?.(N),!N.defaultPrevented&&p()},[p,a]);return h?i.jsx(j,{type:"button",disabled:!g,"data-style":"ghost","data-active-state":m?"on":"off","data-disabled":!g,role:"button",tabIndex:-1,"aria-label":C,"aria-pressed":m,tooltip:C,onClick:y,...c,ref:d,children:l??i.jsxs(i.Fragment,{children:[i.jsx(x,{className:"tiptap-button-icon"}),t&&i.jsx("span",{className:"tiptap-button-text",children:t}),s&&i.jsx(x1,{type:e,shortcutKeys:b})]})}):null});U.displayName="MarkButton";const wn=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",fill:"currentColor"})}));wn.displayName="BoldIcon";const bn=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{d:"M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",fill:"currentColor"}),i.jsx("path",{d:"M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",fill:"currentColor"}),i.jsx("path",{d:"M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",fill:"currentColor"})]}));bn.displayName="Code2Icon";const yn=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{d:"M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",fill:"currentColor"})}));yn.displayName="ItalicIcon";const kn=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{d:"M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",fill:"currentColor"}),i.jsx("path",{d:"M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",fill:"currentColor"})]}));kn.displayName="StrikeIcon";const jn=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z",fill:"currentColor"})]}));jn.displayName="SubscriptIcon";const Sn=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z",fill:"currentColor"})]}));Sn.displayName="SuperscriptIcon";const Ln=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z",fill:"currentColor"})}));Ln.displayName="UnderlineIcon";const v1={bold:wn,italic:yn,underline:Ln,strike:kn,code:bn,superscript:Sn,subscript:jn},In={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function ot(n,e){return!n||!n.isEditable||!ce(e,n)||q(n,["image"])?!1:n.can().toggleMark(e)}function w1(n,e){return!n||!n.isEditable?!1:n.isActive(e)}function b1(n,e){return!n||!n.isEditable||!ot(n,e)?!1:n.chain().focus().toggleMark(e).run()}function y1(n){const{editor:e,type:t,hideWhenUnavailable:r}=n;return!e||!e.isEditable||!ce(t,e)?!1:r&&!e.isActive("code")?ot(e,t):!0}function k1(n){return n.charAt(0).toUpperCase()+n.slice(1)}function j1(n){const{editor:e,type:t,hideWhenUnavailable:r=!1,onToggled:o}=n,{editor:s}=w(e),[a,l]=u.useState(!0),c=ot(s,t),d=w1(s,t);u.useEffect(()=>{if(!s)return;const h=()=>{l(y1({editor:s,type:t,hideWhenUnavailable:r}))};return h(),s.on("selectionUpdate",h),()=>{s.off("selectionUpdate",h)}},[s,t,r]);const f=u.useCallback(()=>{if(!s)return!1;const h=b1(s,t);return h&&o?.(),h},[s,t,o]);return{isVisible:a,isActive:d,handleMark:f,canToggle:c,label:k1(t),shortcutKeys:In[t],Icon:v1[t]}}function S1({align:n,shortcutKeys:e=Tn[n]}){return i.jsx(O,{children:B({shortcutKeys:e})})}const ee=u.forwardRef(({editor:n,align:e,text:t,hideWhenUnavailable:r=!1,onAligned:o,showShortcut:s=!1,onClick:a,icon:l,children:c,...d},f)=>{const{editor:h}=w(n),{isVisible:p,handleTextAlign:C,label:g,canAlign:m,isActive:x,Icon:b,shortcutKeys:y}=T1({editor:h,align:e,hideWhenUnavailable:r,onAligned:o}),N=u.useCallback(W=>{a?.(W),!W.defaultPrevented&&C()},[C,a]);if(!p)return null;const $=l??b;return i.jsx(j,{type:"button",disabled:!m,"data-style":"ghost","data-active-state":x?"on":"off","data-disabled":!m,role:"button",tabIndex:-1,"aria-label":g,"aria-pressed":x,tooltip:g,onClick:N,...d,ref:f,children:c??i.jsxs(i.Fragment,{children:[i.jsx($,{className:"tiptap-button-icon"}),t&&i.jsx("span",{className:"tiptap-button-text",children:t}),s&&i.jsx(S1,{align:e,shortcutKeys:y})]})})});ee.displayName="TextAlignButton";const Rn=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 18C4 17.4477 4.44772 17 5 17H19C19.5523 17 20 17.4477 20 18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18Z",fill:"currentColor"})]}));Rn.displayName="AlignCenterIcon";const Hn=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));Hn.displayName="AlignJustifyIcon";const Nn=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));Nn.displayName="AlignLeftIcon";const En=u.memo(({className:n,...e})=>i.jsxs("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 18C6 17.4477 6.44772 17 7 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H7C6.44772 19 6 18.5523 6 18Z",fill:"currentColor"})]}));En.displayName="AlignRightIcon";const Tn={left:"mod+shift+l",center:"mod+shift+e",right:"mod+shift+r",justify:"mod+shift+j"},L1={left:Nn,center:Rn,right:En,justify:Hn},I1={left:"Align left",center:"Align center",right:"Align right",justify:"Align justify"};function it(n,e){return!n||!n.isEditable||!be(n,"textAlign")||q(n,["image"])?!1:n.can().setTextAlign(e)}function R1(n){return"setTextAlign"in n}function H1(n,e){return!n||!n.isEditable?!1:n.isActive({textAlign:e})}function N1(n,e){if(!n||!n.isEditable||!it(n,e))return!1;const t=n.chain().focus();return R1(t)?t.setTextAlign(e).run():!1}function E1(n){const{editor:e,hideWhenUnavailable:t,align:r}=n;return!e||!e.isEditable||!be(e,"textAlign")?!1:t&&!e.isActive("code")?it(e,r):!0}function T1(n){const{editor:e,align:t,hideWhenUnavailable:r=!1,onAligned:o}=n,{editor:s}=w(e),[a,l]=u.useState(!0),c=it(s,t),d=H1(s,t);u.useEffect(()=>{if(!s)return;const h=()=>{l(E1({editor:s,align:t,hideWhenUnavailable:r}))};return h(),s.on("selectionUpdate",h),()=>{s.off("selectionUpdate",h)}},[s,r,t]);const f=u.useCallback(()=>{if(!s)return!1;const h=N1(s,t);return h&&o?.(),h},[s,t,o]);return{isVisible:a,isActive:d,handleTextAlign:f,canAlign:c,label:I1[t],shortcutKeys:Tn[t],Icon:L1[t]}}function M1({action:n,shortcutKeys:e=Bn[n]}){return i.jsx(O,{children:B({shortcutKeys:e})})}const ve=u.forwardRef(({editor:n,action:e,text:t,hideWhenUnavailable:r=!1,onExecuted:o,showShortcut:s=!1,onClick:a,children:l,...c},d)=>{const{editor:f}=w(n),{isVisible:h,handleAction:p,label:C,canExecute:g,Icon:m,shortcutKeys:x}=U1({editor:f,action:e,hideWhenUnavailable:r,onExecuted:o}),b=u.useCallback(y=>{a?.(y),!y.defaultPrevented&&p()},[p,a]);return h?i.jsx(j,{type:"button",disabled:!g,"data-style":"ghost","data-disabled":!g,role:"button",tabIndex:-1,"aria-label":C,tooltip:C,onClick:b,...c,ref:d,children:l??i.jsxs(i.Fragment,{children:[i.jsx(m,{className:"tiptap-button-icon"}),t&&i.jsx("span",{className:"tiptap-button-text",children:t}),s&&i.jsx(M1,{action:e,shortcutKeys:x})]})}):null});ve.displayName="UndoRedoButton";const Mn=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",fill:"currentColor"})}));Mn.displayName="Redo2Icon";const An=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",fill:"currentColor"})}));An.displayName="Undo2Icon";const Bn={undo:"mod+z",redo:"mod+shift+z"},A1={undo:"Undo",redo:"Redo"},B1={undo:An,redo:Mn};function st(n,e){return!n||!n.isEditable||q(n,["image"])?!1:e==="undo"?n.can().undo():n.can().redo()}function V1(n,e){if(!n||!n.isEditable||!st(n,e))return!1;const t=n.chain().focus();return e==="undo"?t.undo().run():t.redo().run()}function O1(n){const{editor:e,hideWhenUnavailable:t,action:r}=n;return!e||!e.isEditable?!1:t&&!e.isActive("code")?st(e,r):!0}function U1(n){const{editor:e,action:t,hideWhenUnavailable:r=!1,onExecuted:o}=n,{editor:s}=w(e),[a,l]=u.useState(!0),c=st(s,t);u.useEffect(()=>{if(!s)return;const f=()=>{l(O1({editor:s,hideWhenUnavailable:r,action:t}))};return f(),s.on("transaction",f),()=>{s.off("transaction",f)}},[s,r,t]);const d=u.useCallback(()=>{if(!s)return!1;const f=V1(s,t);return f&&o?.(),f},[s,t,o]);return{isVisible:a,handleAction:d,canExecute:c,label:A1[t],shortcutKeys:Bn[t],Icon:B1[t]}}const Vn=u.memo(({className:n,...e})=>i.jsx("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{d:"M12.7071 5.70711C13.0976 5.31658 13.0976 4.68342 12.7071 4.29289C12.3166 3.90237 11.6834 3.90237 11.2929 4.29289L4.29289 11.2929C3.90237 11.6834 3.90237 12.3166 4.29289 12.7071L11.2929 19.7071C11.6834 20.0976 12.3166 20.0976 12.7071 19.7071C13.0976 19.3166 13.0976 18.6834 12.7071 18.2929L7.41421 13L19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11L7.41421 11L12.7071 5.70711Z",fill:"currentColor"})}));Vn.displayName="ArrowLeftIcon";const z1=n=>{const e=Ne.useRef(n);e.current=n,Ne.useEffect(()=>()=>{e.current()},[])},D1={leading:!1,trailing:!0};function On(n,e=250,t=[],r=D1){const o=u.useMemo(()=>_n(n,e,r),t);return z1(()=>{o.cancel()}),o}function lt(){const[n,e]=u.useState({width:0,height:0,offsetTop:0,offsetLeft:0,scale:0}),t=On(()=>{if(typeof window>"u")return;const r=window.visualViewport;if(!r)return;const{width:o=0,height:s=0,offsetTop:a=0,offsetLeft:l=0,scale:c=0}=r;e(d=>o===d.width&&s===d.height&&a===d.offsetTop&&l===d.offsetLeft&&c===d.scale?d:{width:o,height:s,offsetTop:a,offsetLeft:l,scale:c})},200);return u.useEffect(()=>{const r=window.visualViewport;if(r)return r.addEventListener("resize",t),t(),()=>{r.removeEventListener("resize",t)}},[t]),n}const he={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0},Un=typeof window>"u",Z1=!Un&&typeof ResizeObserver<"u",Ce=()=>!Un;function F1({element:n,enabled:e=!0,throttleMs:t=100,useResizeObserver:r=!0}={}){const[o,s]=u.useState(he),a=u.useCallback(()=>!e||!Ce()?null:n?typeof n=="string"?document.querySelector(n):"current"in n?n.current:n:document.body,[n,e]),l=On(()=>{if(!e||!Ce())return;const c=a();if(!c){s(he);return}const d=c.getBoundingClientRect();s({x:d.x,y:d.y,width:d.width,height:d.height,top:d.top,right:d.right,bottom:d.bottom,left:d.left})},t,[e,a],{leading:!0,trailing:!0});return u.useEffect(()=>{if(!e||!Ce()){s(he);return}const c=a();if(!c)return;l();const d=[];if(r&&Z1){const h=new ResizeObserver(()=>{window.requestAnimationFrame(l)});h.observe(c),d.push(()=>h.disconnect())}const f=()=>l();return window.addEventListener("scroll",f,{passive:!0}),window.addEventListener("resize",f,{passive:!0}),d.push(()=>{window.removeEventListener("scroll",f),window.removeEventListener("resize",f)}),()=>{d.forEach(h=>h()),s(he)}},[e,a,l,r]),o}function P1(n={}){return F1({...n,element:Ce()?document.body:null})}function J1({editor:n,overlayHeight:e=0}){const{height:t}=lt(),r=P1({enabled:!0,throttleMs:100,useResizeObserver:!0});return u.useEffect(()=>{(()=>{if(!n)return;const{state:s,view:a}=n;if(!a.hasFocus())return;const{from:l}=s.selection,c=a.coordsAtPos(l);if(t<r.height&&c&&t-c.top<e){const f=Math.max(t/2,e),h=window.scrollY,C=c.top+h-f;window.scrollTo({top:Math.max(0,C),behavior:"smooth"})}})()},[n,e,t,r.height]),r}const q1="doc",$1=[{type:"heading",attrs:{textAlign:null,level:1},content:[{type:"text",text:"Getting started"}]},{type:"paragraph",attrs:{textAlign:null},content:[{type:"text",text:"Welcome to the "},{type:"text",marks:[{type:"italic"},{type:"highlight",attrs:{color:"var(--tt-color-highlight-yellow)"}}],text:"Simple Editor"},{type:"text",text:" template! This template integrates "},{type:"text",marks:[{type:"bold"}],text:"open source"},{type:"text",text:" UI components and Tiptap extensions licensed under "},{type:"text",marks:[{type:"bold"}],text:"MIT"},{type:"text",text:"."}]},{type:"paragraph",attrs:{textAlign:null},content:[{type:"text",text:"Integrate it by following the "},{type:"text",marks:[{type:"link",attrs:{href:"https://tiptap.dev/docs/ui-components/templates/simple-editor",target:"_blank",rel:"noopener noreferrer nofollow",class:null}}],text:"Tiptap UI Components docs"},{type:"text",text:" or using our CLI tool."}]},{type:"codeBlock",attrs:{language:null},content:[{type:"text",text:"npx @tiptap/cli init"}]},{type:"heading",attrs:{textAlign:null,level:2},content:[{type:"text",text:"Features"}]},{type:"blockquote",content:[{type:"paragraph",attrs:{textAlign:null},content:[{type:"text",marks:[{type:"italic"}],text:"A fully responsive rich text editor with built-in support for common formatting and layout tools. Type markdown "},{type:"text",marks:[{type:"code"}],text:"**"},{type:"text",marks:[{type:"italic"}],text:" or use keyboard shortcuts "},{type:"text",marks:[{type:"code"}],text:"⌘+B"},{type:"text",text:" for "},{type:"text",marks:[{type:"strike"}],text:"most"},{type:"text",text:" all common markdown marks. 🪄"}]}]},{type:"paragraph",attrs:{textAlign:"left"},content:[{type:"text",text:"Add images, customize alignment, and apply "},{type:"text",marks:[{type:"highlight",attrs:{color:"var(--tt-color-highlight-blue)"}}],text:"advanced formatting"},{type:"text",text:" to make your writing more engaging and professional."}]},{type:"image",attrs:{src:"/images/tiptap-ui-placeholder-image.jpg",alt:"placeholder-image",title:"placeholder-image"}},{type:"bulletList",content:[{type:"listItem",content:[{type:"paragraph",attrs:{textAlign:"left"},content:[{type:"text",marks:[{type:"bold"}],text:"Superscript"},{type:"text",text:" (x"},{type:"text",marks:[{type:"superscript"}],text:"2"},{type:"text",text:") and "},{type:"text",marks:[{type:"bold"}],text:"Subscript"},{type:"text",text:" (H"},{type:"text",marks:[{type:"subscript"}],text:"2"},{type:"text",text:"O) for precision."}]}]},{type:"listItem",content:[{type:"paragraph",attrs:{textAlign:"left"},content:[{type:"text",marks:[{type:"bold"}],text:"Typographic conversion"},{type:"text",text:": automatically convert to "},{type:"text",marks:[{type:"code"}],text:"->"},{type:"text",text:" an arrow "},{type:"text",marks:[{type:"bold"}],text:"→"},{type:"text",text:"."}]}]}]},{type:"paragraph",attrs:{textAlign:"left"},content:[{type:"text",marks:[{type:"italic"}],text:"→ "},{type:"text",marks:[{type:"link",attrs:{href:"https://tiptap.dev/docs/ui-components/templates/simple-editor#features",target:"_blank",rel:"noopener noreferrer nofollow",class:null}}],text:"Learn more"}]},{type:"horizontalRule"},{type:"heading",attrs:{textAlign:"left",level:2},content:[{type:"text",text:"Make it your own"}]},{type:"paragraph",attrs:{textAlign:"left"},content:[{type:"text",text:"Switch between light and dark modes, and tailor the editor's appearance with customizable CSS to match your style."}]},{type:"taskList",content:[{type:"taskItem",attrs:{checked:!0},content:[{type:"paragraph",attrs:{textAlign:"left"},content:[{type:"text",text:"Test template"}]}]},{type:"taskItem",attrs:{checked:!1},content:[{type:"paragraph",attrs:{textAlign:"left"},content:[{type:"text",marks:[{type:"link",attrs:{href:"https://tiptap.dev/docs/ui-components/templates/simple-editor",target:"_blank",rel:"noopener noreferrer nofollow",class:null}}],text:"Integrate the free template"}]}]}]},{type:"paragraph",attrs:{textAlign:"left"}}],K1={type:q1,content:$1},W1=({onHighlighterClick:n,onLinkClick:e,isMobile:t})=>i.jsxs(i.Fragment,{children:[i.jsx(Ct,{}),i.jsxs(D,{children:[i.jsx(ve,{action:"undo"}),i.jsx(ve,{action:"redo"})]}),i.jsx(Z,{}),i.jsxs(D,{children:[i.jsx(Je,{levels:[1,2,3,4],portal:t}),i.jsx(_t,{types:["bulletList","orderedList","taskList"],portal:t}),i.jsx(Ye,{}),i.jsx(Qe,{})]}),i.jsx(Z,{}),i.jsxs(D,{children:[i.jsx(U,{type:"bold"}),i.jsx(U,{type:"italic"}),i.jsx(U,{type:"strike"}),i.jsx(U,{type:"code"}),i.jsx(U,{type:"underline"}),t?i.jsx(nt,{onClick:n}):i.jsx(d1,{}),t?i.jsx(rt,{onClick:e}):i.jsx(gn,{})]}),i.jsx(Z,{}),i.jsxs(D,{children:[i.jsx(U,{type:"superscript"}),i.jsx(U,{type:"subscript"})]}),i.jsx(Z,{}),i.jsxs(D,{children:[i.jsx(ee,{align:"left"}),i.jsx(ee,{align:"center"}),i.jsx(ee,{align:"right"}),i.jsx(ee,{align:"justify"})]}),i.jsx(Z,{}),i.jsx(D,{children:i.jsx(qe,{text:"Add"})}),i.jsx(Ct,{}),t&&i.jsx(Z,{})]}),G1=({type:n,onBack:e})=>i.jsxs(i.Fragment,{children:[i.jsx(D,{children:i.jsxs(j,{"data-style":"ghost",onClick:e,children:[i.jsx(Vn,{className:"tiptap-button-icon"}),n==="highlighter"?i.jsx(Se,{className:"tiptap-button-icon"}):i.jsx(Le,{className:"tiptap-button-icon"})]})}),i.jsx(Z,{}),n==="highlighter"?i.jsx(dn,{}):i.jsx(p1,{})]});function Y1(){const n=re(),{height:e}=lt(),[t,r]=u.useState("main"),o=u.useRef(null),s=A.useEditor({immediatelyRender:!1,shouldRerenderOnTransaction:!1,editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off","aria-label":"Main content area, start typing to enter text.",class:"simple-editor"}},extensions:[Fn.StarterKit.configure({horizontalRule:!1,link:{openOnClick:!1,enableClickSelection:!0}}),Sr,Jn.TextAlign.configure({types:["heading","paragraph"]}),at.TaskList,at.TaskItem.configure({nested:!0}),$n.Highlight.configure({multicolor:!0}),Pn.Image,qn.Typography,Wn.Superscript,Kn.Subscript,Gn.Selection,jr.configure({accept:"image/*",maxSize:xe,limit:3,upload:Et,onError:l=>console.error("Upload failed:",l)})],content:K1}),a=J1({editor:s,overlayHeight:o.current?.getBoundingClientRect().height??0});return u.useEffect(()=>{!n&&t!=="main"&&r("main")},[n,t]),i.jsx("div",{className:"simple-editor-wrapper",children:i.jsxs(A.EditorContext.Provider,{value:{editor:s},children:[i.jsx(Ue,{ref:o,style:{...n?{bottom:`calc(100% - ${e-a.y}px)`}:{}},children:t==="main"?i.jsx(W1,{onHighlighterClick:()=>r("highlighter"),onLinkClick:()=>r("link"),isMobile:n}):i.jsx(G1,{type:t==="highlighter"?"highlighter":"link",onBack:()=>r("main")})}),i.jsx(A.EditorContent,{editor:s,className:"simple-editor-content"})]})})}exports.BlockquoteButton=Ye;exports.Button=j;exports.Card=ne;exports.CodeBlockButton=Qe;exports.HeadingDropdownMenu=Je;exports.ImageUploadButton=qe;exports.ListDropdownMenu=_t;exports.MAX_FILE_SIZE=xe;exports.MarkButton=U;exports.TextAlignButton=ee;exports.TiptapEditor=Y1;exports.Toolbar=Ue;exports.ToolbarGroup=D;exports.ToolbarSeparator=Z;exports.UndoRedoButton=ve;exports.handleImageUpload=Et;exports.useIsMobile=re;exports.useTiptapEditor=w;exports.useWindowSize=lt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),j=require("react"),_i=require("react-dom");function bf(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const y=bf(j),fa=bf(_i);var ao=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var co={exports:{}},Cs={};/**
2
+ * @license React
3
+ * use-sync-external-store-shim.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Qc;function x0(){if(Qc)return Cs;Qc=1;var t=j;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue;function l(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),m=p[0].inst,v=p[1];return i(function(){m.value=h,m.getSnapshot=f,a(m)&&v({inst:m})},[d,h,f]),o(function(){return a(m)&&v({inst:m}),d(function(){a(m)&&v({inst:m})})},[d]),s(h),h}function a(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return Cs.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Cs}var xs={};/**
10
+ * @license React
11
+ * use-sync-external-store-shim.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var eu;function w0(){return eu||(eu=1,process.env.NODE_ENV!=="production"&&(function(){function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function e(h,p){u||o.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=p();if(!d){var v=p();i(m,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}v=s({inst:{value:m,getSnapshot:p}});var b=v[0].inst,C=v[1];return a(function(){b.value=m,b.getSnapshot=p,n(b)&&C({inst:b})},[h,m,p]),l(function(){return n(b)&&C({inst:b}),h(function(){n(b)&&C({inst:b})})},[h]),c(m),m}function n(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!i(h,m)}catch{return!0}}function r(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=j,i=typeof Object.is=="function"?Object.is:t,s=o.useState,l=o.useEffect,a=o.useLayoutEffect,c=o.useDebugValue,u=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;xs.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),xs}var tu;function ha(){return tu||(tu=1,process.env.NODE_ENV==="production"?co.exports=x0():co.exports=w0()),co.exports}var xf=ha();function we(t){this.content=t}we.prototype={constructor:we,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new we(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new we(n)},addToStart:function(t,e){return new we([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new we(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new we(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=we.from(t),t.size?new we(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=we.from(t),t.size?new we(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=we.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};we.from=function(t){if(t instanceof we)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new we(e)};function wf(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=wf(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Sf(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let c=Sf(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class A{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new A(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new A(r,o)}cutByIndex(e,n){return e==n?A.empty:e==0&&n==this.content.length?this:new A(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new A(o,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return wf(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Sf(this,e,n,r)}findIndex(e){if(e==0)return uo(0,e);if(e==this.size)return uo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?uo(n+1,i):uo(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return A.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new A(n||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ws={index:0,offset:0};function uo(t,e){return ws.index=t,ws.offset=e,ws}function Vo(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Vo(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Vo(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let te=class vl{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Vo(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return vl.none;if(e instanceof vl)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};te.none=[];class zo extends Error{}class D{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ef(this.content,e+this.openStart,n);return r&&new D(r,this.openStart,this.openEnd)}removeBetween(e,n){return new D(kf(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return D.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new D(A.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new D(e,r,o)}}D.empty=new D(A.empty,0,0);function kf(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(kf(i.content,e-o-1,n-o-1)))}function Ef(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Ef(s.content,e-i-1,n,s);return l&&t.replaceChild(o,s.copy(l))}function S0(t,e,n){if(n.openStart>t.depth)throw new zo("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new zo("Inconsistent open depths");return Mf(t,e,n,0)}function Mf(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=Mf(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return xn(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=k0(n,t);return xn(i,Af(t,s,l,e,r))}else return xn(i,Uo(t,e,r))}function Tf(t,e){if(!e.type.compatibleContent(t.type))throw new zo("Cannot join "+e.type.name+" onto "+t.type.name)}function bl(t,e,n){let r=t.node(n);return Tf(r,e.node(n)),r}function Cn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Cr(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Cn(t.nodeAfter,r),i++));for(let l=i;l<s;l++)Cn(o.child(l),r);e&&e.depth==n&&e.textOffset&&Cn(e.nodeBefore,r)}function xn(t,e){return t.type.checkContent(e),t.copy(e)}function Af(t,e,n,r,o){let i=t.depth>o&&bl(t,e,o+1),s=r.depth>o&&bl(n,r,o+1),l=[];return Cr(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(Tf(i,s),Cn(xn(i,Af(t,e,n,r,o+1)),l)):(i&&Cn(xn(i,Uo(t,e,o+1)),l),Cr(e,n,o,l),s&&Cn(xn(s,Uo(n,r,o+1)),l)),Cr(r,null,o,l),new A(l)}function Uo(t,e,n){let r=[];if(Cr(null,t,n,r),t.depth>n){let o=bl(t,e,n+1);Cn(xn(o,Uo(t,e,n+1)),r)}return Cr(e,null,n,r),new A(r)}function k0(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(A.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Or{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return te.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Wo(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new Or(n,r,i)}static resolveCached(e,n){let r=nu.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else nu.set(e,r=new E0);let o=r.elts[r.i]=Or.resolve(e,n);return r.i=(r.i+1)%M0,o}}class E0{constructor(){this.elts=[],this.i=0}}const M0=12,nu=new WeakMap;class Wo{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const T0=Object.create(null);let Yt=class Cl{constructor(e,n,r,o=te.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Vo(this.attrs,n||e.defaultAttrs||T0)&&te.sameSet(this.marks,r||te.none)}copy(e=null){return e==this.content?this:new Cl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Cl(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return D.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new D(c,o.depth-s,i.depth-s)}replace(e,n,r){return S0(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Or.resolveCached(this,e)}resolveNoCache(e){return Or.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Rf(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=A.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=te.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!te.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=A.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};Yt.prototype.text=void 0;class Ko extends Yt{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rf(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ko(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ko(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rf(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class En{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new A0(e,n);if(r.next==null)return En.empty;let o=Of(r);r.next&&r.err("Unexpected trailing text");let i=P0(D0(o));return j0(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
18
+ `)}}En.empty=new En(!0);class A0{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Of(t){let e=[];do e.push(R0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function R0(t){let e=[];do e.push(O0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function O0(t){let e=L0(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=N0(t,e);else break;return e}function ru(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function N0(t,e){let n=ru(t),r=n;return t.eat(",")&&(t.next!="}"?r=ru(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function I0(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function L0(t){if(t.eat("(")){let e=Of(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=I0(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function D0(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Nf(t,e){return e-t}function ou(t,e){let n=[];return r(e),n.sort(Nf);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function P0(t){let e=Object.create(null);return n(ou(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);ou(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new En(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Nf);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function j0(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function If(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Lf(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function Df(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function Pf(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new _0(t,r,e[r]);return n}let iu=class jf{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Pf(e,r.attrs),this.defaultAttrs=If(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==En.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Lf(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Yt(this,this.computeAttrs(e),A.from(n),te.setFrom(r))}createChecked(e=null,n,r){return n=A.from(n),this.checkContent(n),new Yt(this,this.computeAttrs(e),n,te.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=A.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(A.empty,!0);return i?new Yt(this,e,n.append(i),te.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Df(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:te.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new jf(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function B0(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class _0{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?B0(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Hi{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Pf(e,o.attrs),this.excluded=null;let i=If(this.attrs);this.instance=i?new te(this,i):null}create(e=null){return!e&&this.instance?this.instance:new te(this,Lf(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Hi(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Df(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Bf{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=we.from(e.nodes),n.marks=we.from(e.marks||{}),this.nodes=iu.compile(this.spec.nodes,this),this.marks=Hi.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=En.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?su(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:su(this,s.split(" "))}this.nodeFromJSON=o=>Yt.fromJSON(this,o),this.markFromJSON=o=>te.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof iu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new Ko(r,r.defaultAttrs,e,te.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function su(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function H0(t){return t.tag!=null}function F0(t){return t.style!=null}class Xt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(H0(o))this.tags.push(o);else if(F0(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new au(this,n,!1);return r.addAll(e,te.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new au(this,n,!0);return r.addAll(e,te.none,n.from,n.to),D.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(z0(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=cu(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=cu(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Xt(e,Xt.schemaRules(e)))}}const _f={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},$0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Hf={ol:!0,ul:!0},Nr=1,xl=2,xr=4;function lu(t,e,n){return e!=null?(e?Nr:0)|(e==="full"?xl:0):t&&t.whitespace=="pre"?Nr|xl:n&~xr}class fo{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=te.none,this.match=i||(s&xr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(A.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Nr)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=A.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!_f.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class au{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=lu(null,n.preserveWhitespace,0)|(r?xr:0);o?i=new fo(o.type,o.attrs,te.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new fo(null,null,te.none,!0,null,s):i=new fo(e.schema.topNodeType,null,te.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&xl?"full":this.localPreserveWS||(o.options&Nr)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
19
+ `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(s.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Hf.hasOwnProperty(s)&&this.parser.normalizeLists&&V0(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:$0.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(_f.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
20
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=te.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):uu(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=lu(e,i,s.options);s.options&xr&&s.content.length==0&&(l|=xr);let a=te.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):uu(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new fo(e,n,a,o,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Nr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function V0(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Hf.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function z0(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function cu(t){let e={};for(let n in t)e[n]=t[n];return e}function uu(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class In{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Ss(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Io(Ss(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Io(Ss(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Io(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new In(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=du(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return du(e.marks)}}function du(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ss(t){return t.document||window.document}const fu=new WeakMap;function U0(t){let e=fu.get(t);return e===void 0&&fu.set(t,e=W0(t)),e}function W0(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Io(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=U0(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Io(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Ff=65535,$f=Math.pow(2,16);function K0(t,e){return t+e*$f}function hu(t){return t&Ff}function q0(t){return(t-(t&Ff))/$f}const Vf=1,zf=2,Lo=4,Uf=8;class wl{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Uf)>0}get deletedBefore(){return(this.delInfo&(Vf|Lo))>0}get deletedAfter(){return(this.delInfo&(zf|Lo))>0}get deletedAcross(){return(this.delInfo&Lo)>0}}class $e{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&$e.empty)return $e.empty}recover(e){let n=0,r=hu(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+q0(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+o+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:K0(l/3,e-a),m=e==a?zf:e==d?Vf:Lo;return(n<0?e!=a:e!=d)&&(m|=Uf),new wl(h,m,p)}o+=u-c}return r?e+o:new wl(e+o,0,null)}touches(e,n){let r=0,o=hu(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new $e(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?$e.empty:new $e(e<0?[0,-e,0]:[0,0,e])}}$e.empty=new $e([]);class Ir{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Ir(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Ir;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new wl(e,o,null)}}const ks=Object.create(null);class Oe{getMap(){return $e.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ks[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in ks)throw new RangeError("Duplicate use of step JSON ID "+e);return ks[e]=n,n.prototype.jsonID=e,n}}class pe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new pe(e,null)}static fail(e){return new pe(null,e)}static fromReplace(e,n,r,o){try{return pe.ok(e.replace(n,r,o))}catch(i){if(i instanceof zo)return pe.fail(i.message);throw i}}}function pa(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(pa(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return A.fromArray(r)}class Gt extends Oe{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new D(pa(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return pe.fromReplace(e,this.from,this.to,i)}invert(){return new nt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Gt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Gt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Gt(n.from,n.to,e.markFromJSON(n.mark))}}Oe.jsonID("addMark",Gt);class nt extends Oe{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new D(pa(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return pe.fromReplace(e,this.from,this.to,r)}invert(){return new Gt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new nt(n.pos,r.pos,this.mark)}merge(e){return e instanceof nt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new nt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new nt(n.from,n.to,e.markFromJSON(n.mark))}}Oe.jsonID("removeMark",nt);class Jt extends Oe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return pe.fromReplace(e,this.pos,this.pos+1,new D(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Jt(this.pos,n.marks[o]);return new Jt(this.pos,this.mark)}}return new Mn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Jt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Jt(n.pos,e.markFromJSON(n.mark))}}Oe.jsonID("addNodeMark",Jt);class Mn extends Oe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return pe.fromReplace(e,this.pos,this.pos+1,new D(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Jt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Mn(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Mn(n.pos,e.markFromJSON(n.mark))}}Oe.jsonID("removeNodeMark",Mn);class ve extends Oe{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Sl(e,this.from,this.to)?pe.fail("Structure replace would overwrite content"):pe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new $e([this.from,this.to-this.from,this.slice.size])}invert(e){return new ve(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new ve(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ve)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?D.empty:new D(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ve(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?D.empty:new D(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ve(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ve(n.from,n.to,D.fromJSON(e,n.slice),!!n.structure)}}Oe.jsonID("replace",ve);class be extends Oe{constructor(e,n,r,o,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Sl(e,this.from,this.gapFrom)||Sl(e,this.gapTo,this.to)))return pe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return pe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?pe.fromReplace(e,this.from,this.to,r):pe.fail("Content does not fit in gap")}getMap(){return new $e([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new be(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new be(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new be(n.from,n.to,n.gapFrom,n.gapTo,D.fromJSON(e,n.slice),n.insert,!!n.structure)}}Oe.jsonID("replaceAround",be);function Sl(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function G0(t,e,n,r){let o=[],i=[],s,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[m])?s.to=h:o.push(s=new nt(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new Gt(f,h,r))}}),o.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function J0(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof Hi){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>t.step(new nt(s.from,s.to,s.style)))}function ma(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new ve(l,u,D.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new nt(l,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new D(A.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new ve(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(A.empty,!0);t.replace(l,l,new D(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function Z0(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function lr(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),i=t.$from.index(r),s=t.$to.indexAfter(r);if(r<t.depth&&o.canReplace(i,s,n))return r;if(r==0||o.type.spec.isolating||!Z0(o,i,s))break}return null}function Y0(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=A.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=A.from(r.node(p).copy(u)),d++):a--;let f=A.empty,h=0;for(let p=i,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=A.from(o.node(p).copy(f)),h++):c++;t.step(new be(a,c,s,l,new D(u.append(f),d,h),u.size-d,!0))}function ga(t,e,n=null,r=t){let o=X0(t,e),i=o&&Q0(r,e);return i?o.map(pu).concat({type:e,attrs:n}).concat(i.map(pu)):null}function pu(t){return{type:t,attrs:null}}function X0(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function Q0(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function e2(t,e,n){let r=A.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new be(o,i,o,i,new D(r,0,0),n.length,!0))}function t2(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&n2(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Kf(t,s,l,i),ma(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return t.step(new be(d,f,d+1,f-1,new D(A.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Wf(t,s,l,i),!1}})}function Wf(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Kf(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
21
+ `))}})}function n2(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function r2(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new be(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new D(A.from(s),0,0),1,!0))}function Rt(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function o2(t,e,n=1,r){let o=t.doc.resolve(e),i=A.empty,s=A.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){i=A.from(o.node(l).copy(i));let u=r&&r[c];s=A.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}t.step(new ve(e,e,new D(i.append(s),n,n),!0))}function un(t,e){let n=t.resolve(e),r=n.index();return qf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function i2(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function qf(t,e){return!!(t&&e&&!t.isLeaf&&i2(t,e))}function Fi(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&qf(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function s2(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Kf(t,u.node(),u.before(),l)}s.inlineContent&&ma(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new ve(c,a.map(e+n,-1),D.empty,!0)),r===!0){let u=t.doc.resolve(c);Wf(t,u.node(),u.before(),t.steps.length)}return t}function l2(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Gf(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function $i(t,e,n=e,r=D.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return Jf(o,i,r)?new ve(e,n,r):new a2(o,i,r).fit()}function Jf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class a2{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=A.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=A.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new D(i,s,l);return e>-1?new be(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new ve(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Es(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(A.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Es(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new D(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Es(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new D(mr(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new D(mr(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let h=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),v=d.matchType(m.type);if(!v)break;c++,(c>1||a==0||m.content.size)&&(d=v,u.push(Zf(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=gr(this.placed,n,A.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,v=l;m<h;m++){let b=v.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),v=b.content}this.unplaced=p?e==0?D.empty:new D(mr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new D(mr(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ms(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Ms(e,n,o,r,i);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Ms(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=gr(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=gr(this.placed,this.depth,A.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(A.empty,!0);n.childCount&&(this.placed=gr(this.placed,this.frontier.length,n))}}function mr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(mr(t.firstChild.content,e-1,n)))}function gr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(gr(t.lastChild.content,e-1,n)))}function Es(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Zf(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Zf(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(A.empty,!0)))),t.copy(r)}function Ms(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!c2(n,i.content,s)?l:null}function c2(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function u2(t){return t.spec.defining||t.spec.definingForContent}function d2(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(Jf(o,i,r))return t.step(new ve(e,n,r));let s=Xf(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==h&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=u2(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<s.length;m++){let v=s[(m+a)%s.length],b=!0;v<0&&(b=!1,v=-v);let C=o.node(v-1),x=o.index(v-1);if(C.canReplaceWith(x,x,p.type,p.marks))return t.replace(o.before(v),b?i.after(v):n,new D(Yf(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=s[f];h<0||(e=o.before(h),n=i.after(h))}}function Yf(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Yf(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(A.empty,!0))}return t}function f2(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=l2(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new D(A.from(r),0,0))}function h2(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=Xf(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Xf(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}class Zn extends Oe{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return pe.fromReplace(e,this.pos,this.pos+1,new D(A.from(o),0,n.isLeaf?0:1))}getMap(){return $e.empty}invert(e){return new Zn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Zn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Zn(n.pos,n.attr,n.value)}}Oe.jsonID("attr",Zn);class Lr extends Oe{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return pe.ok(r)}getMap(){return $e.empty}invert(e){return new Lr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Lr(n.attr,n.value)}}Oe.jsonID("docAttr",Lr);let er=class extends Error{};er=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};er.prototype=Object.create(Error.prototype);er.prototype.constructor=er;er.prototype.name="TransformError";class Qf{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ir}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new er(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=D.empty){let o=$i(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new D(A.from(r),0,0))}delete(e,n){return this.replace(e,n,D.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return d2(this,e,n,r),this}replaceRangeWith(e,n,r){return f2(this,e,n,r),this}deleteRange(e,n){return h2(this,e,n),this}lift(e,n){return Y0(this,e,n),this}join(e,n=1){return s2(this,e,n),this}wrap(e,n){return e2(this,e,n),this}setBlockType(e,n=e,r,o=null){return t2(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return r2(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Zn(e,n,r)),this}setDocAttribute(e,n){return this.step(new Lr(e,n)),this}addNodeMark(e,n){return this.step(new Jt(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof te)n.isInSet(r.marks)&&this.step(new Mn(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new Mn(e,i)),o=i.removeFromSet(o);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,r){return o2(this,e,n,r),this}addMark(e,n,r){return G0(this,e,n,r),this}removeMark(e,n,r){return J0(this,e,n,r),this}clearIncompatible(e,n,r){return ma(this,e,n,r),this}}const Ts=Object.create(null);let q=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new p2(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=D.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?D.empty:n),l==0&&yu(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),yu(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new V(e):zn(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?zn(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):zn(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ve(e.node(0))}static atStart(e){return zn(e,e,0,0,1)||new Ve(e)}static atEnd(e){return zn(e,e,e.content.size,e.childCount,-1)||new Ve(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ts[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ts)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ts[e]=n,n.prototype.jsonID=e,n}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}};q.prototype.visible=!0;class p2{constructor(e,n){this.$from=e,this.$to=n}}let mu=!1;function gu(t){!mu&&!t.parent.inlineContent&&(mu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class V extends q{constructor(e,n=e){gu(e),gu(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return q.near(r);let o=e.resolve(n.map(this.anchor));return new V(o.parent.inlineContent?o:r,r)}replace(e,n=D.empty){if(super.replace(e,n),n==D.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof V&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Vi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new V(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=q.findFrom(n,r,!0)||q.findFrom(n,-r,!0);if(i)n=i.$head;else return q.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(q.findFrom(e,-r,!0)||q.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new V(e,n)}}q.jsonID("text",V);class Vi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Vi(e.map(this.anchor),e.map(this.head))}resolve(e){return V.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends q{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?q.near(i):new B(i)}content(){return new D(A.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ya(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(n.anchor))}static create(e,n){return new B(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1;q.jsonID("node",B);class ya{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Vi(r,r):new ya(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&B.isSelectable(r)?new B(n):q.near(n)}}class Ve extends q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=D.empty){if(n==D.empty){e.delete(0,e.doc.content.size);let r=q.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ve(e)}map(e){return new Ve(e)}eq(e){return e instanceof Ve}getBookmark(){return m2}}q.jsonID("all",Ve);const m2={map(){return this},resolve(t){return new Ve(t)}};function zn(t,e,n,r,o,i=!1){if(e.inlineContent)return V.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&B.isSelectable(l))return B.create(t,n-(o<0?l.nodeSize:0))}else{let a=zn(t,l,n+o,o<0?l.childCount:0,o,i);if(a)return a}n+=l.nodeSize*o}return null}function yu(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof ve||o instanceof be))return;let i=t.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(q.near(t.doc.resolve(s),n))}const vu=1,ho=2,bu=4;class g2 extends Qf{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|vu)&~ho,this.storedMarks=null,this}get selectionSet(){return(this.updated&vu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ho,this}ensureMarks(e){return te.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ho)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ho,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||te.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(q.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=bu,this}get scrolledIntoView(){return(this.updated&bu)>0}}function Cu(t,e){return!e||!t?t:t.bind(e)}class yr{constructor(e,n,r){this.name=e,this.init=Cu(n.init,r),this.apply=Cu(n.apply,r)}}const y2=[new yr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new yr("selection",{init(t,e){return t.selection||q.atStart(e.doc)},apply(t){return t.selection}}),new yr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new yr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class As{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=y2.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new yr(r.key,r.spec.state,r))})}}class Gn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Gn(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new g2(this)}static create(e){let n=new As(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Gn(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new As(this.schema,e.plugins),r=n.fields,o=new Gn(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new As(e.schema,e.plugins),i=new Gn(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Yt.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=q.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=c.fromJSON.call(a,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function eh(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=eh(o,e,{})),n[r]=o}return n}class ae{constructor(e){this.spec=e,this.props={},e.props&&eh(e.props,this,this.props),this.key=e.key?e.key.key:th("plugin")}getState(e){return e[this.key]}}const Rs=Object.create(null);function th(t){return t in Rs?t+"$"+ ++Rs[t]:(Rs[t]=0,t+"$")}class ye{constructor(e="key"){this.key=th(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const va=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function nh(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const rh=(t,e,n)=>{let r=nh(t,n);if(!r)return!1;let o=ba(r);if(!o){let s=r.blockRange(),l=s&&lr(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(fh(t,o,e,-1))return!0;if(r.parent.content.size==0&&(tr(i,"end")||B.isSelectable(i)))for(let s=r.depth;;s--){let l=$i(t.doc,r.before(s),r.after(s),D.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(tr(i,"end")?q.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):B.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},v2=(t,e,n)=>{let r=nh(t,n);if(!r)return!1;let o=ba(r);return o?oh(t,o,e):!1},b2=(t,e,n)=>{let r=sh(t,n);if(!r)return!1;let o=Ca(r);return o?oh(t,o,e):!1};function oh(t,e,n){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=$i(t.doc,i,a,D.empty);if(!c||c.from!=i||c instanceof ve&&c.slice.size>=a-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(V.create(u.doc,i)),n(u.scrollIntoView())}return!0}function tr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const ih=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=ba(r)}let s=i&&i.nodeBefore;return!s||!B.isSelectable(s)?!1:(e&&e(t.tr.setSelection(B.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function ba(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function sh(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const lh=(t,e,n)=>{let r=sh(t,n);if(!r)return!1;let o=Ca(r);if(!o)return!1;let i=o.nodeAfter;if(fh(t,o,e,1))return!0;if(r.parent.content.size==0&&(tr(i,"start")||B.isSelectable(i))){let s=$i(t.doc,r.before(),r.after(),D.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(tr(i,"start")?q.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):B.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},ah=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Ca(r)}let s=i&&i.nodeAfter;return!s||!B.isSelectable(s)?!1:(e&&e(t.tr.setSelection(B.create(t.doc,i.pos)).scrollIntoView()),!0)};function Ca(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const C2=(t,e)=>{let n=t.selection,r=n instanceof B,o;if(r){if(n.node.isTextblock||!un(t.doc,n.from))return!1;o=n.from}else if(o=Fi(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(B.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},x2=(t,e)=>{let n=t.selection,r;if(n instanceof B){if(n.node.isTextblock||!un(t.doc,n.to))return!1;r=n.to}else if(r=Fi(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},w2=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&lr(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},ch=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
22
+ `).scrollIntoView()),!0)};function xa(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const S2=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=xa(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(q.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},uh=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Ve||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=xa(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(V.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},dh=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Rt(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&lr(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function k2(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof B&&e.selection.node.isBlock)return!r.parentOffset||!Rt(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=xa(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof V||e.selection instanceof Ve)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Rt(u.doc,d,i.length,i);if(f||(i[0]=l?{type:l}:null,f=Rt(u.doc,d,i.length,i)),!f)return!1;if(u.split(d,i.length,i),!a&&c&&r.node(s).type!=l){let h=u.mapping.map(r.before(s)),p=u.doc.resolve(h);l&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const E2=k2(),M2=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(B.create(t.doc,o))),!0)};function T2(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||un(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function fh(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&T2(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=A.empty;for(let b=s.length-1;b>=0;b--)p=A.from(s[b].create(null,p));p=A.from(o.copy(p));let m=t.tr.step(new be(e.pos-1,h,e.pos,h,new D(p,1,0),s.length,!0)),v=m.doc.resolve(h+2*s.length);v.nodeAfter&&v.nodeAfter.type==o.type&&un(m.doc,v.pos)&&m.join(v.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&a?null:q.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&lr(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&tr(i,"start",!0)&&tr(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,v=1;for(;!m.isTextblock;m=m.firstChild)v++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let b=A.empty;for(let x=p.length-1;x>=0;x--)b=A.from(p[x].copy(b));let C=t.tr.step(new be(e.pos-p.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new D(b,p.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function hh(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(V.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const A2=hh(-1),R2=hh(1);function O2(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=s&&ga(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function xu(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function wa(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}wa(va,rh,ih);wa(va,lh,ah);wa(ch,uh,dh,E2);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function N2(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let l=r?n.tr:null;return I2(l,s,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function I2(t,e,n,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Wo(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Wo(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=ga(i,n,r,e);return l?(t&&L2(t,e,l,o,n),!0):!1}function L2(t,e,n,r,o){let i=A.empty;for(let u=n.length-1;u>=0;u--)i=A.from(n[u].type.create(n[u].attrs,i));t.step(new be(e.start-(r?2:0),e.end,e.start,e.end,new D(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let l=n.length-s,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Rt(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function D2(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?P2(e,n,t,i):j2(e,n,i):!0:!1}}function P2(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new be(i-1,s,i,s,new D(A.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Wo(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const l=lr(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(i,-1)-1);return un(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),e(o.scrollIntoView()),!0}function j2(t,e,n){let r=t.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?A.empty:A.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new be(d-(l?1:0),f+(a?1:0),d+1,f-1,new D((l?A.empty:A.from(o.copy(A.empty))).append(a?A.empty:A.from(o.copy(A.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function B2(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=A.from(c?t.create():null),d=new D(A.from(t.create(null,A.from(l.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;n(e.tr.step(new be(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Se=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},nr=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let kl=null;const St=function(t,e,n){let r=kl||(kl=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},_2=function(){kl=null},Tn=function(t,e,n,r){return n&&(wu(t,e,n,r,-1)||wu(t,e,n,r,1))},H2=/^(img|br|input|textarea|hr)$/i;function wu(t,e,n,r,o){for(var i;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Ze(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Jr(t)||H2.test(t.nodeName)||t.contentEditable=="false")return!1;e=Se(t)+(o<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(o<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else t=s,e=o<0?Ze(t):0}else return!1}}function Ze(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function F2(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ze(t)}else if(t.parentNode&&!Jr(t))e=Se(t),t=t.parentNode;else return null}}function $2(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Jr(t))e=Se(t)+1,t=t.parentNode;else return null}}function V2(t,e,n){for(let r=e==0,o=e==Ze(t);r||o;){if(t==n)return!0;let i=Se(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==Ze(t)}}function Jr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const zi=function(t){return t.focusNode&&Tn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function mn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function z2(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function U2(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ze(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ze(r.startContainer),r.startOffset)}}}const dt=typeof navigator<"u"?navigator:null,Su=typeof document<"u"?document:null,dn=dt&&dt.userAgent||"",El=/Edge\/(\d+)/.exec(dn),ph=/MSIE \d/.exec(dn),Ml=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dn),_e=!!(ph||Ml||El),Qt=ph?document.documentMode:Ml?+Ml[1]:El?+El[1]:0,Ye=!_e&&/gecko\/(\d+)/i.test(dn);Ye&&+(/Firefox\/(\d+)/.exec(dn)||[0,0])[1];const Tl=!_e&&/Chrome\/(\d+)/.exec(dn),Ae=!!Tl,mh=Tl?+Tl[1]:0,Ie=!_e&&!!dt&&/Apple Computer/.test(dt.vendor),rr=Ie&&(/Mobile\/\w+/.test(dn)||!!dt&&dt.maxTouchPoints>2),Je=rr||(dt?/Mac/.test(dt.platform):!1),W2=dt?/Win/.test(dt.platform):!1,Tt=/Android \d/.test(dn),Zr=!!Su&&"webkitFontSmoothing"in Su.documentElement.style,K2=Zr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function q2(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function bt(t,e){return typeof t=="number"?t:t[e]}function G2(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function ku(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=nr(s);continue}let l=s,a=l==i.body,c=a?q2(i):G2(l),u=0,d=0;if(e.top<c.top+bt(r,"top")?d=-(c.top-e.top+bt(o,"top")):e.bottom>c.bottom-bt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+bt(o,"top")-c.top:e.bottom-c.bottom+bt(o,"bottom")),e.left<c.left+bt(r,"left")?u=-(c.left-e.left+bt(o,"left")):e.right>c.right-bt(r,"right")&&(u=e.right-c.right+bt(o,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-h,v=l.scrollTop-p;e={left:e.left-m,top:e.top-v,right:e.right-m,bottom:e.bottom-v}}let f=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:nr(s)}}function J2(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:gh(t.dom)}}function gh(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=nr(r));return e}function Z2({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;yh(n,r==0?0:r-e)}function yh(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let _n=null;function Y2(t){if(t.setActive)return t.setActive();if(_n)return t.focus(_n);let e=gh(t);t.focus(_n==null?{get preventScroll(){return _n={preventScroll:!0},!0}}:void 0),_n||(_n=!1,yh(e,0))}function vh(t,e){let n,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=St(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,o=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(i=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!n&&a&&(n=a,o=c,r=0),n&&n.nodeType==3?X2(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:vh(n,o)}function X2(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let i=$t(r,1);if(i.top!=i.bottom&&Sa(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function Sa(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Q2(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function ey(t,e,n){let{node:r,offset:o}=vh(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function ty(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function bh(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Sa(e,c))return bh(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function ny(t,e){let n=t.dom.ownerDocument,r,o=0,i=U2(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!Sa(e,c)||(s=bh(t.dom,e,c),!s))return null}if(Ie)for(let c=s;r&&c;c=nr(c))c.draggable&&(r=void 0);if(s=Q2(s,e),r){if(Ye&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Zr&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=ty(t,r,o,e))}l==null&&(l=ey(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Eu(t){return t.top<t.bottom||t.left<t.right}function $t(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Eu(r))return r}return Array.prototype.find.call(n,Eu)||t.getBoundingClientRect()}const ry=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ch(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Zr||Ye;if(r.nodeType==3)if(s&&(ry.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=$t(St(r,o,o),n);if(Ye&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=$t(St(r,o-1,o-1),-1);if(c.top==a.top){let u=$t(St(r,o,o+1),-1);if(u.top!=a.top)return hr(u,u.left<c.left)}}return a}else{let a=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(a--,u=1):n<0?a--:c++,hr($t(St(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Ze(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return Os(a.getBoundingClientRect(),!1)}if(i==null&&o<Ze(r)){let a=r.childNodes[o];if(a.nodeType==1)return Os(a.getBoundingClientRect(),!0)}return Os(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Ze(r))){let a=r.childNodes[o-1],c=a.nodeType==3?St(a,Ze(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return hr($t(c,1),!1)}if(i==null&&o<Ze(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?St(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return hr($t(c,-1),!0)}return hr($t(r.nodeType==3?St(r):r,-n),n>=0)}function hr(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Os(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function xh(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function oy(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return xh(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=Ch(t,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=St(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const iy=/[\u0590-\u08ac]/;function sy(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=t.domSelection();return l?!iy.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:xh(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),v=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),v}):r.pos==r.start()||r.pos==r.end()}let Mu=null,Tu=null,Au=!1;function ly(t,e,n){return Mu==e&&Tu==n?Au:(Mu=e,Tu=n,Au=n=="up"||n=="down"?oy(t,e,n):sy(t,e,n))}const Xe=0,Ru=1,gn=2,ft=3;class Yr{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Xe,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Se(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e||s instanceof Sh){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof wh&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Se(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Se(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Se(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=Se(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],v=p+m.size;if(i>p&&s<v)return m.setSelection(e-p-m.border,n-p-m.border,r,o);p=v}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Ye||Ie)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
23
+ `),d&&p==h.nodeValue.length)for(let m=h,v;m;m=m.parentNode){if(v=m.nextSibling){v.nodeName=="BR"&&(l=a={node:v.parentNode,offset:Se(v)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Ye&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&Ie)&&Tn(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Tn(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Ye)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+i.border,a=s-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?gn:Ru,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ft:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?gn:ft}r=s}this.dirty=gn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?gn:Ru;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class wh extends Yr{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Xe&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ay extends Yr{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class An extends Yr{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=In.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new An(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&ft||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ft&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Xe){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Xe}}slice(e,n,r){let o=An.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Rl(i,n,s,r)),e>0&&(i=Rl(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class en extends Yr{constructor(e,n,r,o,i,s,l,a,c){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,i,s){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=In.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Mh(u,r,n),c?a=new cy(e,n,r,o,u,d||null,f,c,i,s+1):n.isText?new Ui(e,n,r,o,u,f,i):new en(e,n,r,o,u,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>A.empty)}return e}matchesNode(e,n,r){return this.dirty==Xe&&e.eq(this.node)&&qo(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new dy(this,s&&s.node,e);py(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?te.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,o)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,o)||a.addNode(c,u,d,e,o),o+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==gn)&&(s&&this.protectLocalComposition(e,s),kh(this.contentDOM,this.children,e),rr&&my(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof V)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=gy(this.node.content,s,r-n,o-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new ay(this,i,n,o);e.input.compositionNodes.push(s),this.children=Rl(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==ft||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Xe}updateOuterDeco(e){if(qo(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Eh(this.dom,this.nodeDOM,Al(this.outerDeco,this.node,n),Al(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Ou(t,e,n,r,o){Mh(r,e,t);let i=new en(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Ui extends en{constructor(e,n,r,o,i,s,l){super(e,n,r,o,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==ft||this.dirty!=Xe&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Xe||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Xe,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),i=document.createTextNode(o.text);return new Ui(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ft)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Sh extends Yr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xe&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class cy extends en{constructor(e,n,r,o,i,s,l,a,c,u){super(e,n,r,o,i,s,l,c,u),this.spec=a}update(e,n,r,o){if(this.dirty==ft)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function kh(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=Nu(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(s instanceof An){let a=r?r.previousSibling:t.lastChild;kh(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Nu(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const wr=function(t){t&&(this.nodeName=t)};wr.prototype=Object.create(null);const yn=[new wr];function Al(t,e,n){if(t.length==0)return yn;let r=n?yn[0]:new wr,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new wr(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&o.length==1&&o.push(r=new wr(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function Eh(t,e,n,r){if(n==yn&&r==yn)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=n[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=t&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=yn[0]),o=a}uy(o,l||yn[0],s)}return o}function uy(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function Mh(t,e,n){return Eh(t,t,yn,Al(e,n,t.nodeType!=1))}function qo(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Nu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class dy{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=fy(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=Xe,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=An.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==ft&&s.dom==s.contentDOM&&(s.dirty=gn),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof en){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=ft&&qo(n,a.outerDeco));if(!f&&a.update(e,n,r,o))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=gn,d.updateChildren(o,s+1),d.dirty=Xe),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!qo(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=en.create(this.top,n,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,o,i){let s=en.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new wh(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof An;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ui)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ie||Ae)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Sh(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function fy(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof An)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function hy(t,e){return t.type.side-e.type.side}function py(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let v=o[s++];v.widget&&(u?(d||(d=[u])).push(v):u=v)}if(u)if(d){d.sort(hy);for(let v=0;v<d.length;v++)n(d[v],c,!!a)}else n(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let v=0;v<l.length;v++)l[v].to<=i&&l.splice(v--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let p=i+f.nodeSize;if(f.isText){let v=p;s<o.length&&o[s].from<v&&(v=o[s].from);for(let b=0;b<l.length;b++)l[b].to<v&&(v=l[b].to);v<p&&(a=f.cut(v-i),f=f.cut(0,v-i),p=v,h=-1)}else for(;s<o.length&&o[s].to<p;)s++;let m=f.isInline&&!f.isLeaf?l.filter(v=>!v.inline):l.slice();r(f,m,e.forChild(i,f),h),i=p}}function my(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function gy(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=n){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Rl(t,e,n,r,o){let i=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,u=l+=a.size;c>=n||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function ka(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(zi(n)){for(a=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&B.isSelectable(d)&&o.parent&&!(d.isInline&&V2(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new B(s==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,s]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=Ea(t,u,l,d)}return c}function Th(t){return t.editable?t.hasFocus():Rh(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ot(t,e=!1){let n=t.state.selection;if(Ah(t,n),!!Th(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ae){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Tn(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)vy(t);else{let{anchor:r,head:o}=n,i,s;Iu&&!(n instanceof V)&&(n.$from.parent.inlineContent||(i=Lu(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Lu(t,n.to))),t.docView.setSelection(r,o,t,e),Iu&&(i&&Du(i),s&&Du(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&yy(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Iu=Ie||Ae&&mh<63;function Lu(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Ie&&o&&o.contentEditable=="false")return Ns(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Ns(o);if(i)return Ns(i)}}function Ns(t){return t.contentEditable="true",Ie&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Du(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function yy(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Th(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function vy(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Se(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&_e&&Qt<=11&&(n.disabled=!0,n.disabled=!1)}function Ah(t,e){if(e instanceof B){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Pu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Pu(t)}function Pu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ea(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||V.between(e,n,r)}function ju(t){return t.editable&&!t.hasFocus()?!1:Rh(t)}function Rh(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function by(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Tn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ol(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&q.findFrom(i,e)}function zt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Bu(t,e,n){let r=t.state.selection;if(r instanceof V)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return zt(t,new V(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Ol(t.state,e);return o&&o instanceof B?zt(t,o):!1}else if(!(Je&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?B.isSelectable(i)?zt(t,new B(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):Zr?zt(t,new V(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof B&&r.node.isInline)return zt(t,new V(e>0?r.$to:r.$from));{let o=Ol(t.state,e);return o?zt(t,o):!1}}}function Go(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Sr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Hn(t,e){return e<0?Cy(t):xy(t)}function Cy(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Ye&&n.nodeType==1&&r<Go(n)&&Sr(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Sr(l,-1))o=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Oh(n))break;{let l=n.previousSibling;for(;l&&Sr(l,-1);)o=n.parentNode,i=Se(l),l=l.previousSibling;if(l)n=l,r=Go(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Nl(t,n,r):o&&Nl(t,o,i)}function xy(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Go(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Sr(l,1))i=n,s=++r;else break}else{if(Oh(n))break;{let l=n.nextSibling;for(;l&&Sr(l,1);)i=l.parentNode,s=Se(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=Go(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&Nl(t,i,s)}function Oh(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function wy(t,e){for(;t&&e==t.childNodes.length&&!Jr(t);)e=Se(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Sy(t,e){for(;t&&!e&&!Jr(t);)e=Se(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Nl(t,e,n){if(e.nodeType!=3){let i,s;(s=wy(e,n))?(e=s,n=0):(i=Sy(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(zi(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&Ot(t)},50)}function _u(t,e){let n=t.state.doc.resolve(e);if(!(Ae||W2)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Hu(t,e,n){let r=t.state.selection;if(r instanceof V&&!r.empty||n.indexOf("s")>-1||Je&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Ol(t.state,e);if(s&&s instanceof B)return zt(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof Ve?q.near(s,e):q.findFrom(s,e);return l?zt(t,l):!1}return!1}function Fu(t,e){if(!(t.state.selection instanceof V))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function $u(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function ky(t){if(!Ie||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;$u(t,r,"true"),setTimeout(()=>$u(t,r,"false"),20)}return!1}function Ey(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function My(t,e){let n=e.keyCode,r=Ey(e);if(n==8||Je&&n==72&&r=="c")return Fu(t,-1)||Hn(t,-1);if(n==46&&!e.shiftKey||Je&&n==68&&r=="c")return Fu(t,1)||Hn(t,1);if(n==13||n==27)return!0;if(n==37||Je&&n==66&&r=="c"){let o=n==37?_u(t,t.state.selection.from)=="ltr"?-1:1:-1;return Bu(t,o,r)||Hn(t,o)}else if(n==39||Je&&n==70&&r=="c"){let o=n==39?_u(t,t.state.selection.from)=="ltr"?1:-1:1;return Bu(t,o,r)||Hn(t,o)}else{if(n==38||Je&&n==80&&r=="c")return Hu(t,-1,r)||Hn(t,-1);if(n==40||Je&&n==78&&r=="c")return ky(t)||Hu(t,1,r)||Hn(t,1);if(r==(Je?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ma(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||In.fromSchema(t.state.schema),l=jh(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Ph[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
24
+
25
+ `);return{dom:a,text:f,slice:e}}function Nh(t,e,n,r,o){let i=o.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=!!e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return l=new D(A.from(t.state.schema.text(e.replace(/\r\n?/g,`
26
+ `))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)l=d;else{let f=o.marks(),{schema:h}=t.state,p=In.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let v=s.appendChild(document.createElement("p"));m&&v.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=Oy(n),Zr&&Ny(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Xt.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Ty.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Iy(Vu(l,+u[1],+u[2]),u[4]);else if(l=D.maxOpen(Ay(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=Vu(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const Ty=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ay(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&Lh(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Dh(s[s.length-1],i.length));let u=Ih(l,a);s.push(u),o=o.matchType(u.type),i=a}}),s)return A.from(s)}return t}function Ih(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,A.from(t));return t}function Lh(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=Lh(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(A.from(Ih(n,t,o+1))))}}function Dh(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Dh(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(r))}function Il(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),o<r-1&&(l=Il(l,e,n,r,o+1,i)),o>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Vu(t,e,n){return e<t.openStart&&(t=new D(Il(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new D(Il(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Ph={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let zu=null;function jh(){return zu||(zu=document.implementation.createHTMLDocument("title"))}let Is=null;function Ry(t){let e=window.trustedTypes;return e?(Is||(Is=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Is.createHTML(t)):t}function Oy(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=jh().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&Ph[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Ry(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function Ny(t){let e=t.querySelectorAll(Ae?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Iy(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=A.from(a.create(r[l+1],o)),i++,s++}return new D(o,i,s)}const Le={},De={},Ly={touchstart:!0,touchmove:!0};class Dy{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Py(t){for(let e in Le){let n=Le[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{By(t,r)&&!Ta(t,r)&&(t.editable||!(r.type in De))&&n(t,r)},Ly[e]?{passive:!0}:void 0)}Ie&&t.dom.addEventListener("input",()=>null),Ll(t)}function Zt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function jy(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ll(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ta(t,r))})}function Ta(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function By(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function _y(t,e){!Ta(t,e)&&Le[e.type]&&(t.editable||!(e.type in De))&&Le[e.type](t,e)}De.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!_h(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Tt&&Ae&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),rr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,mn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||My(t,n)?n.preventDefault():Zt(t,"key")};De.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};De.keypress=(t,e)=>{let n=e;if(_h(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Je&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof V)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function Wi(t){return{left:t.clientX,top:t.clientY}}function Hy(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Aa(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),o,!0):l(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Yn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Fy(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(Yn(t,new B(n)),!0):!1}function $y(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof B&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(B.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Yn(t,B.create(t.state.doc,o)),!0):!1}function Vy(t,e,n,r,o){return Aa(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?$y(t,n):Fy(t,n))}function zy(t,e,n,r){return Aa(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function Uy(t,e,n,r){return Aa(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||Wy(t,n,r)}function Wy(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Yn(t,V.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)Yn(t,V.create(r,l+1,l+1+s.content.size));else if(B.isSelectable(s))Yn(t,B.create(r,l));else continue;return!0}}function Ra(t){return Jo(t)}const Bh=Je?"metaKey":"ctrlKey";Le.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ra(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&Hy(n,t.input.lastClick)&&!n[Bh]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Wi(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Ky(t,s,n,!!r)):(i=="doubleClick"?zy:Uy)(t,s.pos,s.inside,n)?n.preventDefault():Zt(t,"pointer"))};class Ky{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Bh],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof B&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ye&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Zt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ot(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Wi(e))),this.updateAllowDefault(e),this.allowDefault||!n?Zt(this.view,"pointer"):Vy(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ie&&this.mightDrag&&!this.mightDrag.node.isAtom||Ae&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yn(this.view,q.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Zt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Zt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Le.touchstart=t=>{t.input.lastTouch=Date.now(),Ra(t),Zt(t,"pointer")};Le.touchmove=t=>{t.input.lastTouch=Date.now(),Zt(t,"pointer")};Le.contextmenu=t=>Ra(t);function _h(t,e){return t.composing?!0:Ie&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const qy=Tt?5e3:-1;De.compositionstart=De.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof V&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Jo(t,!0),t.markCursor=null;else if(Jo(t,!e.selection.empty),Ye&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}Hh(t,qy)};De.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Hh(t,20))};function Hh(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Jo(t),e))}function Fh(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Jy());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Gy(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=F2(e.focusNode,e.focusOffset),r=$2(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function Jy(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Jo(t,e=!1){if(!(Tt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Fh(t),e||t.docView&&t.docView.dirty){let n=ka(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Zy(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Dr=_e&&Qt<15||rr&&K2<604;Le.copy=De.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=Dr?null:n.clipboardData,s=r.content(),{dom:l,text:a}=Ma(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):Zy(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Yy(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Xy(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Pr(t,r.value,null,o,e):Pr(t,r.textContent,r.innerHTML,o,e)},50)}function Pr(t,e,n,r,o){let i=Nh(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,o,i||D.empty)))return!0;if(!i)return!1;let s=Yy(i),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function $h(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}De.paste=(t,e)=>{let n=e;if(t.composing&&!Tt)return;let r=Dr?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Pr(t,$h(r),r.getData("text/html"),o,n)?n.preventDefault():Xy(t,n)};class Vh{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Qy=Je?"altKey":"ctrlKey";function zh(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[Qy]}Le.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Wi(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof B?o.to-1:o.to))){if(r&&r.mightDrag)s=B.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=B.create(t.state.doc,d.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c,slice:u}=Ma(t,l);(!n.dataTransfer.files.length||!Ae||mh>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Dr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Dr||n.dataTransfer.setData("text/plain",c),t.dragging=new Vh(u,zh(t,n),s)};Le.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};De.dragover=De.dragenter=(t,e)=>e.preventDefault();De.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Wi(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",p=>{s=p(s,t,!1)}):s=Nh(t,$h(n.dataTransfer),Dr?null:n.dataTransfer.getData("text/html"),!1,i);let l=!!(r&&zh(t,n));if(t.someProp("handleDrop",p=>p(t,n,s||D.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let a=s?Gf(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=t.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&B.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new B(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,v,b,C)=>p=C),c.setSelection(Ea(t,h,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Le.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ot(t)},20))};Le.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Le.beforeinput=(t,e)=>{if(Ae&&Tt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,mn(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in De)Le[t]=De[t];function jr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Zo{constructor(e,n){this.toDOM=e,this.spec=n||wn,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Ne(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Zo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&jr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class tn{constructor(e,n){this.attrs=e,this.spec=n||wn}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Ne(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof tn&&jr(this.attrs,e.attrs)&&jr(this.spec,e.spec)}static is(e){return e.type instanceof tn}destroy(){}}class Oa{constructor(e,n){this.attrs=e,this.spec=n||wn}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Ne(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof Oa&&jr(this.attrs,e.attrs)&&jr(this.spec,e.spec)}destroy(){}}class Ne{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Ne(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Ne(e,e,new Zo(n,r))}static inline(e,n,r,o){return new Ne(e,n,new tn(r,o))}static node(e,n,r,o){return new Ne(e,n,new Oa(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof tn}get widget(){return this.type instanceof Zo}}const Un=[],wn={};class le{constructor(e,n){this.local=e.length?e:Un,this.children=n.length?n:Un}static create(e,n){return n.length?Yo(n,e,0,wn):Te}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,o+l,i)}}map(e,n,r){return this==Te||e.maps.length==0?this:this.mapInner(e,n,0,0,r||wn)}mapInner(e,n,r,o,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,o);a&&a.type.valid(n,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?ev(this.children,s||[],e,n,r,o,i):s?new le(s.sort(Sn),Un):Te}add(e,n){return n.length?this==Te?le.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Wh(n,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,Yo(u,l,c+1,wn)),i+=3}});let s=Uh(i?Kh(n):n,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new le(s.length?this.local.concat(s).sort(Sn):this.local,o||this.children)}remove(e){return e.length==0||this==Te?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+n,a=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=Te?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new le(o,r):Te}forChild(e,n){if(this==Te)return this;if(n.isLeaf)return le.empty;let r,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof tn){let c=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new le(o.sort(Sn),Un);return r?new Kt([l,r]):l}return r||Te}eq(e){if(this==e)return!0;if(!(e instanceof le)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Na(this.localsInner(e))}localsInner(e){if(this==Te)return Un;if(e.inlineContent||!this.local.some(tn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof tn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}le.empty=new le([],[]);le.removeOverlap=Na;const Te=le.empty;class Kt{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,wn));return Kt.from(r)}forChild(e,n){if(n.isLeaf)return le.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Te&&(i instanceof Kt?r=r.concat(i.members):r.push(i))}return Kt.from(r)}eq(e){if(!(e instanceof Kt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?Na(r?n:n.sort(Sn)):Un}static from(e){switch(e.length){case 0:return Te;case 1:return e[0];default:return new Kt(e.every(n=>n instanceof le)?e:e.reduce((n,r)=>n.concat(r instanceof le?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function ev(t,e,n,r,o,i,s){let l=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,m)=>{let v=m-p-(h-f);for(let b=0;b<l.length;b+=3){let C=l[b+1];if(C<0||f>C+u-d)continue;let x=l[b]+u-d;h>=x?l[b+1]=f<=x?-2:-1:f>=u&&v&&(l[b]+=v,l[b+1]+=v)}d+=v}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+i,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(d),v=r.maybeChild(p);if(v&&m==d&&m+v.nodeSize==h){let b=l[c+2].mapInner(n,v,u+1,t[c]+i+1,s);b!=Te?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=tv(l,t,e,n,o,i,s),u=Yo(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new le(e.sort(Sn),l)}function Uh(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Ne(o.from+e,o.to+e,o.type))}return n}function tv(t,e,n,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function Wh(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Kh(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Yo(t,e,n,r){let o=[],i=!1;e.forEach((l,a)=>{let c=Wh(t,l,a+n);if(c){i=!0;let u=Yo(c,l,n+a+1,r);u!=Te&&o.push(a,a+l.nodeSize,u)}});let s=Uh(i?Kh(t):t,-n).sort(Sn);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||o.length?new le(s,o):Te}function Sn(t,e){return t.from-e.from||t.to-e.to}function Na(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Uu(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Uu(e,o,r.copy(i.from,r.to)));break}}}return e}function Uu(t,e,n){for(;e<t.length&&Sn(n,t[e])>0;)e++;t.splice(e,0,n)}function Ls(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Te&&e.push(r)}),t.cursorWrapper&&e.push(le.create(t.state.doc,[t.cursorWrapper.deco])),Kt.from(e)}const nv={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},rv=_e&&Qt<=11;class ov{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class iv{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ov,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);_e&&Qt<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),rv&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,nv)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(ju(this.view)){if(this.suppressingSelectionUpdates)return Ot(this.view);if(_e&&Qt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Tn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=nr(i))n.add(i);for(let i=e.anchorNode;i;i=nr(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&ju(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(Ye&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||av(e,d)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&zi(r)&&(c=ka(e))&&c.eq(q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ot(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),sv(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ot(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(_e&&Qt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?Se(o)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?Se(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Wu=new WeakMap,Ku=!1;function sv(t){if(!Wu.has(t)&&(Wu.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ye,Ku)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Ku=!0}}function qu(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Tn(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function lv(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return qu(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?qu(t,n):null}function av(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function cv(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],zi(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Ae&&t.input.lastKeyCode===8)for(let v=i;v>o;v--){let b=r.childNodes[v-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){i=v;break}if(!C||C.size)break}let d=t.state.doc,f=t.someProp("domParser")||Xt.fromSchema(t.state.schema),h=d.resolve(s),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:uv,context:h});if(c&&c[0].pos!=null){let v=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=v),p={anchor:v+s,head:b+s}}return{doc:m,sel:p,from:s,to:l}}function uv(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ie&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ie&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const dv=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function fv(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=ka(t,S);if(M&&!t.state.selection.eq(M)){if(Ae&&Tt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",P=>P(t,mn(13,"Enter"))))return;let N=t.state.tr.setSelection(M);S=="pointer"?N.setMeta("pointer",!0):S=="key"&&N.scrollIntoView(),i&&N.setMeta("composition",i),t.dispatch(N)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=cv(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=mv(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(rr&&t.input.lastIOSEnter>Date.now()-225||Tt)&&o.some(S=>S.nodeType==1&&!dv.test(S.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",S=>S(t,mn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof V&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let S=Gu(t,t.state.doc,c.sel);if(S&&!S.eq(t.state.selection)){let M=t.state.tr.setSelection(S);i&&M.setMeta("composition",i),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof V&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),_e&&Qt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),v=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),C=m.sameParent(v)&&m.parent.inlineContent&&b.end()>=p.endA;if((rr&&t.input.lastIOSEnter>Date.now()-225&&(!C||o.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!C&&m.pos<c.doc.content.size&&(!m.sameParent(v)||!m.parent.inlineContent)&&m.pos<v.pos&&!/\S/.test(c.doc.textBetween(m.pos,v.pos,"","")))&&t.someProp("handleKeyDown",S=>S(t,mn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&pv(u,p.start,p.endA,m,v)&&t.someProp("handleKeyDown",S=>S(t,mn(8,"Backspace")))){Tt&&Ae&&t.domObserver.suppressSelectionUpdates();return}Ae&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Tt&&!C&&m.start()!=v.start()&&v.parentOffset==0&&m.depth==v.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,v=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(S){return S(t,mn(13,"Enter"))})},20));let x=p.start,w=p.endA,E=S=>{let M=S||t.state.tr.replace(x,w,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let N=Gu(t,M.doc,c.sel);N&&!(Ae&&t.composing&&N.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==x||N.head==M.mapping.map(w)-1)||_e&&N.empty&&N.head==x)&&M.setSelection(N)}return i&&M.setMeta("composition",i),M.scrollIntoView()},k;if(C)if(m.pos==v.pos){_e&&Qt<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ot(t),20));let S=E(t.state.tr.delete(x,w)),M=u.resolve(p.start).marksAcross(u.resolve(p.endA));M&&S.ensureMarks(M),t.dispatch(S)}else if(p.endA==p.endB&&(k=hv(m.parent.content.cut(m.parentOffset,v.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let S=E(t.state.tr);k.type=="add"?S.addMark(x,w,k.mark):S.removeMark(x,w,k.mark),t.dispatch(S)}else if(m.parent.child(m.index()).isText&&m.index()==v.index()-(v.textOffset?0:1)){let S=m.parent.textBetween(m.parentOffset,v.parentOffset),M=()=>E(t.state.tr.insertText(S,x,w));t.someProp("handleTextInput",N=>N(t,x,w,S,M))||t.dispatch(M())}else t.dispatch(E());else t.dispatch(E())}function Gu(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ea(t,e.resolve(n.anchor),e.resolve(n.head))}function hv(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(A.from(c).eq(t))return{mark:l,type:s}}function pv(t,e,n,r,o){if(n-e<=o.pos-r.pos||Ds(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Ds(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ds(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Ds(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function mv(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(s,l));r-=s+a-i}if(s<i&&t.size<e.size){let a=r<=i&&r>=s?i-r:0;i-=a,i&&i<e.size&&Ju(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<t.size&&Ju(t.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Ju(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class qh{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Dy,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ed),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Xu(this),Yu(this),this.nodeViews=Qu(this),this.docView=Ou(this.state.doc,Zu(this),Ls(this),this.dom,this),this.domObserver=new iv(this,(r,o,i,s)=>fv(this,r,o,i,s)),this.domObserver.start(),Py(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ll(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ed),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Fh(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=Qu(this);yv(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ll(this),this.editable=Xu(this),Yu(this);let a=Ls(this),c=Zu(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&J2(this);if(s){this.domObserver.stop();let h=d&&(_e||Ae)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&gv(o.selection,e.selection);if(d){let p=Ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Gy(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Ou(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&by(this))?Ot(this,h):(Ah(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Z2(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof B){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&ku(this,n.getBoundingClientRect(),e)}else ku(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Vh(e.slice,e.move,o<0?void 0:B.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=n?n(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(_e){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Y2(this.dom),Ot(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ny(this,e)}coordsAtPos(e,n=1){return Ch(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return ly(this,n||this.state,e)}pasteHTML(e,n){return Pr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Pr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ma(this,e)}destroy(){this.docView&&(jy(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ls(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,_2())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return _y(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ie&&this.root.nodeType===11&&z2(this.dom.ownerDocument)==this.dom&&lv(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}qh.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Zu(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ne.node(0,t.state.doc.content.size,e)]}function Yu(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ne.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Xu(t){return!t.someProp("editable",e=>e(t.state)===!1)}function gv(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Qu(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function yv(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function ed(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var on={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Xo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},vv=typeof navigator<"u"&&/Mac/.test(navigator.platform),bv=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ke=0;ke<10;ke++)on[48+ke]=on[96+ke]=String(ke);for(var ke=1;ke<=24;ke++)on[ke+111]="F"+ke;for(var ke=65;ke<=90;ke++)on[ke]=String.fromCharCode(ke+32),Xo[ke]=String.fromCharCode(ke);for(var Ps in on)Xo.hasOwnProperty(Ps)||(Xo[Ps]=on[Ps]);function Cv(t){var e=vv&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||bv&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Xo:on)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const xv=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),wv=typeof navigator<"u"&&/Win/.test(navigator.platform);function Sv(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))xv?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function kv(t){let e=Object.create(null);for(let n in t)e[Sv(n)]=t[n];return e}function js(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Ev(t){return new ae({props:{handleKeyDown:Gh(t)}})}function Gh(t){let e=kv(t);return function(n,r){let o=Cv(r),i,s=e[js(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[js(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(wv&&r.ctrlKey&&r.altKey)&&(i=on[r.keyCode])&&i!=o){let l=e[js(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var Mv=Object.defineProperty,Ia=(t,e)=>{for(var n in e)Mv(t,n,{get:e[n],enumerable:!0})};function Ki(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var qi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...c)=>{const u=l(...c)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],l=!!t,a=t||o.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),s.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const m=this.buildProps(a,e),v=f(...p)(m);return s.push(v),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:Ki({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)(s)]))}};return s}},Jh={};Ia(Jh,{blur:()=>Tv,clearContent:()=>Av,clearNodes:()=>Rv,command:()=>Ov,createParagraphNear:()=>Nv,cut:()=>Iv,deleteCurrentNode:()=>Lv,deleteNode:()=>Dv,deleteRange:()=>Pv,deleteSelection:()=>jv,enter:()=>Bv,exitCode:()=>_v,extendMarkRange:()=>Hv,first:()=>Fv,focus:()=>$v,forEach:()=>Vv,insertContent:()=>zv,insertContentAt:()=>Kv,joinBackward:()=>Jv,joinDown:()=>Gv,joinForward:()=>Zv,joinItemBackward:()=>Yv,joinItemForward:()=>Xv,joinTextblockBackward:()=>Qv,joinTextblockForward:()=>eb,joinUp:()=>qv,keyboardShortcut:()=>nb,lift:()=>rb,liftEmptyBlock:()=>ob,liftListItem:()=>ib,newlineInCode:()=>sb,resetAttributes:()=>lb,scrollIntoView:()=>ab,selectAll:()=>cb,selectNodeBackward:()=>ub,selectNodeForward:()=>db,selectParentNode:()=>fb,selectTextblockEnd:()=>hb,selectTextblockStart:()=>pb,setContent:()=>mb,setMark:()=>Lb,setMeta:()=>Db,setNode:()=>Pb,setNodeSelection:()=>jb,setTextSelection:()=>Bb,sinkListItem:()=>_b,splitBlock:()=>Hb,splitListItem:()=>Fb,toggleList:()=>$b,toggleMark:()=>Vb,toggleNode:()=>zb,toggleWrap:()=>Ub,undoInputRule:()=>Wb,unsetAllMarks:()=>Kb,unsetMark:()=>qb,updateAttributes:()=>Gb,wrapIn:()=>Jb,wrapInList:()=>Zb});var Tv=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),Av=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Rv=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=lr(h);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},Ov=t=>e=>t(e),Nv=()=>({state:t,dispatch:e})=>uh(t,e),Iv=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new V(r.doc.resolve(Math.max(s-1,0)))),!0},Lv=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const l=o.before(i),a=o.after(i);t.delete(l,a).scrollIntoView()}return!0}return!1};function me(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var Dv=t=>({tr:e,state:n,dispatch:r})=>{const o=me(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const a=i.before(s),c=i.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},Pv=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},jv=()=>({state:t,dispatch:e})=>va(t,e),Bv=()=>({commands:t})=>t.keyboardShortcut("Enter"),_v=()=>({state:t,dispatch:e})=>S2(t,e);function La(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Qo(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:La(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Zh(t,e,n={}){return t.find(r=>r.type===e&&Qo(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function td(t,e,n={}){return!!Zh(t,e,n)}function Da(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!Zh([...o.node.marks],e,n)))return;let s=o.index,l=t.start()+o.offset,a=s+1,c=l+o.node.nodeSize;for(;s>0&&td([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&td([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function jt(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var Hv=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=jt(t,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(o){const d=Da(a,i,e);if(d&&d.from<=c&&d.to>=u){const f=V.create(s,d.from,d.to);n.setSelection(f)}}return!0},Fv=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Yh(t){return t instanceof V}function vn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Xh(t,e=null){if(!e)return null;const n=q.atStart(t),r=q.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,i=r.to;return e==="all"?V.create(t,vn(0,o,i),vn(t.content.size,o,i)):V.create(t,vn(e,o,i),vn(e,o,i))}function Qh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Gi(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var $v=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Gi()||Qh())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!Yh(n.state.selection))return s(),!0;const l=Xh(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},Vv=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),zv=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),ep=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&ep(r)}return t};function po(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return ep(n)}function Br(t,e,n){if(t instanceof Yt||t instanceof A)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return A.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Br("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,l="";const a=new Bf({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Xt.fromSchema(a).parseSlice(po(t),n.parseOptions):Xt.fromSchema(a).parse(po(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Xt.fromSchema(e);return n.slice?i.parseSlice(po(t),n.parseOptions).content:i.parse(po(t),n.parseOptions)}return Br("",e,n)}function Uv(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof ve||o instanceof be))return;const i=t.mapping.maps[r];let s=0;i.forEach((l,a,c,u)=>{s===0&&(s=u)}),t.setSelection(q.near(t.doc.resolve(s),n))}var Wv=t=>!("type"in t),Kv=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Br(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(v){a(v)}try{l=Br(e,i.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(v){return a(v),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((Wv(l)?l:[l]).forEach(v=>{v.check(),f=f?v.isText&&v.marks.length===0:!1,h=h?v.isBlock:!1}),u===d&&h){const{parent:v}=r.doc.resolve(u);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(v=>v.text||"").join("");else if(e instanceof A){let v="";e.forEach(b=>{b.text&&(v+=b.text)}),m=v}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=l;const v=r.doc.resolve(u),b=v.node(),C=v.parentOffset===0,x=b.isText||b.isTextblock,w=b.content.size>0;C&&x&&w&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}n.updateSelection&&Uv(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},qv=()=>({state:t,dispatch:e})=>C2(t,e),Gv=()=>({state:t,dispatch:e})=>x2(t,e),Jv=()=>({state:t,dispatch:e})=>rh(t,e),Zv=()=>({state:t,dispatch:e})=>lh(t,e),Yv=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Fi(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Xv=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Fi(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Qv=()=>({state:t,dispatch:e})=>v2(t,e),eb=()=>({state:t,dispatch:e})=>b2(t,e);function tp(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function tb(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Gi()||tp()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var nb=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=tb(t).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function sn(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?me(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(o,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=o-r,c=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Qo(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}var rb=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return sn(n,o,e)?w2(n,r):!1},ob=()=>({state:t,dispatch:e})=>dh(t,e),ib=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return D2(r)(e,n)},sb=()=>({state:t,dispatch:e})=>ch(t,e);function Ji(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function nd(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var lb=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Ji(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=me(t,r.schema)),l==="mark"&&(s=jt(t,r.schema)),o&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,nd(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(nd(d.attrs,e)))})})}),!0):!1},ab=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),cb=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ve(t.doc);t.setSelection(n)}return!0},ub=()=>({state:t,dispatch:e})=>ih(t,e),db=()=>({state:t,dispatch:e})=>ah(t,e),fb=()=>({state:t,dispatch:e})=>M2(t,e),hb=()=>({state:t,dispatch:e})=>R2(t,e),pb=()=>({state:t,dispatch:e})=>A2(t,e);function Dl(t,e,n={},r={}){return Br(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var mb=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const c=Dl(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function np(t,e){const n=jt(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Pa(t,e){const n=new Qf(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function gb(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function yb(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function rp(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function vb(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Zi(t){return e=>vb(e.$from,t)}function $(t,e,n){return t.config[e]===void 0&&t.parent?$(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?$(t.parent,e,n):null}):t.config[e]}function ja(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=$(e,"addExtensions",n);return r?[e,...ja(r())]:e}).flat(10)}function Ba(t,e){const n=In.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function op(t){return typeof t=="function"}function X(t,e=void 0,...n){return op(t)?e?t.bind(e)(...n):t(...n):t}function bb(t={}){return Object.keys(t).length===0&&t.constructor===Object}function _r(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function ip(t){const e=[],{nodeExtensions:n,markExtensions:r}=_r(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:o},a=$(s,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...i,...h}})})})})}),o.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=$(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function re(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const l=i?String(i).split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(u=>!a.includes(u));r[o]=[...a,...c].join(" ")}else if(o==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[o]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[o]=i}),r},{})}function Hr(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>re(n,r),{})}function Cb(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function rd(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Cb(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...r,...o}}}}function od(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&bb(n)?!1:n!=null))}function xb(t,e){var n;const r=ip(t),{nodeExtensions:o,markExtensions:i}=_r(t),s=(n=o.find(c=>$(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(o.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,C)=>{const x=$(C,"extendNodeSchema",d);return{...b,...x?x(c):{}}},{}),h=od({...f,content:X($(c,"content",d)),marks:X($(c,"marks",d)),group:X($(c,"group",d)),inline:X($(c,"inline",d)),atom:X($(c,"atom",d)),selectable:X($(c,"selectable",d)),draggable:X($(c,"draggable",d)),code:X($(c,"code",d)),whitespace:X($(c,"whitespace",d)),linebreakReplacement:X($(c,"linebreakReplacement",d)),defining:X($(c,"defining",d)),isolating:X($(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var C,x;return[b.name,{default:(C=b?.attribute)==null?void 0:C.default,validate:(x=b?.attribute)==null?void 0:x.validate}]}))}),p=X($(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>rd(b,u)));const m=$(c,"renderHTML",d);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Hr(b,u)}));const v=$(c,"renderText",d);return v&&(h.toText=v),[c.name,h]})),a=Object.fromEntries(i.map(c=>{const u=r.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((v,b)=>{const C=$(b,"extendMarkSchema",d);return{...v,...C?C(c):{}}},{}),h=od({...f,inclusive:X($(c,"inclusive",d)),excludes:X($(c,"excludes",d)),group:X($(c,"group",d)),spanning:X($(c,"spanning",d)),code:X($(c,"code",d)),attrs:Object.fromEntries(u.map(v=>{var b,C;return[v.name,{default:(b=v?.attribute)==null?void 0:b.default,validate:(C=v?.attribute)==null?void 0:C.validate}]}))}),p=X($(c,"parseHTML",d));p&&(h.parseDOM=p.map(v=>rd(v,u)));const m=$(c,"renderHTML",d);return m&&(h.toDOM=v=>m({mark:v,HTMLAttributes:Hr(v,u)})),[c.name,h]}));return new Bf({topNode:s,nodes:l,marks:a})}function wb(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function _a(t){return t.sort((n,r)=>{const o=$(n,"priority")||100,i=$(r,"priority")||100;return o>i?-1:o<i?1:0})}function sp(t){const e=_a(ja(t)),n=wb(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function lp(t,e,n){const{from:r,to:o}=e,{blockSeparator:i=`
27
+
28
+ `,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(r,o,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=i);const h=s?.[a.type.name];if(h)return u&&(l+=h({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a?.text)==null?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function Sb(t,e){const n={from:0,to:t.content.size};return lp(t,n,e)}function ap(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function kb(t,e){const n=me(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function cp(t,e){const n=Ji(typeof e=="string"?e:e.name,t.schema);return n==="node"?kb(t,e):n==="mark"?np(t,e):{}}function Eb(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function Mb(t){const e=Eb(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Ha(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const c=e.slice(i).map(l,-1),u=e.slice(i).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Mb(r)}function Fa(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t),s=Da(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var Tb=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let i=r,s=null;for(;i>0&&s===null;){const l=o.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function Bs(t,e){return e.nodes[t]||e.marks[t]||null}function Do(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var Ab=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;const u=((c=(a=o.type.spec).toText)==null?void 0:c.call(a,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-i))}),n};function Pl(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?jt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Qo(d.attrs,n,{strict:!1}));let s=0;const l=[];if(o.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,v)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(h,v),C=Math.min(p,v+m.nodeSize),x=C-b;s+=x,l.push(...m.marks.map(w=>({mark:w,from:b,to:C})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Qo(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=s}function Rb(t,e,n={}){if(!e)return sn(t,null,n)||Pl(t,null,n);const r=Ji(e,t.schema);return r==="node"?sn(t,e,n):r==="mark"?Pl(t,e,n):!1}var Ob=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const i=Zi(l=>l.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Nb=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function id(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function sd(t,e){const{nodeExtensions:n}=_r(e),r=n.find(s=>s.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=X($(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function Yi(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(i=>{o!==!1&&(Yi(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function up(t){return t instanceof B}function Ib(t,e,n){var r;const{selection:o}=e;let i=null;if(Yh(o)&&(i=o.$cursor),i){const l=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var Lb=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=jt(t,r.schema);if(o)if(s){const c=np(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(b=>b.type===a)?f.marks.forEach(b=>{a===b.type&&n.addMark(p,m,a.create({...b.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return Ib(r,n,a)},Db=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Pb=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=me(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:l})=>xu(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>xu(i,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},jb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=vn(t,0,r.content.size),i=B.create(r,o);e.setSelection(i)}return!0},Bb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=V.atStart(r).from,l=V.atEnd(r).to,a=vn(o,s,l),c=vn(i,s,l),u=V.create(r,a,c);e.setSelection(u)}return!0},_b=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return B2(r)(e,n)};function ld(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var Hb=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,c=o.extensionManager.attributes,u=Do(c,l.node().type.name,l.node().attrs);if(i instanceof B&&i.node.isBlock)return!l.parentOffset||!Rt(s,l.pos)?!1:(r&&(t&&ld(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:gb(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Rt(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Rt(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(i instanceof V&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),v=e.doc.resolve(m);l.node(-1).canReplaceWith(v.index(),v.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&ld(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},Fb=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const l=me(t,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let b=A.empty;const C=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-C;M>=a.depth-3;M-=1)b=A.from(a.node(M).copy(b));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w={...Do(f,a.node().type.name,a.node().attrs),...e},E=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(w))||void 0;b=b.append(A.from(l.createAndFill(null,E)||void 0));const k=a.before(a.depth-(C-1));n.replace(k,a.after(-x),new D(b,4-C,0));let S=-1;n.doc.nodesBetween(k,n.doc.content.size,(M,N)=>{if(S>-1)return!1;M.isTextblock&&M.content.size===0&&(S=N+1)}),S>-1&&n.setSelection(V.near(n.doc.resolve(S))),n.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...Do(f,d.type.name,d.attrs),...e},m={...Do(f,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const v=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!Rt(n.doc,a.pos,2))return!1;if(o){const{selection:b,storedMarks:C}=r,{splittableMarks:x}=i.extensionManager,w=C||b.$to.parentOffset&&b.$from.marks();if(n.split(a.pos,2,v).scrollIntoView(),!w||!o)return!0;const E=w.filter(k=>x.includes(k.type.name));n.ensureMarks(E)}return!0},_s=(t,e)=>{const n=Zi(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&un(t.doc,n.pos)&&t.join(n.pos),!0},Hs=(t,e)=>{const n=Zi(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&un(t.doc,r)&&t.join(r),!0},$b=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,h=me(t,s.schema),p=me(e,s.schema),{selection:m,storedMarks:v}=s,{$from:b,$to:C}=m,x=b.blockRange(C),w=v||m.$to.parentOffset&&m.$from.marks();if(!x)return!1;const E=Zi(k=>sd(k.type.name,d))(m);if(x.depth>=1&&E&&x.depth-E.depth<=1){if(E.node.type===h)return c.liftListItem(p);if(sd(E.node.type.name,d)&&h.validContent(E.node.content)&&l)return a().command(()=>(i.setNodeMarkup(E.pos,h),!0)).command(()=>_s(i,h)).command(()=>Hs(i,h)).run()}return!n||!w||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>_s(i,h)).command(()=>Hs(i,h)).run():a().command(()=>{const k=u().wrapInList(h,r),S=w.filter(M=>f.includes(M.type.name));return i.ensureMarks(S),k?!0:c.clearNodes()}).wrapInList(h,r).command(()=>_s(i,h)).command(()=>Hs(i,h)).run()},Vb=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=jt(t,r.schema);return Pl(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},zb=(t,e,n={})=>({state:r,commands:o})=>{const i=me(t,r.schema),s=me(e,r.schema),l=sn(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(s,a):o.setNode(i,{...a,...n})},Ub=(t,e={})=>({state:n,commands:r})=>{const o=me(t,n.schema);return sn(n,o,e)?r.lift(o):r.wrapIn(o,e)},Wb=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},Kb=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},qb=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,a=jt(t,r.schema),{$from:c,empty:u,ranges:d}=l;if(!o)return!0;if(u&&s){let{from:f,to:h}=l;const p=(i=c.marks().find(v=>v.type===a))==null?void 0:i.attrs,m=Da(c,a,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},Gb=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Ji(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=me(t,r.schema)),l==="mark"&&(s=jt(t,r.schema)),o&&n.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;let d,f,h,p;n.selection.empty?r.doc.nodesBetween(c,u,(m,v)=>{i&&i===m.type&&(h=Math.max(v,c),p=Math.min(v+m.nodeSize,u),d=v,f=m)}):r.doc.nodesBetween(c,u,(m,v)=>{v<c&&i&&i===m.type&&(h=Math.max(v,c),p=Math.min(v+m.nodeSize,u),d=v,f=m),v>=c&&v<=u&&(i&&i===m.type&&n.setNodeMarkup(v,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(b=>{if(s===b.type){const C=Math.max(v,c),x=Math.min(v+m.nodeSize,u);n.addMark(C,x,s.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&n.addMark(h,p,s.create({...m.attrs,...e}))}))}),!0):!1},Jb=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return O2(o,e)(n,r)},Zb=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return N2(o,e)(n,r)},Yb=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Xr=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Xb=(t,e)=>{if(La(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function mo(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Ab(c)+i;return s.forEach(f=>{if(u)return;const h=Xb(d,f.find);if(!h)return;const p=a.state.tr,m=Ki({state:a.state,transaction:p}),v={from:r-(h[0].length-i.length),to:o},{commands:b,chain:C,can:x}=new qi({editor:n,state:m});f.handler({state:m,range:v,match:h,commands:b,chain:C,can:x})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:o,text:i}),a.dispatch(p),u=!0)}),u}function Qb(t){const{editor:e,rules:n}=t,r=new ae({state:{init(){return null},apply(o,i,s){const l=o.getMeta(r);if(l)return l;const a=o.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=Ba(A.from(u),s.schema);const{from:d}=a,f=d+u.length;mo({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return mo({editor:e,from:i,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&mo({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?mo({editor:e,from:s.pos,to:s.pos,text:`
29
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function eC(t){return Object.prototype.toString.call(t).slice(8,-1)}function go(t){return eC(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function dp(t,e){const n={...t};return go(t)&&go(e)&&Object.keys(e).forEach(r=>{go(e[r])&&go(t[r])?n[r]=dp(t[r],e[r]):n[r]=e[r]}),n}var $a=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...X($(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...X($(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>dp(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},ht=class fp extends $a{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new fp(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;const a=s.find(c=>c?.type.name===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function tC(t){return typeof t=="number"}var nC=class{constructor(t){this.find=t.find,this.handler=t.handler}},rC=(t,e,n)=>{if(La(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function oC(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:u}=new qi({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,p)=>{var m,v,b,C,x;if((v=(m=h.type)==null?void 0:m.spec)!=null&&v.code||!(h.isText||h.isTextblock||h.isInline))return;const w=(x=(C=(b=h.content)==null?void 0:b.size)!=null?C:h.nodeSize)!=null?x:0,E=Math.max(r,p),k=Math.min(o,p+w);if(E>=k)return;const S=h.isText?h.text||"":h.textBetween(E-p,k-p,void 0,"");rC(S,i.find,s).forEach(N=>{if(N.index===void 0)return;const P=E+N.index+1,W=P+N[0].length,z={from:n.tr.mapping.map(P),to:n.tr.mapping.map(W)},H=i.handler({state:n,range:z,match:N,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(H)})}),d.every(h=>h!==null)}var yo=null,iC=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function sC(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,v=Ki({state:u,transaction:m});if(!(!oC({editor:e,state:v,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new ae({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(yo=e)},h=()=>{yo&&(yo=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,l=f,!i){const h=yo;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return s=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!o,v=p.getMeta("uiEvent")==="drop"&&!i,b=p.getMeta("applyPasteRules"),C=!!b;if(!m&&!v&&!C)return;if(C){let{text:E}=b;typeof E=="string"?E=E:E=Ba(A.from(E),h.schema);const{from:k}=b,S=k+E.length,M=iC(E);return a({rule:u,state:h,from:k,to:{b:S},pasteEvt:M})}const x=f.doc.content.findDiffStart(h.doc.content),w=f.doc.content.findDiffEnd(h.doc.content);if(!(!tC(x)||!w||x===w.b))return a({rule:u,state:h,from:x,to:w,pasteEvt:s})}}))}var Xi=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=sp(t),this.schema=xb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Bs(e.name,this.schema)},r=$(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return _a([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Bs(r.name,this.schema)},i=[],s=$(r,"addKeyboardShortcuts",o);let l={};if(r.type==="mark"&&$(r,"exitable",o)&&(l.ArrowRight=()=>ht.handleExit({editor:t,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=Ev(l);i.push(a);const c=$(r,"addInputRules",o);if(id(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=Qb({editor:t,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}const u=$(r,"addPasteRules",o);if(id(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=sC({editor:t,rules:f});i.push(...h)}}const d=$(r,"addProseMirrorPlugins",o);if(d){const f=d();i.push(...f)}return i})}get attributes(){return ip(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=_r(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:me(n.name,this.schema)},i=$(n,"addNodeView",o);if(!i)return[];const s=(l,a,c,u,d)=>{const f=Hr(l,r);return i()({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,s]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=_r(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:jt(n.name,this.schema)},i=$(n,"addMarkView",o);if(!i)return[];const s=(l,a,c)=>{const u=Hr(l,r);return i()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{CC(l,t,d)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Bs(e.name,this.schema)};e.type==="mark"&&((n=X($(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=$(e,"onBeforeCreate",r),i=$(e,"onCreate",r),s=$(e,"onUpdate",r),l=$(e,"onSelectionUpdate",r),a=$(e,"onTransaction",r),c=$(e,"onFocus",r),u=$(e,"onBlur",r),d=$(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Xi.resolve=sp;Xi.sort=_a;Xi.flatten=ja;var lC={};Ia(lC,{ClipboardTextSerializer:()=>pp,Commands:()=>mp,Delete:()=>gp,Drop:()=>yp,Editable:()=>vp,FocusEvents:()=>Cp,Keymap:()=>xp,Paste:()=>wp,Tabindex:()=>Sp,focusEventsPluginKey:()=>bp});var ce=class hp extends $a{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new hp(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},pp=ce.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ae({key:new ye("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),a=ap(n);return lp(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),mp=ce.create({name:"commands",addCommands(){return{...Jh}}}),gp=ce.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const i=()=>{var s,l,a,c;if((c=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const u=Pa(t.before,[t,...e]);Ha(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{const v=m+p.nodeSize-2,b=h.oldRange.from<=m&&v<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:v,newFrom:u.mapping.map(m),newTo:u.mapping.map(v),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var m,v;if(h instanceof nt){const b=f.slice(p).map(h.from,-1),C=f.slice(p).map(h.to),x=f.invert().map(b,-1),w=f.invert().map(C),E=(m=u.doc.nodeAt(b-1))==null?void 0:m.marks.some(S=>S.eq(h.mark)),k=(v=u.doc.nodeAt(C))==null?void 0:v.marks.some(S=>S.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:x,to:w},newRange:{from:b,to:C},partial:!!(k||E),editor:this.editor,transaction:t,combinedTransform:u})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i()}}),yp=ce.create({name:"drop",addProseMirrorPlugins(){return[new ae({key:new ye("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),vp=ce.create({name:"editable",addProseMirrorPlugins(){return[new ae({key:new ye("editable"),props:{editable:()=>this.editor.options.editable}})]}}),bp=new ye("focusEvents"),Cp=ce.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ae({key:bp,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),xp=ce.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,v=d.pos-d.parentOffset,b=m&&p.parent.childCount===1?v===d.pos:q.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Gi()||tp()?i:o},addProseMirrorPlugins(){return[new ae({key:new ye("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:l}=e.selection,a=q.atStart(e.doc).from,c=q.atEnd(e.doc).to;if(i||!(s===a&&l===c)||!Yi(n.doc))return;const f=n.tr,h=Ki({state:n,transaction:f}),{commands:p}=new qi({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),wp=ce.create({name:"paste",addProseMirrorPlugins(){return[new ae({key:new ye("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Sp=ce.create({name:"tabindex",addProseMirrorPlugins(){return[new ae({key:new ye("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),aC=class Wn{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Wn(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Wn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Wn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!o&&l.depth<=this.depth)return;const a=new Wn(l,this.editor,o,o?n:null);o&&(a.actualDepth=this.depth+1),e.push(new Wn(l,this.editor,o,o?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const i=o.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==n[a])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(a=>n[a]===s.node.attrs[a])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},cC=`.ProseMirror {
30
+ position: relative;
31
+ }
32
+
33
+ .ProseMirror {
34
+ word-wrap: break-word;
35
+ white-space: pre-wrap;
36
+ white-space: break-spaces;
37
+ -webkit-font-variant-ligatures: none;
38
+ font-variant-ligatures: none;
39
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
40
+ }
41
+
42
+ .ProseMirror [contenteditable="false"] {
43
+ white-space: normal;
44
+ }
45
+
46
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
47
+ white-space: pre-wrap;
48
+ }
49
+
50
+ .ProseMirror pre {
51
+ white-space: pre-wrap;
52
+ }
53
+
54
+ img.ProseMirror-separator {
55
+ display: inline !important;
56
+ border: none !important;
57
+ margin: 0 !important;
58
+ width: 0 !important;
59
+ height: 0 !important;
60
+ }
61
+
62
+ .ProseMirror-gapcursor {
63
+ display: none;
64
+ pointer-events: none;
65
+ position: absolute;
66
+ margin: 0;
67
+ }
68
+
69
+ .ProseMirror-gapcursor:after {
70
+ content: "";
71
+ display: block;
72
+ position: absolute;
73
+ top: -2px;
74
+ width: 20px;
75
+ border-top: 1px solid black;
76
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
77
+ }
78
+
79
+ @keyframes ProseMirror-cursor-blink {
80
+ to {
81
+ visibility: hidden;
82
+ }
83
+ }
84
+
85
+ .ProseMirror-hideselection *::selection {
86
+ background: transparent;
87
+ }
88
+
89
+ .ProseMirror-hideselection *::-moz-selection {
90
+ background: transparent;
91
+ }
92
+
93
+ .ProseMirror-hideselection * {
94
+ caret-color: transparent;
95
+ }
96
+
97
+ .ProseMirror-focused .ProseMirror-gapcursor {
98
+ display: block;
99
+ }`;function uC(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var dC=class extends Yb{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:o,moved:i})=>this.options.onDrop(r,o,i)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=Xh(e,this.options.autofocus);this.editorState=Gn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=uC(cC,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=op(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(o=>{const i=typeof o=="string"?`${o}$`:o.key;n=n.filter(s=>!s.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[vp,pp.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),mp,Cp,xp,Sp,yp,wp,gp].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Xi(r,this)}createCommandManager(){this.commandManager=new qi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Dl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Dl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new qh(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),o=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=s?.getMeta("focus"),a=s?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return cp(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return Rb(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ba(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
100
+
101
+ `,textSerializers:n={}}=t||{};return Sb(this.state.doc,{blockSeparator:e,textSerializers:{...ap(this.schema),...n}})}get isEmpty(){return Yi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new aC(e,this)}get $doc(){return this.$pos(0)}};function Rn(t){return new Xr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=X(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=e,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(Fa(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+a,c);const f=n.from+a+s.length;i.addMark(n.from+a,f,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function fC(t){return new Xr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=X(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from;let l=n.to;const a=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,s+r[0].length-1),i.replaceWith(u,l,a)}else if(r[0]){const c=t.type.isInline?s:s-1;i.insert(c,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function jl(t){return new Xr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),i=X(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function he(t){return new Xr({find:t.find,handler:({state:e,range:n,match:r})=>{let o=t.replace,i=n.from;const s=n.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;const a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)},undoable:t.undoable})}function or(t){return new Xr({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const i=X(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),c=a&&ga(a,t.type,i);if(!c)return null;if(s.wrap(a,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(v=>h.includes(v.type.name));s.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&un(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)},undoable:t.undoable})}function hC(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof B){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let o=r.depth;for(;o>=0;){const i=r.index(o);if(r.node(o).contentMatchAt(i).matchType(e))return!0;o-=1}return!1}var pC={};Ia(pC,{createAtomBlockMarkdownSpec:()=>mC,createBlockMarkdownSpec:()=>gC,createInlineMarkdownSpec:()=>bC,parseAttributes:()=>Va,parseIndentedBlocks:()=>Bl,renderNestedMarkdownContent:()=>Ua,serializeAttributes:()=>za});function Va(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const c=o.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[c]=h.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function za(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function mC(t){const{nodeName:e,name:n,parseAttributes:r=Va,serializeAttributes:o=za,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=t,a=n||e,c=u=>{if(!l)return u;const d={};return l.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...i,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const m=p[1]||"",v=r(m);if(!s.find(C=>!(C in v)))return{type:e,raw:p[0],attributes:v}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function gC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=Va,serializeAttributes:i=za,defaultAttributes:s={},content:l="block",allowedAttributes:a}=t,c=n||e,u=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...s,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=d.match(m);if(!v)return;const[b,C=""]=v,x=o(C);let w=1;const E=b.length;let k="";const S=/^:::([\w-]*)(\s.*)?/gm,M=d.slice(E);for(S.lastIndex=0;;){const N=S.exec(M);if(N===null)break;const P=N.index,W=N[1];if(!((p=N[2])!=null&&p.endsWith(":::"))){if(W)w+=1;else if(w-=1,w===0){const z=M.slice(0,P);k=z.trim();const H=d.slice(0,E+P+N[0].length);let I=[];if(k)if(l==="block")for(I=h.blockTokens(z),I.forEach(_=>{_.text&&(!_.tokens||_.tokens.length===0)&&(_.tokens=h.inlineTokens(_.text))});I.length>0;){const _=I[I.length-1];if(_.type==="paragraph"&&(!_.text||_.text.trim()===""))I.pop();else break}else I=h.inlineTokens(k);return{type:e,raw:H,attributes:x,content:k,tokens:I}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=i(h),m=p?` {${p}}`:"",v=f.renderChildren(d.content||[],`
102
+
103
+ `);return`:::${c}${m}
104
+
105
+ ${v}
106
+
107
+ :::`}}}function yC(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,o,i,s]=r;e[o]=i||s,r=n.exec(t)}return e}function vC(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function bC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=yC,serializeAttributes:i=vC,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=t,c=n||e,u=f=>{if(!a)return f;const h={};return a.forEach(p=>{p in f&&(h[p]=f[p])}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...s,...f.attributes};if(l)return h.createNode(e,p);const m=r?r(f):f.content||"";return m?h.createNode(e,p,[h.createTextNode(m)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),m=p?.index;return m!==void 0?m:-1},tokenize(f,h,p){const m=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),v=f.match(m);if(!v)return;let b="",C="";if(l){const[,w]=v;C=w}else{const[,w,E]=v;C=w,b=E||""}const x=o(C.trim());return{type:e,raw:v[0],content:b.trim(),attributes:x}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const p=u(f.attrs||{}),m=i(p),v=m?` ${m}`:"";return l?`[${c}${v}]`:`[${c}${v}]${h}[/${c}]`}}}function Bl(t,e,n){var r,o,i,s;const l=t.split(`
108
+ `),a=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<l.length;){const f=l[u],h=f.match(e.itemPattern);if(!h){if(a.length>0)break;if(f.trim()===""){u+=1;continue}else return}const p=e.extractItemData(h),{indentLevel:m,mainContent:v}=p;c=`${c}${f}
109
+ `;const b=[v];for(u+=1;u<l.length;){const E=l[u];if(E.trim()===""){const S=l.slice(u+1).findIndex(P=>P.trim()!=="");if(S===-1)break;if((((o=(r=l[u+1+S].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>m){b.push(E),c=`${c}${E}
110
+ `,u+=1;continue}else break}if((((s=(i=E.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>m)b.push(E),c=`${c}${E}
111
+ `,u+=1;else break}let C;const x=b.slice(1);if(x.length>0){const E=x.map(k=>k.slice(m+d)).join(`
112
+ `);E.trim()&&(e.customNestedParser?C=e.customNestedParser(E):C=n.blockTokens(E))}const w=e.createToken(p,C);a.push(w)}if(a.length!==0)return{items:a,raw:c.trim()}}function Ua(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const o=typeof n=="function"?n(r):n,[i,...s]=t.content,l=e.renderChildren([i]),a=[`${o}${l}`];return s&&s.length>0&&s.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
113
+ `).map(f=>f?e.indent(f):"").join(`
114
+ `);a.push(d)}}),a.join(`
115
+ `)}function CC(t,e,n={}){const{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((l,a)=>{const c=i.mapping.map(a),u=i.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==s)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}var Pe=class kp extends $a{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new kp(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},xC=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,o,i,s,l;const{view:a}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,f=0;if(this.dom!==u){const C=this.dom.getBoundingClientRect(),x=u.getBoundingClientRect(),w=(o=t.offsetX)!=null?o:(r=t.nativeEvent)==null?void 0:r.offsetX,E=(s=t.offsetY)!=null?s:(i=t.nativeEvent)==null?void 0:i.offsetY;d=x.x-C.x+w,f=x.y-C.y+E}const h=this.dom.cloneNode(!0);try{const C=this.dom.getBoundingClientRect();h.style.width=`${Math.round(C.width)}px`,h.style.height=`${Math.round(C.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(h),document.body.appendChild(p),(l=t.dataTransfer)==null||l.setDragImage(h,d,f)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const m=this.getPos();if(typeof m!="number")return;const v=B.create(a.state.doc,m),b=a.state.tr.setSelection(v);a.dispatch(b)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const o=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!o)return!0;const{isEditable:l}=this.editor,{isDragging:a}=this,c=!!this.node.type.spec.draggable,u=B.isSelectable(this.node),d=t.type==="copy",f=t.type==="paste",h=t.type==="cut",p=t.type==="mousedown";if(!c&&u&&o&&t.target===this.dom&&t.preventDefault(),c&&o&&!a&&t.target===this.dom)return t.preventDefault(),!1;if(c&&l&&!a&&p){const m=n.closest("[data-drag-handle]");m&&(this.dom===m||this.dom.contains(m))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||i||d||f||h||p&&u)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(Gi()||Qh())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function ln(t){return new nC({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const i=X(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;const{tr:s}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(Fa(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(v=>v===t.type&&v!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+l.length,s.addMark(n.from+u,c,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}var Fs,ad;function wC(){return ad||(ad=1,Fs=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;for(o of e.entries())if(!t(o[1],n.get(o[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(e[o]!==n[o])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}),Fs}var SC=wC();const kC=Cf(SC);var vo={exports:{}},$s={};/**
116
+ * @license React
117
+ * use-sync-external-store-shim/with-selector.production.js
118
+ *
119
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
120
+ *
121
+ * This source code is licensed under the MIT license found in the
122
+ * LICENSE file in the root directory of this source tree.
123
+ */var cd;function EC(){if(cd)return $s;cd=1;var t=j,e=ha();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,i=t.useRef,s=t.useEffect,l=t.useMemo,a=t.useDebugValue;return $s.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function b(k){if(!C){if(C=!0,x=k,k=f(k),h!==void 0&&m.hasValue){var S=m.value;if(h(S,k))return w=S}return w=k}if(S=w,r(x,k))return S;var M=f(k);return h!==void 0&&h(S,M)?(x=k,S):(x=k,w=M)}var C=!1,x,w,E=d===void 0?null:d;return[function(){return b(u())},E===null?void 0:function(){return b(E())}]},[u,d,f,h]);var v=o(c,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=v},[v]),a(v),v},$s}var Vs={};/**
124
+ * @license React
125
+ * use-sync-external-store-shim/with-selector.development.js
126
+ *
127
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
128
+ *
129
+ * This source code is licensed under the MIT license found in the
130
+ * LICENSE file in the root directory of this source tree.
131
+ */var ud;function MC(){return ud||(ud=1,process.env.NODE_ENV!=="production"&&(function(){function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=j,n=ha(),r=typeof Object.is=="function"?Object.is:t,o=n.useSyncExternalStore,i=e.useRef,s=e.useEffect,l=e.useMemo,a=e.useDebugValue;Vs.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function b(k){if(!C){if(C=!0,x=k,k=f(k),h!==void 0&&m.hasValue){var S=m.value;if(h(S,k))return w=S}return w=k}if(S=w,r(x,k))return S;var M=f(k);return h!==void 0&&h(S,M)?(x=k,S):(x=k,w=M)}var C=!1,x,w,E=d===void 0?null:d;return[function(){return b(u())},E===null?void 0:function(){return b(E())}]},[u,d,f,h]);var v=o(c,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=v},[v]),a(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Vs}var dd;function TC(){return dd||(dd=1,process.env.NODE_ENV==="production"?vo.exports=EC():vo.exports=MC()),vo.exports}var AC=TC(),RC=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},OC=({contentComponent:t})=>{const e=xf.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return g.jsx(g.Fragment,{children:Object.values(e)})};function NC(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:_i.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}var IC=class extends j.Component{constructor(t){var e;super(t),this.editorContentRef=j.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(t.view.dom),t.setOptions({element:e}),t.contentComponent=NC(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.firstChild))return;const n=document.createElement("div");n.append(e.view.dom),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return g.jsxs(g.Fragment,{children:[g.jsx("div",{ref:RC(e,this.editorContentRef),...n}),t?.contentComponent&&g.jsx(OC,{contentComponent:t.contentComponent})]})}},LC=j.forwardRef((t,e)=>{const n=j.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return j.createElement(IC,{key:n,innerRef:e,...t})}),DC=j.memo(LC),PC=typeof window<"u"?j.useLayoutEffect:j.useEffect,jC=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function Ep(t){var e;const[n]=j.useState(()=>new jC(t.editor)),r=AC.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:kC);return PC(()=>n.watch(t.editor),[t.editor,n]),j.useDebugValue(r),r}var fd=process.env.NODE_ENV!=="production",_l=typeof window>"u",BC=_l||!!(typeof window<"u"&&window.next),_C=class Mp{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(_l||BC){if(fd)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&_l&&fd)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var o,i;return(i=(o=this.options.current).onBeforeCreate)==null?void 0:i.call(o,...r)},onBlur:(...r)=>{var o,i;return(i=(o=this.options.current).onBlur)==null?void 0:i.call(o,...r)},onCreate:(...r)=>{var o,i;return(i=(o=this.options.current).onCreate)==null?void 0:i.call(o,...r)},onDestroy:(...r)=>{var o,i;return(i=(o=this.options.current).onDestroy)==null?void 0:i.call(o,...r)},onFocus:(...r)=>{var o,i;return(i=(o=this.options.current).onFocus)==null?void 0:i.call(o,...r)},onSelectionUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onSelectionUpdate)==null?void 0:i.call(o,...r)},onTransaction:(...r)=>{var o,i;return(i=(o=this.options.current).onTransaction)==null?void 0:i.call(o,...r)},onUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onUpdate)==null?void 0:i.call(o,...r)},onContentError:(...r)=>{var o,i;return(i=(o=this.options.current).onContentError)==null?void 0:i.call(o,...r)},onDrop:(...r)=>{var o,i;return(i=(o=this.options.current).onDrop)==null?void 0:i.call(o,...r)},onPaste:(...r)=>{var o,i;return(i=(o=this.options.current).onPaste)==null?void 0:i.call(o,...r)},onDelete:(...r)=>{var o,i;return(i=(o=this.options.current).onDelete)==null?void 0:i.call(o,...r)}};return new dC(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((o,i)=>{var s;return o===((s=n.extensions)==null?void 0:s[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Mp.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,o)=>r===e[o]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function HC(t={},e=[]){const n=j.useRef(t);n.current=t;const[r]=j.useState(()=>new _C(n)),o=xf.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return j.useDebugValue(o),j.useEffect(r.onRender(e)),Ep({editor:o,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),o}var Wa=j.createContext({editor:null});Wa.Consumer;var FC=()=>j.useContext(Wa),Tp=j.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),$C=()=>j.useContext(Tp),Ap=j.forwardRef((t,e)=>{const{onDragStart:n}=$C(),r=t.as||"div";return g.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function hd(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function pd(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function VC(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function zC(t){if(hd(t)||pd(t))return!0;if(VC(t)){const e=t.type;if(e)return hd(e)||pd(e)}return!1}function UC(){try{if(j.version)return parseInt(j.version.split(".")[0],10)>=19}catch{}return!1}var WC=class{constructor(t,{editor:e,props:n={},as:r="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?_i.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var t;const e=this.component,n=this.props,r=this.editor,o=UC(),i=zC(e),s={...n};s.ref&&!(o||i)&&delete s.ref,!s.ref&&(o||i)&&(s.ref=l=>{this.ref=l}),this.reactElement=g.jsx(e,{...s}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};j.createContext({markViewContentRef:()=>{}});var KC=class extends xC{constructor(t,e,n){if(super(t,e,n),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode(),ref:j.createRef()};if(!this.component.displayName){const a=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=a(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:a=>{a&&this.contentDOMElement&&a.firstChild!==this.contentDOMElement&&(a.hasAttribute("data-node-view-wrapper")&&a.removeAttribute("data-node-view-wrapper"),a.appendChild(this.contentDOMElement))}},o=this.component,i=j.memo(a=>g.jsx(Tp.Provider,{value:r,children:j.createElement(o,a)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new WC(i,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=Hr(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function Rp(t,e){return n=>n.editor.contentComponent?new KC(t,n,e):{}}var ei=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},qC=/^\s*>\s$/,GC=Pe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return ei("blockquote",{...re(this.options.HTMLAttributes,t),children:ei("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=[];return t.content.forEach(o=>{const s=e.renderChildren(o).split(`
132
+ `).map(l=>`> ${l}`).join(`
133
+ `);n.push(s)}),n.flatMap(o=>[o,"> "]).slice(0,-1).join(`
134
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[or({find:qC,type:this.type})]}}),JC=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ZC=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,YC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,XC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,QC=ht.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return ei("strong",{...re(this.options.HTMLAttributes,t),children:ei("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Rn({find:JC,type:this.type}),Rn({find:YC,type:this.type})]},addPasteRules(){return[ln({find:ZC,type:this.type}),ln({find:XC,type:this.type})]}}),ex=/(^|[^`])`([^`]+)`(?!`)$/,tx=/(^|[^`])`([^`]+)`(?!`)/g,nx=ht.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Rn({find:ex,type:this.type})]},addPasteRules(){return[ln({find:tx,type:this.type})]}}),zs=4,rx=/^```([a-z]+)?[\s\n]$/,ox=/^~~~([a-z]+)?[\s\n]$/,ix=Pe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:zs,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",re(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const o=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
135
+ `):r=`\`\`\`${o}
136
+
137
+ \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:zs,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;const l=" ".repeat(n);return s?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:c,to:u}=o,h=r.doc.textBetween(c,u,`
138
+ `,`
139
+ `).split(`
140
+ `).map(p=>l+p).join(`
141
+ `);return a.replaceWith(c,u,r.schema.text(h)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:zs,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type!==this.type?!1:s?t.commands.command(({tr:l})=>{var a;const{pos:c}=i,u=i.start(),d=i.end(),h=r.doc.textBetween(u,d,`
142
+ `,`
143
+ `).split(`
144
+ `);let p=0,m=0;const v=c-u;for(let k=0;k<h.length;k+=1){if(m+h[k].length>=v){p=k;break}m+=h[k].length+1}const C=((a=h[p].match(/^ */))==null?void 0:a[0])||"",x=Math.min(C.length,n);if(x===0)return!0;let w=u;for(let k=0;k<p;k+=1)w+=h[k].length+1;return l.delete(w,w+x),c-w<=x&&l.setSelection(V.create(l.doc,w)),!0}):t.commands.command(({tr:l})=>{const{from:a,to:c}=o,f=r.doc.textBetween(a,c,`
145
+ `,`
146
+ `).split(`
147
+ `).map(h=>{var p;const m=((p=h.match(/^ */))==null?void 0:p[0])||"",v=Math.min(m.length,n);return h.slice(v)}).join(`
148
+ `);return l.replaceWith(a,c,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
149
+
150
+ `);return!i||!s?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const l=o.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:c})=>(c.setSelection(q.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[jl({find:rx,type:this.type,getAttributes:t=>({language:t[1]})}),jl({find:ox,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ae({key:new ye("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o?.mode;if(!n||!i)return!1;const{tr:s,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
151
+ `));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(V.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),sx=Pe.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
152
+
153
+ `):""}),lx=Pe.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",re(this.options.HTMLAttributes,t)]},renderText(){return`
154
+ `},renderMarkdown:(t,e)=>e.indent(`
155
+ `),parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ax=Pe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,re(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,o="#".repeat(r);return t.content?`${o} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>jl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),Op=Pe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",re(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!hC(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return up(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:i,tr:s,dispatch:l})=>{if(l){const{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(V.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(B.create(s.doc,a.pos)):s.setSelection(V.create(s.doc,a.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(s.insert(c,d),s.setSelection(V.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[fC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),cx=Op,ux=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,dx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,fx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,hx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,px=ht.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Rn({find:ux,type:this.type}),Rn({find:fx,type:this.type})]},addPasteRules(){return[ln({find:dx,type:this.type}),ln({find:hx,type:this.type})]}});const mx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",gx="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Hl="numeric",Fl="ascii",$l="alpha",kr="asciinumeric",vr="alphanumeric",Vl="domain",Np="emoji",yx="scheme",vx="slashscheme",Us="whitespace";function bx(t,e){return t in e||(e[t]=[]),e[t]}function bn(t,e,n){e[Hl]&&(e[kr]=!0,e[vr]=!0),e[Fl]&&(e[kr]=!0,e[$l]=!0),e[kr]&&(e[vr]=!0),e[$l]&&(e[vr]=!0),e[vr]&&(e[Vl]=!0),e[Np]&&(e[Vl]=!0);for(const r in e){const o=bx(r,n);o.indexOf(t)<0&&o.push(t)}}function Cx(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Be(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Be.groups={};Be.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||Be.groups;let o;return e&&e.j?o=e:(o=new Be(e),n&&r&&bn(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const i=t.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(t[s]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Be.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const i=e;let s,l=o.go(t);if(l?(s=new Be,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Be,i){if(r)if(s.t&&typeof s.t=="string"){const a=Object.assign(Cx(s.t,r),n);bn(i,a,r)}else n&&bn(i,n,r);s.t=i}return o.j[t]=s,s}};const G=(t,e,n,r,o)=>t.ta(e,n,r,o),ue=(t,e,n,r,o)=>t.tr(e,n,r,o),md=(t,e,n,r,o)=>t.ts(e,n,r,o),O=(t,e,n,r,o)=>t.tt(e,n,r,o),wt="WORD",zl="UWORD",Ip="ASCIINUMERICAL",Lp="ALPHANUMERICAL",Fr="LOCALHOST",Ul="TLD",Wl="UTLD",Po="SCHEME",Kn="SLASH_SCHEME",Ka="NUM",Kl="WS",qa="NL",Er="OPENBRACE",Mr="CLOSEBRACE",ti="OPENBRACKET",ni="CLOSEBRACKET",ri="OPENPAREN",oi="CLOSEPAREN",ii="OPENANGLEBRACKET",si="CLOSEANGLEBRACKET",li="FULLWIDTHLEFTPAREN",ai="FULLWIDTHRIGHTPAREN",ci="LEFTCORNERBRACKET",ui="RIGHTCORNERBRACKET",di="LEFTWHITECORNERBRACKET",fi="RIGHTWHITECORNERBRACKET",hi="FULLWIDTHLESSTHAN",pi="FULLWIDTHGREATERTHAN",mi="AMPERSAND",gi="APOSTROPHE",yi="ASTERISK",Ut="AT",vi="BACKSLASH",bi="BACKTICK",Ci="CARET",qt="COLON",Ga="COMMA",xi="DOLLAR",ot="DOT",wi="EQUALS",Ja="EXCLAMATION",Ge="HYPHEN",Tr="PERCENT",Si="PIPE",ki="PLUS",Ei="POUND",Ar="QUERY",Za="QUOTE",Dp="FULLWIDTHMIDDLEDOT",Ya="SEMI",it="SLASH",Rr="TILDE",Mi="UNDERSCORE",Pp="EMOJI",Ti="SYM";var jp=Object.freeze({__proto__:null,ALPHANUMERICAL:Lp,AMPERSAND:mi,APOSTROPHE:gi,ASCIINUMERICAL:Ip,ASTERISK:yi,AT:Ut,BACKSLASH:vi,BACKTICK:bi,CARET:Ci,CLOSEANGLEBRACKET:si,CLOSEBRACE:Mr,CLOSEBRACKET:ni,CLOSEPAREN:oi,COLON:qt,COMMA:Ga,DOLLAR:xi,DOT:ot,EMOJI:Pp,EQUALS:wi,EXCLAMATION:Ja,FULLWIDTHGREATERTHAN:pi,FULLWIDTHLEFTPAREN:li,FULLWIDTHLESSTHAN:hi,FULLWIDTHMIDDLEDOT:Dp,FULLWIDTHRIGHTPAREN:ai,HYPHEN:Ge,LEFTCORNERBRACKET:ci,LEFTWHITECORNERBRACKET:di,LOCALHOST:Fr,NL:qa,NUM:Ka,OPENANGLEBRACKET:ii,OPENBRACE:Er,OPENBRACKET:ti,OPENPAREN:ri,PERCENT:Tr,PIPE:Si,PLUS:ki,POUND:Ei,QUERY:Ar,QUOTE:Za,RIGHTCORNERBRACKET:ui,RIGHTWHITECORNERBRACKET:fi,SCHEME:Po,SEMI:Ya,SLASH:it,SLASH_SCHEME:Kn,SYM:Ti,TILDE:Rr,TLD:Ul,UNDERSCORE:Mi,UTLD:Wl,UWORD:zl,WORD:wt,WS:Kl});const Ct=/[a-z]/,pr=new RegExp("\\p{L}","u"),Ws=new RegExp("\\p{Emoji}","u"),xt=/\d/,Ks=/\s/,gd="\r",qs=`
156
+ `,xx="️",wx="‍",Gs="";let bo=null,Co=null;function Sx(t=[]){const e={};Be.groups=e;const n=new Be;bo==null&&(bo=yd(mx)),Co==null&&(Co=yd(gx)),O(n,"'",gi),O(n,"{",Er),O(n,"}",Mr),O(n,"[",ti),O(n,"]",ni),O(n,"(",ri),O(n,")",oi),O(n,"<",ii),O(n,">",si),O(n,"(",li),O(n,")",ai),O(n,"「",ci),O(n,"」",ui),O(n,"『",di),O(n,"』",fi),O(n,"<",hi),O(n,">",pi),O(n,"&",mi),O(n,"*",yi),O(n,"@",Ut),O(n,"`",bi),O(n,"^",Ci),O(n,":",qt),O(n,",",Ga),O(n,"$",xi),O(n,".",ot),O(n,"=",wi),O(n,"!",Ja),O(n,"-",Ge),O(n,"%",Tr),O(n,"|",Si),O(n,"+",ki),O(n,"#",Ei),O(n,"?",Ar),O(n,'"',Za),O(n,"/",it),O(n,";",Ya),O(n,"~",Rr),O(n,"_",Mi),O(n,"\\",vi),O(n,"・",Dp);const r=ue(n,xt,Ka,{[Hl]:!0});ue(r,xt,r);const o=ue(r,Ct,Ip,{[kr]:!0}),i=ue(r,pr,Lp,{[vr]:!0}),s=ue(n,Ct,wt,{[Fl]:!0});ue(s,xt,o),ue(s,Ct,s),ue(o,xt,o),ue(o,Ct,o);const l=ue(n,pr,zl,{[$l]:!0});ue(l,Ct),ue(l,xt,i),ue(l,pr,l),ue(i,xt,i),ue(i,Ct),ue(i,pr,i);const a=O(n,qs,qa,{[Us]:!0}),c=O(n,gd,Kl,{[Us]:!0}),u=ue(n,Ks,Kl,{[Us]:!0});O(n,Gs,u),O(c,qs,a),O(c,Gs,u),ue(c,Ks,u),O(u,gd),O(u,qs),ue(u,Ks,u),O(u,Gs,u);const d=ue(n,Ws,Pp,{[Np]:!0});O(d,"#"),ue(d,Ws,d),O(d,xx,d);const f=O(d,wx);O(f,"#"),ue(f,Ws,d);const h=[[Ct,s],[xt,o]],p=[[Ct,null],[pr,l],[xt,i]];for(let m=0;m<bo.length;m++)Ht(n,bo[m],Ul,wt,h);for(let m=0;m<Co.length;m++)Ht(n,Co[m],Wl,zl,p);bn(Ul,{tld:!0,ascii:!0},e),bn(Wl,{utld:!0,alpha:!0},e),Ht(n,"file",Po,wt,h),Ht(n,"mailto",Po,wt,h),Ht(n,"http",Kn,wt,h),Ht(n,"https",Kn,wt,h),Ht(n,"ftp",Kn,wt,h),Ht(n,"ftps",Kn,wt,h),bn(Po,{scheme:!0,ascii:!0},e),bn(Kn,{slashscheme:!0,ascii:!0},e),t=t.sort((m,v)=>m[0]>v[0]?1:-1);for(let m=0;m<t.length;m++){const v=t[m][0],C=t[m][1]?{[yx]:!0}:{[vx]:!0};v.indexOf("-")>=0?C[Vl]=!0:Ct.test(v)?xt.test(v)?C[kr]=!0:C[Fl]=!0:C[Hl]=!0,md(n,v,v,C)}return md(n,"localhost",Fr,{ascii:!0}),n.jd=new Be(Ti),{start:n,tokens:Object.assign({groups:e},jp)}}function Bp(t,e){const n=kx(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function kx(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Ht(t,e,n,r,o){let i;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];t.j[a]?i=t.j[a]:(i=new Be(r),i.jr=o.slice(),t.j[a]=i),t=i}return i=new Be(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function yd(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const $r={defaultProtocol:"http",events:null,format:vd,formatHref:vd,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Xa(t,e=null){let n=Object.assign({},$r);t&&(n=Object.assign(n,t instanceof Xa?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}Xa.prototype={o:$r,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:$r[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function vd(t){return t}function _p(t,e){this.t="token",this.v=t,this.tk=e}_p.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=$r.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function Qi(t,e){class n extends _p{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const bd=Qi("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Cd=Qi("text"),Ex=Qi("nl"),xo=Qi("url",{isLink:!0,toHref(t=$r.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Fr&&t[1].t===qt}}),Ke=t=>new Be(t);function Mx({groups:t}){const e=t.domain.concat([mi,yi,Ut,vi,bi,Ci,xi,wi,Ge,Ka,Tr,Si,ki,Ei,it,Ti,Rr,Mi]),n=[gi,qt,Ga,ot,Ja,Tr,Ar,Za,Ya,ii,si,Er,Mr,ni,ti,ri,oi,li,ai,ci,ui,di,fi,hi,pi],r=[mi,gi,yi,vi,bi,Ci,xi,wi,Ge,Er,Mr,Tr,Si,ki,Ei,Ar,it,Ti,Rr,Mi],o=Ke(),i=O(o,Rr);G(i,r,i),G(i,t.domain,i);const s=Ke(),l=Ke(),a=Ke();G(o,t.domain,s),G(o,t.scheme,l),G(o,t.slashscheme,a),G(s,r,i),G(s,t.domain,s);const c=O(s,Ut);O(i,Ut,c),O(l,Ut,c),O(a,Ut,c);const u=O(i,ot);G(u,r,i),G(u,t.domain,i);const d=Ke();G(c,t.domain,d),G(d,t.domain,d);const f=O(d,ot);G(f,t.domain,d);const h=Ke(bd);G(f,t.tld,h),G(f,t.utld,h),O(c,Fr,h);const p=O(d,Ge);O(p,Ge,p),G(p,t.domain,d),G(h,t.domain,d),O(h,ot,f),O(h,Ge,p);const m=O(h,qt);G(m,t.numeric,bd);const v=O(s,Ge),b=O(s,ot);O(v,Ge,v),G(v,t.domain,s),G(b,r,i),G(b,t.domain,s);const C=Ke(xo);G(b,t.tld,C),G(b,t.utld,C),G(C,t.domain,s),G(C,r,i),O(C,ot,b),O(C,Ge,v),O(C,Ut,c);const x=O(C,qt),w=Ke(xo);G(x,t.numeric,w);const E=Ke(xo),k=Ke();G(E,e,E),G(E,n,k),G(k,e,E),G(k,n,k),O(C,it,E),O(w,it,E);const S=O(l,qt),M=O(a,qt),N=O(M,it),P=O(N,it);G(l,t.domain,s),O(l,ot,b),O(l,Ge,v),G(a,t.domain,s),O(a,ot,b),O(a,Ge,v),G(S,t.domain,E),O(S,it,E),O(S,Ar,E),G(P,t.domain,E),G(P,e,E),O(P,it,E);const W=[[Er,Mr],[ti,ni],[ri,oi],[ii,si],[li,ai],[ci,ui],[di,fi],[hi,pi]];for(let z=0;z<W.length;z++){const[H,I]=W[z],_=O(E,H);O(k,H,_),O(_,I,E);const F=Ke(xo);G(_,e,F);const L=Ke();G(_,n),G(F,e,F),G(F,n,L),G(L,e,F),G(L,n,L),O(F,I,E),O(L,I,E)}return O(o,Fr,C),O(o,qa,Ex),{start:o,tokens:jp}}function Tx(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(a=l.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=a||l.go(n[o].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(Js(Cd,e,s)),s=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);i.push(Js(h,e,p))}}return s.length>0&&i.push(Js(Cd,e,s)),i}function Js(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const Ax=typeof console<"u"&&console&&console.warn||(()=>{}),Rx="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ie={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Ox(){return Be.groups={},ie.scanner=null,ie.parser=null,ie.tokenQueue=[],ie.pluginQueue=[],ie.customSchemes=[],ie.initialized=!1,ie}function xd(t,e=!1){if(ie.initialized&&Ax(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Rx}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
157
+ 1. Must only contain digits, lowercase ASCII letters or "-"
158
+ 2. Cannot start or end with "-"
159
+ 3. "-" cannot repeat`);ie.customSchemes.push([t,e])}function Nx(){ie.scanner=Sx(ie.customSchemes);for(let t=0;t<ie.tokenQueue.length;t++)ie.tokenQueue[t][1]({scanner:ie.scanner});ie.parser=Mx(ie.scanner.tokens);for(let t=0;t<ie.pluginQueue.length;t++)ie.pluginQueue[t][1]({scanner:ie.scanner,parser:ie.parser});return ie.initialized=!0,ie}function Qa(t){return ie.initialized||Nx(),Tx(ie.parser.start,t,Bp(ie.scanner.start,t))}Qa.scan=Bp;function Hp(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Xa(n),o=Qa(t),i=[];for(let s=0;s<o.length;s++){const l=o[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var ec="[\0-   ᠎ -\u2029  ]",Ix=new RegExp(ec),Lx=new RegExp(`${ec}$`),Dx=new RegExp(ec,"g");function Px(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function jx(t){return new ae({key:new ye("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,l=Pa(n.doc,[...e]);if(Ha(l).forEach(({newRange:c})=>{const u=rp(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!Lx.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(Ix).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const v=Qa(p).map(b=>b.toObject(t.defaultProtocol));if(!Px(v))return!1;v.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Fa(b.from,b.to,r.doc).some(C=>C.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function Bx(t){return new ae({key:new ye("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;s=d.find(f=>f.nodeName==="A")}if(!s)return!1;const l=cp(e.state,t.type.name),a=(o=s?.href)!=null?o:l.href,c=(i=s?.target)!=null?i:l.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),s&&a?(window.open(a,c),!0):!1}}})}function _x(t){return new ae({key:new ye("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:o}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=Hp(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||o!==void 0&&!o(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function pn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Dx,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Hx=ht.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){xd(t);return}xd(t.scheme,t.optionalSlashes)})},onDestroy(){Ox()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!pn(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!pn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!pn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",re(this.options.HTMLAttributes,t),0]:["a",re(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!pn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!pn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ln({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=Hp(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!pn(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(jx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!pn(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Bx({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(_x({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Fx=Object.defineProperty,$x=(t,e)=>{for(var n in e)Fx(t,n,{get:e[n],enumerable:!0})},Vx="listItem",wd="textStyle",Sd=/^\s*([-+*])\s$/,Fp=Pe.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
160
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Vx,this.editor.getAttributes(wd)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=or({find:Sd,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=or({find:Sd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(wd),editor:this.editor})),[t]}}),$p=Pe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(o=>o.type==="paragraph"))n=e.parseChildren(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const s=t.tokens.slice(1),l=e.parseChildren(s);n.push(...l)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>Ua(t,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),zx={};$x(zx,{findListItemPos:()=>Qr,getNextListDepth:()=>tc,handleBackspace:()=>ql,handleDelete:()=>Gl,hasListBefore:()=>Vp,hasListItemAfter:()=>Ux,hasListItemBefore:()=>zp,listItemHasSubList:()=>Up,nextListIsDeeper:()=>Wp,nextListIsHigher:()=>Kp});var Qr=(t,e)=>{const{$from:n}=e.selection,r=me(t,e.schema);let o=null,i=n.depth,s=n.pos,l=null;for(;i>0&&l===null;)o=n.node(i),o.type===r?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},tc=(t,e)=>{const n=Qr(t,e);if(!n)return!1;const[,r]=Tb(e,t,n.$pos.pos+4);return r},Vp=(t,e,n)=>{const{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),i=t.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},zp=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==t)},Up=(t,e,n)=>{if(!n)return!1;const r=me(t,e.schema);let o=!1;return n.descendants(i=>{i.type===r&&(o=!0)}),o},ql=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!sn(t.state,e)&&Vp(t.state,e,n)){const{$anchor:l}=t.state.selection,a=t.state.doc.resolve(l.before()-1),c=[];a.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(a.start()+u.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},d.end()).joinForward().run()}if(!sn(t.state,e)||!Nb(t.state))return!1;const r=Qr(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=Up(e,t.state,i);return zp(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},Wp=(t,e)=>{const n=tc(t,e),r=Qr(t,e);return!r||!n?!1:n>r.depth},Kp=(t,e)=>{const n=tc(t,e),r=Qr(t,e);return!r||!n?!1:n<r.depth},Gl=(t,e)=>{if(!sn(t.state,e)||!Ob(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:Wp(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Kp(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Ux=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==t)},qp=ce.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Gl(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Gl(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&ql(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&ql(t,n,r)&&(e=!0)}),e}}}}),kd=/^(\s*)(\d+)\.\s+(.*)$/,Wx=/^\s/;function Kx(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],i=o.match(kd);if(!i)break;const[,s,l,a]=i,c=s.length;let u=a,d=n+1;const f=[o];for(;d<t.length;){const h=t[d];if(h.match(kd))break;if(h.trim()==="")f.push(h),u+=`
161
+ `,d+=1;else if(h.match(Wx))f.push(h),u+=`
162
+ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:u.trim(),raw:f.join(`
163
+ `)}),r=d,n=d}return[e,r]}function Gp(t,e,n){var r;const o=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const l=s.content.split(`
164
+ `),a=((r=l[0])==null?void 0:r.trim())||"",c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const u=l.slice(1).join(`
165
+ `).trim();if(u){const h=n.blockTokens(u);c.push(...h)}let d=i+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(m=>m.indent)),p=Gp(f,h,n);c.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(m=>m.raw).join(`
166
+ `)})}o.push({type:"list_item",raw:s.raw,tokens:c}),i=d}else i+=1}return o}function qx(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){const i=e.parseChildren([o]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([o]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var Gx="listItem",Ed="textStyle",Md=/^(\d+)\.\s$/,Jp=Pe.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",re(this.options.HTMLAttributes,n),0]:["ol",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?qx(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
167
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const o=t.split(`
168
+ `),[i,s]=Kx(o);if(i.length===0)return;const l=Gp(i,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:l,raw:o.slice(0,s).join(`
169
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Gx,this.editor.getAttributes(Ed)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=or({find:Md,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=or({find:Md,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ed)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Jx=/^\s*(\[([( |x])?\])\s$/,Zp=Pe.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",re(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const o=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Ua(t,e,o)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=u=>{var d,f;l.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:d}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=n();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p?.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{o.setAttribute(u,d)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),o.append(i,a),Object.entries(e).forEach(([u,d])=>{o.setAttribute(u,d)}),{dom:o,contentDOM:a,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[or({find:Jx,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Yp=Pe.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",re(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
170
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const s=Bl(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},o=Bl(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ce.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Fp.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push($p.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(qp.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Jp.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Zp.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Yp.configure(this.options.taskList)),t}});var Zx=Pe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",re(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Yx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Xx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Qx=ht.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Rn({find:Yx,type:this.type})]},addPasteRules(){return[ln({find:Xx,type:this.type})]}}),ew=Pe.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),tw=ht.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",re(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const i=o[2].trim();return{type:"underline",raw:o[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function nw(t={}){return new ae({view(e){return new rw(e,t)}})}class rw{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*l;r={left:p.left,right:p.right,top:m-v,bottom:m+v}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Gf(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class de extends q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return de.valid(r)?new de(r):q.near(r)}content(){return D.empty}eq(e){return e instanceof de&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new de(e.resolve(n.pos))}getBookmark(){return new nc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!ow(e)||!iw(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&de.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let a=e.doc.resolve(o);if(de.valid(a))return a}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!B.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let l=e.doc.resolve(o);if(de.valid(l))return l}return null}}}de.prototype.visible=!1;de.findFrom=de.findGapCursorFrom;q.jsonID("gapcursor",de);class nc{constructor(e){this.pos=e}map(e){return new nc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return de.valid(n)?new de(n):q.near(n)}}function Xp(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function ow(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||Xp(o.type))return!0;if(o.inlineContent)return!1}}return!0}function iw(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||Xp(o.type))return!0;if(o.inlineContent)return!1}}return!0}function sw(){return new ae({props:{decorations:uw,createSelectionBetween(t,e,n){return e.pos==n.pos&&de.valid(n)?new de(n):null},handleClick:aw,handleKeyDown:lw,handleDOMEvents:{beforeinput:cw}}})}const lw=Gh({ArrowLeft:wo("horiz",-1),ArrowRight:wo("horiz",1),ArrowUp:wo("vert",-1),ArrowDown:wo("vert",1)});function wo(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof V){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=de.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new de(c))),!0):!1}}function aw(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!de.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&B.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new de(r))),!0)}function cw(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof de))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=A.empty;for(let s=r.length-1;s>=0;s--)o=A.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new D(o,0,0));return i.setSelection(V.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function uw(t){if(!(t.selection instanceof de))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",le.create(t.doc,[Ne.widget(t.selection.head,e,{key:"gapcursor"})])}var Ai=200,Ce=function(){};Ce.prototype.append=function(e){return e.length?(e=Ce.from(e),!this.length&&e||e.length<Ai&&this.leafAppend(e)||this.length<Ai&&e.leafPrepend(this)||this.appendInner(e)):this};Ce.prototype.prepend=function(e){return e.length?Ce.from(e).append(this):this};Ce.prototype.appendInner=function(e){return new dw(this,e)};Ce.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ce.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ce.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ce.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ce.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};Ce.from=function(e){return e instanceof Ce?e:e&&e.length?new Qp(e):Ce.empty};var Qp=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Ai)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Ai)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ce);Ce.empty=new Qp([]);var dw=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ce);const fw=500;class tt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Ft(d.map));let h=d.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ft(p,void 0,void 0,c.length+u.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new tt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Ft(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),o||(a=f)}let c=s-r.depth;return c>pw&&(l=hw(l,c),s-=c),new tt(l.append(i),s)}remapping(e,n){let r=new Ir;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new tt(this.items.append(e.map(n=>new Ft(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),v=f.selection&&f.selection.map(i.slice(a+1,h));v&&l++,r.push(new Ft(p,m,v))}else r.push(new Ft(p))},o);let c=[];for(let f=n;f<s;f++)c.push(new Ft(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new tt(u,l);return d.emptyItemCount()>fw&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new Ft(c.invert(),a,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new tt(Ce.from(o.reverse()),i)}}tt.empty=new tt(Ce.empty,0);function hw(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let Ft=class em{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new em(n.getMap().invert(),n,this.selection)}}};class Wt{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const pw=20;function mw(t,e,n,r){let o=n.getMeta(kn),i;if(o)return o.historyState;n.getMeta(vw)&&(t=new Wt(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(kn))return s.getMeta(kn).redo?new Wt(t.done.addTransform(n,void 0,r,jo(e)),t.undone,Td(n.mapping.maps),t.prevTime,t.prevComposition):new Wt(t.done,t.undone.addTransform(n,void 0,r,jo(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!gw(n,t.prevRanges)),c=s?Zs(t.prevRanges,n.mapping):Td(n.mapping.maps);return new Wt(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,jo(e)),tt.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Wt(t.done.rebased(n,i),t.undone.rebased(n,i),Zs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Wt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Zs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function gw(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function Td(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function Zs(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function yw(t,e,n){let r=jo(e),o=kn.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),a=new Wt(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(kn,{redo:n,historyState:a})}let Ys=!1,Ad=null;function jo(t){let e=t.plugins;if(Ad!=e){Ys=!1,Ad=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ys=!0;break}}return Ys}const kn=new ye("history"),vw=new ye("closeHistory");function bw(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ae({key:kn,state:{init(){return new Wt(tt.empty,tt.empty,null,0,-1)},apply(e,n,r){return mw(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?nm:r=="historyRedo"?rm:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function tm(t,e){return(n,r)=>{let o=kn.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=yw(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const nm=tm(!1,!0),rm=tm(!0,!0);ce.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ae({key:new ye("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>o){const s=i-o,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Cw=ce.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[nw(this.options)]}});ce.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ae({key:new ye("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!n||!r)return le.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(o>=c&&o<=c+a.nodeSize-1))return!1;s+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(o>=c&&o<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ne.node(c,c+a.nodeSize,{class:this.options.className}))}),le.create(t,i)}}})]}});var xw=ce.create({name:"gapCursor",addProseMirrorPlugins(){return[sw()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=X($(t,"allowGapCursor",n)))!=null?e:null}}});ce.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ae({key:new ye("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,l)=>{const a=r>=l&&r<=l+s.nodeSize,c=!s.isLeaf&&Yi(s);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];i&&u.push(this.options.emptyEditorClass);const d=Ne.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});o.push(d)}return this.options.includeChildren}),le.create(t,o)}}})]}});var ww=ce.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ae({key:new ye("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||up(n.selection)||t.view.dragging?null:le.create(n.doc,[Ne.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Rd({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var Sw=ce.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ye(this.name),n=((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new ae({key:e,appendTransaction:(o,i,s)=>{const{doc:l,tr:a,schema:c}=s,u=e.getState(s),d=l.content.size,f=c.nodes[n];if(u)return a.insert(d,f.create())},state:{init:(o,i)=>{const s=i.tr.doc.lastChild;return!Rd({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged)return i;const s=o.doc.lastChild;return!Rd({node:s,types:r})}}})]}}),kw=ce.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>nm(t,e),redo:()=>({state:t,dispatch:e})=>rm(t,e)}},addProseMirrorPlugins(){return[bw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Ew=ce.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(QC.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(GC.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(Fp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(nx.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(ix.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(sx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(Cw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(xw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(lx.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(ax.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(kw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(Op.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(px.configure(this.options.italic)),this.options.listItem!==!1&&o.push($p.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(qp.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(Hx.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Jp.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(Zx.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(Qx.configure(this.options.strike)),this.options.text!==!1&&o.push(ew.configure(this.options.text)),this.options.underline!==!1&&o.push(tw.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(Sw.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),Mw=ce.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:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!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")}}}),Tw=t=>he({find:/--$/,replace:t??"—"}),Aw=t=>he({find:/\.\.\.$/,replace:t??"…"}),Rw=t=>he({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),Ow=t=>he({find:/"$/,replace:t??"”"}),Nw=t=>he({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),Iw=t=>he({find:/'$/,replace:t??"’"}),Lw=t=>he({find:/<-$/,replace:t??"←"}),Dw=t=>he({find:/->$/,replace:t??"→"}),Pw=t=>he({find:/\(c\)$/,replace:t??"©"}),jw=t=>he({find:/\(tm\)$/,replace:t??"™"}),Bw=t=>he({find:/\(sm\)$/,replace:t??"℠"}),_w=t=>he({find:/\(r\)$/,replace:t??"®"}),Hw=t=>he({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),Fw=t=>he({find:/\+\/-$/,replace:t??"±"}),$w=t=>he({find:/!=$/,replace:t??"≠"}),Vw=t=>he({find:/<<$/,replace:t??"«"}),zw=t=>he({find:/>>$/,replace:t??"»"}),Uw=t=>he({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),Ww=t=>he({find:/\^2$/,replace:t??"²"}),Kw=t=>he({find:/\^3$/,replace:t??"³"}),qw=t=>he({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),Gw=t=>he({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),Jw=ce.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(Tw(this.options.emDash)),this.options.ellipsis!==!1&&t.push(Aw(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(Rw(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(Ow(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(Nw(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(Iw(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(Lw(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(Dw(this.options.rightArrow)),this.options.copyright!==!1&&t.push(Pw(this.options.copyright)),this.options.trademark!==!1&&t.push(jw(this.options.trademark)),this.options.servicemark!==!1&&t.push(Bw(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(_w(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(Hw(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(Fw(this.options.plusMinus)),this.options.notEqual!==!1&&t.push($w(this.options.notEqual)),this.options.laquo!==!1&&t.push(Vw(this.options.laquo)),this.options.raquo!==!1&&t.push(zw(this.options.raquo)),this.options.multiplication!==!1&&t.push(Uw(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(Ww(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(Kw(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(qw(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(Gw(this.options.threeQuarters)),t}}),Zw=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Yw=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Xw=ht.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",re(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){const o=/^(==)([^=]+)(==)/.exec(t);if(o){const i=o[2].trim(),s=n.inlineTokens(i);return{type:"highlight",raw:o[0],text:i,tokens:s}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Rn({find:Zw,type:this.type})]},addPasteRules(){return[ln({find:Yw,type:this.type})]}}),Qw=ht.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),e7=ht.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),xe=[];for(var Xs=0;Xs<256;++Xs)xe.push((Xs+256).toString(16).slice(1));function t7(t,e=0){return(xe[t[e+0]]+xe[t[e+1]]+xe[t[e+2]]+xe[t[e+3]]+"-"+xe[t[e+4]]+xe[t[e+5]]+"-"+xe[t[e+6]]+xe[t[e+7]]+"-"+xe[t[e+8]]+xe[t[e+9]]+"-"+xe[t[e+10]]+xe[t[e+11]]+xe[t[e+12]]+xe[t[e+13]]+xe[t[e+14]]+xe[t[e+15]]).toLowerCase()}var So,n7=new Uint8Array(16);function r7(){if(!So&&(So=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!So))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return So(n7)}var o7=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Od={randomUUID:o7};function i7(t,e,n){if(Od.randomUUID&&!t)return Od.randomUUID();t=t||{};var r=t.random||(t.rng||r7)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,t7(r)}function s7(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function l7(t){const e=t.filter((r,o)=>t.indexOf(r)!==o);return s7(e)}var a7=ce.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>i7(),filterTransaction:null,updateDocument:!0}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>t[this.options.attributeName]?{[`data-${this.options.attributeName}`]:t[this.options.attributeName]}:{}}}}]},onCreate(){var t;if(!this.options.updateDocument)return;const e=this.editor.extensionManager.extensions.find(l=>l.name==="collaboration"),n=this.editor.extensionManager.extensions.find(l=>l.name==="collaborationCaret"),o=[e,n].filter(Boolean).find(l=>{var a;return(a=l?.options)==null?void 0:a.provider}),i=(t=o?.options)==null?void 0:t.provider,s=()=>{const{view:l,state:a}=this.editor,{tr:c,doc:u}=a,{types:d,attributeName:f,generateID:h}=this.options;yb(u,m=>d.includes(m.type.name)&&m.attrs[f]===null).forEach(({node:m,pos:v})=>{c.setNodeMarkup(v,void 0,{...m.attrs,[f]:h({node:m,pos:v})})}),c.setMeta("addToHistory",!1),l.dispatch(c),i&&i.off("synced",s)};if(o){if(!i)return s();i.on("synced",s)}else return s()},addProseMirrorPlugins(){if(!this.options.updateDocument)return[];let t=null,e=!1;return[new ae({key:new ye("uniqueID"),appendTransaction:(n,r,o)=>{const i=n.some(m=>m.docChanged)&&!r.doc.eq(o.doc),s=this.options.filterTransaction&&n.some(m=>{var v,b;return!((b=(v=this.options).filterTransaction)!=null&&b.call(v,m))});if(n.find(m=>m.getMeta("y-sync$"))||!i||s)return;const{tr:a}=o,{types:c,attributeName:u,generateID:d}=this.options,f=Pa(r.doc,n),{mapping:h}=f;if(Ha(f).forEach(({newRange:m})=>{const v=rp(o.doc,m,C=>c.includes(C.type.name)),b=v.map(({node:C})=>C.attrs[u]).filter(C=>C!==null);v.forEach(({node:C,pos:x},w)=>{var E;const k=(E=a.doc.nodeAt(x))==null?void 0:E.attrs[u];if(k===null){a.setNodeMarkup(x,void 0,{...C.attrs,[u]:d({node:C,pos:x})});return}const S=v[w+1];if(S&&C.content.size===0){if(a.setNodeMarkup(S.pos,void 0,{...S.node.attrs,[u]:k}),b[w+1]=k,S.node.attrs[u])return;const W=d({node:C,pos:x});return a.setNodeMarkup(x,void 0,{...C.attrs,[u]:W}),b[w]=W,a}const M=l7(b),{deleted:N}=h.invert().mapResult(x);N&&M.includes(k)&&a.setNodeMarkup(x,void 0,{...C.attrs,[u]:d({node:C,pos:x})})})}),!!a.steps.length)return a.setStoredMarks(o.tr.storedMarks),a},view(n){const r=o=>{var i;t=(i=n.dom.parentElement)!=null&&i.contains(o.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{var o,i;return(t!==n.dom.parentElement||((o=r.dataTransfer)==null?void 0:o.effectAllowed)==="copyMove"||((i=r.dataTransfer)==null?void 0:i.effectAllowed)==="copy")&&(t=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:n=>{if(!e)return n;const{types:r,attributeName:o}=this.options,i=s=>{const l=[];return s.forEach(a=>{if(a.isText){l.push(a);return}if(!r.includes(a.type.name)){l.push(a.copy(i(a.content)));return}const c=a.type.create({...a.attrs,[o]:null},i(a.content),a.marks);l.push(c)}),A.from(l)};return e=!1,new D(i(n.content),n.openStart,n.openEnd)}}})]}}),c7=a7;function es(){return typeof window<"u"}function ar(t){return rc(t)?(t.nodeName||"").toLowerCase():"#document"}function He(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function pt(t){var e;return(e=(rc(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function rc(t){return es()?t instanceof Node||t instanceof He(t).Node:!1}function ne(t){return es()?t instanceof Element||t instanceof He(t).Element:!1}function ze(t){return es()?t instanceof HTMLElement||t instanceof He(t).HTMLElement:!1}function Jl(t){return!es()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof He(t).ShadowRoot}const u7=new Set(["inline","contents"]);function eo(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=et(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!u7.has(o)}const d7=new Set(["table","td","th"]);function f7(t){return d7.has(ar(t))}const h7=[":popover-open",":modal"];function ts(t){return h7.some(e=>{try{return t.matches(e)}catch{return!1}})}const p7=["transform","translate","scale","rotate","perspective"],m7=["transform","translate","scale","rotate","perspective","filter"],g7=["paint","layout","strict","content"];function oc(t){const e=ns(),n=ne(t)?et(t):t;return p7.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||m7.some(r=>(n.willChange||"").includes(r))||g7.some(r=>(n.contain||"").includes(r))}function y7(t){let e=It(t);for(;ze(e)&&!Nt(e);){if(oc(e))return e;if(ts(e))return null;e=It(e)}return null}function ns(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const v7=new Set(["html","body","#document"]);function Nt(t){return v7.has(ar(t))}function et(t){return He(t).getComputedStyle(t)}function rs(t){return ne(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function It(t){if(ar(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Jl(t)&&t.host||pt(t);return Jl(e)?e.host:e}function om(t){const e=It(t);return Nt(e)?t.ownerDocument?t.ownerDocument.body:t.body:ze(e)&&eo(e)?e:om(e)}function nn(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=om(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=He(o);if(i){const l=Zl(s);return e.concat(s,s.visualViewport||[],eo(o)?o:[],l&&n?nn(l):[])}return e.concat(o,nn(o,[],n))}function Zl(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const b7=["top","right","bottom","left"],an=Math.min,Fe=Math.max,Ri=Math.round,ko=Math.floor,ut=t=>({x:t,y:t}),C7={left:"right",right:"left",bottom:"top",top:"bottom"},x7={start:"end",end:"start"};function Yl(t,e,n){return Fe(t,an(e,n))}function Lt(t,e){return typeof t=="function"?t(e):t}function Dt(t){return t.split("-")[0]}function cr(t){return t.split("-")[1]}function ic(t){return t==="x"?"y":"x"}function sc(t){return t==="y"?"height":"width"}const w7=new Set(["top","bottom"]);function at(t){return w7.has(Dt(t))?"y":"x"}function lc(t){return ic(at(t))}function S7(t,e,n){n===void 0&&(n=!1);const r=cr(t),o=lc(t),i=sc(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Oi(s)),[s,Oi(s)]}function k7(t){const e=Oi(t);return[Xl(t),e,Xl(e)]}function Xl(t){return t.replace(/start|end/g,e=>x7[e])}const Nd=["left","right"],Id=["right","left"],E7=["top","bottom"],M7=["bottom","top"];function T7(t,e,n){switch(t){case"top":case"bottom":return n?e?Id:Nd:e?Nd:Id;case"left":case"right":return e?E7:M7;default:return[]}}function A7(t,e,n,r){const o=cr(t);let i=T7(Dt(t),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(Xl)))),i}function Oi(t){return t.replace(/left|right|bottom|top/g,e=>C7[e])}function R7(t){return{top:0,right:0,bottom:0,left:0,...t}}function im(t){return typeof t!="number"?R7(t):{top:t,right:t,bottom:t,left:t}}function Ni(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}/*!
171
+ * tabbable 6.3.0
172
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
173
+ */var O7=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Ql=O7.join(","),sm=typeof Element>"u",Vr=sm?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ii=!sm&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},zr=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),i=o===""||o==="true",s=i||n&&e&&zr(e.parentNode);return s},N7=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},I7=function(e,n,r){if(zr(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Ql));return n&&Vr.call(e,Ql)&&o.unshift(e),o=o.filter(r),o},ea=function(e,n,r){for(var o=[],i=Array.from(e);i.length;){var s=i.shift();if(!zr(s,!1))if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,c=ea(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{var u=Vr.call(s,Ql);u&&r.filter(s)&&(n||!e.includes(s))&&o.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),f=!zr(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&f){var h=ea(d===!0?s.children:d.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return o},lm=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},am=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||N7(e))&&!lm(e)?0:e.tabIndex},L7=function(e,n){var r=am(e);return r<0&&n&&!lm(e)?0:r},D7=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},cm=function(e){return e.tagName==="INPUT"},P7=function(e){return cm(e)&&e.type==="hidden"},j7=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},B7=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},_7=function(e){if(!e.name)return!0;var n=e.form||Ii(e),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=B7(o,e.form);return!i||i===e},H7=function(e){return cm(e)&&e.type==="radio"},F7=function(e){return H7(e)&&!_7(e)},$7=function(e){var n,r=e&&Ii(e),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==e){var s,l,a;for(i=!!((s=o)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(o)||e!=null&&(a=e.ownerDocument)!==null&&a!==void 0&&a.contains(e));!i&&o;){var c,u,d;r=Ii(o),o=(c=r)===null||c===void 0?void 0:c.host,i=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},Ld=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},V7=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var s=Vr.call(e,"details>summary:first-of-type"),l=s?e.parentElement:e;if(Vr.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=e;e;){var c=e.parentElement,u=Ii(e);if(c&&!c.shadowRoot&&o(c)===!0)return Ld(e);e.assignedSlot?e=e.assignedSlot:!c&&u!==e.ownerDocument?e=u.host:e=c}e=a}if($7(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ld(e);return!1},z7=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Vr.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},U7=function(e,n){return!(n.disabled||zr(n)||P7(n)||V7(n,e)||j7(n)||z7(n))},Dd=function(e,n){return!(F7(n)||am(n)<0||!U7(e,n))},W7=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},um=function(e){var n=[],r=[];return e.forEach(function(o,i){var s=!!o.scopeParent,l=s?o.scopeParent:o,a=L7(l,s),c=s?um(o.candidates):l;a===0?s?n.push.apply(n,c):n.push(l):r.push({documentOrder:i,tabIndex:a,item:o,isScope:s,content:c})}),r.sort(D7).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},dm=function(e,n){n=n||{};var r;return n.getShadowRoot?r=ea([e],n.includeContainer,{filter:Dd.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:W7}):r=I7(e,n.includeContainer,Dd.bind(null,n)),um(r)};function K7(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function q7(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function fm(){return/apple/i.test(navigator.vendor)}function G7(){return K7().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function J7(){return q7().includes("jsdom/")}const Pd="data-floating-ui-focusable",Z7="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function ta(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function ir(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Jl(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function qn(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Qs(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function Y7(t){return t.matches("html,body")}function ct(t){return t?.ownerDocument||document}function X7(t){return ze(t)&&t.matches(Z7)}function Q7(t){if(!t||J7())return!0;try{return t.matches(":focus-visible")}catch{return!0}}function e4(t){return t?t.hasAttribute(Pd)?t:t.querySelector("["+Pd+"]")||t:null}function Bo(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var i;return o.parentId===e&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...Bo(t,o.id,n)])}function t4(t){return"nativeEvent"in t}function na(t,e){const n=["mouse","pen"];return n.push("",void 0),n.includes(t)}var n4=typeof document<"u",r4=function(){},rt=n4?j.useLayoutEffect:r4;const o4={...y};function Eo(t){const e=y.useRef(t);return rt(()=>{e.current=t}),e}const i4=o4.useInsertionEffect,s4=i4||(t=>t());function st(t){const e=y.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return s4(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const hm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function pm(t,e){const n=dm(t,hm()),r=n.length;if(r===0)return;const o=ta(ct(t)),i=n.indexOf(o),s=i===-1?e===1?0:r-1:i+e;return n[s]}function l4(t){return pm(ct(t).body,1)||t}function a4(t){return pm(ct(t).body,-1)||t}function el(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!ir(n,r)}function c4(t){dm(t,hm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function jd(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Bd(t,e,n){let{reference:r,floating:o}=t;const i=at(e),s=lc(e),l=sc(s),a=Dt(e),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let h;switch(a){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(cr(e)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}const u4=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=Bd(c,r,a),f=r,h={},p=0;for(let m=0;m<l.length;m++){const{name:v,fn:b}=l[m],{x:C,y:x,data:w,reset:E}=await b({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:t,floating:e}});u=C??u,d=x??d,h={...h,[v]:{...h[v],...w}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):E.rects),{x:u,y:d}=Bd(c,f,a)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:h}};async function Ur(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Lt(e,t),p=im(h),v=l[f?d==="floating"?"reference":"floating":d],b=Ni(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),C=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},E=Ni(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:C,offsetParent:x,strategy:a}):C);return{top:(b.top-E.top+p.top)/w.y,bottom:(E.bottom-b.bottom+p.bottom)/w.y,left:(b.left-E.left+p.left)/w.x,right:(E.right-b.right+p.right)/w.x}}const d4=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=Lt(t,e)||{};if(c==null)return{};const d=im(u),f={x:n,y:r},h=lc(o),p=sc(h),m=await s.getDimensions(c),v=h==="y",b=v?"top":"left",C=v?"bottom":"right",x=v?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-f[h]-i.floating[p],E=f[h]-i.reference[h],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=k?k[x]:0;(!S||!await(s.isElement==null?void 0:s.isElement(k)))&&(S=l.floating[x]||i.floating[p]);const M=w/2-E/2,N=S/2-m[p]/2-1,P=an(d[b],N),W=an(d[C],N),z=P,H=S-m[p]-W,I=S/2-m[p]/2+M,_=Yl(z,I,H),F=!a.arrow&&cr(o)!=null&&I!==_&&i.reference[p]/2-(I<z?P:W)-m[p]/2<0,L=F?I<z?I-z:I-H:0;return{[h]:f[h]+L,data:{[h]:_,centerOffset:I-_-L,...F&&{alignmentOffset:L}},reset:F}}}),f4=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...v}=Lt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Dt(o),C=at(l),x=Dt(l)===l,w=await(a.isRTL==null?void 0:a.isRTL(c.floating)),E=f||(x||!m?[Oi(l)]:k7(l)),k=p!=="none";!f&&k&&E.push(...A7(l,m,p,w));const S=[l,...E],M=await Ur(e,v),N=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&N.push(M[b]),d){const I=S7(o,s,w);N.push(M[I[0]],M[I[1]])}if(P=[...P,{placement:o,overflows:N}],!N.every(I=>I<=0)){var W,z;const I=(((W=i.flip)==null?void 0:W.index)||0)+1,_=S[I];if(_&&(!(d==="alignment"?C!==at(_):!1)||P.every(T=>at(T.placement)===C?T.overflows[0]>0:!0)))return{data:{index:I,overflows:P},reset:{placement:_}};let F=(z=P.filter(L=>L.overflows[0]<=0).sort((L,T)=>L.overflows[1]-T.overflows[1])[0])==null?void 0:z.placement;if(!F)switch(h){case"bestFit":{var H;const L=(H=P.filter(T=>{if(k){const R=at(T.placement);return R===C||R==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(R=>R>0).reduce((R,U)=>R+U,0)]).sort((T,R)=>T[1]-R[1])[0])==null?void 0:H[0];L&&(F=L);break}case"initialPlacement":F=l;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function _d(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Hd(t){return b7.some(e=>t[e]>=0)}const h4=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...o}=Lt(t,e);switch(r){case"referenceHidden":{const i=await Ur(e,{...o,elementContext:"reference"}),s=_d(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Hd(s)}}}case"escaped":{const i=await Ur(e,{...o,altBoundary:!0}),s=_d(i,n.floating);return{data:{escapedOffsets:s,escaped:Hd(s)}}}default:return{}}}}},mm=new Set(["left","top"]);async function p4(t,e){const{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Dt(n),l=cr(n),a=at(n)==="y",c=mm.has(s)?-1:1,u=i&&a?-1:1,d=Lt(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const m4=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:i,placement:s,middlewareData:l}=e,a=await p4(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},g4=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:v=>{let{x:b,y:C}=v;return{x:b,y:C}}},...a}=Lt(t,e),c={x:n,y:r},u=await Ur(e,a),d=at(Dt(o)),f=ic(d);let h=c[f],p=c[d];if(i){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",C=h+u[v],x=h-u[b];h=Yl(C,h,x)}if(s){const v=d==="y"?"top":"left",b=d==="y"?"bottom":"right",C=p+u[v],x=p-u[b];p=Yl(C,p,x)}const m=l.fn({...e,[f]:h,[d]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:i,[d]:s}}}}}},y4=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=e,{offset:l=0,mainAxis:a=!0,crossAxis:c=!0}=Lt(t,e),u={x:n,y:r},d=at(o),f=ic(d);let h=u[f],p=u[d];const m=Lt(l,e),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){const x=f==="y"?"height":"width",w=i.reference[f]-i.floating[x]+v.mainAxis,E=i.reference[f]+i.reference[x]-v.mainAxis;h<w?h=w:h>E&&(h=E)}if(c){var b,C;const x=f==="y"?"width":"height",w=mm.has(Dt(o)),E=i.reference[d]-i.floating[x]+(w&&((b=s.offset)==null?void 0:b[d])||0)+(w?0:v.crossAxis),k=i.reference[d]+i.reference[x]+(w?0:((C=s.offset)==null?void 0:C[d])||0)-(w?v.crossAxis:0);p<E?p=E:p>k&&(p=k)}return{[f]:h,[d]:p}}}},v4=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:i,platform:s,elements:l}=e,{apply:a=()=>{},...c}=Lt(t,e),u=await Ur(e,c),d=Dt(o),f=cr(o),h=at(o)==="y",{width:p,height:m}=i.floating;let v,b;d==="top"||d==="bottom"?(v=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=d,v=f==="end"?"top":"bottom");const C=m-u.top-u.bottom,x=p-u.left-u.right,w=an(m-u[v],C),E=an(p-u[b],x),k=!e.middlewareData.shift;let S=w,M=E;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(M=x),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(S=C),k&&!f){const P=Fe(u.left,0),W=Fe(u.right,0),z=Fe(u.top,0),H=Fe(u.bottom,0);h?M=p-2*(P!==0||W!==0?P+W:Fe(u.left,u.right)):S=m-2*(z!==0||H!==0?z+H:Fe(u.top,u.bottom))}await a({...e,availableWidth:M,availableHeight:S});const N=await s.getDimensions(l.floating);return p!==N.width||m!==N.height?{reset:{rects:!0}}:{}}}};function gm(t){const e=et(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=ze(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=Ri(n)!==i||Ri(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function ac(t){return ne(t)?t:t.contextElement}function Xn(t){const e=ac(t);if(!ze(e))return ut(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:i}=gm(e);let s=(i?Ri(n.width):n.width)/r,l=(i?Ri(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const b4=ut(0);function ym(t){const e=He(t);return!ns()||!e.visualViewport?b4:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function C4(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==He(t)?!1:e}function On(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=ac(t);let s=ut(1);e&&(r?ne(r)&&(s=Xn(r)):s=Xn(t));const l=C4(i,n,r)?ym(i):ut(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const f=He(i),h=r&&ne(r)?He(r):r;let p=f,m=Zl(p);for(;m&&r&&h!==p;){const v=Xn(m),b=m.getBoundingClientRect(),C=et(m),x=b.left+(m.clientLeft+parseFloat(C.paddingLeft))*v.x,w=b.top+(m.clientTop+parseFloat(C.paddingTop))*v.y;a*=v.x,c*=v.y,u*=v.x,d*=v.y,a+=x,c+=w,p=He(m),m=Zl(p)}}return Ni({width:u,height:d,x:a,y:c})}function is(t,e){const n=rs(t).scrollLeft;return e?e.left+n:On(pt(t)).left+n}function vm(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-is(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function x4(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const i=o==="fixed",s=pt(r),l=e?ts(e.floating):!1;if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=ut(1);const u=ut(0),d=ze(r);if((d||!d&&!i)&&((ar(r)!=="body"||eo(s))&&(a=rs(r)),ze(r))){const h=On(r);c=Xn(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!i?vm(s,a):ut(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-a.scrollTop*c.y+u.y+f.y}}function w4(t){return Array.from(t.getClientRects())}function S4(t){const e=pt(t),n=rs(t),r=t.ownerDocument.body,o=Fe(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Fe(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+is(t);const l=-n.scrollTop;return et(r).direction==="rtl"&&(s+=Fe(e.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}const Fd=25;function k4(t,e){const n=He(t),r=pt(t),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;const u=ns();(!u||u&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=is(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=Fd&&(i-=p)}else c<=Fd&&(i+=c);return{width:i,height:s,x:l,y:a}}const E4=new Set(["absolute","fixed"]);function M4(t,e){const n=On(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=ze(t)?Xn(t):ut(1),s=t.clientWidth*i.x,l=t.clientHeight*i.y,a=o*i.x,c=r*i.y;return{width:s,height:l,x:a,y:c}}function $d(t,e,n){let r;if(e==="viewport")r=k4(t,n);else if(e==="document")r=S4(pt(t));else if(ne(e))r=M4(e,n);else{const o=ym(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Ni(r)}function bm(t,e){const n=It(t);return n===e||!ne(n)||Nt(n)?!1:et(n).position==="fixed"||bm(n,e)}function T4(t,e){const n=e.get(t);if(n)return n;let r=nn(t,[],!1).filter(l=>ne(l)&&ar(l)!=="body"),o=null;const i=et(t).position==="fixed";let s=i?It(t):t;for(;ne(s)&&!Nt(s);){const l=et(s),a=oc(s);!a&&l.position==="fixed"&&(o=null),(i?!a&&!o:!a&&l.position==="static"&&!!o&&E4.has(o.position)||eo(s)&&!a&&bm(t,s))?r=r.filter(u=>u!==s):o=l,s=It(s)}return e.set(t,r),r}function A4(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const s=[...n==="clippingAncestors"?ts(e)?[]:T4(e,this._c):[].concat(n),r],l=s[0],a=s.reduce((c,u)=>{const d=$d(e,u,o);return c.top=Fe(d.top,c.top),c.right=an(d.right,c.right),c.bottom=an(d.bottom,c.bottom),c.left=Fe(d.left,c.left),c},$d(e,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function R4(t){const{width:e,height:n}=gm(t);return{width:e,height:n}}function O4(t,e,n){const r=ze(e),o=pt(e),i=n==="fixed",s=On(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=ut(0);function c(){a.x=is(o)}if(r||!r&&!i)if((ar(e)!=="body"||eo(o))&&(l=rs(e)),r){const h=On(e,!0,i,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?vm(o,l):ut(0),d=s.left+l.scrollLeft-a.x-u.x,f=s.top+l.scrollTop-a.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function tl(t){return et(t).position==="static"}function Vd(t,e){if(!ze(t)||et(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return pt(t)===n&&(n=n.ownerDocument.body),n}function Cm(t,e){const n=He(t);if(ts(t))return n;if(!ze(t)){let o=It(t);for(;o&&!Nt(o);){if(ne(o)&&!tl(o))return o;o=It(o)}return n}let r=Vd(t,e);for(;r&&f7(r)&&tl(r);)r=Vd(r,e);return r&&Nt(r)&&tl(r)&&!oc(r)?n:r||y7(t)||n}const N4=async function(t){const e=this.getOffsetParent||Cm,n=this.getDimensions,r=await n(t.floating);return{reference:O4(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function I4(t){return et(t).direction==="rtl"}const L4={convertOffsetParentRelativeRectToViewportRelativeRect:x4,getDocumentElement:pt,getClippingRect:A4,getOffsetParent:Cm,getElementRects:N4,getClientRects:w4,getDimensions:R4,getScale:Xn,isElement:ne,isRTL:I4};function xm(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function D4(t,e){let n=null,r;const o=pt(t);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(l||e(),!f||!h)return;const p=ko(d),m=ko(o.clientWidth-(u+f)),v=ko(o.clientHeight-(d+h)),b=ko(u),x={rootMargin:-p+"px "+-m+"px "+-v+"px "+-b+"px",threshold:Fe(0,an(1,a))||1};let w=!0;function E(k){const S=k[0].intersectionRatio;if(S!==a){if(!w)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!xm(c,t.getBoundingClientRect())&&s(),w=!1}try{n=new IntersectionObserver(E,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,x)}n.observe(t)}return s(!0),i}function wm(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=ac(t),u=o||i?[...c?nn(c):[],...nn(e)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&l?D4(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(b=>{let[C]=b;C&&C.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(e)})),n()}),c&&!a&&h.observe(c),h.observe(e));let p,m=a?On(t):null;a&&v();function v(){const b=On(t);m&&!xm(m,b)&&n(),m=b,p=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(C=>{o&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),d?.(),(b=h)==null||b.disconnect(),h=null,a&&cancelAnimationFrame(p)}}const P4=m4,j4=g4,B4=f4,_4=v4,H4=h4,zd=d4,F4=y4,$4=(t,e,n)=>{const r=new Map,o={platform:L4,...n},i={...o.platform,_c:r};return u4(t,e,{...o,platform:i})};var V4=typeof document<"u",z4=function(){},_o=V4?j.useLayoutEffect:z4;function Li(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Li(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!Li(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function Sm(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Ud(t,e){const n=Sm(t);return Math.round(e*n)/n}function nl(t){const e=y.useRef(t);return _o(()=>{e.current=t}),e}function km(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[u,d]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=y.useState(r);Li(f,r)||h(r);const[p,m]=y.useState(null),[v,b]=y.useState(null),C=y.useCallback(T=>{T!==k.current&&(k.current=T,m(T))},[]),x=y.useCallback(T=>{T!==S.current&&(S.current=T,b(T))},[]),w=i||p,E=s||v,k=y.useRef(null),S=y.useRef(null),M=y.useRef(u),N=a!=null,P=nl(a),W=nl(o),z=nl(c),H=y.useCallback(()=>{if(!k.current||!S.current)return;const T={placement:e,strategy:n,middleware:f};W.current&&(T.platform=W.current),$4(k.current,S.current,T).then(R=>{const U={...R,isPositioned:z.current!==!1};I.current&&!Li(M.current,U)&&(M.current=U,fa.flushSync(()=>{d(U)}))})},[f,e,n,W,z]);_o(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(T=>({...T,isPositioned:!1})))},[c]);const I=y.useRef(!1);_o(()=>(I.current=!0,()=>{I.current=!1}),[]),_o(()=>{if(w&&(k.current=w),E&&(S.current=E),w&&E){if(P.current)return P.current(w,E,H);H()}},[w,E,H,P,N]);const _=y.useMemo(()=>({reference:k,floating:S,setReference:C,setFloating:x}),[C,x]),F=y.useMemo(()=>({reference:w,floating:E}),[w,E]),L=y.useMemo(()=>{const T={position:n,left:0,top:0};if(!F.floating)return T;const R=Ud(F.floating,u.x),U=Ud(F.floating,u.y);return l?{...T,transform:"translate("+R+"px, "+U+"px)",...Sm(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:U}},[n,l,F.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:H,refs:_,elements:F,floatingStyles:L}),[u,H,_,F,L])}const U4=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?zd({element:r.current,padding:o}).fn(n):{}:r?zd({element:r,padding:o}).fn(n):{}}}},Em=(t,e)=>({...P4(t),options:[t,e]}),Mm=(t,e)=>({...j4(t),options:[t,e]}),W4=(t,e)=>({...F4(t),options:[t,e]}),Tm=(t,e)=>({...B4(t),options:[t,e]}),K4=(t,e)=>({..._4(t),options:[t,e]}),q4=(t,e)=>({...H4(t),options:[t,e]}),G4=(t,e)=>({...U4(t),options:[t,e]});function Am(t){const e=y.useRef(void 0),n=y.useCallback(r=>{const o=t.map(i=>{if(i!=null){if(typeof i=="function"){const s=i,l=s(r);return typeof l=="function"?l:()=>{s(null)}}return i.current=r,()=>{i.current=null}}});return()=>{o.forEach(i=>i?.())}},t);return y.useMemo(()=>t.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=n(r))},t)}const J4="data-floating-ui-focusable",Wd="active",Kd="selected",Z4={...y};let qd=!1,Y4=0;const Gd=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Y4++;function X4(){const[t,e]=y.useState(()=>qd?Gd():void 0);return rt(()=>{t==null&&e(Gd())},[]),y.useEffect(()=>{qd=!0},[]),t}const Q4=Z4.useId,cc=Q4||X4;let ra;process.env.NODE_ENV!=="production"&&(ra=new Set);function e5(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((t=ra)!=null&&t.has(o))){var i;(i=ra)==null||i.add(o),console.error(o)}}function t5(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const n5=y.createContext(null),r5=y.createContext(null),uc=()=>{var t;return((t=y.useContext(n5))==null?void 0:t.id)||null},dc=()=>y.useContext(r5);function to(t){return"data-floating-ui-"+t}function qe(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const Jd=to("safe-polygon");function rl(t,e,n){if(n&&!na(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function ol(t){return typeof t=="function"?t():t}function o5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:s}=t,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=e,h=dc(),p=uc(),m=Eo(c),v=Eo(a),b=Eo(n),C=Eo(d),x=y.useRef(),w=y.useRef(-1),E=y.useRef(),k=y.useRef(-1),S=y.useRef(!0),M=y.useRef(!1),N=y.useRef(()=>{}),P=y.useRef(!1),W=st(()=>{var L;const T=(L=o.current.openEvent)==null?void 0:L.type;return T?.includes("mouse")&&T!=="mousedown"});y.useEffect(()=>{if(!l)return;function L(T){let{open:R}=T;R||(qe(w),qe(k),S.current=!0,P.current=!1)}return i.on("openchange",L),()=>{i.off("openchange",L)}},[l,i]),y.useEffect(()=>{if(!l||!m.current||!n)return;function L(R){W()&&r(!1,R,"hover")}const T=ct(s.floating).documentElement;return T.addEventListener("mouseleave",L),()=>{T.removeEventListener("mouseleave",L)}},[s.floating,n,r,l,m,W]);const z=y.useCallback(function(L,T,R){T===void 0&&(T=!0),R===void 0&&(R="hover");const U=rl(v.current,"close",x.current);U&&!E.current?(qe(w),w.current=window.setTimeout(()=>r(!1,L,R),U)):T&&(qe(w),r(!1,L,R))},[v,r]),H=st(()=>{N.current(),E.current=void 0}),I=st(()=>{if(M.current){const L=ct(s.floating).body;L.style.pointerEvents="",L.removeAttribute(Jd),M.current=!1}}),_=st(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);y.useEffect(()=>{if(!l)return;function L(K){if(qe(w),S.current=!1,u&&!na(x.current)||ol(C.current)>0&&!rl(v.current,"open"))return;const Z=rl(v.current,"open",x.current);Z?w.current=window.setTimeout(()=>{b.current||r(!0,K,"hover")},Z):n||r(!0,K,"hover")}function T(K){if(_()){I();return}N.current();const Z=ct(s.floating);if(qe(k),P.current=!1,m.current&&o.current.floatingContext){n||qe(w),E.current=m.current({...o.current.floatingContext,tree:h,x:K.clientX,y:K.clientY,onClose(){I(),H(),_()||z(K,!0,"safe-polygon")}});const se=E.current;Z.addEventListener("mousemove",se),N.current=()=>{Z.removeEventListener("mousemove",se)};return}(x.current==="touch"?!ir(s.floating,K.relatedTarget):!0)&&z(K)}function R(K){_()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:h,x:K.clientX,y:K.clientY,onClose(){I(),H(),_()||z(K)}})(K))}function U(){qe(w)}function Q(K){_()||z(K,!1)}if(ne(s.domReference)){const K=s.domReference,Z=s.floating;return n&&K.addEventListener("mouseleave",R),f&&K.addEventListener("mousemove",L,{once:!0}),K.addEventListener("mouseenter",L),K.addEventListener("mouseleave",T),Z&&(Z.addEventListener("mouseleave",R),Z.addEventListener("mouseenter",U),Z.addEventListener("mouseleave",Q)),()=>{n&&K.removeEventListener("mouseleave",R),f&&K.removeEventListener("mousemove",L),K.removeEventListener("mouseenter",L),K.removeEventListener("mouseleave",T),Z&&(Z.removeEventListener("mouseleave",R),Z.removeEventListener("mouseenter",U),Z.removeEventListener("mouseleave",Q))}}},[s,l,t,u,f,z,H,I,r,n,b,h,v,m,o,_,C]),rt(()=>{var L;if(l&&n&&(L=m.current)!=null&&(L=L.__options)!=null&&L.blockPointerEvents&&W()){M.current=!0;const R=s.floating;if(ne(s.domReference)&&R){var T;const U=ct(s.floating).body;U.setAttribute(Jd,"");const Q=s.domReference,K=h==null||(T=h.nodesRef.current.find(Z=>Z.id===p))==null||(T=T.context)==null?void 0:T.elements.floating;return K&&(K.style.pointerEvents=""),U.style.pointerEvents="none",Q.style.pointerEvents="auto",R.style.pointerEvents="auto",()=>{U.style.pointerEvents="",Q.style.pointerEvents="",R.style.pointerEvents=""}}}},[l,n,p,s,h,m,W]),rt(()=>{n||(x.current=void 0,P.current=!1,H(),I())},[n,H,I]),y.useEffect(()=>()=>{H(),qe(w),qe(k),I()},[l,s.domReference,H,I]);const F=y.useMemo(()=>{function L(T){x.current=T.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(T){const{nativeEvent:R}=T;function U(){!S.current&&!b.current&&r(!0,R,"hover")}u&&!na(x.current)||n||ol(C.current)===0||P.current&&T.movementX**2+T.movementY**2<2||(qe(k),x.current==="touch"?U():(P.current=!0,k.current=window.setTimeout(U,ol(C.current))))}}},[u,r,n,b,C]);return y.useMemo(()=>l?{reference:F}:{},[l,F])}const Zd=()=>{},i5=y.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Zd,setState:Zd,isInstantPhase:!1});function s5(t){const{children:e,delay:n,timeoutMs:r=0}=t,[o,i]=y.useReducer((a,c)=>({...a,...c}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),s=y.useRef(null),l=y.useCallback(a=>{i({currentId:a})},[]);return rt(()=>{o.currentId?s.current===null?s.current=o.currentId:o.isInstantPhase||i({isInstantPhase:!0}):(o.isInstantPhase&&i({isInstantPhase:!1}),s.current=null)},[o.currentId,o.isInstantPhase]),g.jsx(i5.Provider,{value:y.useMemo(()=>({...o,setState:i,setCurrentId:l}),[o,l]),children:e})}const Rm={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Yd=y.forwardRef(function(e,n){const[r,o]=y.useState();rt(()=>{fm()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[to("focus-guard")]:"",style:Rm};return g.jsx("span",{...e,...i})}),Om=y.createContext(null),Xd=to("portal");function l5(t){t===void 0&&(t={});const{id:e,root:n}=t,r=cc(),o=c5(),[i,s]=y.useState(null),l=y.useRef(null);return rt(()=>()=>{i?.remove(),queueMicrotask(()=>{l.current=null})},[i]),rt(()=>{if(!r||l.current)return;const a=e?document.getElementById(e):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(Xd,""),a.appendChild(c),l.current=c,s(c)},[e,r]),rt(()=>{if(n===null||!r||l.current)return;let a=n||o?.portalNode;a&&!rc(a)&&(a=a.current),a=a||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(Xd,""),a=c||a,a.appendChild(u),l.current=u,s(u)},[e,n,r,o]),i}function a5(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,i=l5({id:n,root:r}),[s,l]=y.useState(null),a=y.useRef(null),c=y.useRef(null),u=y.useRef(null),d=y.useRef(null),f=s?.modal,h=s?.open,p=!!s&&!s.modal&&s.open&&o&&!!(r||i);return y.useEffect(()=>{if(!i||!o||f)return;function m(v){i&&el(v)&&(v.type==="focusin"?jd:c4)(i)}return i.addEventListener("focusin",m,!0),i.addEventListener("focusout",m,!0),()=>{i.removeEventListener("focusin",m,!0),i.removeEventListener("focusout",m,!0)}},[i,o,f]),y.useEffect(()=>{i&&(h||jd(i))},[h,i]),g.jsxs(Om.Provider,{value:y.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:i,setFocusManagerState:l}),[o,i]),children:[p&&i&&g.jsx(Yd,{"data-type":"outside",ref:a,onFocus:m=>{if(el(m,i)){var v;(v=u.current)==null||v.focus()}else{const b=s?s.domReference:null,C=a4(b);C?.focus()}}}),p&&i&&g.jsx("span",{"aria-owns":i.id,style:Rm}),i&&fa.createPortal(e,i),p&&i&&g.jsx(Yd,{"data-type":"outside",ref:c,onFocus:m=>{if(el(m,i)){var v;(v=d.current)==null||v.focus()}else{const b=s?s.domReference:null,C=l4(b);C?.focus(),s?.closeOnFocusOut&&s?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const c5=()=>y.useContext(Om),u5={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},d5={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Qd=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function f5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=t,{enabled:s=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=e,m=dc(),v=st(typeof a=="function"?a:()=>!1),b=typeof a=="function"?v:a,C=y.useRef(!1),{escapeKey:x,outsidePress:w}=Qd(h),{escapeKey:E,outsidePress:k}=Qd(p),S=y.useRef(!1),M=st(I=>{var _;if(!n||!s||!l||I.key!=="Escape"||S.current)return;const F=(_=i.current.floatingContext)==null?void 0:_.nodeId,L=m?Bo(m.nodesRef.current,F):[];if(!x&&(I.stopPropagation(),L.length>0)){let T=!0;if(L.forEach(R=>{var U;if((U=R.context)!=null&&U.open&&!R.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}r(!1,t4(I)?I.nativeEvent:I,"escape-key")}),N=st(I=>{var _;const F=()=>{var L;M(I),(L=qn(I))==null||L.removeEventListener("keydown",F)};(_=qn(I))==null||_.addEventListener("keydown",F)}),P=st(I=>{var _;const F=i.current.insideReactTree;i.current.insideReactTree=!1;const L=C.current;if(C.current=!1,c==="click"&&L||F||typeof b=="function"&&!b(I))return;const T=qn(I),R="["+to("inert")+"]",U=ct(o.floating).querySelectorAll(R);let Q=ne(T)?T:null;for(;Q&&!Nt(Q);){const se=It(Q);if(Nt(se)||!ne(se))break;Q=se}if(U.length&&ne(T)&&!Y7(T)&&!ir(T,o.floating)&&Array.from(U).every(se=>!ir(Q,se)))return;if(ze(T)&&H){const se=Nt(T),ge=et(T),Y=/auto|scroll/,ee=se||Y.test(ge.overflowX),We=se||Y.test(ge.overflowY),vt=ee&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,jn=We&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,bs=ge.direction==="rtl",Bn=jn&&(bs?I.offsetX<=T.offsetWidth-T.clientWidth:I.offsetX>T.clientWidth),C0=vt&&I.offsetY>T.clientHeight;if(Bn||C0)return}const K=(_=i.current.floatingContext)==null?void 0:_.nodeId,Z=m&&Bo(m.nodesRef.current,K).some(se=>{var ge;return Qs(I,(ge=se.context)==null?void 0:ge.elements.floating)});if(Qs(I,o.floating)||Qs(I,o.domReference)||Z)return;const Ue=m?Bo(m.nodesRef.current,K):[];if(Ue.length>0){let se=!0;if(Ue.forEach(ge=>{var Y;if((Y=ge.context)!=null&&Y.open&&!ge.context.dataRef.current.__outsidePressBubbles){se=!1;return}}),!se)return}r(!1,I,"outside-press")}),W=st(I=>{var _;const F=()=>{var L;P(I),(L=qn(I))==null||L.removeEventListener(c,F)};(_=qn(I))==null||_.addEventListener(c,F)});y.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=w;let I=-1;function _(U){r(!1,U,"ancestor-scroll")}function F(){window.clearTimeout(I),S.current=!0}function L(){I=window.setTimeout(()=>{S.current=!1},ns()?5:0)}const T=ct(o.floating);l&&(T.addEventListener("keydown",E?N:M,E),T.addEventListener("compositionstart",F),T.addEventListener("compositionend",L)),b&&T.addEventListener(c,k?W:P,k);let R=[];return f&&(ne(o.domReference)&&(R=nn(o.domReference)),ne(o.floating)&&(R=R.concat(nn(o.floating))),!ne(o.reference)&&o.reference&&o.reference.contextElement&&(R=R.concat(nn(o.reference.contextElement)))),R=R.filter(U=>{var Q;return U!==((Q=T.defaultView)==null?void 0:Q.visualViewport)}),R.forEach(U=>{U.addEventListener("scroll",_,{passive:!0})}),()=>{l&&(T.removeEventListener("keydown",E?N:M,E),T.removeEventListener("compositionstart",F),T.removeEventListener("compositionend",L)),b&&T.removeEventListener(c,k?W:P,k),R.forEach(U=>{U.removeEventListener("scroll",_)}),window.clearTimeout(I)}},[i,o,l,b,c,n,r,f,s,x,w,M,E,N,P,k,W]),y.useEffect(()=>{i.current.insideReactTree=!1},[i,b,c]);const z=y.useMemo(()=>({onKeyDown:M,...u&&{[u5[d]]:I=>{r(!1,I.nativeEvent,"reference-press")},...d!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[M,r,u,d]),H=y.useMemo(()=>({onKeyDown:M,onMouseDown(){C.current=!0},onMouseUp(){C.current=!0},[d5[c]]:()=>{i.current.insideReactTree=!0}}),[M,c,i]);return y.useMemo(()=>s?{reference:z,floating:H}:{},[s,z,H])}function h5(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=cc(),i=y.useRef({}),[s]=y.useState(()=>t5()),l=uc()!=null;if(process.env.NODE_ENV!=="production"){const h=r.reference;h&&!ne(h)&&e5("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=y.useState(r.reference),u=st((h,p,m)=>{i.current.openEvent=h?p:void 0,s.emit("openchange",{open:h,event:p,reason:m,nested:l}),n?.(h,p,m)}),d=y.useMemo(()=>({setPositionReference:c}),[]),f=y.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return y.useMemo(()=>({dataRef:i,open:e,onOpenChange:u,elements:f,events:s,floatingId:o,refs:d}),[e,u,f,s,o,d])}function p5(t){t===void 0&&(t={});const{nodeId:e}=t,n=h5({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[i,s]=y.useState(null),[l,a]=y.useState(null),u=o?.domReference||i,d=y.useRef(null),f=dc();rt(()=>{u&&(d.current=u)},[u]);const h=km({...t,elements:{...o,...l&&{reference:l}}}),p=y.useCallback(x=>{const w=ne(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),getClientRects:()=>x.getClientRects(),contextElement:x}:x;a(w),h.refs.setReference(w)},[h.refs]),m=y.useCallback(x=>{(ne(x)||x===null)&&(d.current=x,s(x)),(ne(h.refs.reference.current)||h.refs.reference.current===null||x!==null&&!ne(x))&&h.refs.setReference(x)},[h.refs]),v=y.useMemo(()=>({...h.refs,setReference:m,setPositionReference:p,domReference:d}),[h.refs,m,p]),b=y.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),C=y.useMemo(()=>({...h,...r,refs:v,elements:b,nodeId:e}),[h,v,b,e,r]);return rt(()=>{r.dataRef.current.floatingContext=C;const x=f?.nodesRef.current.find(w=>w.id===e);x&&(x.context=C)}),y.useMemo(()=>({...h,context:C,refs:v,elements:b}),[h,v,b,C])}function il(){return G7()&&fm()}function m5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:s}=t,{enabled:l=!0,visibleOnly:a=!0}=e,c=y.useRef(!1),u=y.useRef(-1),d=y.useRef(!0);y.useEffect(()=>{if(!l)return;const h=He(s.domReference);function p(){!n&&ze(s.domReference)&&s.domReference===ta(ct(s.domReference))&&(c.current=!0)}function m(){d.current=!0}function v(){d.current=!1}return h.addEventListener("blur",p),il()&&(h.addEventListener("keydown",m,!0),h.addEventListener("pointerdown",v,!0)),()=>{h.removeEventListener("blur",p),il()&&(h.removeEventListener("keydown",m,!0),h.removeEventListener("pointerdown",v,!0))}},[s.domReference,n,l]),y.useEffect(()=>{if(!l)return;function h(p){let{reason:m}=p;(m==="reference-press"||m==="escape-key")&&(c.current=!0)}return o.on("openchange",h),()=>{o.off("openchange",h)}},[o,l]),y.useEffect(()=>()=>{qe(u)},[]);const f=y.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(h){if(c.current)return;const p=qn(h.nativeEvent);if(a&&ne(p)){if(il()&&!h.relatedTarget){if(!d.current&&!X7(p))return}else if(!Q7(p))return}r(!0,h.nativeEvent,"focus")},onBlur(h){c.current=!1;const p=h.relatedTarget,m=h.nativeEvent,v=ne(p)&&p.hasAttribute(to("focus-guard"))&&p.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var b;const C=ta(s.domReference?s.domReference.ownerDocument:document);!p&&C===s.domReference||ir((b=i.current.floatingContext)==null?void 0:b.refs.floating.current,C)||ir(s.domReference,C)||v||r(!1,m,"focus")})}}),[i,s.domReference,r,a]);return y.useMemo(()=>l?{reference:f}:{},[l,f])}function sl(t,e,n){const r=new Map,o=n==="item";let i=t;if(o&&t){const{[Wd]:s,[Kd]:l,...a}=t;i=a}return{...n==="floating"&&{tabIndex:-1,[J4]:""},...i,...e.map(s=>{const l=s?s[n]:null;return typeof l=="function"?t?l(t):null:l}).concat(t).reduce((s,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[Wd,Kd].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var f,h=arguments.length,p=new Array(h),m=0;m<h;m++)p[m]=arguments[m];return(f=r.get(c))==null?void 0:f.map(v=>v(...p)).find(v=>v!==void 0)}}}else s[c]=u}),s),{})}}function g5(t){t===void 0&&(t=[]);const e=t.map(l=>l?.reference),n=t.map(l=>l?.floating),r=t.map(l=>l?.item),o=y.useCallback(l=>sl(l,t,"reference"),e),i=y.useCallback(l=>sl(l,t,"floating"),n),s=y.useCallback(l=>sl(l,t,"item"),r);return y.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const y5=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function v5(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:i,floatingId:s}=t,{enabled:l=!0,role:a="dialog"}=e,c=cc(),u=((n=i.domReference)==null?void 0:n.id)||c,d=y.useMemo(()=>{var C;return((C=e4(i.floating))==null?void 0:C.id)||s},[i.floating,s]),f=(r=y5.get(a))!=null?r:a,p=uc()!=null,m=y.useMemo(()=>f==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":o?d:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[f,d,p,o,u,a]),v=y.useMemo(()=>{const C={id:d,...f&&{role:f}};return f==="tooltip"||a==="label"?C:{...C,...f==="menu"&&{"aria-labelledby":u}}},[f,d,u,a]),b=y.useCallback(C=>{let{active:x,selected:w}=C;const E={role:"option",...x&&{id:d+"-fui-option"}};switch(a){case"select":case"combobox":return{...E,"aria-selected":w}}return{}},[d,a]);return y.useMemo(()=>l?{reference:m,floating:v,item:b}:{},[l,m,v,b])}function b5({initialOpen:t=!1,placement:e="top",open:n,onOpenChange:r,delay:o=600,closeDelay:i=0}={}){const[s,l]=y.useState(t),a=n??s,c=r??l,u=p5({placement:e,open:a,onOpenChange:c,whileElementsMounted:wm,middleware:[Em(4),Tm({crossAxis:e.includes("-"),fallbackAxisSideDirection:"start",padding:4}),Mm({padding:4})]}),d=u.context,f=o5(d,{mouseOnly:!0,move:!1,restMs:o,enabled:n==null,delay:{close:i}}),h=m5(d,{enabled:n==null}),p=f5(d),m=v5(d,{role:"tooltip"}),v=g5([f,h,p,m]);return y.useMemo(()=>({open:a,setOpen:c,...v,...u}),[a,c,v,u])}const oa=y.createContext(null);function Nm(){const t=y.useContext(oa);if(t==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return t}function Im({children:t,...e}){const n=b5(e);return e.useDelayGroup?g.jsx(s5,{delay:{open:e.delay??0,close:e.closeDelay??0},timeoutMs:e.timeout,children:g.jsx(oa.Provider,{value:n,children:t})}):g.jsx(oa.Provider,{value:n,children:t})}const Lm=y.forwardRef(function({children:e,asChild:n=!1,...r},o){const i=Nm(),s=y.isValidElement(e)?parseInt(y.version,10)>=19?e.props.ref:e.ref:void 0,l=Am([i.refs.setReference,o,s]);if(n&&y.isValidElement(e)){const a={"data-tooltip-state":i.open?"open":"closed"};return y.cloneElement(e,i.getReferenceProps({ref:l,...r,...typeof e.props=="object"?e.props:{},...a}))}return g.jsx("button",{ref:l,"data-tooltip-state":i.open?"open":"closed",...i.getReferenceProps(r),children:e})}),Dm=y.forwardRef(function({style:e,children:n,portal:r=!0,portalProps:o={},...i},s){const l=Nm(),a=Am([l.refs.setFloating,s]);if(!l.open)return null;const c=g.jsx("div",{ref:a,style:{...l.floatingStyles,...e},...l.getFloatingProps(i),className:"tiptap-tooltip",children:n});return r?g.jsx(a5,{...o,children:c}):c});Im.displayName="Tooltip";Lm.displayName="TooltipTrigger";Dm.displayName="TooltipContent";const ia=5*1024*1024,C5={mod:"⌘",command:"⌘",meta:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",option:"⌥",shift:"⇧",backspace:"Del",delete:"⌦",enter:"⏎",escape:"⎋",capslock:"⇪"};function Ee(...t){return t.filter(Boolean).join(" ")}function x5(){return typeof navigator<"u"&&navigator.platform.toLowerCase().includes("mac")}const w5=(t,e,n=!0)=>{if(e){const r=t.toLowerCase();return C5[r]||(n?t.toUpperCase():t)}return n?t.charAt(0).toUpperCase()+t.slice(1):t},mt=t=>{const{shortcutKeys:e,delimiter:n="+",capitalize:r=!0}=t;return e?e.split(n).map(o=>o.trim()).map(o=>w5(o,x5(),r)):[]},no=(t,e)=>e?.schema?e.schema.spec.marks.get(t)!==void 0:!1,Bt=(t,e)=>e?.schema?e.schema.spec.nodes.get(t)!==void 0:!1;function S5(t){const{state:e,view:n}=t,{doc:r,selection:o}=e,i=q.findFrom(o.$to,1,!0);if(i)return n.dispatch(e.tr.setSelection(i).scrollIntoView()),!0;const s=e.schema.nodes.paragraph;if(!s)return console.warn("No paragraph node type found in schema."),!1;const l=r.content.size,a=s.create();let c=e.tr.insert(l,a);const u=c.doc.resolve(l+1);return c=c.setSelection(V.near(u)).scrollIntoView(),n.dispatch(c),!0}function gt(t){return typeof t=="number"&&t>=0}function ss(t,e){if(!t)return!1;const n=Array.isArray(e)?e:[e],r=n.some(o=>t.extensionManager.extensions.some(i=>i.name===o));return r||console.warn(`None of the extensions [${n.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`),r}function k5(t,e){try{const n=t.state.doc.nodeAt(e);return n||(console.warn(`No node found at position ${e}`),null)}catch(n){return console.error(`Error getting node at position ${e}:`,n),null}}function fn(t){const{editor:e,node:n,nodePos:r}=t;if(!e||!e.state?.doc)return null;const o=n!=null,i=gt(r);if(!o&&!i)return null;if(o){let s=-1,l=null;if(e.state.doc.descendants((a,c)=>a===n?(s=c,l=a,!1):!0),s!==-1&&l!==null)return{pos:s,node:l}}if(i){const s=k5(e,r);if(s)return{pos:r,node:s}}return null}function _t(t,e=[]){if(!t||!t.state.selection)return!1;const{state:n}=t,{selection:r}=n;if(r.empty)return!1;if(r instanceof B){const o=r.node;return o?e.includes(o.type.name):!1}return!1}const E5=async(t,e,n)=>{if(!t)throw new Error("No file provided");if(t.size>ia)throw new Error(`File size exceeds maximum allowed (${ia/(1024*1024)}MB)`);for(let r=0;r<=100;r+=10){if(n?.aborted)throw new Error("Upload cancelled");await new Promise(o=>setTimeout(o,500)),e?.({progress:r})}return"/images/tiptap-ui-placeholder-image.jpg"},M5=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function T5(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return!t||t.replace(M5,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}function A5(t,e,n){try{const r=new URL(t,e);if(T5(r.href,n))return r.href}catch{}return"#"}const R5=({shortcuts:t})=>t.length===0?null:g.jsx("div",{children:t.map((e,n)=>g.jsxs(y.Fragment,{children:[n>0&&g.jsx("kbd",{children:"+"}),g.jsx("kbd",{children:e})]},n))}),fe=y.forwardRef(({className:t,children:e,tooltip:n,showTooltip:r=!0,shortcutKeys:o,"aria-label":i,...s},l)=>{const a=y.useMemo(()=>mt({shortcutKeys:o}),[o]);return!n||!r?g.jsx("button",{className:Ee("tiptap-button",t),ref:l,"aria-label":i,...s,children:e}):g.jsxs(Im,{delay:200,children:[g.jsx(Lm,{className:Ee("tiptap-button",t),ref:l,"aria-label":i,...s,children:e}),g.jsxs(Dm,{children:[n,g.jsx(R5,{shortcuts:a})]})]})});fe.displayName="Button";const Nn=y.forwardRef(({className:t,children:e,orientation:n="vertical",...r},o)=>g.jsx("div",{ref:o,className:Ee("tiptap-button-group",t),"data-orientation":n,role:"group",...r,children:e}));Nn.displayName="ButtonGroup";function ef({orientation:t="horizontal",size:e,style:n={},...r}){const o={...n,...t==="horizontal"&&!e&&{flex:1},...e&&{width:t==="vertical"?"1px":e,height:t==="horizontal"?"1px":e}};return g.jsx("div",{...r,style:o})}const ls=y.forwardRef(({decorative:t,orientation:e="vertical",className:n,...r},o)=>{const s=t?{role:"none"}:{"aria-orientation":e==="vertical"?e:void 0,role:"separator"};return g.jsx("div",{className:Ee("tiptap-separator",n),"data-orientation":e,...s,...r,ref:o})});ls.displayName="Separator";function Pm({editor:t,containerRef:e,query:n,items:r,onSelect:o,onClose:i,orientation:s="vertical",autoSelectFirstItem:l=!0}){const[a,c]=y.useState(l?0:-1);return y.useEffect(()=>{const u=f=>{if(!r.length)return!1;const h=()=>c(m=>m===-1?0:(m+1)%r.length),p=()=>c(m=>m===-1?r.length-1:(m-1+r.length)%r.length);switch(f.key){case"ArrowUp":return s==="horizontal"?!1:(f.preventDefault(),p(),!0);case"ArrowDown":return s==="horizontal"?!1:(f.preventDefault(),h(),!0);case"ArrowLeft":return s==="vertical"?!1:(f.preventDefault(),p(),!0);case"ArrowRight":return s==="vertical"?!1:(f.preventDefault(),h(),!0);case"Tab":return f.preventDefault(),f.shiftKey?p():h(),!0;case"Home":return f.preventDefault(),c(0),!0;case"End":return f.preventDefault(),c(r.length-1),!0;case"Enter":return f.isComposing?!1:(f.preventDefault(),a!==-1&&r[a]&&o?.(r[a]),!0);case"Escape":return f.preventDefault(),i?.(),!0;default:return!1}};let d=null;if(t?d=t.view.dom:e?.current&&(d=e.current),d)return d.addEventListener("keydown",u,!0),()=>{d?.removeEventListener("keydown",u,!0)}},[t,e,r,a,o,i,s]),y.useEffect(()=>{n&&c(l?0:-1)},[n,l]),{selectedIndex:r.length?a:void 0,setSelectedIndex:c}}const tf=(t,e)=>{typeof t=="function"?t(e):t&&typeof t=="object"&&"current"in t&&(t.current=e)},O5=(t,e)=>{const n=y.useRef(null);return y.useCallback(r=>{t&&"current"in t&&(t.current=r),n.current&&tf(n.current,null),n.current=e,e&&tf(e,r)},[t,e])},N5=t=>{const[e,n]=y.useState([]),r=y.useCallback(()=>t.current?Array.from(t.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[t]);y.useEffect(()=>{const i=t.current;if(!i)return;const s=()=>n(r());s();const l=new MutationObserver(s);return l.observe(i,{childList:!0,subtree:!0}),()=>l.disconnect()},[r,t]);const{selectedIndex:o}=Pm({containerRef:t,items:e,orientation:"horizontal",onSelect:i=>i.click(),autoSelectFirstItem:!1});y.useEffect(()=>{const i=t.current;if(!i)return;const s=a=>{const c=a.target;i.contains(c)&&c.setAttribute("data-focus-visible","true")},l=a=>{const c=a.target;i.contains(c)&&c.removeAttribute("data-focus-visible")};return i.addEventListener("focus",s,!0),i.addEventListener("blur",l,!0),()=>{i.removeEventListener("focus",s,!0),i.removeEventListener("blur",l,!0)}},[t]),y.useEffect(()=>{o!==void 0&&e[o]&&e[o].focus()},[o,e])},fc=y.forwardRef(({children:t,className:e,variant:n="fixed",...r},o)=>{const i=y.useRef(null),s=O5(i,o);return N5(i),g.jsx("div",{ref:s,role:"toolbar","aria-label":"toolbar","data-variant":n,className:Ee("tiptap-toolbar",e),...r,children:t})});fc.displayName="Toolbar";const Et=y.forwardRef(({children:t,className:e,...n},r)=>g.jsx("div",{ref:r,role:"group",className:Ee("tiptap-toolbar-group",e),...n,children:t}));Et.displayName="ToolbarGroup";const Mt=y.forwardRef(({...t},e)=>g.jsx(ls,{ref:e,orientation:"vertical",decorative:!0,...t}));Mt.displayName="ToolbarSeparator";const jm=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z",fill:"currentColor"})}));jm.displayName="CloseIcon";function I5(t){const[e,n]=y.useState([]),r=async l=>{if(l.size>t.maxSize){const d=new Error(`File size exceeds maximum allowed (${t.maxSize/1024/1024}MB)`);return t.onError?.(d),null}const a=new AbortController,c=crypto.randomUUID(),u={id:c,file:l,progress:0,status:"uploading",abortController:a};n(d=>[...d,u]);try{if(!t.upload)throw new Error("Upload function is not defined");const d=await t.upload(l,f=>{n(h=>h.map(p=>p.id===c?{...p,progress:f.progress}:p))},a.signal);if(!d)throw new Error("Upload failed: No URL returned");return a.signal.aborted?null:(n(f=>f.map(h=>h.id===c?{...h,status:"success",url:d,progress:100}:h)),t.onSuccess?.(d),d)}catch(d){return a.signal.aborted||(n(f=>f.map(h=>h.id===c?{...h,status:"error",progress:0}:h)),t.onError?.(d instanceof Error?d:new Error("Upload failed"))),null}};return{fileItems:e,uploadFiles:async l=>{if(!l||l.length===0)return t.onError?.(new Error("No files to upload")),[];if(t.limit&&l.length>t.limit)return t.onError?.(new Error(`Maximum ${t.limit} file${t.limit===1?"":"s"} allowed`)),[];const a=l.map(u=>r(u));return(await Promise.all(a)).filter(u=>u!==null)},removeFileItem:l=>{n(a=>{const c=a.find(u=>u.id===l);return c?.abortController&&c.abortController.abort(),c?.url&&URL.revokeObjectURL(c.url),a.filter(u=>u.id!==l)})},clearAllFiles:()=>{e.forEach(l=>{l.abortController&&l.abortController.abort(),l.url&&URL.revokeObjectURL(l.url)}),n([])}}}const Bm=()=>g.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"tiptap-image-upload-icon",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),g.jsx("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]}),L5=()=>g.jsx("svg",{width:"43",height:"57",viewBox:"0 0 43 57",fill:"currentColor",className:"tiptap-image-upload-dropzone-rect-primary",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z",fill:"currentColor",fillOpacity:"0.11",stroke:"currentColor",strokeWidth:"1.5"})}),D5=()=>g.jsx("svg",{width:"10",height:"10",className:"tiptap-image-upload-dropzone-rect-secondary",viewBox:"0 0 10 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z",fill:"currentColor"})}),P5=({onFile:t,children:e})=>{const[n,r]=y.useState(!1),[o,i]=y.useState(!1),s=u=>{u.preventDefault(),u.stopPropagation(),i(!0)},l=u=>{u.preventDefault(),u.stopPropagation(),u.currentTarget.contains(u.relatedTarget)||(i(!1),r(!1))},a=u=>{u.preventDefault(),u.stopPropagation(),r(!0)},c=u=>{u.preventDefault(),u.stopPropagation(),i(!1),r(!1);const d=Array.from(u.dataTransfer.files);d.length>0&&t(d)};return g.jsx("div",{className:`tiptap-image-upload-drag-area ${o?"drag-active":""} ${n?"drag-over":""}`,onDragEnter:s,onDragLeave:l,onDragOver:a,onDrop:c,children:e})},j5=({fileItem:t,onRemove:e})=>{const n=r=>{if(r===0)return"0 Bytes";const o=1024,i=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(r)/Math.log(o));return`${parseFloat((r/Math.pow(o,s)).toFixed(2))} ${i[s]}`};return g.jsxs("div",{className:"tiptap-image-upload-preview",children:[t.status==="uploading"&&g.jsx("div",{className:"tiptap-image-upload-progress",style:{width:`${t.progress}%`}}),g.jsxs("div",{className:"tiptap-image-upload-preview-content",children:[g.jsxs("div",{className:"tiptap-image-upload-file-info",children:[g.jsx("div",{className:"tiptap-image-upload-file-icon",children:g.jsx(Bm,{})}),g.jsxs("div",{className:"tiptap-image-upload-details",children:[g.jsx("span",{className:"tiptap-image-upload-text",children:t.file.name}),g.jsx("span",{className:"tiptap-image-upload-subtext",children:n(t.file.size)})]})]}),g.jsxs("div",{className:"tiptap-image-upload-actions",children:[t.status==="uploading"&&g.jsxs("span",{className:"tiptap-image-upload-progress-text",children:[t.progress,"%"]}),g.jsx(fe,{type:"button","data-style":"ghost",onClick:r=>{r.stopPropagation(),e()},children:g.jsx(jm,{className:"tiptap-button-icon"})})]})]})]})},B5=({maxSize:t,limit:e})=>g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"tiptap-image-upload-dropzone",children:[g.jsx(L5,{}),g.jsx(D5,{}),g.jsx("div",{className:"tiptap-image-upload-icon-container",children:g.jsx(Bm,{})})]}),g.jsxs("div",{className:"tiptap-image-upload-content",children:[g.jsxs("span",{className:"tiptap-image-upload-text",children:[g.jsx("em",{children:"Click to upload"})," or drag and drop"]}),g.jsxs("span",{className:"tiptap-image-upload-subtext",children:["Maximum ",e," file",e===1?"":"s",", ",t/1024/1024,"MB each."]})]})]}),_5=t=>{const{accept:e,limit:n,maxSize:r}=t.node.attrs,o=y.useRef(null),i=t.extension,s={maxSize:r,limit:n,accept:e,upload:i.options.upload,onSuccess:i.options.onSuccess,onError:i.options.onError},{fileItems:l,uploadFiles:a,removeFileItem:c,clearAllFiles:u}=I5(s),d=async m=>{const v=await a(m);if(v.length>0){const b=t.getPos();if(gt(b)){const C=v.map((x,w)=>{const E=m[w]?.name.replace(/\.[^/.]+$/,"")||"unknown";return{type:i.options.type,attrs:{...i.options,src:x,alt:E,title:E}}});t.editor.chain().focus().deleteRange({from:b,to:b+t.node.nodeSize}).insertContentAt(b,C).run(),S5(t.editor)}}},f=m=>{const v=m.target.files;if(!v||v.length===0){i.options.onError?.(new Error("No file selected"));return}d(Array.from(v))},h=()=>{o.current&&l.length===0&&(o.current.value="",o.current.click())},p=l.length>0;return g.jsxs(Ap,{className:"tiptap-image-upload",tabIndex:0,onClick:h,children:[!p&&g.jsx(P5,{onFile:d,children:g.jsx(B5,{maxSize:r,limit:n})}),p&&g.jsxs("div",{className:"tiptap-image-upload-previews",children:[l.length>1&&g.jsxs("div",{className:"tiptap-image-upload-header",children:[g.jsxs("span",{children:["Uploading ",l.length," files"]}),g.jsx(fe,{type:"button","data-style":"ghost",onClick:m=>{m.stopPropagation(),u()},children:"Clear All"})]}),l.map(m=>g.jsx(j5,{fileItem:m,onRemove:()=>c(m.id)},m.id))]}),g.jsx("input",{ref:o,name:"file",accept:e,type:"file",multiple:n>1,onChange:f,onClick:m=>m.stopPropagation()})]})},H5=Pe.create({name:"imageUpload",group:"block",draggable:!0,atom:!0,addOptions(){return{type:"image",accept:"image/*",limit:1,maxSize:0,upload:void 0,onError:void 0,onSuccess:void 0,HTMLAttributes:{}}},addAttributes(){return{accept:{default:this.options.accept},limit:{default:this.options.limit},maxSize:{default:this.options.maxSize}}},parseHTML(){return[{tag:'div[data-type="image-upload"]'}]},renderHTML({HTMLAttributes:t}){return["div",re({"data-type":"image-upload"},t)]},addNodeView(){return Rp(_5)},addCommands(){return{setImageUploadNode:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addKeyboardShortcuts(){return{Enter:({editor:t})=>{const{selection:e}=t.state,{nodeAfter:n}=e.$from;if(n&&n.type.name==="imageUpload"&&t.isActive("imageUpload")){const r=t.view.nodeDOM(e.$from.pos);if(r&&r instanceof HTMLElement){const o=r.firstChild;if(o&&o instanceof HTMLElement)return o.click(),!0}}return!1}}}}),F5=cx.extend({renderHTML(){return["div",re(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),$5=({node:t,updateAttributes:e,selected:n})=>{const[r,o]=j.useState(!1),[i,s]=j.useState({width:t.attrs.width||300,height:t.attrs.height||"auto"}),l=j.useRef(null),a=j.useRef(null),c=j.useRef(t.attrs.width||300),u=t.attrs.imageId||`img-${Date.now()}`;j.useEffect(()=>{s({width:t.attrs.width||300,height:t.attrs.height||"auto"})},[t.attrs.width,t.attrs.height]);const d=j.useCallback(v=>{v.preventDefault(),v.stopPropagation(),o(!0);const b=v.clientX,C=typeof i.width=="number"?i.width:300,x=l.current;let w=1;x&&x.naturalWidth&&x.naturalHeight&&(w=x.naturalWidth/x.naturalHeight);const E=S=>{const M=S.clientX-b,N=Math.max(50,C+M);c.current=N;const P=i.height==="auto"?"auto":Math.max(30,N/w);s({width:N,height:P}),a.current&&(a.current.style.width=`${N}px`,P!=="auto"&&(a.current.style.height=`${P}px`))},k=()=>{o(!1);const S=Math.round(c.current);e({width:S}),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",k)};document.addEventListener("mousemove",E),document.addEventListener("mouseup",k)},[i,e]),f=j.useCallback(()=>{i.height==="auto"&&l.current&&s(v=>({...v,height:"auto"}))},[i.width,i.height]),h={position:"relative",display:"inline-block",width:i.width,height:i.height==="auto"?"auto":i.height,maxWidth:"100%",userSelect:r?"none":"auto",outline:n?"2px solid #007bff":"none",outlineOffset:"2px"},p={width:"100%",height:i.height==="auto"?"auto":"100%",display:"block",objectFit:"contain"},m={position:"absolute",bottom:-5,right:-5,width:12,height:12,background:"#007bff",border:"2px solid white",borderRadius:"50%",cursor:"nw-resize",opacity:n||r?1:0,transition:"opacity 0.2s ease",zIndex:10,boxShadow:"0 2px 4px rgba(0,0,0,0.2)"};return g.jsx(Ap,{className:"resizable-image-wrapper","data-drag-handle":"",children:g.jsxs("div",{ref:a,id:`resizable-image-${u}`,style:h,onMouseEnter:()=>{if(a.current){const v=a.current.querySelector(".resize-handle");v&&(v.style.opacity="1")}},onMouseLeave:()=>{if(!r&&!n&&a.current){const v=a.current.querySelector(".resize-handle");v&&(v.style.opacity="0")}},children:[g.jsx("img",{ref:l,src:t.attrs.src,alt:t.attrs.alt||"",title:t.attrs.title||"",style:p,onLoad:f,draggable:!1}),g.jsx("div",{className:"resize-handle",style:m,onMouseDown:d,title:"拖拽調整圖片大小"}),(n||r)&&g.jsxs("div",{style:{position:"absolute",top:-25,left:0,background:"rgba(0, 0, 0, 0.8)",color:"white",padding:"2px 6px",borderRadius:"3px",fontSize:"12px",whiteSpace:"nowrap",zIndex:11},children:[typeof i.width=="number"?Math.round(i.width):i.width," ","×"," ",i.height==="auto"?"auto":typeof i.height=="number"?Math.round(i.height):i.height]})]})})},V5=Pe.create({name:"resizableImage",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},width:{default:null,parseHTML:t=>{const e=t.getAttribute("width");return e?parseInt(e):null},renderHTML:t=>t.width?{width:t.width,height:"auto"}:{}},imageId:{default:null,parseHTML:t=>t.getAttribute("data-image-id"),renderHTML:t=>t.imageId?{"data-image-id":t.imageId}:{}}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])',getAttrs:t=>{const e=t,n=e.getAttribute("width"),r=e.getAttribute("data-image-id");return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title"),width:n?parseInt(n):300,imageId:r||`img-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}}}]},renderHTML({HTMLAttributes:t}){return["img",re(this.options.HTMLAttributes,t)]},addCommands(){return{setResizableImage:t=>({commands:e})=>{const n=`img-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return e.insertContent({type:this.name,attrs:{...t,imageId:n,width:t.width||300}})},setImageSize:t=>({commands:e})=>e.updateAttributes(this.name,t)}},addNodeView(){return Rp($5)}}),hc=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",fill:"currentColor"})}));hc.displayName="ChevronDownIcon";function oe(t){const{editor:e}=FC(),n=y.useMemo(()=>t||e,[t,e]);return Ep({editor:n,selector(o){return o.editor?{editor:o.editor,editorState:o.editor.state,canCommand:o.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}const yt=y.forwardRef(({variant:t,size:e="default",appearance:n="default",trimText:r=!1,className:o,children:i,...s},l)=>g.jsx("div",{ref:l,className:`tiptap-badge ${o||""}`,"data-style":t,"data-size":e,"data-appearance":n,"data-text-trim":r?"on":"off",...s,children:i}));yt.displayName="Badge";function z5({level:t,shortcutKeys:e=Km[t]}){return g.jsx(yt,{children:mt({shortcutKeys:e})})}const _m=y.forwardRef(({editor:t,level:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=oe(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,Icon:v,shortcutKeys:b}=W5({editor:u,level:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&p()},[p,s]);return d?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(z5,{level:e,shortcutKeys:b})]})}):null});_m.displayName="HeadingButton";const Hm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",fill:"currentColor"})]}));Hm.displayName="HeadingOneIcon";const Fm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",fill:"currentColor"})]}));Fm.displayName="HeadingTwoIcon";const $m=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",fill:"currentColor"})]}));$m.displayName="HeadingThreeIcon";const Vm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),g.jsx("path",{d:"M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",fill:"currentColor"})]}));Vm.displayName="HeadingFourIcon";const zm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z",fill:"currentColor"})]}));zm.displayName="HeadingFiveIcon";const Um=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z",fill:"currentColor"})]}));Um.displayName="HeadingSixIcon";const Wm={1:Hm,2:Fm,3:$m,4:Vm,5:zm,6:Um},Km={1:"ctrl+alt+1",2:"ctrl+alt+2",3:"ctrl+alt+3",4:"ctrl+alt+4",5:"ctrl+alt+5",6:"ctrl+alt+6"};function Wr(t,e,n=!0){if(!t||!t.isEditable||!Bt("heading",t)||_t(t,["image"]))return!1;if(!n)return e?t.can().setNode("heading",{level:e}):t.can().setNode("heading");try{const o=t.view.state,i=o.selection;if(i.empty||i instanceof V){const s=fn({editor:t,node:o.selection.$anchor.node(1)})?.pos;if(!gt(s))return!1}return!0}catch{return!1}}function pc(t,e){return!t||!t.isEditable?!1:Array.isArray(e)?e.some(n=>t.isActive("heading",{level:n})):e?t.isActive("heading",{level:e}):t.isActive("heading")}function U5(t,e){if(!t||!t.isEditable)return!1;const n=Array.isArray(e)?e:[e],r=n.find(o=>Wr(t,o));if(!r)return!1;try{const o=t.view;let i=o.state,s=i.tr;if(i.selection.empty||i.selection instanceof V){const d=fn({editor:t,node:i.selection.$anchor.node(1)})?.pos;if(!gt(d))return!1;s=s.setSelection(B.create(i.doc,d)),o.dispatch(s),i=o.state}const l=i.selection;let a=t.chain().focus();if(l instanceof B){const d=l.node.firstChild?.firstChild,f=l.node.lastChild?.lastChild,h=d?l.from+d.nodeSize:l.from+1,p=f?l.to-f.nodeSize:l.to-1;a=a.setTextSelection({from:h,to:p}).clearNodes()}return(n.some(d=>t.isActive("heading",{level:d}))?a.setNode("paragraph"):a.setNode("heading",{level:r})).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function qm(t){const{editor:e,level:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!Bt("heading",e)?!1:r&&!e.isActive("code")?Array.isArray(n)?n.some(o=>Wr(e,o)):Wr(e,n):!0}function W5(t){const{editor:e,level:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=oe(e),[s,l]=y.useState(!0),a=Wr(i,n),c=pc(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(qm({editor:i,level:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=U5(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleToggle:u,canToggle:a,label:`Heading ${n}`,shortcutKeys:Km[n],Icon:Wm[n]}}function J(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t?.(o),n===!1||!o.defaultPrevented)return e?.(o)}}function nf(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function as(...t){return e=>{let n=!1;const r=t.map(o=>{const i=nf(o,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():nf(t[o],null)}}}}function Re(...t){return y.useCallback(as(...t),t)}function ur(t,e=[]){let n=[];function r(i,s){const l=y.createContext(s),a=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,m=f?.[t]?.[a]||l,v=y.useMemo(()=>p,Object.values(p));return g.jsx(m.Provider,{value:v,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[t]?.[a]||l,p=y.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>y.createContext(s));return function(l){const a=l?.[t]||i;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])}};return o.scopeName=t,[r,K5(o,...e)]}function K5(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((l,{useScope:a,scopeName:c})=>{const d=a(i)[`__scope${c}`];return{...l,...d}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var cn=globalThis?.document?y.useLayoutEffect:()=>{},q5=y[" useInsertionEffect ".trim().toString()]||cn;function mc({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,i,s]=G5({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:o;{const u=y.useRef(t!==void 0);y.useEffect(()=>{const d=u.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}const c=y.useCallback(u=>{if(l){const d=J5(u)?u(t):u;d!==t&&s.current?.(d)}else i(u)},[l,t,i,s]);return[a,c]}function G5({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),o=y.useRef(n),i=y.useRef(e);return q5(()=>{i.current=e},[e]),y.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}function J5(t){return typeof t=="function"}function Kr(t){const e=Z5(t),n=y.forwardRef((r,o)=>{const{children:i,...s}=r,l=y.Children.toArray(i),a=l.find(X5);if(a){const c=a.props.children,u=l.map(d=>d===a?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return g.jsx(e,{...s,ref:o,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return g.jsx(e,{...s,ref:o,children:i})});return n.displayName=`${t}.Slot`,n}function Z5(t){const e=y.forwardRef((n,r)=>{const{children:o,...i}=n;if(y.isValidElement(o)){const s=e3(o),l=Q5(i,o.props);return o.type!==y.Fragment&&(l.ref=r?as(r,s):s),y.cloneElement(o,l)}return y.Children.count(o)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Y5=Symbol("radix.slottable");function X5(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Y5}function Q5(t,e){const n={...e};for(const r in e){const o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...t,...n}}function e3(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var t3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Me=t3.reduce((t,e)=>{const n=Kr(`Primitive.${e}`),r=y.forwardRef((o,i)=>{const{asChild:s,...l}=o,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Gm(t,e){t&&fa.flushSync(()=>t.dispatchEvent(e))}function Jm(t){const e=t+"CollectionProvider",[n,r]=ur(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:v,children:b}=m,C=j.useRef(null),x=j.useRef(new Map).current;return g.jsx(o,{scope:v,itemMap:x,collectionRef:C,children:b})};s.displayName=e;const l=t+"CollectionSlot",a=Kr(l),c=j.forwardRef((m,v)=>{const{scope:b,children:C}=m,x=i(l,b),w=Re(v,x.collectionRef);return g.jsx(a,{ref:w,children:C})});c.displayName=l;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=Kr(u),h=j.forwardRef((m,v)=>{const{scope:b,children:C,...x}=m,w=j.useRef(null),E=Re(v,w),k=i(u,b);return j.useEffect(()=>(k.itemMap.set(w,{ref:w,...x}),()=>void k.itemMap.delete(w))),g.jsx(f,{[d]:"",ref:E,children:C})});h.displayName=u;function p(m){const v=i(t+"CollectionConsumer",m);return j.useCallback(()=>{const C=v.collectionRef.current;if(!C)return[];const x=Array.from(C.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((k,S)=>x.indexOf(k.ref.current)-x.indexOf(S.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:c,ItemSlot:h},p,r]}var n3=y.createContext(void 0);function Zm(t){const e=y.useContext(n3);return t||e||"ltr"}function Pt(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>e.current?.(...n),[])}function r3(t,e=globalThis?.document){const n=Pt(t);y.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var o3="DismissableLayer",sa="dismissableLayer.update",i3="dismissableLayer.pointerDownOutside",s3="dismissableLayer.focusOutside",rf,Ym=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gc=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...a}=t,c=y.useContext(Ym),[u,d]=y.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=y.useState({}),p=Re(e,S=>d(S)),m=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(v),C=u?m.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,w=C>=b,E=c3(S=>{const M=S.target,N=[...c.branches].some(P=>P.contains(M));!w||N||(o?.(S),s?.(S),S.defaultPrevented||l?.())},f),k=u3(S=>{const M=S.target;[...c.branches].some(P=>P.contains(M))||(i?.(S),s?.(S),S.defaultPrevented||l?.())},f);return r3(S=>{C===c.layers.size-1&&(r?.(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},f),y.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(rf=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),of(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=rf)}},[u,f,n,c]),y.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),of())},[u,c]),y.useEffect(()=>{const S=()=>h({});return document.addEventListener(sa,S),()=>document.removeEventListener(sa,S)},[]),g.jsx(Me.div,{...a,ref:p,style:{pointerEvents:x?w?"auto":"none":void 0,...t.style},onFocusCapture:J(t.onFocusCapture,k.onFocusCapture),onBlurCapture:J(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:J(t.onPointerDownCapture,E.onPointerDownCapture)})});gc.displayName=o3;var l3="DismissableLayerBranch",a3=y.forwardRef((t,e)=>{const n=y.useContext(Ym),r=y.useRef(null),o=Re(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),g.jsx(Me.div,{...t,ref:o})});a3.displayName=l3;function c3(t,e=globalThis?.document){const n=Pt(t),r=y.useRef(!1),o=y.useRef(()=>{});return y.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let a=function(){Xm(i3,n,c,{discrete:!0})};const c={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=a,e.addEventListener("click",o.current,{once:!0})):a()}else e.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function u3(t,e=globalThis?.document){const n=Pt(t),r=y.useRef(!1);return y.useEffect(()=>{const o=i=>{i.target&&!r.current&&Xm(s3,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function of(){const t=new CustomEvent(sa);document.dispatchEvent(t)}function Xm(t,e,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?Gm(o,i):o.dispatchEvent(i)}var ll=0;function Qm(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??sf()),document.body.insertAdjacentElement("beforeend",t[1]??sf()),ll++,()=>{ll===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),ll--}},[])}function sf(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var al="focusScope.autoFocusOnMount",cl="focusScope.autoFocusOnUnmount",lf={bubbles:!1,cancelable:!0},d3="FocusScope",yc=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=t,[l,a]=y.useState(null),c=Pt(o),u=Pt(i),d=y.useRef(null),f=Re(e,m=>a(m)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let m=function(x){if(h.paused||!l)return;const w=x.target;l.contains(w)?d.current=w:Vt(d.current,{select:!0})},v=function(x){if(h.paused||!l)return;const w=x.relatedTarget;w!==null&&(l.contains(w)||Vt(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const E of x)E.removedNodes.length>0&&Vt(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const C=new MutationObserver(b);return l&&C.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),C.disconnect()}}},[r,l,h.paused]),y.useEffect(()=>{if(l){cf.add(h);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(al,lf);l.addEventListener(al,c),l.dispatchEvent(b),b.defaultPrevented||(f3(y3(e1(l)),{select:!0}),document.activeElement===m&&Vt(l))}return()=>{l.removeEventListener(al,c),setTimeout(()=>{const b=new CustomEvent(cl,lf);l.addEventListener(cl,u),l.dispatchEvent(b),b.defaultPrevented||Vt(m??document.body,{select:!0}),l.removeEventListener(cl,u),cf.remove(h)},0)}}},[l,c,u,h]);const p=y.useCallback(m=>{if(!n&&!r||h.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(v&&b){const C=m.currentTarget,[x,w]=h3(C);x&&w?!m.shiftKey&&b===w?(m.preventDefault(),n&&Vt(x,{select:!0})):m.shiftKey&&b===x&&(m.preventDefault(),n&&Vt(w,{select:!0})):b===C&&m.preventDefault()}},[n,r,h.paused]);return g.jsx(Me.div,{tabIndex:-1,...s,ref:f,onKeyDown:p})});yc.displayName=d3;function f3(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Vt(r,{select:e}),document.activeElement!==n)return}function h3(t){const e=e1(t),n=af(e,t),r=af(e.reverse(),t);return[n,r]}function e1(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function af(t,e){for(const n of t)if(!p3(n,{upTo:e}))return n}function p3(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function m3(t){return t instanceof HTMLInputElement&&"select"in t}function Vt(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&m3(t)&&e&&t.select()}}var cf=g3();function g3(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=uf(t,e),t.unshift(e)},remove(e){t=uf(t,e),t[0]?.resume()}}}function uf(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function y3(t){return t.filter(e=>e.tagName!=="A")}var v3=y[" useId ".trim().toString()]||(()=>{}),b3=0;function Di(t){const[e,n]=y.useState(v3());return cn(()=>{n(r=>r??String(b3++))},[t]),t||(e?`radix-${e}`:"")}var C3="Arrow",t1=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...i}=t;return g.jsx(Me.svg,{...i,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});t1.displayName=C3;var x3=t1;function w3(t){const[e,n]=y.useState(void 0);return cn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,l;if("borderBoxSize"in i){const a=i.borderBoxSize,c=Array.isArray(a)?a[0]:a;s=c.inlineSize,l=c.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var vc="Popper",[n1,cs]=ur(vc),[S3,r1]=n1(vc),o1=t=>{const{__scopePopper:e,children:n}=t,[r,o]=y.useState(null);return g.jsx(S3,{scope:e,anchor:r,onAnchorChange:o,children:n})};o1.displayName=vc;var i1="PopperAnchor",s1=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,i=r1(i1,n),s=y.useRef(null),l=Re(e,s),a=y.useRef(null);return y.useEffect(()=>{const c=a.current;a.current=r?.current||s.current,c!==a.current&&i.onAnchorChange(a.current)}),r?null:g.jsx(Me.div,{...o,ref:l})});s1.displayName=i1;var bc="PopperContent",[k3,E3]=n1(bc),l1=y.forwardRef((t,e)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:a=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=t,v=r1(bc,n),[b,C]=y.useState(null),x=Re(e,Y=>C(Y)),[w,E]=y.useState(null),k=w3(w),S=k?.width??0,M=k?.height??0,N=r+(i!=="center"?"-"+i:""),P=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},W=Array.isArray(c)?c:[c],z=W.length>0,H={padding:P,boundary:W.filter(T3),altBoundary:z},{refs:I,floatingStyles:_,placement:F,isPositioned:L,middlewareData:T}=km({strategy:"fixed",placement:N,whileElementsMounted:(...Y)=>wm(...Y,{animationFrame:h==="always"}),elements:{reference:v.anchor},middleware:[Em({mainAxis:o+M,alignmentAxis:s}),a&&Mm({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?W4():void 0,...H}),a&&Tm({...H}),K4({...H,apply:({elements:Y,rects:ee,availableWidth:We,availableHeight:vt})=>{const{width:jn,height:bs}=ee.reference,Bn=Y.floating.style;Bn.setProperty("--radix-popper-available-width",`${We}px`),Bn.setProperty("--radix-popper-available-height",`${vt}px`),Bn.setProperty("--radix-popper-anchor-width",`${jn}px`),Bn.setProperty("--radix-popper-anchor-height",`${bs}px`)}}),w&&G4({element:w,padding:l}),A3({arrowWidth:S,arrowHeight:M}),f&&q4({strategy:"referenceHidden",...H})]}),[R,U]=u1(F),Q=Pt(p);cn(()=>{L&&Q?.()},[L,Q]);const K=T.arrow?.x,Z=T.arrow?.y,Ue=T.arrow?.centerOffset!==0,[se,ge]=y.useState();return cn(()=>{b&&ge(window.getComputedStyle(b).zIndex)},[b]),g.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:L?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[T.transformOrigin?.x,T.transformOrigin?.y].join(" "),...T.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(k3,{scope:n,placedSide:R,onArrowChange:E,arrowX:K,arrowY:Z,shouldHideArrow:Ue,children:g.jsx(Me.div,{"data-side":R,"data-align":U,...m,ref:x,style:{...m.style,animation:L?void 0:"none"}})})})});l1.displayName=bc;var a1="PopperArrow",M3={top:"bottom",right:"left",bottom:"top",left:"right"},c1=y.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,i=E3(a1,r),s=M3[i.placedSide];return g.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:g.jsx(x3,{...o,ref:n,style:{...o.style,display:"block"}})})});c1.displayName=a1;function T3(t){return t!==null}var A3=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:o}=e,s=o.arrow?.centerOffset!==0,l=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[c,u]=u1(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(o.arrow?.x??0)+l/2,h=(o.arrow?.y??0)+a/2;let p="",m="";return c==="bottom"?(p=s?d:`${f}px`,m=`${-a}px`):c==="top"?(p=s?d:`${f}px`,m=`${r.floating.height+a}px`):c==="right"?(p=`${-a}px`,m=s?d:`${h}px`):c==="left"&&(p=`${r.floating.width+a}px`,m=s?d:`${h}px`),{data:{x:p,y:m}}}});function u1(t){const[e,n="center"]=t.split("-");return[e,n]}var d1=o1,Cc=s1,f1=l1,h1=c1,R3="Portal",xc=y.forwardRef((t,e)=>{const{container:n,...r}=t,[o,i]=y.useState(!1);cn(()=>i(!0),[]);const s=n||o&&globalThis?.document?.body;return s?_i.createPortal(g.jsx(Me.div,{...r,ref:e}),s):null});xc.displayName=R3;function O3(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Ln=t=>{const{present:e,children:n}=t,r=N3(e),o=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Re(r.ref,I3(o));return typeof n=="function"||r.isPresent?y.cloneElement(o,{ref:i}):null};Ln.displayName="Presence";function N3(t){const[e,n]=y.useState(),r=y.useRef(null),o=y.useRef(t),i=y.useRef("none"),s=t?"mounted":"unmounted",[l,a]=O3(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const c=Mo(r.current);i.current=l==="mounted"?c:"none"},[l]),cn(()=>{const c=r.current,u=o.current;if(u!==t){const f=i.current,h=Mo(c);t?a("MOUNT"):h==="none"||c?.display==="none"?a("UNMOUNT"):a(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,a]),cn(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const m=Mo(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&m&&(a("ANIMATION_END"),!o.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=h=>{h.target===e&&(i.current=Mo(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Mo(t){return t?.animationName||"none"}function I3(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var ul="rovingFocusGroup.onEntryFocus",L3={bubbles:!1,cancelable:!0},ro="RovingFocusGroup",[la,p1,D3]=Jm(ro),[P3,m1]=ur(ro,[D3]),[j3,B3]=P3(ro),g1=y.forwardRef((t,e)=>g.jsx(la.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(la.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(_3,{...t,ref:e})})}));g1.displayName=ro;var _3=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:a,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=t,f=y.useRef(null),h=Re(e,f),p=Zm(i),[m,v]=mc({prop:s,defaultProp:l??null,onChange:a,caller:ro}),[b,C]=y.useState(!1),x=Pt(c),w=p1(n),E=y.useRef(!1),[k,S]=y.useState(0);return y.useEffect(()=>{const M=f.current;if(M)return M.addEventListener(ul,x),()=>M.removeEventListener(ul,x)},[x]),g.jsx(j3,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:y.useCallback(M=>v(M),[v]),onItemShiftTab:y.useCallback(()=>C(!0),[]),onFocusableItemAdd:y.useCallback(()=>S(M=>M+1),[]),onFocusableItemRemove:y.useCallback(()=>S(M=>M-1),[]),children:g.jsx(Me.div,{tabIndex:b||k===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...t.style},onMouseDown:J(t.onMouseDown,()=>{E.current=!0}),onFocus:J(t.onFocus,M=>{const N=!E.current;if(M.target===M.currentTarget&&N&&!b){const P=new CustomEvent(ul,L3);if(M.currentTarget.dispatchEvent(P),!P.defaultPrevented){const W=w().filter(F=>F.focusable),z=W.find(F=>F.active),H=W.find(F=>F.id===m),_=[z,H,...W].filter(Boolean).map(F=>F.ref.current);b1(_,u)}}E.current=!1}),onBlur:J(t.onBlur,()=>C(!1))})})}),y1="RovingFocusGroupItem",v1=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...l}=t,a=Di(),c=i||a,u=B3(y1,n),d=u.currentTabStopId===c,f=p1(n),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:m}=u;return y.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),g.jsx(la.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:g.jsx(Me.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...l,ref:e,onMouseDown:J(t.onMouseDown,v=>{r?u.onItemFocus(c):v.preventDefault()}),onFocus:J(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:J(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=$3(v,u.orientation,u.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let x=f().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const w=x.indexOf(v.currentTarget);x=u.loop?V3(x,w+1):x.slice(w+1)}setTimeout(()=>b1(x))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});v1.displayName=y1;var H3={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function F3(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function $3(t,e,n){const r=F3(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return H3[r]}function b1(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function V3(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var z3=g1,U3=v1,W3=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Fn=new WeakMap,To=new WeakMap,Ao={},dl=0,C1=function(t){return t&&(t.host||C1(t.parentNode))},K3=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=C1(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},q3=function(t,e,n,r){var o=K3(e,Array.isArray(t)?t:[t]);Ao[n]||(Ao[n]=new WeakMap);var i=Ao[n],s=[],l=new Set,a=new Set(o),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=(Fn.get(f)||0)+1,v=(i.get(f)||0)+1;Fn.set(f,m),i.set(f,v),s.push(f),m===1&&p&&To.set(f,!0),v===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return u(e),l.clear(),dl++,function(){s.forEach(function(d){var f=Fn.get(d)-1,h=i.get(d)-1;Fn.set(d,f),i.set(d,h),f||(To.has(d)||d.removeAttribute(r),To.delete(d)),h||d.removeAttribute(n)}),dl--,dl||(Fn=new WeakMap,Fn=new WeakMap,To=new WeakMap,Ao={})}},x1=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=W3(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),q3(r,o,n,"aria-hidden")):function(){return null}},lt=function(){return lt=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},lt.apply(this,arguments)};function w1(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function G3(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var Ho="right-scroll-bar-position",Fo="width-before-scroll-bar",J3="with-scroll-bars-hidden",Z3="--removed-body-scroll-bar-size";function fl(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Y3(t,e){var n=j.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=e,n.facade}var X3=typeof window<"u"?y.useLayoutEffect:y.useEffect,df=new WeakMap;function Q3(t,e){var n=Y3(null,function(r){return t.forEach(function(o){return fl(o,r)})});return X3(function(){var r=df.get(n);if(r){var o=new Set(r),i=new Set(t),s=n.current;o.forEach(function(l){i.has(l)||fl(l,null)}),i.forEach(function(l){o.has(l)||fl(l,s)})}df.set(n,t)},[t]),n}function eS(t){return t}function tS(t,e){e===void 0&&(e=eS);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var s=e(i,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(i),s=n}var a=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function nS(t){t===void 0&&(t={});var e=tS(null);return e.options=lt({async:!0,ssr:!1},t),e}var S1=function(t){var e=t.sideCar,n=w1(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return y.createElement(r,lt({},n))};S1.isSideCarExport=!0;function rS(t,e){return t.useMedium(e),S1}var k1=nS(),hl=function(){},us=y.forwardRef(function(t,e){var n=y.useRef(null),r=y.useState({onScrollCapture:hl,onWheelCapture:hl,onTouchMoveCapture:hl}),o=r[0],i=r[1],s=t.forwardProps,l=t.children,a=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,v=t.allowPinchZoom,b=t.as,C=b===void 0?"div":b,x=t.gapMode,w=w1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=f,k=Q3([n,e]),S=lt(lt({},w),o);return y.createElement(y.Fragment,null,u&&y.createElement(E,{sideCar:k1,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:x}),s?y.cloneElement(y.Children.only(l),lt(lt({},S),{ref:k})):y.createElement(C,lt({},S,{className:a,ref:k}),l))});us.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};us.classNames={fullWidth:Fo,zeroRight:Ho};var oS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function iS(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=oS();return e&&t.setAttribute("nonce",e),t}function sS(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function lS(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var aS=function(){var t=0,e=null;return{add:function(n){t==0&&(e=iS())&&(sS(e,n),lS(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},cS=function(){var t=aS();return function(e,n){y.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},E1=function(){var t=cS(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},uS={left:0,top:0,right:0,gap:0},pl=function(t){return parseInt(t||"",10)||0},dS=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[pl(n),pl(r),pl(o)]},fS=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return uS;var e=dS(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},hS=E1(),Qn="data-scroll-locked",pS=function(t,e,n,r){var o=t.left,i=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),`
174
+ .`.concat(J3,` {
175
+ overflow: hidden `).concat(r,`;
176
+ padding-right: `).concat(l,"px ").concat(r,`;
177
+ }
178
+ body[`).concat(Qn,`] {
179
+ overflow: hidden `).concat(r,`;
180
+ overscroll-behavior: contain;
181
+ `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
182
+ padding-left: `.concat(o,`px;
183
+ padding-top: `).concat(i,`px;
184
+ padding-right: `).concat(s,`px;
185
+ margin-left:0;
186
+ margin-top:0;
187
+ margin-right: `).concat(l,"px ").concat(r,`;
188
+ `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
189
+ }
190
+
191
+ .`).concat(Ho,` {
192
+ right: `).concat(l,"px ").concat(r,`;
193
+ }
194
+
195
+ .`).concat(Fo,` {
196
+ margin-right: `).concat(l,"px ").concat(r,`;
197
+ }
198
+
199
+ .`).concat(Ho," .").concat(Ho,` {
200
+ right: 0 `).concat(r,`;
201
+ }
202
+
203
+ .`).concat(Fo," .").concat(Fo,` {
204
+ margin-right: 0 `).concat(r,`;
205
+ }
206
+
207
+ body[`).concat(Qn,`] {
208
+ `).concat(Z3,": ").concat(l,`px;
209
+ }
210
+ `)},ff=function(){var t=parseInt(document.body.getAttribute(Qn)||"0",10);return isFinite(t)?t:0},mS=function(){y.useEffect(function(){return document.body.setAttribute(Qn,(ff()+1).toString()),function(){var t=ff()-1;t<=0?document.body.removeAttribute(Qn):document.body.setAttribute(Qn,t.toString())}},[])},gS=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;mS();var i=y.useMemo(function(){return fS(o)},[o]);return y.createElement(hS,{styles:pS(i,!e,o,n?"":"!important")})},aa=!1;if(typeof window<"u")try{var Ro=Object.defineProperty({},"passive",{get:function(){return aa=!0,!0}});window.addEventListener("test",Ro,Ro),window.removeEventListener("test",Ro,Ro)}catch{aa=!1}var $n=aa?{passive:!1}:!1,yS=function(t){return t.tagName==="TEXTAREA"},M1=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!yS(t)&&n[e]==="visible")},vS=function(t){return M1(t,"overflowY")},bS=function(t){return M1(t,"overflowX")},hf=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=T1(t,r);if(o){var i=A1(t,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},CS=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},xS=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},T1=function(t,e){return t==="v"?vS(e):bS(e)},A1=function(t,e){return t==="v"?CS(e):xS(e)},wS=function(t,e){return t==="h"&&e==="rtl"?-1:1},SS=function(t,e,n,r,o){var i=wS(t,window.getComputedStyle(e).direction),s=i*r,l=n.target,a=e.contains(l),c=!1,u=s>0,d=0,f=0;do{if(!l)break;var h=A1(t,l),p=h[0],m=h[1],v=h[2],b=m-v-i*p;(p||b)&&T1(t,l)&&(d+=b,f+=p);var C=l.parentNode;l=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!a&&l!==document.body||a&&(e.contains(l)||e===l));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},Oo=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},pf=function(t){return[t.deltaX,t.deltaY]},mf=function(t){return t&&"current"in t?t.current:t},kS=function(t,e){return t[0]===e[0]&&t[1]===e[1]},ES=function(t){return`
211
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
212
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
213
+ `)},MS=0,Vn=[];function TS(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),o=y.useState(MS++)[0],i=y.useState(E1)[0],s=y.useRef(t);y.useEffect(function(){s.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=G3([t.lockRef.current],(t.shards||[]).map(mf),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=y.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=Oo(m),C=n.current,x="deltaX"in m?m.deltaX:C[0]-b[0],w="deltaY"in m?m.deltaY:C[1]-b[1],E,k=m.target,S=Math.abs(x)>Math.abs(w)?"h":"v";if("touches"in m&&S==="h"&&k.type==="range")return!1;var M=hf(S,k);if(!M)return!0;if(M?E=S:(E=S==="v"?"h":"v",M=hf(S,k)),!M)return!1;if(!r.current&&"changedTouches"in m&&(x||w)&&(r.current=E),!E)return!0;var N=r.current||E;return SS(N,v,m,N==="h"?x:w)},[]),a=y.useCallback(function(m){var v=m;if(!(!Vn.length||Vn[Vn.length-1]!==i)){var b="deltaY"in v?pf(v):Oo(v),C=e.current.filter(function(E){return E.name===v.type&&(E.target===v.target||v.target===E.shadowParent)&&kS(E.delta,b)})[0];if(C&&C.should){v.cancelable&&v.preventDefault();return}if(!C){var x=(s.current.shards||[]).map(mf).filter(Boolean).filter(function(E){return E.contains(v.target)}),w=x.length>0?l(v,x[0]):!s.current.noIsolation;w&&v.cancelable&&v.preventDefault()}}},[]),c=y.useCallback(function(m,v,b,C){var x={name:m,delta:v,target:b,should:C,shadowParent:AS(b)};e.current.push(x),setTimeout(function(){e.current=e.current.filter(function(w){return w!==x})},1)},[]),u=y.useCallback(function(m){n.current=Oo(m),r.current=void 0},[]),d=y.useCallback(function(m){c(m.type,pf(m),m.target,l(m,t.lockRef.current))},[]),f=y.useCallback(function(m){c(m.type,Oo(m),m.target,l(m,t.lockRef.current))},[]);y.useEffect(function(){return Vn.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,$n),document.addEventListener("touchmove",a,$n),document.addEventListener("touchstart",u,$n),function(){Vn=Vn.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,$n),document.removeEventListener("touchmove",a,$n),document.removeEventListener("touchstart",u,$n)}},[]);var h=t.removeScrollBar,p=t.inert;return y.createElement(y.Fragment,null,p?y.createElement(i,{styles:ES(o)}):null,h?y.createElement(gS,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function AS(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const RS=rS(k1,TS);var wc=y.forwardRef(function(t,e){return y.createElement(us,lt({},t,{ref:e,sideCar:RS}))});wc.classNames=us.classNames;var ca=["Enter"," "],OS=["ArrowDown","PageUp","Home"],R1=["ArrowUp","PageDown","End"],NS=[...OS,...R1],IS={ltr:[...ca,"ArrowRight"],rtl:[...ca,"ArrowLeft"]},LS={ltr:["ArrowLeft"],rtl:["ArrowRight"]},oo="Menu",[qr,DS,PS]=Jm(oo),[Dn,O1]=ur(oo,[PS,cs,m1]),ds=cs(),N1=m1(),[jS,Pn]=Dn(oo),[BS,io]=Dn(oo),I1=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=t,l=ds(e),[a,c]=y.useState(null),u=y.useRef(!1),d=Pt(i),f=Zm(o);return y.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),g.jsx(d1,{...l,children:g.jsx(jS,{scope:e,open:n,onOpenChange:d,content:a,onContentChange:c,children:g.jsx(BS,{scope:e,onClose:y.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:s,children:r})})})};I1.displayName=oo;var _S="MenuAnchor",Sc=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=ds(n);return g.jsx(Cc,{...o,...r,ref:e})});Sc.displayName=_S;var kc="MenuPortal",[HS,L1]=Dn(kc,{forceMount:void 0}),D1=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,i=Pn(kc,e);return g.jsx(HS,{scope:e,forceMount:n,children:g.jsx(Ln,{present:n||i.open,children:g.jsx(xc,{asChild:!0,container:o,children:r})})})};D1.displayName=kc;var Qe="MenuContent",[FS,Ec]=Dn(Qe),P1=y.forwardRef((t,e)=>{const n=L1(Qe,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=Pn(Qe,t.__scopeMenu),s=io(Qe,t.__scopeMenu);return g.jsx(qr.Provider,{scope:t.__scopeMenu,children:g.jsx(Ln,{present:r||i.open,children:g.jsx(qr.Slot,{scope:t.__scopeMenu,children:s.modal?g.jsx($S,{...o,ref:e}):g.jsx(VS,{...o,ref:e})})})})}),$S=y.forwardRef((t,e)=>{const n=Pn(Qe,t.__scopeMenu),r=y.useRef(null),o=Re(e,r);return y.useEffect(()=>{const i=r.current;if(i)return x1(i)},[]),g.jsx(Mc,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),VS=y.forwardRef((t,e)=>{const n=Pn(Qe,t.__scopeMenu);return g.jsx(Mc,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),zS=Kr("MenuContent.ScrollLock"),Mc=y.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:p,...m}=t,v=Pn(Qe,n),b=io(Qe,n),C=ds(n),x=N1(n),w=DS(n),[E,k]=y.useState(null),S=y.useRef(null),M=Re(e,S,v.onContentChange),N=y.useRef(0),P=y.useRef(""),W=y.useRef(0),z=y.useRef(null),H=y.useRef("right"),I=y.useRef(0),_=p?wc:y.Fragment,F=p?{as:zS,allowPinchZoom:!0}:void 0,L=R=>{const U=P.current+R,Q=w().filter(Y=>!Y.disabled),K=document.activeElement,Z=Q.find(Y=>Y.ref.current===K)?.textValue,Ue=Q.map(Y=>Y.textValue),se=tk(Ue,U,Z),ge=Q.find(Y=>Y.textValue===se)?.ref.current;(function Y(ee){P.current=ee,window.clearTimeout(N.current),ee!==""&&(N.current=window.setTimeout(()=>Y(""),1e3))})(U),ge&&setTimeout(()=>ge.focus())};y.useEffect(()=>()=>window.clearTimeout(N.current),[]),Qm();const T=y.useCallback(R=>H.current===z.current?.side&&rk(R,z.current?.area),[]);return g.jsx(FS,{scope:n,searchRef:P,onItemEnter:y.useCallback(R=>{T(R)&&R.preventDefault()},[T]),onItemLeave:y.useCallback(R=>{T(R)||(S.current?.focus(),k(null))},[T]),onTriggerLeave:y.useCallback(R=>{T(R)&&R.preventDefault()},[T]),pointerGraceTimerRef:W,onPointerGraceIntentChange:y.useCallback(R=>{z.current=R},[]),children:g.jsx(_,{...F,children:g.jsx(yc,{asChild:!0,trapped:o,onMountAutoFocus:J(i,R=>{R.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:g.jsx(gc,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:g.jsx(z3,{asChild:!0,...x,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:k,onEntryFocus:J(a,R=>{b.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(f1,{role:"menu","aria-orientation":"vertical","data-state":Y1(v.open),"data-radix-menu-content":"",dir:b.dir,...C,...m,ref:M,style:{outline:"none",...m.style},onKeyDown:J(m.onKeyDown,R=>{const Q=R.target.closest("[data-radix-menu-content]")===R.currentTarget,K=R.ctrlKey||R.altKey||R.metaKey,Z=R.key.length===1;Q&&(R.key==="Tab"&&R.preventDefault(),!K&&Z&&L(R.key));const Ue=S.current;if(R.target!==Ue||!NS.includes(R.key))return;R.preventDefault();const ge=w().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);R1.includes(R.key)&&ge.reverse(),QS(ge)}),onBlur:J(t.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(N.current),P.current="")}),onPointerMove:J(t.onPointerMove,Gr(R=>{const U=R.target,Q=I.current!==R.clientX;if(R.currentTarget.contains(U)&&Q){const K=R.clientX>I.current?"right":"left";H.current=K,I.current=R.clientX}}))})})})})})})});P1.displayName=Qe;var US="MenuGroup",Tc=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Me.div,{role:"group",...r,ref:e})});Tc.displayName=US;var WS="MenuLabel",j1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Me.div,{...r,ref:e})});j1.displayName=WS;var Pi="MenuItem",gf="menu.itemSelect",fs=y.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,i=y.useRef(null),s=io(Pi,t.__scopeMenu),l=Ec(Pi,t.__scopeMenu),a=Re(e,i),c=y.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const f=new CustomEvent(gf,{bubbles:!0,cancelable:!0});d.addEventListener(gf,h=>r?.(h),{once:!0}),Gm(d,f),f.defaultPrevented?c.current=!1:s.onClose()}};return g.jsx(B1,{...o,ref:a,disabled:n,onClick:J(t.onClick,u),onPointerDown:d=>{t.onPointerDown?.(d),c.current=!0},onPointerUp:J(t.onPointerUp,d=>{c.current||d.currentTarget?.click()}),onKeyDown:J(t.onKeyDown,d=>{const f=l.searchRef.current!=="";n||f&&d.key===" "||ca.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});fs.displayName=Pi;var B1=y.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=t,s=Ec(Pi,n),l=N1(n),a=y.useRef(null),c=Re(e,a),[u,d]=y.useState(!1),[f,h]=y.useState("");return y.useEffect(()=>{const p=a.current;p&&h((p.textContent??"").trim())},[i.children]),g.jsx(qr.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:g.jsx(U3,{asChild:!0,...l,focusable:!r,children:g.jsx(Me.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:J(t.onPointerMove,Gr(p=>{r?s.onItemLeave(p):(s.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(t.onPointerLeave,Gr(p=>s.onItemLeave(p))),onFocus:J(t.onFocus,()=>d(!0)),onBlur:J(t.onBlur,()=>d(!1))})})})}),KS="MenuCheckboxItem",_1=y.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return g.jsx(z1,{scope:t.__scopeMenu,checked:n,children:g.jsx(fs,{role:"menuitemcheckbox","aria-checked":ji(n)?"mixed":n,...o,ref:e,"data-state":Rc(n),onSelect:J(o.onSelect,()=>r?.(ji(n)?!0:!n),{checkForDefaultPrevented:!1})})})});_1.displayName=KS;var H1="MenuRadioGroup",[qS,GS]=Dn(H1,{value:void 0,onValueChange:()=>{}}),F1=y.forwardRef((t,e)=>{const{value:n,onValueChange:r,...o}=t,i=Pt(r);return g.jsx(qS,{scope:t.__scopeMenu,value:n,onValueChange:i,children:g.jsx(Tc,{...o,ref:e})})});F1.displayName=H1;var $1="MenuRadioItem",V1=y.forwardRef((t,e)=>{const{value:n,...r}=t,o=GS($1,t.__scopeMenu),i=n===o.value;return g.jsx(z1,{scope:t.__scopeMenu,checked:i,children:g.jsx(fs,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Rc(i),onSelect:J(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});V1.displayName=$1;var Ac="MenuItemIndicator",[z1,JS]=Dn(Ac,{checked:!1}),U1=y.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,i=JS(Ac,n);return g.jsx(Ln,{present:r||ji(i.checked)||i.checked===!0,children:g.jsx(Me.span,{...o,ref:e,"data-state":Rc(i.checked)})})});U1.displayName=Ac;var ZS="MenuSeparator",W1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Me.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});W1.displayName=ZS;var YS="MenuArrow",K1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=ds(n);return g.jsx(h1,{...o,...r,ref:e})});K1.displayName=YS;var XS="MenuSub",[zE,q1]=Dn(XS),br="MenuSubTrigger",G1=y.forwardRef((t,e)=>{const n=Pn(br,t.__scopeMenu),r=io(br,t.__scopeMenu),o=q1(br,t.__scopeMenu),i=Ec(br,t.__scopeMenu),s=y.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:a}=i,c={__scopeMenu:t.__scopeMenu},u=y.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return y.useEffect(()=>u,[u]),y.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),a(null)}},[l,a]),g.jsx(Sc,{asChild:!0,...c,children:g.jsx(B1,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Y1(n.open),...t,ref:as(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(t.onPointerMove,Gr(d=>{i.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:J(t.onPointerLeave,Gr(d=>{u();const f=n.content?.getBoundingClientRect();if(f){const h=n.content?.dataset.side,p=h==="right",m=p?-5:5,v=f[p?"left":"right"],b=f[p?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:v,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:v,y:f.bottom}],side:h}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:J(t.onKeyDown,d=>{const f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||IS[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});G1.displayName=br;var J1="MenuSubContent",Z1=y.forwardRef((t,e)=>{const n=L1(Qe,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=Pn(Qe,t.__scopeMenu),s=io(Qe,t.__scopeMenu),l=q1(J1,t.__scopeMenu),a=y.useRef(null),c=Re(e,a);return g.jsx(qr.Provider,{scope:t.__scopeMenu,children:g.jsx(Ln,{present:r||i.open,children:g.jsx(qr.Slot,{scope:t.__scopeMenu,children:g.jsx(Mc,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{s.isUsingKeyboardRef.current&&a.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:J(t.onFocusOutside,u=>{u.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:J(t.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:J(t.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=LS[s.dir].includes(u.key);d&&f&&(i.onOpenChange(!1),l.trigger?.focus(),u.preventDefault())})})})})})});Z1.displayName=J1;function Y1(t){return t?"open":"closed"}function ji(t){return t==="indeterminate"}function Rc(t){return ji(t)?"indeterminate":t?"checked":"unchecked"}function QS(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function ek(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function tk(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=ek(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const a=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}function nk(t,e){const{x:n,y:r}=t;let o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){const l=e[i],a=e[s],c=l.x,u=l.y,d=a.x,f=a.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}function rk(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return nk(n,e)}function Gr(t){return e=>e.pointerType==="mouse"?t(e):void 0}var ok=I1,ik=Sc,sk=D1,lk=P1,ak=Tc,ck=j1,uk=fs,dk=_1,fk=F1,hk=V1,pk=U1,mk=W1,gk=K1,yk=G1,vk=Z1,hs="DropdownMenu",[bk]=ur(hs,[O1]),je=O1(),[Ck,X1]=bk(hs),Q1=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=t,a=je(e),c=y.useRef(null),[u,d]=mc({prop:o,defaultProp:i??!1,onChange:s,caller:hs});return g.jsx(Ck,{scope:e,triggerId:Di(),triggerRef:c,contentId:Di(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:l,children:g.jsx(ok,{...a,open:u,onOpenChange:d,dir:r,modal:l,children:n})})};Q1.displayName=hs;var eg="DropdownMenuTrigger",tg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,i=X1(eg,n),s=je(n);return g.jsx(ik,{asChild:!0,...s,children:g.jsx(Me.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:as(e,i.triggerRef),onPointerDown:J(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:J(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});tg.displayName=eg;var xk="DropdownMenuPortal",ng=t=>{const{__scopeDropdownMenu:e,...n}=t,r=je(e);return g.jsx(sk,{...r,...n})};ng.displayName=xk;var rg="DropdownMenuContent",og=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=X1(rg,n),i=je(n),s=y.useRef(!1);return g.jsx(lk,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:e,onCloseAutoFocus:J(t.onCloseAutoFocus,l=>{s.current||o.triggerRef.current?.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:J(t.onInteractOutside,l=>{const a=l.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,u=a.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});og.displayName=rg;var wk="DropdownMenuGroup",Sk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(ak,{...o,...r,ref:e})});Sk.displayName=wk;var kk="DropdownMenuLabel",Ek=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(ck,{...o,...r,ref:e})});Ek.displayName=kk;var Mk="DropdownMenuItem",ig=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(uk,{...o,...r,ref:e})});ig.displayName=Mk;var Tk="DropdownMenuCheckboxItem",Ak=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(dk,{...o,...r,ref:e})});Ak.displayName=Tk;var Rk="DropdownMenuRadioGroup",Ok=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(fk,{...o,...r,ref:e})});Ok.displayName=Rk;var Nk="DropdownMenuRadioItem",Ik=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(hk,{...o,...r,ref:e})});Ik.displayName=Nk;var Lk="DropdownMenuItemIndicator",Dk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(pk,{...o,...r,ref:e})});Dk.displayName=Lk;var Pk="DropdownMenuSeparator",jk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(mk,{...o,...r,ref:e})});jk.displayName=Pk;var Bk="DropdownMenuArrow",_k=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(gk,{...o,...r,ref:e})});_k.displayName=Bk;var Hk="DropdownMenuSubTrigger",Fk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(yk,{...o,...r,ref:e})});Fk.displayName=Hk;var $k="DropdownMenuSubContent",sg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=je(n);return g.jsx(vk,{...o,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});sg.displayName=$k;var Vk=Q1,lg=tg,zk=ng,ag=og,Uk=ig,cg=sg;function ug({...t}){return g.jsx(Vk,{modal:!1,...t})}function dg({...t}){return g.jsx(zk,{...t})}const Oc=y.forwardRef(({...t},e)=>g.jsx(lg,{ref:e,...t}));Oc.displayName=lg.displayName;const fg=Uk,Wk=y.forwardRef(({className:t,portal:e=!0,...n},r)=>{const o=g.jsx(cg,{ref:r,className:Ee("tiptap-dropdown-menu",t),...n});return e?g.jsx(dg,{...typeof e=="object"?e:{},children:o}):o});Wk.displayName=cg.displayName;const Nc=y.forwardRef(({className:t,sideOffset:e=4,portal:n=!1,...r},o)=>{const i=g.jsx(ag,{ref:o,sideOffset:e,onCloseAutoFocus:s=>s.preventDefault(),className:Ee("tiptap-dropdown-menu",t),...r});return n?g.jsx(dg,{...typeof n=="object"?n:{},children:i}):i});Nc.displayName=ag.displayName;const dr=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Ee("tiptap-card",t),...e}));dr.displayName="Card";const Kk=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Ee("tiptap-card-header",t),...e}));Kk.displayName="CardHeader";const so=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Ee("tiptap-card-body",t),...e}));so.displayName="CardBody";const Ic=y.forwardRef(({className:t,orientation:e="vertical",...n},r)=>g.jsx("div",{ref:r,"data-orientation":e,className:Ee("tiptap-card-item-group",t),...n}));Ic.displayName="CardItemGroup";const qk=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Ee("tiptap-card-group-label",t),...e}));qk.displayName="CardGroupLabel";const Gk=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Ee("tiptap-card-footer",t),...e}));Gk.displayName="CardFooter";const Lc=y.forwardRef(({editor:t,levels:e=[1,2,3,4,5,6],hideWhenUnavailable:n=!1,portal:r=!1,onOpenChange:o,...i},s)=>{const{editor:l}=oe(t),[a,c]=y.useState(!1),{isVisible:u,isActive:d,canToggle:f,Icon:h}=Zk({editor:l,levels:e,hideWhenUnavailable:n}),p=y.useCallback(m=>{!l||!f||(c(m),o?.(m))},[f,l,o]);return u?g.jsxs(ug,{modal:!0,open:a,onOpenChange:p,children:[g.jsx(Oc,{asChild:!0,children:g.jsxs(fe,{type:"button","data-style":"ghost","data-active-state":d?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":"Format text as heading","aria-pressed":d,tooltip:"Heading",...i,ref:s,children:[g.jsx(h,{className:"tiptap-button-icon"}),g.jsx(hc,{className:"tiptap-button-dropdown-small"})]})}),g.jsx(Nc,{align:"start",portal:r,children:g.jsx(dr,{children:g.jsx(so,{children:g.jsx(Nn,{children:e.map(m=>g.jsx(fg,{asChild:!0,children:g.jsx(_m,{editor:l,level:m,text:`Heading ${m}`,showTooltip:!1})},`heading-${m}`))})})})})]}):null});Lc.displayName="HeadingDropdownMenu";const hg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",fill:"currentColor"})}));hg.displayName="HeadingIcon";function Jk(t,e=[1,2,3,4,5,6]){if(!(!t||!t.isEditable))return e.find(n=>pc(t,n))}function Zk(t){const{editor:e,levels:n=[1,2,3,4,5,6],hideWhenUnavailable:r=!1}=t||{},{editor:o}=oe(e),[i,s]=y.useState(!0),l=Jk(o,n),a=pc(o),c=Wr(o);return y.useEffect(()=>{if(!o)return;const u=()=>{s(qm({editor:o,hideWhenUnavailable:r,level:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,r,n]),{isVisible:i,activeLevel:l,isActive:a,canToggle:c,levels:n,label:"Heading",Icon:l?Wm[l]:hg}}function Yk({shortcutKeys:t=ua}){return g.jsx(yt,{children:mt({shortcutKeys:t})})}const Dc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onInserted:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=oe(t),{isVisible:u,canInsert:d,handleImage:f,label:h,isActive:p,shortcutKeys:m,Icon:v}=g9({editor:c,hideWhenUnavailable:n,onInserted:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&f()},[f,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":h,"aria-pressed":p,tooltip:h,onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(Yk,{shortcutKeys:m})]})}):null});Dc.displayName="ImageUploadButton";const pg=["shift","alt","meta","mod","ctrl","control"],Xk={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function rn(t){return(Xk[t.trim()]||t.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function mg(t){return pg.includes(t)}function ml(t,e=","){return t.toLowerCase().split(e)}function gl(t,e="+",n=">",r=!1,o){let i=[],s=!1;t=t.trim(),t.includes(n)?(s=!0,i=t.toLocaleLowerCase().split(n).map(c=>rn(c))):i=t.toLocaleLowerCase().split(e).map(c=>rn(c));const l={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod"),useKey:r},a=i.filter(c=>!pg.includes(c));return{...l,keys:a,description:o,isSequence:s,hotkey:t}}typeof document<"u"&&(document.addEventListener("keydown",t=>{t.code!==void 0&&gg([rn(t.code)])}),document.addEventListener("keyup",t=>{t.code!==void 0&&yg([rn(t.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{At.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{At.clear()},0)}));const At=new Set;function Pc(t){return Array.isArray(t)}function Qk(t,e=","){return(Pc(t)?t:t.split(e)).every(n=>At.has(n.trim().toLowerCase()))}function gg(t){const e=Array.isArray(t)?t:[t];At.has("meta")&&At.forEach(n=>!mg(n)&&At.delete(n.toLowerCase())),e.forEach(n=>At.add(n.toLowerCase()))}function yg(t){const e=Array.isArray(t)?t:[t];t==="meta"?At.clear():e.forEach(n=>At.delete(n.toLowerCase()))}function e9(t,e,n){(typeof n=="function"&&n(t,e)||n===!0)&&t.preventDefault()}function t9(t,e,n){return typeof n=="function"?n(t,e):n===!0||n===void 0}const n9=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function r9(t){return vg(t,n9)}function vg(t,e=!1){const{target:n,composed:r}=t;let o,i;return o9(n)&&r?(o=t.composedPath()[0]&&t.composedPath()[0].tagName,i=t.composedPath()[0]&&t.composedPath()[0].role):(o=n&&n.tagName,i=n&&n.role),Pc(e)?!!(o&&e&&e.some(s=>s.toLowerCase()===o.toLowerCase()||s===i)):!!(o&&e&&e)}function o9(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function i9(t,e){return t.length===0&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):e?t.some(n=>e.includes(n))||t.includes("*"):!0}const s9=(t,e,n=!1)=>{const{alt:r,meta:o,mod:i,shift:s,ctrl:l,keys:a,useKey:c}=e,{code:u,key:d,ctrlKey:f,metaKey:h,shiftKey:p,altKey:m}=t,v=rn(u);if(c&&a?.length===1&&a.includes(d))return!0;if(!a?.includes(v)&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(v))return!1;if(!n){if(r!==m&&v!=="alt"||s!==p&&v!=="shift")return!1;if(i){if(!h&&!f)return!1}else if(o!==h&&v!=="meta"&&v!=="os"||l!==f&&v!=="ctrl"&&v!=="control")return!1}return a&&a.length===1&&a.includes(v)?!0:a?Qk(a):!a},l9=j.createContext(void 0),a9=()=>j.useContext(l9);function bg(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce((n,r)=>n&&bg(t[r],e[r]),!0):t===e}const c9=j.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),u9=()=>j.useContext(c9);function d9(t){const e=j.useRef(void 0);return bg(e.current,t)||(e.current=t),e.current}const yf=t=>{t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},f9=typeof window<"u"?j.useLayoutEffect:j.useEffect;function Cg(t,e,n,r){const o=j.useRef(null),i=j.useRef(!1),s=Array.isArray(n)?Array.isArray(r)?void 0:r:n,l=Pc(t)?t.join(s?.delimiter):t,a=Array.isArray(n)?n:Array.isArray(r)?r:void 0,c=j.useCallback(e,a??[]),u=j.useRef(c);a?u.current=c:u.current=e;const d=d9(s),{activeScopes:f}=u9(),h=a9();return f9(()=>{if(d?.enabled===!1||!i9(f,d?.scopes))return;let p=[],m;const v=(w,E=!1)=>{if(!(r9(w)&&!vg(w,d?.enableOnFormTags))){if(o.current!==null){const k=o.current.getRootNode();if((k instanceof Document||k instanceof ShadowRoot)&&k.activeElement!==o.current&&!o.current.contains(k.activeElement)){yf(w);return}}w.target?.isContentEditable&&!d?.enableOnContentEditable||ml(l,d?.delimiter).forEach(k=>{if(k.includes(d?.splitKey??"+")&&k.includes(d?.sequenceSplitKey??">")){console.warn(`Hotkey ${k} contains both ${d?.splitKey??"+"} and ${d?.sequenceSplitKey??">"} which is not supported.`);return}const S=gl(k,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description);if(S.isSequence){m=setTimeout(()=>{p=[]},d?.sequenceTimeoutMs??1e3);const M=S.useKey?w.key:rn(w.code);if(mg(M.toLowerCase()))return;p.push(M);const N=S.keys?.[p.length-1];if(M!==N){p=[],m&&clearTimeout(m);return}p.length===S.keys?.length&&(u.current(w,S),m&&clearTimeout(m),p=[])}else if(s9(w,S,d?.ignoreModifiers)||S.keys?.includes("*")){if(d?.ignoreEventWhen?.(w)||E&&i.current)return;if(e9(w,S,d?.preventDefault),!t9(w,S,d?.enabled)){yf(w);return}u.current(w,S),E||(i.current=!0)}})}},b=w=>{w.code!==void 0&&(gg(rn(w.code)),(d?.keydown===void 0&&d?.keyup!==!0||d?.keydown)&&v(w))},C=w=>{w.code!==void 0&&(yg(rn(w.code)),i.current=!1,d?.keyup&&v(w,!0))},x=o.current||s?.document||document;return x.addEventListener("keyup",C,s?.eventListenerOptions),x.addEventListener("keydown",b,s?.eventListenerOptions),h&&ml(l,d?.delimiter).forEach(w=>h.addHotkey(gl(w,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description))),()=>{x.removeEventListener("keyup",C,s?.eventListenerOptions),x.removeEventListener("keydown",b,s?.eventListenerOptions),h&&ml(l,d?.delimiter).forEach(w=>h.removeHotkey(gl(w,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description))),p=[],m&&clearTimeout(m)}},[l,d,f]),o}function fr(t=768){const[e,n]=y.useState(void 0);return y.useEffect(()=>{const r=window.matchMedia(`(max-width: ${t-1}px)`),o=()=>{n(window.innerWidth<t)};return r.addEventListener("change",o),n(window.innerWidth<t),()=>r.removeEventListener("change",o)},[t]),!!e}const xg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 2C20 1.44772 19.5523 1 19 1C18.4477 1 18 1.44772 18 2V4H16C15.4477 4 15 4.44772 15 5C15 5.55228 15.4477 6 16 6H18V8C18 8.55228 18.4477 9 19 9C19.5523 9 20 8.55228 20 8V6H22C22.5523 6 23 5.55228 23 5C23 4.44772 22.5523 4 22 4H20V2ZM5 4C4.73478 4 4.48043 4.10536 4.29289 4.29289C4.10536 4.48043 4 4.73478 4 5V19C4 19.2652 4.10536 19.5196 4.29289 19.7071C4.48043 19.8946 4.73478 20 5 20H5.58579L14.379 11.2068C14.9416 10.6444 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584 10.6444 18.621 11.2068L20 12.5858V12C20 11.4477 20.4477 11 21 11C21.5523 11 22 11.4477 22 12V14.998C22 14.9994 22 15.0007 22 15.002V19C22 19.7957 21.6839 20.5587 21.1213 21.1213C20.5587 21.6839 19.7957 22 19 22H6.00219C6.00073 22 5.99927 22 5.99781 22H5C4.20435 22 3.44129 21.6839 2.87868 21.1213C2.31607 20.5587 2 19.7957 2 19V5C2 4.20435 2.31607 3.44129 2.87868 2.87868C3.44129 2.31607 4.20435 2 5 2H12C12.5523 2 13 2.44772 13 3C13 3.55228 12.5523 4 12 4H5ZM8.41422 20H19C19.2652 20 19.5196 19.8946 19.7071 19.7071C19.8946 19.5196 20 19.2652 20 19V15.4142L17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211L8.41422 20ZM6.87868 6.87868C7.44129 6.31607 8.20435 6 9 6C9.79565 6 10.5587 6.31607 11.1213 6.87868C11.6839 7.44129 12 8.20435 12 9C12 9.79565 11.6839 10.5587 11.1213 11.1213C10.5587 11.6839 9.79565 12 9 12C8.20435 12 7.44129 11.6839 6.87868 11.1213C6.31607 10.5587 6 9.79565 6 9C6 8.20435 6.31607 7.44129 6.87868 6.87868ZM9 8C8.73478 8 8.48043 8.10536 8.29289 8.29289C8.10536 8.48043 8 8.73478 8 9C8 9.26522 8.10536 9.51957 8.29289 9.70711C8.48043 9.89464 8.73478 10 9 10C9.26522 10 9.51957 9.89464 9.70711 9.70711C9.89464 9.51957 10 9.26522 10 9C10 8.73478 9.89464 8.48043 9.70711 8.29289C9.51957 8.10536 9.26522 8 9 8Z",fill:"currentColor"})}));xg.displayName="ImagePlusIcon";const ua="mod+shift+i";function jc(t){return!t||!t.isEditable||!ss(t,"imageUpload")||_t(t,["image"])?!1:t.can().insertContent({type:"imageUpload"})}function h9(t){return!t||!t.isEditable?!1:t.isActive("imageUpload")}function p9(t){if(!t||!t.isEditable||!jc(t))return!1;try{return t.chain().focus().insertContent({type:"imageUpload"}).run()}catch{return!1}}function m9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!ss(e,"imageUpload")?!1:n&&!e.isActive("code")?jc(e):!0}function g9(t){const{editor:e,hideWhenUnavailable:n=!1,onInserted:r}=t||{},{editor:o}=oe(e),i=fr(),[s,l]=y.useState(!0),a=jc(o),c=h9(o);y.useEffect(()=>{if(!o)return;const d=()=>{l(m9({editor:o,hideWhenUnavailable:n}))};return d(),o.on("selectionUpdate",d),()=>{o.off("selectionUpdate",d)}},[o,n]);const u=y.useCallback(()=>{if(!o)return!1;const d=p9(o);return d&&r?.(),d},[o,r]);return Cg(ua,d=>{d.preventDefault(),u()},{enabled:s&&a,enableOnContentEditable:!i,enableOnFormTags:!0}),{isVisible:s,isActive:c,handleImage:u,canInsert:a,label:"Add image",shortcutKeys:ua,Icon:xg}}function y9({type:t,shortcutKeys:e=kg[t]}){return g.jsx(yt,{children:mt({shortcutKeys:e})})}const wg=y.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=oe(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,shortcutKeys:v,Icon:b}=x9({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&p()},[p,s]);return d?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(b,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(y9,{type:e,shortcutKeys:v})]})}):null});wg.displayName="ListButton";const ps=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));ps.displayName="ListIcon";const Bc=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",fill:"currentColor"})]}));Bc.displayName="ListOrderedIcon";const _c=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",fill:"currentColor"})]}));_c.displayName="ListTodoIcon";const Sg={bulletList:ps,orderedList:Bc,taskList:_c},v9={bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List"},kg={bulletList:"mod+shift+8",orderedList:"mod+shift+7",taskList:"mod+shift+9"};function ms(t,e,n=!0){if(!t||!t.isEditable||!Bt(e,t)||_t(t,["image"]))return!1;if(!n)switch(e){case"bulletList":return t.can().toggleBulletList();case"orderedList":return t.can().toggleOrderedList();case"taskList":return t.can().toggleList("taskList","taskItem");default:return!1}try{const o=t.view.state,i=o.selection;if(i.empty||i instanceof V){const s=fn({editor:t,node:o.selection.$anchor.node(1)})?.pos;if(!gt(s))return!1}return!0}catch{return!1}}function Hc(t,e){if(!t||!t.isEditable)return!1;switch(e){case"bulletList":return t.isActive("bulletList");case"orderedList":return t.isActive("orderedList");case"taskList":return t.isActive("taskList");default:return!1}}function b9(t,e){if(!t||!t.isEditable||!ms(t,e))return!1;try{const n=t.view;let r=n.state,o=r.tr;if(r.selection.empty||r.selection instanceof V){const l=fn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!gt(l))return!1;o=o.setSelection(B.create(r.doc,l)),n.dispatch(o),r=n.state}const i=r.selection;let s=t.chain().focus();if(i instanceof B){const l=i.node.firstChild?.firstChild,a=i.node.lastChild?.lastChild,c=l?i.from+l.nodeSize:i.from+1,u=a?i.to-a.nodeSize:i.to-1;s=s.setTextSelection({from:c,to:u}).clearNodes()}if(t.isActive(e))s.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();else{const a={bulletList:()=>s.toggleBulletList(),orderedList:()=>s.toggleOrderedList(),taskList:()=>s.toggleList("taskList","taskItem")}[e];if(!a)return!1;a().run()}return t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function C9(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!Bt(n,e)?!1:r&&!e.isActive("code")?ms(e,n):!0}function x9(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=oe(e),[s,l]=y.useState(!0),a=ms(i,n),c=Hc(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(C9({editor:i,type:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=b9(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleToggle:u,canToggle:a,label:v9[n],shortcutKeys:kg[n],Icon:Sg[n]}}const w9=[{label:"Bullet List",type:"bulletList",icon:ps},{label:"Ordered List",type:"orderedList",icon:Bc},{label:"Task List",type:"taskList",icon:_c}];function S9(t,e){return!t||!t.isEditable?!1:e.some(n=>ms(t,n))}function k9(t,e){return!t||!t.isEditable?!1:e.some(n=>Hc(t,n))}function E9(t){return w9.filter(e=>!e.type||t.includes(e.type))}function M9(t){const{editor:e,hideWhenUnavailable:n,listInSchema:r,canToggleAny:o}=t;return!r||!e?!1:n&&!e.isActive("code")?o:!0}function T9(t,e){if(!(!t||!t.isEditable))return e.find(n=>Hc(t,n))}function A9(t){const{editor:e,types:n=["bulletList","orderedList","taskList"],hideWhenUnavailable:r=!1}=t||{},{editor:o}=oe(e),[i,s]=y.useState(!1),l=n.some(h=>Bt(h,o)),a=y.useMemo(()=>E9(n),[n]),c=S9(o,n),u=k9(o,n),d=T9(o,n),f=a.find(h=>h.type===d);return y.useEffect(()=>{if(!o)return;const h=()=>{s(M9({editor:o,hideWhenUnavailable:r,listInSchema:l,canToggleAny:c}))};return h(),o.on("selectionUpdate",h),()=>{o.off("selectionUpdate",h)}},[c,o,r,l,n]),{isVisible:i,activeType:d,isActive:u,canToggle:c,types:n,filteredLists:a,label:"List",Icon:f?Sg[f.type]:ps}}function Eg({editor:t,types:e=["bulletList","orderedList","taskList"],hideWhenUnavailable:n=!1,onOpenChange:r,portal:o=!1,...i}){const{editor:s}=oe(t),[l,a]=y.useState(!1),{filteredLists:c,canToggle:u,isActive:d,isVisible:f,Icon:h}=A9({editor:s,types:e,hideWhenUnavailable:n}),p=y.useCallback(m=>{a(m),r?.(m)},[r]);return!f||!s||!s.isEditable?null:g.jsxs(ug,{open:l,onOpenChange:p,children:[g.jsx(Oc,{asChild:!0,children:g.jsxs(fe,{type:"button","data-style":"ghost","data-active-state":d?"on":"off",role:"button",tabIndex:-1,disabled:!u,"data-disabled":!u,"aria-label":"List options",tooltip:"List",...i,children:[g.jsx(h,{className:"tiptap-button-icon"}),g.jsx(hc,{className:"tiptap-button-dropdown-small"})]})}),g.jsx(Nc,{align:"start",portal:o,children:g.jsx(dr,{children:g.jsx(so,{children:g.jsx(Nn,{children:c.map(m=>g.jsx(fg,{asChild:!0,children:g.jsx(wg,{editor:s,type:m.type,text:m.label,showTooltip:!1})},m.type))})})})})]})}function R9({shortcutKeys:t=Tg}){return g.jsx(yt,{children:mt({shortcutKeys:t})})}const Fc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=oe(t),{isVisible:u,canToggle:d,isActive:f,handleToggle:h,label:p,shortcutKeys:m,Icon:v}=I9({editor:c,hideWhenUnavailable:n,onToggled:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&h()},[h,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":p,"aria-pressed":f,tooltip:"Blockquote",onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(R9,{shortcutKeys:m})]})}):null});Fc.displayName="BlockquoteButton";const Mg=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z",fill:"currentColor"})]}));Mg.displayName="BlockquoteIcon";const Tg="mod+shift+b";function $c(t,e=!0){if(!t||!t.isEditable||!Bt("blockquote",t)||_t(t,["image"]))return!1;if(!e)return t.can().toggleWrap("blockquote");try{const r=t.view.state,o=r.selection;if(o.empty||o instanceof V){const i=fn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!gt(i))return!1}return!0}catch{return!1}}function O9(t){if(!t||!t.isEditable||!$c(t))return!1;try{const e=t.view;let n=e.state,r=n.tr;if(n.selection.empty||n.selection instanceof V){const l=fn({editor:t,node:n.selection.$anchor.node(1)})?.pos;if(!gt(l))return!1;r=r.setSelection(B.create(n.doc,l)),e.dispatch(r),n=e.state}const o=n.selection;let i=t.chain().focus();if(o instanceof B){const l=o.node.firstChild?.firstChild,a=o.node.lastChild?.lastChild,c=l?o.from+l.nodeSize:o.from+1,u=a?o.to-a.nodeSize:o.to-1;i=i.setTextSelection({from:c,to:u}).clearNodes()}return(t.isActive("blockquote")?i.lift("blockquote"):i.wrapIn("blockquote")).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function N9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!Bt("blockquote",e)?!1:n&&!e.isActive("code")?$c(e):!0}function I9(t){const{editor:e,hideWhenUnavailable:n=!1,onToggled:r}=t||{},{editor:o}=oe(e),[i,s]=y.useState(!0),l=$c(o),a=o?.isActive("blockquote")||!1;y.useEffect(()=>{if(!o)return;const u=()=>{s(N9({editor:o,hideWhenUnavailable:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,n]);const c=y.useCallback(()=>{if(!o)return!1;const u=O9(o);return u&&r?.(),u},[o,r]);return{isVisible:i,isActive:a,handleToggle:c,canToggle:l,label:"Blockquote",shortcutKeys:Tg,Icon:Mg}}function L9({shortcutKeys:t=Rg}){return g.jsx(yt,{children:mt({shortcutKeys:t})})}const Vc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=oe(t),{isVisible:u,canToggle:d,isActive:f,handleToggle:h,label:p,shortcutKeys:m,Icon:v}=j9({editor:c,hideWhenUnavailable:n,onToggled:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&h()},[h,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",disabled:!d,"data-disabled":!d,tabIndex:-1,"aria-label":p,"aria-pressed":f,tooltip:"Code Block",onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(L9,{shortcutKeys:m})]})}):null});Vc.displayName="CodeBlockButton";const Ag=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z",fill:"currentColor"})]}));Ag.displayName="CodeBlockIcon";const Rg="mod+alt+c";function zc(t,e=!0){if(!t||!t.isEditable||!Bt("codeBlock",t)||_t(t,["image"]))return!1;if(!e)return t.can().toggleNode("codeBlock","paragraph");try{const r=t.view.state,o=r.selection;if(o.empty||o instanceof V){const i=fn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!gt(i))return!1}return!0}catch{return!1}}function D9(t){if(!t||!t.isEditable||!zc(t))return!1;try{const e=t.view;let n=e.state,r=n.tr;if(n.selection.empty||n.selection instanceof V){const l=fn({editor:t,node:n.selection.$anchor.node(1)})?.pos;if(!gt(l))return!1;r=r.setSelection(B.create(n.doc,l)),e.dispatch(r),n=e.state}const o=n.selection;let i=t.chain().focus();if(o instanceof B){const l=o.node.firstChild?.firstChild,a=o.node.lastChild?.lastChild,c=l?o.from+l.nodeSize:o.from+1,u=a?o.to-a.nodeSize:o.to-1;i=i.setTextSelection({from:c,to:u}).clearNodes()}return(t.isActive("codeBlock")?i.setNode("paragraph"):i.toggleNode("codeBlock","paragraph")).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function P9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!Bt("codeBlock",e)?!1:n&&!e.isActive("code")?zc(e):!0}function j9(t){const{editor:e,hideWhenUnavailable:n=!1,onToggled:r}=t||{},{editor:o}=oe(e),[i,s]=y.useState(!0),l=zc(o),a=o?.isActive("codeBlock")||!1;y.useEffect(()=>{if(!o)return;const u=()=>{s(P9({editor:o,hideWhenUnavailable:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,n]);const c=y.useCallback(()=>{if(!o)return!1;const u=D9(o);return u&&r?.(),u},[o,r]);return{isVisible:i,isActive:a,handleToggle:c,canToggle:l,label:"Code Block",shortcutKeys:Rg,Icon:Ag}}const Og=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.43471 4.01458C4.34773 4.06032 4.26607 4.11977 4.19292 4.19292C4.11977 4.26607 4.06032 4.34773 4.01458 4.43471C2.14611 6.40628 1 9.0693 1 12C1 18.0751 5.92487 23 12 23C14.9306 23 17.5936 21.854 19.5651 19.9856C19.6522 19.9398 19.7339 19.8803 19.8071 19.8071C19.8803 19.7339 19.9398 19.6522 19.9856 19.5651C21.854 17.5936 23 14.9306 23 12C23 5.92487 18.0751 1 12 1C9.0693 1 6.40628 2.14611 4.43471 4.01458ZM6.38231 4.9681C7.92199 3.73647 9.87499 3 12 3C16.9706 3 21 7.02944 21 12C21 14.125 20.2635 16.078 19.0319 17.6177L6.38231 4.9681ZM17.6177 19.0319C16.078 20.2635 14.125 21 12 21C7.02944 21 3 16.9706 3 12C3 9.87499 3.73647 7.92199 4.9681 6.38231L17.6177 19.0319Z",fill:"currentColor"})}));Og.displayName="BanIcon";const gs=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.3167 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z",fill:"currentColor"})}));gs.displayName="HighlighterIcon";var ys="Popover",[Ng]=ur(ys,[cs]),lo=cs(),[B9,hn]=Ng(ys),Ig=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=t,l=lo(e),a=y.useRef(null),[c,u]=y.useState(!1),[d,f]=mc({prop:r,defaultProp:o??!1,onChange:i,caller:ys});return g.jsx(d1,{...l,children:g.jsx(B9,{scope:e,contentId:Di(),triggerRef:a,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:s,children:n})})};Ig.displayName=ys;var Lg="PopoverAnchor",_9=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=hn(Lg,n),i=lo(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=o;return y.useEffect(()=>(s(),()=>l()),[s,l]),g.jsx(Cc,{...i,...r,ref:e})});_9.displayName=Lg;var Dg="PopoverTrigger",Pg=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=hn(Dg,n),i=lo(n),s=Re(e,o.triggerRef),l=g.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Fg(o.open),...r,ref:s,onClick:J(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:g.jsx(Cc,{asChild:!0,...i,children:l})});Pg.displayName=Dg;var Uc="PopoverPortal",[H9,F9]=Ng(Uc,{forceMount:void 0}),jg=t=>{const{__scopePopover:e,forceMount:n,children:r,container:o}=t,i=hn(Uc,e);return g.jsx(H9,{scope:e,forceMount:n,children:g.jsx(Ln,{present:n||i.open,children:g.jsx(xc,{asChild:!0,container:o,children:r})})})};jg.displayName=Uc;var sr="PopoverContent",Bg=y.forwardRef((t,e)=>{const n=F9(sr,t.__scopePopover),{forceMount:r=n.forceMount,...o}=t,i=hn(sr,t.__scopePopover);return g.jsx(Ln,{present:r||i.open,children:i.modal?g.jsx(V9,{...o,ref:e}):g.jsx(z9,{...o,ref:e})})});Bg.displayName=sr;var $9=Kr("PopoverContent.RemoveScroll"),V9=y.forwardRef((t,e)=>{const n=hn(sr,t.__scopePopover),r=y.useRef(null),o=Re(e,r),i=y.useRef(!1);return y.useEffect(()=>{const s=r.current;if(s)return x1(s)},[]),g.jsx(wc,{as:$9,allowPinchZoom:!0,children:g.jsx(_g,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(t.onCloseAutoFocus,s=>{s.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(t.onPointerDownOutside,s=>{const l=s.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0,c=l.button===2||a;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:J(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),z9=y.forwardRef((t,e)=>{const n=hn(sr,t.__scopePopover),r=y.useRef(!1),o=y.useRef(!1);return g.jsx(_g,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),_g=y.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:u,...d}=t,f=hn(sr,n),h=lo(n);return Qm(),g.jsx(yc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:g.jsx(gc,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:g.jsx(f1,{"data-state":Fg(f.open),role:"dialog",id:f.contentId,...h,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Hg="PopoverClose",U9=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=hn(Hg,n);return g.jsx(Me.button,{type:"button",...r,ref:e,onClick:J(t.onClick,()=>o.onOpenChange(!1))})});U9.displayName=Hg;var W9="PopoverArrow",K9=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=lo(n);return g.jsx(h1,{...o,...r,ref:e})});K9.displayName=W9;function Fg(t){return t?"open":"closed"}var q9=Ig,G9=Pg,J9=jg,Z9=Bg;function $g({...t}){return g.jsx(q9,{...t})}function Vg({...t}){return g.jsx(G9,{...t})}function zg({className:t,align:e="center",sideOffset:n=4,...r}){return g.jsx(J9,{children:g.jsx(Z9,{align:e,sideOffset:n,className:Ee("tiptap-popover",t),...r})})}function Y9({shortcutKeys:t=da}){return g.jsx(yt,{children:mt({shortcutKeys:t})})}const Ug=y.forwardRef(({editor:t,highlightColor:e,text:n,hideWhenUnavailable:r=!1,onApplied:o,showShortcut:i=!1,onClick:s,children:l,style:a,...c},u)=>{const{editor:d}=oe(t),{isVisible:f,canColorHighlight:h,isActive:p,handleColorHighlight:m,label:v,shortcutKeys:b}=Kc({editor:d,highlightColor:e,label:n||`Toggle highlight (${e})`,hideWhenUnavailable:r,onApplied:o}),C=y.useCallback(w=>{s?.(w),!w.defaultPrevented&&m()},[m,s]),x=y.useMemo(()=>({...a,"--highlight-color":e}),[e,a]);return f?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":v,"aria-pressed":p,tooltip:v,onClick:C,style:x,...c,ref:u,children:l??g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"tiptap-button-highlight",style:{"--highlight-color":e}}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(Y9,{shortcutKeys:b})]})}):null});Ug.displayName="ColorHighlightButton";const da="mod+shift+h",X9=[{label:"Default background",value:"var(--tt-bg-color)",border:"var(--tt-bg-color-contrast)"},{label:"Gray background",value:"var(--tt-color-highlight-gray)",border:"var(--tt-color-highlight-gray-contrast)"},{label:"Brown background",value:"var(--tt-color-highlight-brown)",border:"var(--tt-color-highlight-brown-contrast)"},{label:"Orange background",value:"var(--tt-color-highlight-orange)",border:"var(--tt-color-highlight-orange-contrast)"},{label:"Yellow background",value:"var(--tt-color-highlight-yellow)",border:"var(--tt-color-highlight-yellow-contrast)"},{label:"Green background",value:"var(--tt-color-highlight-green)",border:"var(--tt-color-highlight-green-contrast)"},{label:"Blue background",value:"var(--tt-color-highlight-blue)",border:"var(--tt-color-highlight-blue-contrast)"},{label:"Purple background",value:"var(--tt-color-highlight-purple)",border:"var(--tt-color-highlight-purple-contrast)"},{label:"Pink background",value:"var(--tt-color-highlight-pink)",border:"var(--tt-color-highlight-pink-contrast)"},{label:"Red background",value:"var(--tt-color-highlight-red)",border:"var(--tt-color-highlight-red-contrast)"}];function Wg(t){const e=new Map(X9.map(n=>[n.value,n]));return t.map(n=>e.get(n)).filter(n=>!!n)}function Wc(t){return!t||!t.isEditable||!no("highlight",t)||_t(t,["image"])?!1:t.can().setMark("highlight")}function Q9(t,e){return!t||!t.isEditable?!1:e?t.isActive("highlight",{color:e}):t.isActive("highlight")}function eE(t){return!t||!t.isEditable||!Wc(t)?!1:t.chain().focus().unsetMark("highlight").run()}function tE(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!no("highlight",e)?!1:n&&!e.isActive("code")?Wc(e):!0}function Kc(t){const{editor:e,label:n,highlightColor:r,hideWhenUnavailable:o=!1,onApplied:i}=t,{editor:s}=oe(e),l=fr(),[a,c]=y.useState(!0),u=Wc(s),d=Q9(s,r);y.useEffect(()=>{if(!s)return;const p=()=>{c(tE({editor:s,hideWhenUnavailable:o}))};return p(),s.on("selectionUpdate",p),()=>{s.off("selectionUpdate",p)}},[s,o]);const f=y.useCallback(()=>{if(!s||!u||!r||!n)return!1;if(s.state.storedMarks){const p=s.schema.marks.highlight;p&&s.view.dispatch(s.state.tr.removeStoredMark(p))}setTimeout(()=>{const p=s.chain().focus().toggleMark("highlight",{color:r}).run();return p&&i?.({color:r,label:n}),p},0)},[u,r,s,n,i]),h=y.useCallback(()=>{const p=eE(s);return p&&i?.({color:"",label:"Remove highlight"}),p},[s,i]);return Cg(da,p=>{p.preventDefault(),f()},{enabled:a&&u,enableOnContentEditable:!l,enableOnFormTags:!0}),{isVisible:a,isActive:d,handleColorHighlight:f,handleRemoveHighlight:h,canColorHighlight:u,label:n||"Highlight",shortcutKeys:da,Icon:gs}}const qc=y.forwardRef(({className:t,children:e,...n},r)=>g.jsx(fe,{type:"button",className:t,"data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Highlight text",tooltip:"Highlight",ref:r,...n,children:e??g.jsx(gs,{className:"tiptap-button-icon"})}));qc.displayName="ColorHighlightPopoverButton";function Kg({editor:t,colors:e=Wg(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"])}){const{handleRemoveHighlight:n}=Kc({editor:t}),r=fr(),o=y.useRef(null),i=y.useMemo(()=>[...e,{label:"Remove highlight",value:"none"}],[e]),{selectedIndex:s}=Pm({containerRef:o,items:i,orientation:"both",onSelect:l=>{if(!o.current)return!1;const a=o.current.querySelector('[data-highlighted="true"]');a&&a.click(),l.value==="none"&&n()},autoSelectFirstItem:!1});return g.jsx(dr,{ref:o,tabIndex:0,style:r?{boxShadow:"none",border:0}:{},children:g.jsx(so,{style:r?{padding:0}:{},children:g.jsxs(Ic,{orientation:"horizontal",children:[g.jsx(Nn,{orientation:"horizontal",children:e.map((l,a)=>g.jsx(Ug,{editor:t,highlightColor:l.value,tooltip:l.label,"aria-label":`${l.label} highlight color`,tabIndex:a===s?0:-1,"data-highlighted":s===a},l.value))}),g.jsx(ls,{}),g.jsx(Nn,{orientation:"horizontal",children:g.jsx(fe,{onClick:n,"aria-label":"Remove highlight",tooltip:"Remove highlight",tabIndex:s===e.length?0:-1,type:"button",role:"menuitem","data-style":"ghost","data-highlighted":s===e.length,children:g.jsx(Og,{className:"tiptap-button-icon"})})})]})})})}function nE({editor:t,colors:e=Wg(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"]),hideWhenUnavailable:n=!1,onApplied:r,...o}){const{editor:i}=oe(t),[s,l]=y.useState(!1),{isVisible:a,canColorHighlight:c,isActive:u,label:d,Icon:f}=Kc({editor:i,hideWhenUnavailable:n,onApplied:r});return a?g.jsxs($g,{open:s,onOpenChange:l,children:[g.jsx(Vg,{asChild:!0,children:g.jsx(qc,{disabled:!c,"data-active-state":u?"on":"off","data-disabled":!c,"aria-pressed":u,"aria-label":d,tooltip:d,...o,children:g.jsx(f,{className:"tiptap-button-icon"})})}),g.jsx(zg,{"aria-label":"Highlight colors",children:g.jsx(Kg,{editor:i,colors:e})})]}):null}const qg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",fill:"currentColor"})}));qg.displayName="CornerDownLeftIcon";const Gg=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",fill:"currentColor"}),g.jsx("path",{d:"M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",fill:"currentColor"})]}));Gg.displayName="ExternalLinkIcon";const vs=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",fill:"currentColor"}),g.jsx("path",{d:"M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",fill:"currentColor"})]}));vs.displayName="LinkIcon";const Jg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",fill:"currentColor"})}));Jg.displayName="TrashIcon";function rE({className:t,type:e,...n}){return g.jsx("input",{type:e,className:Ee("tiptap-input",t),...n})}function oE({className:t,children:e,...n}){return g.jsx("div",{className:Ee("tiptap-input-group",t),...n,children:e})}const Gc=y.forwardRef(({className:t,children:e,...n},r)=>g.jsx(fe,{type:"button",className:t,"data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Link",tooltip:"Link",ref:r,...n,children:e||g.jsx(vs,{className:"tiptap-button-icon"})}));Gc.displayName="LinkButton";const Zg=({url:t,setUrl:e,setLink:n,removeLink:r,openLink:o,isActive:i})=>{const s=fr(),l=a=>{a.key==="Enter"&&(a.preventDefault(),n())};return g.jsx(dr,{style:{...s?{boxShadow:"none",border:0}:{}},children:g.jsx(so,{style:{...s?{padding:0}:{}},children:g.jsxs(Ic,{orientation:"horizontal",children:[g.jsx(oE,{children:g.jsx(rE,{type:"url",placeholder:"Paste a link...",value:t,onChange:a=>e(a.target.value),onKeyDown:l,autoFocus:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})}),g.jsx(Nn,{orientation:"horizontal",children:g.jsx(fe,{type:"button",onClick:n,title:"Apply link",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(qg,{className:"tiptap-button-icon"})})}),g.jsx(ls,{}),g.jsxs(Nn,{orientation:"horizontal",children:[g.jsx(fe,{type:"button",onClick:o,title:"Open in new window",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(Gg,{className:"tiptap-button-icon"})}),g.jsx(fe,{type:"button",onClick:r,title:"Remove link",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(Jg,{className:"tiptap-button-icon"})})]})]})})})},iE=({editor:t})=>{const e=e0({editor:t});return g.jsx(Zg,{...e})},Yg=y.forwardRef(({editor:t,hideWhenUnavailable:e=!1,onSetLink:n,onOpenChange:r,autoOpenOnLinkActive:o=!0,onClick:i,children:s,...l},a)=>{const{editor:c}=oe(t),[u,d]=y.useState(!1),{isVisible:f,canSet:h,isActive:p,url:m,setUrl:v,setLink:b,removeLink:C,openLink:x,label:w,Icon:E}=e0({editor:c,hideWhenUnavailable:e,onSetLink:n}),k=y.useCallback(N=>{d(N),r?.(N)},[r]),S=y.useCallback(()=>{b(),d(!1)},[b]),M=y.useCallback(N=>{i?.(N),!N.defaultPrevented&&d(!u)},[i,u]);return y.useEffect(()=>{o&&p&&d(!0)},[o,p]),f?g.jsxs($g,{open:u,onOpenChange:k,children:[g.jsx(Vg,{asChild:!0,children:g.jsx(Gc,{disabled:!h,"data-active-state":p?"on":"off","data-disabled":!h,"aria-label":w,"aria-pressed":p,onClick:M,...l,ref:a,children:s??g.jsx(E,{className:"tiptap-button-icon"})})}),g.jsx(zg,{children:g.jsx(Zg,{url:m,setUrl:v,setLink:S,removeLink:C,openLink:x,isActive:p})})]}):null});Yg.displayName="LinkPopover";function Xg(t){return!t||!t.isEditable?!1:t.can().setMark("link")}function Qg(t){return!t||!t.isEditable?!1:t.isActive("link")}function sE(t){const{editor:e,hideWhenUnavailable:n}=t;return!no("link",e)||!e?!1:n&&!e.isActive("code")?Xg(e):!0}function lE(t){const{editor:e,onSetLink:n}=t,[r,o]=y.useState(null);y.useEffect(()=>{if(!e)return;const{href:a}=e.getAttributes("link");Qg(e)&&r===null&&o(a||"")},[e,r]),y.useEffect(()=>{if(!e)return;const a=()=>{const{href:c}=e.getAttributes("link");o(c||"")};return e.on("selectionUpdate",a),()=>{e.off("selectionUpdate",a)}},[e]);const i=y.useCallback(()=>{if(!r||!e)return;const{selection:a}=e.state,c=a.empty;let u=e.chain().focus();u=u.extendMarkRange("link").setLink({href:r}),c&&(u=u.insertContent({type:"text",text:r})),u.run(),o(null),n?.()},[e,n,r]),s=y.useCallback(()=>{e&&(e.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink",!0).run(),o(""))},[e]),l=y.useCallback((a="_blank",c="noopener,noreferrer")=>{if(!r)return;const u=A5(r,window.location.href);u!=="#"&&window.open(u,a,c)},[r]);return{url:r||"",setUrl:o,setLink:i,removeLink:s,openLink:l}}function aE(t){const{editor:e,hideWhenUnavailable:n=!1}=t,r=Xg(e),o=Qg(e),[i,s]=y.useState(!1);return y.useEffect(()=>{if(!e)return;const l=()=>{s(sE({editor:e,hideWhenUnavailable:n}))};return l(),e.on("selectionUpdate",l),()=>{e.off("selectionUpdate",l)}},[e,n]),{isVisible:i,canSet:r,isActive:o}}function e0(t){const{editor:e,hideWhenUnavailable:n=!1,onSetLink:r}=t||{},{editor:o}=oe(e),{isVisible:i,canSet:s,isActive:l}=aE({editor:o,hideWhenUnavailable:n}),a=lE({editor:o,onSetLink:r});return{isVisible:i,canSet:s,isActive:l,label:"Link",Icon:vs,...a}}function cE({type:t,shortcutKeys:e=a0[t]}){return g.jsx(yt,{children:mt({shortcutKeys:e})})}const kt=y.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=oe(t),{isVisible:d,handleMark:f,label:h,canToggle:p,isActive:m,Icon:v,shortcutKeys:b}=mE({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&f()},[f,s]);return d?g.jsx(fe,{type:"button",disabled:!p,"data-style":"ghost","data-active-state":m?"on":"off","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,"aria-pressed":m,tooltip:h,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(cE,{type:e,shortcutKeys:b})]})}):null});kt.displayName="MarkButton";const t0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",fill:"currentColor"})}));t0.displayName="BoldIcon";const n0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",fill:"currentColor"}),g.jsx("path",{d:"M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",fill:"currentColor"}),g.jsx("path",{d:"M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",fill:"currentColor"})]}));n0.displayName="Code2Icon";const r0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",fill:"currentColor"})}));r0.displayName="ItalicIcon";const o0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",fill:"currentColor"}),g.jsx("path",{d:"M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",fill:"currentColor"})]}));o0.displayName="StrikeIcon";const i0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z",fill:"currentColor"})]}));i0.displayName="SubscriptIcon";const s0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z",fill:"currentColor"})]}));s0.displayName="SuperscriptIcon";const l0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z",fill:"currentColor"})}));l0.displayName="UnderlineIcon";const uE={bold:t0,italic:r0,underline:l0,strike:o0,code:n0,superscript:s0,subscript:i0},a0={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function Jc(t,e){return!t||!t.isEditable||!no(e,t)||_t(t,["image"])?!1:t.can().toggleMark(e)}function dE(t,e){return!t||!t.isEditable?!1:t.isActive(e)}function fE(t,e){return!t||!t.isEditable||!Jc(t,e)?!1:t.chain().focus().toggleMark(e).run()}function hE(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!no(n,e)?!1:r&&!e.isActive("code")?Jc(e,n):!0}function pE(t){return t.charAt(0).toUpperCase()+t.slice(1)}function mE(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=oe(e),[s,l]=y.useState(!0),a=Jc(i,n),c=dE(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(hE({editor:i,type:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=fE(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleMark:u,canToggle:a,label:pE(n),shortcutKeys:a0[n],Icon:uE[n]}}function gE({align:t,shortcutKeys:e=h0[t]}){return g.jsx(yt,{children:mt({shortcutKeys:e})})}const Jn=y.forwardRef(({editor:t,align:e,text:n,hideWhenUnavailable:r=!1,onAligned:o,showShortcut:i=!1,onClick:s,icon:l,children:a,...c},u)=>{const{editor:d}=oe(t),{isVisible:f,handleTextAlign:h,label:p,canAlign:m,isActive:v,Icon:b,shortcutKeys:C}=SE({editor:d,align:e,hideWhenUnavailable:r,onAligned:o}),x=y.useCallback(E=>{s?.(E),!E.defaultPrevented&&h()},[h,s]);if(!f)return null;const w=l??b;return g.jsx(fe,{type:"button",disabled:!m,"data-style":"ghost","data-active-state":v?"on":"off","data-disabled":!m,role:"button",tabIndex:-1,"aria-label":p,"aria-pressed":v,tooltip:p,onClick:x,...c,ref:u,children:a??g.jsxs(g.Fragment,{children:[g.jsx(w,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(gE,{align:e,shortcutKeys:C})]})})});Jn.displayName="TextAlignButton";const c0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 18C4 17.4477 4.44772 17 5 17H19C19.5523 17 20 17.4477 20 18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18Z",fill:"currentColor"})]}));c0.displayName="AlignCenterIcon";const u0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));u0.displayName="AlignJustifyIcon";const d0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));d0.displayName="AlignLeftIcon";const f0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 18C6 17.4477 6.44772 17 7 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H7C6.44772 19 6 18.5523 6 18Z",fill:"currentColor"})]}));f0.displayName="AlignRightIcon";const h0={left:"mod+shift+l",center:"mod+shift+e",right:"mod+shift+r",justify:"mod+shift+j"},yE={left:d0,center:c0,right:f0,justify:u0},vE={left:"Align left",center:"Align center",right:"Align right",justify:"Align justify"};function Zc(t,e){return!t||!t.isEditable||!ss(t,"textAlign")||_t(t,["image"])?!1:t.can().setTextAlign(e)}function bE(t){return"setTextAlign"in t}function CE(t,e){return!t||!t.isEditable?!1:t.isActive({textAlign:e})}function xE(t,e){if(!t||!t.isEditable||!Zc(t,e))return!1;const n=t.chain().focus();return bE(n)?n.setTextAlign(e).run():!1}function wE(t){const{editor:e,hideWhenUnavailable:n,align:r}=t;return!e||!e.isEditable||!ss(e,"textAlign")?!1:n&&!e.isActive("code")?Zc(e,r):!0}function SE(t){const{editor:e,align:n,hideWhenUnavailable:r=!1,onAligned:o}=t,{editor:i}=oe(e),[s,l]=y.useState(!0),a=Zc(i,n),c=CE(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(wE({editor:i,align:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,r,n]);const u=y.useCallback(()=>{if(!i)return!1;const d=xE(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleTextAlign:u,canAlign:a,label:vE[n],shortcutKeys:h0[n],Icon:yE[n]}}function kE({action:t,shortcutKeys:e=g0[t]}){return g.jsx(yt,{children:mt({shortcutKeys:e})})}const Bi=y.forwardRef(({editor:t,action:e,text:n,hideWhenUnavailable:r=!1,onExecuted:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=oe(t),{isVisible:d,handleAction:f,label:h,canExecute:p,Icon:m,shortcutKeys:v}=RE({editor:u,action:e,hideWhenUnavailable:r,onExecuted:o}),b=y.useCallback(C=>{s?.(C),!C.defaultPrevented&&f()},[f,s]);return d?g.jsx(fe,{type:"button",disabled:!p,"data-style":"ghost","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,tooltip:h,onClick:b,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(m,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(kE,{action:e,shortcutKeys:v})]})}):null});Bi.displayName="UndoRedoButton";const p0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",fill:"currentColor"})}));p0.displayName="Redo2Icon";const m0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",fill:"currentColor"})}));m0.displayName="Undo2Icon";const g0={undo:"mod+z",redo:"mod+shift+z"},EE={undo:"Undo",redo:"Redo"},ME={undo:m0,redo:p0};function Yc(t,e){return!t||!t.isEditable||_t(t,["image"])?!1:e==="undo"?t.can().undo():t.can().redo()}function TE(t,e){if(!t||!t.isEditable||!Yc(t,e))return!1;const n=t.chain().focus();return e==="undo"?n.undo().run():n.redo().run()}function AE(t){const{editor:e,hideWhenUnavailable:n,action:r}=t;return!e||!e.isEditable?!1:n&&!e.isActive("code")?Yc(e,r):!0}function RE(t){const{editor:e,action:n,hideWhenUnavailable:r=!1,onExecuted:o}=t,{editor:i}=oe(e),[s,l]=y.useState(!0),a=Yc(i,n);y.useEffect(()=>{if(!i)return;const u=()=>{l(AE({editor:i,hideWhenUnavailable:r,action:n}))};return u(),i.on("transaction",u),()=>{i.off("transaction",u)}},[i,r,n]);const c=y.useCallback(()=>{if(!i)return!1;const u=TE(i,n);return u&&o?.(),u},[i,n,o]);return{isVisible:s,handleAction:c,canExecute:a,label:EE[n],shortcutKeys:g0[n],Icon:ME[n]}}const y0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M12.7071 5.70711C13.0976 5.31658 13.0976 4.68342 12.7071 4.29289C12.3166 3.90237 11.6834 3.90237 11.2929 4.29289L4.29289 11.2929C3.90237 11.6834 3.90237 12.3166 4.29289 12.7071L11.2929 19.7071C11.6834 20.0976 12.3166 20.0976 12.7071 19.7071C13.0976 19.3166 13.0976 18.6834 12.7071 18.2929L7.41421 13L19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11L7.41421 11L12.7071 5.70711Z",fill:"currentColor"})}));y0.displayName="ArrowLeftIcon";var yl,vf;function OE(){if(vf)return yl;vf=1;var t="Expected a function",e=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt,a=typeof ao=="object"&&ao&&ao.Object===Object&&ao,c=typeof self=="object"&&self&&self.Object===Object&&self,u=a||c||Function("return this")(),d=Object.prototype,f=d.toString,h=Math.max,p=Math.min,m=function(){return u.Date.now()};function v(k,S,M){var N,P,W,z,H,I,_=0,F=!1,L=!1,T=!0;if(typeof k!="function")throw new TypeError(t);S=E(S)||0,C(M)&&(F=!!M.leading,L="maxWait"in M,W=L?h(E(M.maxWait)||0,S):W,T="trailing"in M?!!M.trailing:T);function R(ee){var We=N,vt=P;return N=P=void 0,_=ee,z=k.apply(vt,We),z}function U(ee){return _=ee,H=setTimeout(Z,S),F?R(ee):z}function Q(ee){var We=ee-I,vt=ee-_,jn=S-We;return L?p(jn,W-vt):jn}function K(ee){var We=ee-I,vt=ee-_;return I===void 0||We>=S||We<0||L&&vt>=W}function Z(){var ee=m();if(K(ee))return Ue(ee);H=setTimeout(Z,Q(ee))}function Ue(ee){return H=void 0,T&&N?R(ee):(N=P=void 0,z)}function se(){H!==void 0&&clearTimeout(H),_=0,N=I=P=H=void 0}function ge(){return H===void 0?z:Ue(m())}function Y(){var ee=m(),We=K(ee);if(N=arguments,P=this,I=ee,We){if(H===void 0)return U(I);if(L)return H=setTimeout(Z,S),R(I)}return H===void 0&&(H=setTimeout(Z,S)),z}return Y.cancel=se,Y.flush=ge,Y}function b(k,S,M){var N=!0,P=!0;if(typeof k!="function")throw new TypeError(t);return C(M)&&(N="leading"in M?!!M.leading:N,P="trailing"in M?!!M.trailing:P),v(k,S,{leading:N,maxWait:S,trailing:P})}function C(k){var S=typeof k;return!!k&&(S=="object"||S=="function")}function x(k){return!!k&&typeof k=="object"}function w(k){return typeof k=="symbol"||x(k)&&f.call(k)==n}function E(k){if(typeof k=="number")return k;if(w(k))return e;if(C(k)){var S=typeof k.valueOf=="function"?k.valueOf():k;k=C(S)?S+"":S}if(typeof k!="string")return k===0?k:+k;k=k.replace(r,"");var M=i.test(k);return M||s.test(k)?l(k.slice(2),M?2:8):o.test(k)?e:+k}return yl=b,yl}var NE=OE();const IE=Cf(NE),LE=t=>{const e=j.useRef(t);e.current=t,j.useEffect(()=>()=>{e.current()},[])},DE={leading:!1,trailing:!0};function v0(t,e=250,n=[],r=DE){const o=y.useMemo(()=>IE(t,e,r),n);return LE(()=>{o.cancel()}),o}function Xc(){const[t,e]=y.useState({width:0,height:0,offsetTop:0,offsetLeft:0,scale:0}),n=v0(()=>{if(typeof window>"u")return;const r=window.visualViewport;if(!r)return;const{width:o=0,height:i=0,offsetTop:s=0,offsetLeft:l=0,scale:a=0}=r;e(c=>o===c.width&&i===c.height&&s===c.offsetTop&&l===c.offsetLeft&&a===c.scale?c:{width:o,height:i,offsetTop:s,offsetLeft:l,scale:a})},200);return y.useEffect(()=>{const r=window.visualViewport;if(r)return r.addEventListener("resize",n),n(),()=>{r.removeEventListener("resize",n)}},[n]),t}const No={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0},b0=typeof window>"u",PE=!b0&&typeof ResizeObserver<"u",$o=()=>!b0;function jE({element:t,enabled:e=!0,throttleMs:n=100,useResizeObserver:r=!0}={}){const[o,i]=y.useState(No),s=y.useCallback(()=>!e||!$o()?null:t?typeof t=="string"?document.querySelector(t):"current"in t?t.current:t:document.body,[t,e]),l=v0(()=>{if(!e||!$o())return;const a=s();if(!a){i(No);return}const c=a.getBoundingClientRect();i({x:c.x,y:c.y,width:c.width,height:c.height,top:c.top,right:c.right,bottom:c.bottom,left:c.left})},n,[e,s],{leading:!0,trailing:!0});return y.useEffect(()=>{if(!e||!$o()){i(No);return}const a=s();if(!a)return;l();const c=[];if(r&&PE){const d=new ResizeObserver(()=>{window.requestAnimationFrame(l)});d.observe(a),c.push(()=>d.disconnect())}const u=()=>l();return window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u,{passive:!0}),c.push(()=>{window.removeEventListener("scroll",u),window.removeEventListener("resize",u)}),()=>{c.forEach(d=>d()),i(No)}},[e,s,l,r]),o}function BE(t={}){return jE({...t,element:$o()?document.body:null})}function _E({editor:t,overlayHeight:e=0}){const{height:n}=Xc(),r=BE({enabled:!0,throttleMs:100,useResizeObserver:!0});return y.useEffect(()=>{(()=>{if(!t)return;const{state:i,view:s}=t;if(!s.hasFocus())return;const{from:l}=i.selection,a=s.coordsAtPos(l);if(n<r.height&&a&&n-a.top<e){const u=Math.max(n/2,e),d=window.scrollY,h=a.top+d-u;window.scrollTo({top:Math.max(0,h),behavior:"smooth"})}})()},[t,e,n,r.height]),r}const HE=({onHighlighterClick:t,onLinkClick:e,isMobile:n})=>g.jsxs(g.Fragment,{children:[g.jsx(ef,{}),g.jsxs(Et,{children:[g.jsx(Bi,{action:"undo"}),g.jsx(Bi,{action:"redo"})]}),g.jsx(Mt,{}),g.jsxs(Et,{children:[g.jsx(Lc,{levels:[1,2,3,4],portal:n}),g.jsx(Eg,{types:["bulletList","orderedList","taskList"],portal:n}),g.jsx(Fc,{}),g.jsx(Vc,{})]}),g.jsx(Mt,{}),g.jsxs(Et,{children:[g.jsx(kt,{type:"bold"}),g.jsx(kt,{type:"italic"}),g.jsx(kt,{type:"strike"}),g.jsx(kt,{type:"code"}),g.jsx(kt,{type:"underline"}),n?g.jsx(qc,{onClick:t}):g.jsx(nE,{}),n?g.jsx(Gc,{onClick:e}):g.jsx(Yg,{})]}),g.jsx(Mt,{}),g.jsxs(Et,{children:[g.jsx(kt,{type:"superscript"}),g.jsx(kt,{type:"subscript"})]}),g.jsx(Mt,{}),g.jsxs(Et,{children:[g.jsx(Jn,{align:"left"}),g.jsx(Jn,{align:"center"}),g.jsx(Jn,{align:"right"}),g.jsx(Jn,{align:"justify"})]}),g.jsx(Mt,{}),g.jsx(Et,{children:g.jsx(Dc,{text:"Add"})}),g.jsx(ef,{}),n&&g.jsx(Mt,{})]}),FE=({type:t,onBack:e})=>g.jsxs(g.Fragment,{children:[g.jsx(Et,{children:g.jsxs(fe,{"data-style":"ghost",onClick:e,children:[g.jsx(y0,{className:"tiptap-button-icon"}),t==="highlighter"?g.jsx(gs,{className:"tiptap-button-icon"}):g.jsx(vs,{className:"tiptap-button-icon"})]})}),g.jsx(Mt,{}),t==="highlighter"?g.jsx(Kg,{}):g.jsx(iE,{})]});function $E(t){const e=fr(),{height:n}=Xc(),[r,o]=j.useState("main"),i=j.useRef(null),s=HC({content:t.value,immediatelyRender:!1,shouldRerenderOnTransaction:!1,onUpdate:({editor:a})=>{a&&t.onChange(a.getHTML())},editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off","aria-label":"Main content area, start typing to enter text.",class:"simple-editor"}},extensions:[V5,H5.configure({type:"resizableImage",accept:"image/*",maxSize:1*1024*1024*1024,upload:(a,c,u)=>Promise.resolve(t.onUploadImage?.(a,c,u)||"")}),Ew.configure({horizontalRule:!1,link:{openOnClick:!1,enableClickSelection:!0}}),F5,Mw.configure({types:["heading","paragraph"]}),Yp,Zp.configure({nested:!0}),Xw.configure({multicolor:!0}),Jw,e7,Qw,ww,c7.configure({attributeName:"id",generateID:()=>`tiptap-editor-${t.id}`})]}),l=_E({editor:s,overlayHeight:i.current?.getBoundingClientRect().height??0});return j.useEffect(()=>{!e&&r!=="main"&&o("main")},[e,r]),j.useEffect(()=>()=>{s&&s.commands.clearContent()},[s]),g.jsx("div",{className:"simple-editor-wrapper",children:g.jsxs(Wa.Provider,{value:{editor:s},children:[g.jsx(fc,{ref:i,style:{...e?{bottom:`calc(100% - ${n-l.y}px)`}:{}},children:r==="main"?g.jsx(HE,{onHighlighterClick:()=>o("highlighter"),onLinkClick:()=>o("link"),isMobile:e}):g.jsx(FE,{type:r==="highlighter"?"highlighter":"link",onBack:()=>o("main")})}),g.jsx(DC,{editor:s,className:"simple-editor-content"})]})})}exports.BlockquoteButton=Fc;exports.Button=fe;exports.Card=dr;exports.CodeBlockButton=Vc;exports.HeadingDropdownMenu=Lc;exports.ImageUploadButton=Dc;exports.ListDropdownMenu=Eg;exports.MAX_FILE_SIZE=ia;exports.MarkButton=kt;exports.TextAlignButton=Jn;exports.TiptapEditor=$E;exports.Toolbar=fc;exports.ToolbarGroup=Et;exports.ToolbarSeparator=Mt;exports.UndoRedoButton=Bi;exports.onUploadImage=E5;exports.useIsMobile=fr;exports.useTiptapEditor=oe;exports.useWindowSize=Xc;
2
214
  //# sourceMappingURL=index.cjs.map