@strands.gg/accui 2.17.31 → 2.17.35

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.
@@ -1,19 +1,19 @@
1
1
  "use strict";const a=require("vue"),de=(n,e)=>{const t=n.__vccOpts||n;for(const[r,i]of e)t[r]=i;return t},fd={class:"accui-component-scope"},hd={class:"alert-content"},pd={class:"alert-icon-container"},md={class:"alert-main-icon",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true"},gd=["d"],yd={class:"alert-text-container"},kd={key:0,class:"alert-dismiss-container"},bd=a.defineComponent({__name:"UiAlert",props:{variant:{default:"info"},title:{},message:{},dismissible:{type:Boolean,default:!1}},emits:["dismiss"],setup(n){const e=n,t=a.computed(()=>({success:"alert alert-success",error:"alert alert-error",warning:"alert alert-warning",info:"alert alert-info"})[e.variant]),r=a.computed(()=>"alert-title"),i=a.computed(()=>"alert-message"),o=a.computed(()=>({success:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",error:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",warning:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",info:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"})[e.variant]);return(s,l)=>(a.openBlock(),a.createElementBlock("div",fd,[a.createElementVNode("div",{class:a.normalizeClass(t.value),role:"alert"},[a.createElementVNode("div",hd,[a.createElementVNode("div",pd,[(a.openBlock(),a.createElementBlock("svg",md,[a.createElementVNode("path",{"fill-rule":"evenodd",d:o.value,"clip-rule":"evenodd"},null,8,gd)]))]),a.createElementVNode("div",yd,[n.title?(a.openBlock(),a.createElementBlock("h3",{key:0,class:a.normalizeClass(r.value)},a.toDisplayString(n.title),3)):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(i.value)},[a.renderSlot(s.$slots,"default",{},()=>[a.createTextVNode(a.toDisplayString(n.message),1)],!0)],2)]),n.dismissible?(a.openBlock(),a.createElementBlock("div",kd,[a.createElementVNode("button",{type:"button",class:"alert-dismiss-button",onClick:l[0]||(l[0]=c=>s.$emit("dismiss"))},[...l[1]||(l[1]=[a.createElementVNode("span",{class:"sr-only"},"Dismiss",-1),a.createElementVNode("svg",{class:"alert-dismiss-icon",fill:"currentColor",viewBox:"0 0 20 20"},[a.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)])])])):a.createCommentVNode("",!0)])],2)]))}}),co=de(bd,[["__scopeId","data-v-68f69cce"]]),vd=`<svg width="302" height="438" viewBox="0 0 302 438" fill="none" xmlns="http://www.w3.org/2000/svg">
2
2
  <path d="M71.5001 96C71.5001 96 132 106 137 61.5C142 17 117.5 3.50005 94.5001 1.50003C71.5001 -0.499996 16.0001 8.5 2.00014 72.5C-6.5 130.5 71.5003 227.5 165 218C258.5 208.5 280.758 148.5 283.5 121C286.242 93.5 277.5 61.5 238.5 61.5C153 61.5 150.501 185 170.5 235C190.5 285 199 279 213 314C227.001 349 217.296 411.458 183 427C129.456 450.65 92 426 78.5 407.5C65 389 68.0003 357 94.5001 344.5C121 332 212.41 393.5 301.5 361" stroke="black"/>
3
3
  </svg>
4
- `,xd={key:0,class:"loader-icon"},wd=["width","height"],Cd=["d"],Sd=["stroke-width"],Md=["stroke-width"],Td=["width","height"],Ed={key:3,class:"loader-text"},Nd=a.defineComponent({__name:"UiLoader",props:{size:{default:"md"},color:{default:"primary"},variant:{default:"circle"},text:{},centered:{type:Boolean,default:!0},weight:{default:30},fullWidth:{type:Boolean,default:!1}},setup(n){const t=vd.replace(/<svg[^>]*>/,"").replace(/<\/svg>/,"").trim().match(/d="([^"]*)"/)?.[1]||"",r=n,i={sm:32,md:48,lg:64,xl:80},o=a.computed(()=>typeof r.size=="number"?r.size:i[r.size]||i.md);return(s,l)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["loader-container",[{"loader-centered":n.centered},`loader-color-${n.color}`]])},[n.variant==="spinner"?(a.openBlock(),a.createElementBlock("div",xd,[(a.openBlock(),a.createElementBlock("svg",{width:o.value,height:o.value,viewBox:"0 0 500 500"},[a.createElementVNode("defs",null,[a.createElementVNode("path",{id:"logo-path",d:a.unref(t),transform:"translate(81, 13) scale(1.0)"},null,8,Cd)]),a.createElementVNode("use",{href:"#logo-path",fill:"none",stroke:"var(--loader-semi-color)","stroke-width":n.weight,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,Sd),a.createElementVNode("use",{href:"#logo-path",fill:"none",stroke:"var(--loader-solid-color)","stroke-width":n.weight,"stroke-linecap":"round","stroke-linejoin":"round",class:"loader-animated-path"},null,8,Md)],8,wd))])):n.variant==="circle"?(a.openBlock(),a.createElementBlock("div",{key:1,class:"loader-circle",style:a.normalizeStyle({width:`${o.value}px`,height:`${o.value}px`})},[(a.openBlock(),a.createElementBlock("svg",{width:o.value,height:o.value,viewBox:"0 0 50 50"},[...l[0]||(l[0]=[a.createElementVNode("circle",{cx:"25",cy:"25",r:"20",fill:"none",stroke:"var(--loader-solid-color)","stroke-width":"4","stroke-linecap":"round",class:"loader-circle-path"},null,-1)])],8,Td))],4)):n.variant==="bar"?(a.openBlock(),a.createElementBlock("div",{key:2,class:"loader-bar",style:a.normalizeStyle({width:n.fullWidth?"100%":`${o.value*1.5}px`,height:`${Math.max(o.value*.1,4)}px`})},[...l[1]||(l[1]=[a.createElementVNode("div",{class:"loader-bar-track"},[a.createElementVNode("div",{class:"loader-bar-fill"})],-1)])],4)):a.createCommentVNode("",!0),n.text?(a.openBlock(),a.createElementBlock("p",Ed,a.toDisplayString(n.text),1)):a.createCommentVNode("",!0)],2))}}),zr=de(Nd,[["__scopeId","data-v-4b565c5d"]]),Ad={key:0,class:"button-loading-content"},Bd={key:0},Od={key:0,class:"leading-icon"},Dd={key:1,class:"trailing-icon"},Id=a.defineComponent({__name:"UiButton.Content",props:{loading:{type:Boolean,default:!1},loadingText:{},icon:{type:Boolean,default:!1},size:{},align:{default:"center"}},setup(n){const e=a.useSlots(),t=a.computed(()=>!!e["leading-icon"]),r=a.computed(()=>!!e["trailing-icon"]),i=n,o=a.computed(()=>{switch(i.size){case"xs":return 16;case"sm":return 18;case"md":return 20;case"lg":return 24;case"xl":return 28;default:return 20}}),s=a.computed(()=>i.size?`button-content-${i.size}`:"button-content-md");return(l,c)=>n.loading?(a.openBlock(),a.createElementBlock("span",Ad,[a.createVNode(zr,{variant:"circle",size:o.value,centered:!1,color:"white"},null,8,["size"]),n.icon?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("span",Bd,a.toDisplayString(n.loadingText||"Loading..."),1))])):(a.openBlock(),a.createElementBlock("span",{key:1,class:a.normalizeClass(["button-content",s.value,`button-content-align-${n.align}`])},[n.icon?a.renderSlot(l.$slots,"icon",{key:0},void 0,!0):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[t.value?(a.openBlock(),a.createElementBlock("span",Od,[a.renderSlot(l.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(l.$slots,"icon",{},void 0,!0),a.createElementVNode("span",{class:a.normalizeClass(["button-text-content",`button-text-align-${n.align}`])},[a.renderSlot(l.$slots,"default",{},void 0,!0)],2),r.value?(a.openBlock(),a.createElementBlock("span",Dd,[a.renderSlot(l.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0)],64))],2))}}),Wt=de(Id,[["__scopeId","data-v-676024d7"]]),$d=["href","target","rel"],Oi=a.defineComponent({__name:"UiButton.Anchor",props:{to:{},href:{},external:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{},icon:{type:Boolean,default:!1},buttonClasses:{},buttonStyles:{}},emits:["click"],setup(n,{emit:e}){const t=n,r=e,i=a.computed(()=>{if(t.href)return t.href;if(t.to){if(typeof t.to=="string")return t.to;if(typeof t.to=="object"&&t.to)return"#route-object-not-supported"}return"#"}),o=s=>{if(t.disabled||t.loading){s.preventDefault();return}r("click",s)};return(s,l)=>(a.openBlock(),a.createElementBlock("a",{href:i.value,target:n.external?"_blank":void 0,rel:n.external?"noopener noreferrer":void 0,class:a.normalizeClass(n.buttonClasses),style:a.normalizeStyle(n.buttonStyles),onClick:o},[a.createVNode(Wt,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon},{"leading-icon":a.withCtx(()=>[a.renderSlot(s.$slots,"leading-icon")]),icon:a.withCtx(()=>[a.renderSlot(s.$slots,"icon")]),default:a.withCtx(()=>[a.renderSlot(s.$slots,"default")]),"trailing-icon":a.withCtx(()=>[a.renderSlot(s.$slots,"trailing-icon")]),_:3},8,["loading","loading-text","icon"])],14,$d))}}),Di=a.defineComponent({__name:"UiButton.Nuxt",props:{to:{},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{},icon:{type:Boolean,default:!1},buttonClasses:{},buttonStyles:{}},emits:["click"],setup(n,{emit:e}){const t=a.getCurrentInstance(),r=a.computed(()=>t?.appContext.app.component("NuxtLink")?"NuxtLink":t?.appContext.app.component("RouterLink")?"RouterLink":"a"),i=n,o=e,s=l=>{if(i.disabled||i.loading){l.preventDefault();return}o("click",l)};return(l,c)=>(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r.value),{to:r.value!=="a"?n.to:void 0,href:r.value==="a"?typeof n.to=="string"?n.to:"/":void 0,class:a.normalizeClass(n.buttonClasses),style:a.normalizeStyle(n.buttonStyles),onClick:s},{default:a.withCtx(()=>[a.createVNode(Wt,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon},{"leading-icon":a.withCtx(()=>[a.renderSlot(l.$slots,"leading-icon")]),icon:a.withCtx(()=>[a.renderSlot(l.$slots,"icon")]),default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),"trailing-icon":a.withCtx(()=>[a.renderSlot(l.$slots,"trailing-icon")]),_:3},8,["loading","loading-text","icon"])]),_:3},8,["to","href","class","style"]))}}),Ii=a.defineComponent({__name:"UiButton.Vue",props:{to:{},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{},icon:{type:Boolean,default:!1},buttonClasses:{},buttonStyles:{}},emits:["click"],setup(n,{emit:e}){const t=n,r=e,i=o=>{if(t.disabled||t.loading){o.preventDefault();return}r("click",o)};return(o,s)=>{const l=a.resolveComponent("router-link");return a.openBlock(),a.createBlock(l,{to:n.to,class:a.normalizeClass(n.buttonClasses),style:a.normalizeStyle(n.buttonStyles),onClick:i},{default:a.withCtx(()=>[a.createVNode(Wt,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon},{"leading-icon":a.withCtx(()=>[a.renderSlot(o.$slots,"leading-icon")]),icon:a.withCtx(()=>[a.renderSlot(o.$slots,"icon")]),default:a.withCtx(()=>[a.renderSlot(o.$slots,"default")]),"trailing-icon":a.withCtx(()=>[a.renderSlot(o.$slots,"trailing-icon")]),_:3},8,["loading","loading-text","icon"])]),_:3},8,["to","class","style"])}}}),Rd={class:"ui-tooltip-content"},Ld=a.defineComponent({inheritAttrs:!1,__name:"UiTooltip",props:{content:{default:""},position:{default:"top"},delay:{default:500},disabled:{type:Boolean,default:!1},offset:{default:8},maxWidth:{default:250}},setup(n){const e=n,t=a.ref(),r=a.ref(),i=a.ref(!1),o=a.ref(!1);let s=null,l=null;const c=a.ref({}),d=async()=>{if(!t.value||!r.value||!o.value)return;await a.nextTick();const h=t.value.getBoundingClientRect();r.value.style.visibility="hidden",r.value.style.opacity="1";const p=r.value.getBoundingClientRect(),m=p.width,g=p.height;r.value.style.visibility="",r.value.style.opacity="";const y=window.innerWidth,k=window.innerHeight;let v=0,b=0;switch(e.position){case"top":v=h.top-g-e.offset,b=h.left+h.width/2-m/2;break;case"bottom":v=h.bottom+e.offset,b=h.left+h.width/2-m/2;break;case"left":v=h.top+h.height/2-g/2,b=h.left-m-e.offset;break;case"right":v=h.top+h.height/2-g/2,b=h.right+e.offset;break}const x=8;b<x?b=x:b+m>y-x&&(b=y-m-x),v<x?v=x:v+g>k-x&&(v=k-g-x),c.value={position:"fixed",top:`${v}px`,left:`${b}px`,zIndex:"9999"}},u=()=>{e.disabled||(l&&(clearTimeout(l),l=null),o.value=!0,a.nextTick(()=>{d()}),s=setTimeout(()=>{i.value=!0},e.delay))},f=()=>{s&&(clearTimeout(s),s=null),l=setTimeout(()=>{i.value=!1,setTimeout(()=>{o.value=!1},200)},100)};return a.onUnmounted(()=>{s&&clearTimeout(s),l&&clearTimeout(l)}),(h,p)=>(a.openBlock(),a.createElementBlock("div",a.mergeProps({ref_key:"tooltipContainer",ref:t,class:"ui-tooltip-container"},h.$attrs,{onMouseenter:u,onMouseleave:f}),[a.renderSlot(h.$slots,"default",{},void 0,!0),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[o.value?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"tooltipRef",ref:r,class:a.normalizeClass(["ui-tooltip",[`ui-tooltip--${n.position}`,{"ui-tooltip--visible":i.value}]]),style:a.normalizeStyle(c.value),role:"tooltip"},[a.createElementVNode("div",Rd,[a.renderSlot(h.$slots,"tooltip",{},()=>[a.createTextVNode(a.toDisplayString(n.content),1)],!0)]),a.createElementVNode("div",{class:a.normalizeClass(["ui-tooltip-arrow",`ui-tooltip-arrow--${n.position}`])},null,2)],6)):a.createCommentVNode("",!0)]))],16))}}),Tl=de(Ld,[["__scopeId","data-v-ba66edda"]]),zd=["type","disabled","tabindex"],Pd=["type","disabled","tabindex"],Vd=a.defineComponent({inheritAttrs:!1,__name:"UiButton",props:{variant:{default:"primary"},size:{default:"md"},type:{default:"button"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{},fullWidth:{type:Boolean,default:!1},color:{default:"primary"},fontWeight:{default:600},icon:{type:Boolean,default:!1},squircle:{type:Boolean,default:!1},to:{},href:{},external:{type:Boolean,default:!1},tabindex:{},title:{},align:{default:"center"}},emits:["click"],setup(n,{emit:e}){const t=n,r=a.computed(()=>t.title?typeof t.title=="string"?{content:t.title,position:"top",disabled:t.disabled||t.loading}:{...t.title,disabled:t.title.disabled??(t.disabled||t.loading)}:null),i=a.computed(()=>!!(typeof process<"u"&&process.client!==void 0||typeof window<"u"&&(window.__NUXT__||window.$nuxt))),o=a.computed(()=>{try{if(typeof window<"u"&&window.Vue?.Router)return!0}catch{}return!1}),s=a.computed(()=>["ui-button",`ui-button-${t.variant}`,`ui-button-${t.size}`,`ui-button-color-${t.color}`,t.loading?"ui-button-loading":"",t.disabled?"ui-button-disabled":"",t.fullWidth?"ui-button-full-width":"",t.icon?"ui-button-icon":"",t.squircle?"ui-button-squircle":""].filter(Boolean)),l=a.computed(()=>s.value.join(" ")),c=a.computed(()=>({fontWeight:t.fontWeight})),d=a.computed(()=>t.disabled||t.loading?-1:t.tabindex??void 0);return(u,f)=>n.title?(a.openBlock(),a.createBlock(Tl,a.normalizeProps(a.mergeProps({key:0},r.value)),{default:a.withCtx(()=>[n.to?i.value&&n.to?(a.openBlock(),a.createBlock(Di,{key:1,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,onClick:f[1]||(f[1]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):o.value&&n.to?(a.openBlock(),a.createBlock(Ii,{key:2,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,onClick:f[2]||(f[2]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):(a.openBlock(),a.createBlock(Oi,{key:3,to:n.to,href:n.href,external:n.external,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,onClick:f[3]||(f[3]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","href","external","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):(a.openBlock(),a.createElementBlock("button",a.mergeProps({key:0},u.$attrs,{type:n.type,disabled:n.disabled||n.loading,class:l.value,style:c.value,tabindex:d.value,onClick:f[0]||(f[0]=h=>u.$emit("click",h))}),[a.createVNode(Wt,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,size:n.size,align:n.align},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","align"])],16,zd))]),_:3},16)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[n.to?i.value&&n.to?(a.openBlock(),a.createBlock(Di,{key:1,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,onClick:f[5]||(f[5]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):o.value&&n.to?(a.openBlock(),a.createBlock(Ii,{key:2,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,onClick:f[6]||(f[6]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):(a.openBlock(),a.createBlock(Oi,{key:3,to:n.to,href:n.href,external:n.external,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,onClick:f[7]||(f[7]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","href","external","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):(a.openBlock(),a.createElementBlock("button",a.mergeProps({key:0},u.$attrs,{type:n.type,disabled:n.disabled||n.loading,class:l.value,style:c.value,tabindex:d.value,onClick:f[4]||(f[4]=h=>u.$emit("click",h))}),[a.createVNode(Wt,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,size:n.size,align:n.align},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","align"])],16,Pd))],64))}}),W=de(Vd,[["__scopeId","data-v-62daebaa"]]),Fd={key:0,class:"ui-card-header"},Hd={key:0,class:"ui-card-title-wrapper"},jd={key:0,class:"ui-card-title"},Ud={key:0,class:"ui-card-subtitle"},qd={key:1,class:"ui-card-content"},Wd={key:2,class:"ui-card-footer"},Kd=a.defineComponent({inheritAttrs:!1,__name:"UiCard",props:{variant:{default:"default"},padding:{default:"md"},shadow:{default:"sm"},color:{default:"default"},title:{},subtitle:{}},setup(n){const e=a.useAttrs();return(t,r)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["ui-card",[`ui-card-${n.variant}`,`ui-card-padding-${n.padding}`,`ui-card-shadow-${n.shadow}`,`ui-card-color-${n.color}`,a.unref(e).class]])},[t.$slots.header||n.title||n.subtitle||t.$slots["leading-icon"]||t.$slots["trailing-icon"]?(a.openBlock(),a.createElementBlock("div",Fd,[a.renderSlot(t.$slots,"header",{},()=>[a.renderSlot(t.$slots,"leading-icon",{},void 0,!0),n.title||t.$slots.title||n.subtitle||t.$slots.subtitle?(a.openBlock(),a.createElementBlock("div",Hd,[n.title||t.$slots.title?a.renderSlot(t.$slots,"title",{key:0},()=>[n.title?(a.openBlock(),a.createElementBlock("h2",jd,a.toDisplayString(n.title),1)):a.createCommentVNode("",!0)],!0):a.createCommentVNode("",!0),n.subtitle||t.$slots.subtitle?a.renderSlot(t.$slots,"subtitle",{key:1},()=>[n.subtitle?(a.openBlock(),a.createElementBlock("p",Ud,a.toDisplayString(n.subtitle),1)):a.createCommentVNode("",!0)],!0):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.renderSlot(t.$slots,"trailing-icon",{},void 0,!0),a.renderSlot(t.$slots,"actions",{},void 0,!0)],!0)])):a.createCommentVNode("",!0),t.$slots.default?(a.openBlock(),a.createElementBlock("div",qd,[a.renderSlot(t.$slots,"default",{},void 0,!0)])):a.createCommentVNode("",!0),t.$slots.footer?(a.openBlock(),a.createElementBlock("div",Wd,[a.renderSlot(t.$slots,"footer",{},void 0,!0)])):a.createCommentVNode("",!0)],2))}}),uo=de(Kd,[["__scopeId","data-v-374e57b2"]]);const es=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Jd=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),Gd=n=>{const e=Jd(n);return e.charAt(0).toUpperCase()+e.slice(1)},Yd=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim(),ts=n=>n==="";var en={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Qd=({name:n,iconNode:e,absoluteStrokeWidth:t,"absolute-stroke-width":r,strokeWidth:i,"stroke-width":o,size:s=en.width,color:l=en.stroke,...c},{slots:d})=>a.h("svg",{...en,...c,width:s,height:s,stroke:l,"stroke-width":ts(t)||ts(r)||t===!0||r===!0?Number(i||o||en["stroke-width"])*24/Number(s):i||o||en["stroke-width"],class:Yd("lucide",c.class,...n?[`lucide-${es(Gd(n))}-icon`,`lucide-${es(n)}`]:["lucide-icon"])},[...e.map(u=>a.h(...u)),...d.default?[d.default()]:[]]);const J=(n,e)=>(t,{slots:r,attrs:i})=>a.h(Qd,{...i,...t,iconNode:e,name:n},r);const Xd=J("align-center",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const Zd=J("align-left",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const _d=J("align-right",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const eu=J("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const tu=J("calendar-clock",[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);const nu=J("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const ru=J("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Pr=J("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const iu=J("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const ou=J("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const su=J("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const lu=J("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const au=J("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const cu=J("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const du=J("file-input",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);const uu=J("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);const fu=J("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);const hu=J("heading-3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);const pu=J("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const mu=J("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);const gu=J("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);const El=J("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const yu=J("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const ku=J("redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);const bu=J("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const vu=J("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);const xu=J("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);const wu=J("undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);const fo=J("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Cu={key:0,class:"input-leading-icon"},Su=["id","type","value","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","tabindex"],Mu={key:1,class:"input-trailing-icon"},Tu={key:2,class:"input-trailing-icon"},Eu={key:3,class:"input-trailing-icon"},Nu=a.defineComponent({__name:"UiInput.Text",props:{type:{default:"text"},min:{},max:{},step:{},autocomplete:{},spellcheck:{type:Boolean,default:!0},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","keydown"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(!1),o=a.computed(()=>t.type==="password"?i.value?"text":"password":t.type),s=a.computed(()=>t.hasTrailingIcon||t.type==="password"||t.type==="search"&&t.modelValue),l=a.computed(()=>{if(t.tabindex!==void 0)return t.tabindex+1}),c=a.computed(()=>{const y=[];return t.error&&y.push("input-error"),t.disabled&&y.push("input-disabled"),t.readonly&&y.push("input-readonly"),y.push(`input-size-${t.size}`),y}),d=a.computed(()=>{const y=[];return t.hasLeadingIcon?y.push("input-padding-left-icon"):y.push("input-padding-left"),s.value?y.push("input-padding-right-icon"):y.push("input-padding-right"),y}),u=y=>{let v=y.target.value;t.type==="number"&&v!==""&&(v=parseFloat(v)||0),r("update:modelValue",v)},f=y=>{r("blur",y)},h=y=>{r("focus",y)},p=y=>{r("keydown",y)},m=()=>{i.value=!i.value},g=()=>{r("update:modelValue","")};return(y,k)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper",c.value])},[a.renderSlot(y.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Cu,[a.renderSlot(y.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.createElementVNode("input",{id:n.inputId,type:o.value,value:n.modelValue,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:n.required,min:n.min,max:n.max,step:n.step,autocomplete:n.autocomplete,spellcheck:n.spellcheck,tabindex:n.tabindex,class:a.normalizeClass(["input-base",d.value]),onInput:u,onBlur:f,onFocus:h,onKeydown:p},null,42,Su),n.type==="password"?(a.openBlock(),a.createElementBlock("div",Mu,[a.createVNode(W,{color:i.value?"primary":"secondary",variant:i.value?"primary":"ghost",size:"sm",icon:"",squircle:"",tabindex:l.value,"aria-label":i.value?"Hide password":"Show password",onClick:m},{icon:a.withCtx(()=>[i.value?(a.openBlock(),a.createBlock(a.unref(au),{key:0})):(a.openBlock(),a.createBlock(a.unref(cu),{key:1}))]),_:1},8,["color","variant","tabindex","aria-label"])])):n.type==="search"&&n.modelValue&&!n.disabled&&!n.readonly?(a.openBlock(),a.createElementBlock("div",Tu,[a.createVNode(W,{color:"danger",variant:"ghost",size:"sm",icon:"",squircle:"",tabindex:l.value,"aria-label":"Clear search",onClick:g},{icon:a.withCtx(()=>[a.createVNode(a.unref(fo))]),_:1},8,["tabindex"])])):t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",Eu,[a.renderSlot(y.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(y.$slots,"trailing",{},void 0,!0)],2))}}),Au=de(Nu,[["__scopeId","data-v-4807b700"]]),Bu={key:0,class:"input-leading-icon"},Ou=["id","value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck"],Du={key:1,class:"input-trailing-icon"},Iu=a.defineComponent({__name:"UiInput.Textarea",props:{rows:{default:3},cols:{},maxlength:{},autocomplete:{},spellcheck:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","keydown"],setup(n,{emit:e}){const t=n,r=e,i=a.computed(()=>{const u=[];return t.error&&u.push("input-error"),t.disabled&&u.push("input-disabled"),t.readonly&&u.push("input-readonly"),u.push(`input-size-${t.size}`),u}),o=a.computed(()=>{const u=[];return t.hasLeadingIcon?u.push("input-padding-left-icon"):u.push("input-padding-left"),t.hasTrailingIcon?u.push("input-padding-right-icon"):u.push("input-padding-right"),u}),s=u=>{const f=u.target;r("update:modelValue",f.value)},l=u=>{r("blur",u)},c=u=>{r("focus",u)},d=u=>{r("keydown",u)};return(u,f)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper input-textarea",i.value])},[a.renderSlot(u.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Bu,[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(["textarea-wrapper",{"textarea-resizable":n.resizable}])},[a.createElementVNode("textarea",{id:n.inputId,value:n.modelValue,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:n.required,rows:n.rows,cols:n.cols,maxlength:n.maxlength,autocomplete:n.autocomplete,spellcheck:n.spellcheck,class:a.normalizeClass(["input-base",[{"input-textarea-resize":n.resizable},o.value]]),onInput:s,onBlur:l,onFocus:c,onKeydown:d},null,42,Ou)],2),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",Du,[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(u.$slots,"trailing",{},void 0,!0)],2))}}),$u=de(Iu,[["__scopeId","data-v-7d410607"]]);function Vr(n){const{trigger:e,floating:t,placement:r="bottom-start",offset:i=8,flip:o=!0,shift:s=!0,sameWidth:l=!1,autoUpdate:c=!1,clickOutside:d}=n,u=a.ref({position:"fixed",top:"0px",left:"0px",zIndex:"9999"}),f=async()=>{if(await a.nextTick(),!e.value||!t.value||typeof e.value.getBoundingClientRect!="function"||typeof t.value.getBoundingClientRect!="function")return;const b=e.value.getBoundingClientRect(),x=t.value.getBoundingClientRect(),[w,S="start"]=r.split("-");let M=0,C=0;switch(w){case"bottom":M=b.left,C=b.bottom+i;break;case"top":M=b.left,C=b.top-x.height-i;break;case"right":M=b.right+i,C=b.top;break;case"left":M=b.left-x.width-i,C=b.top;break}if(w==="top"||w==="bottom")switch(S){case"center":M=b.left+(b.width-x.width)/2;break;case"end":M=b.right-x.width;break}else if(w==="left"||w==="right")switch(S){case"center":C=b.top+(b.height-x.height)/2;break;case"end":C=b.bottom-x.height;break}let A=l?b.width:void 0;const $=window.innerWidth,U=window.innerHeight,j=8;let K=!1,N=!1;if(o){if(w==="bottom"&&C+x.height>U-j){const R=b.top-x.height-i;R>=j&&(C=R,K=!0)}else if(w==="top"&&C<j){const R=b.bottom+i;R+x.height<=U-j&&(C=R,K=!1)}if(w==="right"&&M+x.width>$-j){const R=b.left-x.width-i;R>=j&&(M=R,N=!0)}else if(w==="left"&&M<j){const R=b.right+i;R+x.width<=$-j&&(M=R,N=!1)}}s&&(M<j?M=j:M+x.width>$-j&&(M=$-x.width-j),C<j?C=j:C+x.height>U-j&&(C=U-x.height-j));const D={position:"fixed",zIndex:"9999",...A?{width:`${A}px`}:{}};K?D.bottom=`${U-C-x.height}px`:D.top=`${C}px`,N?D.right=`${$-M-x.width}px`:D.left=`${M}px`,u.value=D},h=()=>{f()};let p=null;const m=()=>{h()},g=()=>{if(h(),d?.enabled&&d.handler&&e.value){if(typeof e.value.getBoundingClientRect!="function")return;const b=e.value.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth;(b.bottom<0||b.top>x||b.right<0||b.left>w)&&d.handler()}},y=b=>{if(!d?.enabled||!d.handler)return;const x=b.target;if(!x||!e.value||!t.value||typeof e.value.contains!="function"||typeof t.value.contains!="function")return;const w=e.value.contains(x),S=t.value.contains(x);!w&&!S&&d.handler()},k=()=>{c&&(window.addEventListener("resize",m),window.addEventListener("scroll",g,!0),typeof ResizeObserver<"u"&&(p=new ResizeObserver(()=>{h()}),a.nextTick(()=>{e.value&&p&&typeof e.value.getBoundingClientRect=="function"&&p.observe(e.value),t.value&&p&&typeof t.value.getBoundingClientRect=="function"&&p.observe(t.value)}))),d?.enabled&&document.addEventListener("click",y,!0)},v=()=>{c&&(window.removeEventListener("resize",m),window.removeEventListener("scroll",g,!0)),d?.enabled&&document.removeEventListener("click",y,!0),p&&(p.disconnect(),p=null)};return a.onMounted(()=>{k()}),a.onUnmounted(()=>{v()}),{floatingStyle:u,updatePosition:h,cleanup:v}}const Ru={key:0,class:"input-leading-icon"},Lu=["tabindex","aria-expanded","aria-controls","aria-disabled"],zu={class:"input-select-value"},Pu={key:0,class:"input-select-text"},Vu={key:1,class:"input-select-placeholder"},Fu={key:1,class:"input-trailing-icon"},Hu=["id","aria-multiselectable"],ju={key:0,class:"input-dropdown-search"},Uu={key:0,class:"input-dropdown-no-options"},qu=["onClick","onMouseenter","aria-selected"],Wu={class:"input-dropdown-option-content"},Ku={class:"input-dropdown-option-text"},Ju={key:0,class:"input-dropdown-option-description"},Gu={key:0,class:"input-dropdown-option-check"},Yu=a.defineComponent({__name:"UiInput.Select",props:{options:{default:()=>[]},multiple:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},allowInsert:{type:Boolean,default:!1},maxDropdownHeight:{default:400},noOptionsText:{default:"No options available"},searchPlaceholder:{default:""},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(),o=a.ref(),s=a.ref(),l=a.computed(()=>`dropdown-${t.inputId||Math.random().toString(36).substr(2,9)}`),c=a.computed(()=>{if(i.value){const N=i.value.closest('[role="dialog"][aria-modal="true"]');if(N)return N}return"body"}),d=a.ref({isOpen:!1,searchQuery:"",highlightedIndex:-1}),{floatingStyle:u,updatePosition:f,cleanup:h}=Vr({trigger:i,floating:o,placement:"bottom-start",offset:10,shift:!0,flip:!0,sameWidth:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{S()}}}),p=a.computed(()=>t.multiple?Array.isArray(t.modelValue)?t.modelValue:[]:t.modelValue!==void 0?[t.modelValue]:[]),m=a.computed(()=>{if(t.multiple){const N=t.options.filter(D=>p.value.includes(D.value));return N.length>0?`${N.length} selected`:null}else return t.options.find(D=>D.value===t.modelValue)?.label||null}),g=a.computed(()=>{let N=t.options;if(t.searchable&&d.value.searchQuery){const D=d.value.searchQuery.toLowerCase();N=t.options.filter(R=>R.label.toLowerCase().includes(D)||R.description?.toLowerCase().includes(D)),t.allowInsert&&t.multiple&&d.value.searchQuery.trim()&&(t.options.some(ke=>ke.label.toLowerCase()===d.value.searchQuery.toLowerCase())||(N=[{value:`__insert__${d.value.searchQuery}`,label:`Add "${d.value.searchQuery}"`,description:"Add as new item",disabled:!1},...N]))}return N}),y=a.computed(()=>t.searchPlaceholder&&t.searchPlaceholder.trim()!==""?t.searchPlaceholder:t.allowInsert&&t.multiple?"Search or create...":"Search..."),k=a.computed(()=>t.disabled?-1:t.tabindex??0),v=a.computed(()=>{if(t.tabindex!==void 0)return t.tabindex+1}),b=a.computed(()=>{const N=[];return t.error&&N.push("input-error"),t.disabled&&N.push("input-disabled"),N.push(`input-size-${t.size}`),N}),x=a.computed(()=>{const N=[];return t.hasLeadingIcon?N.push("input-padding-left-icon"):N.push("input-padding-left"),t.hasTrailingIcon?N.push("input-padding-right-icon"):N.push("input-padding-right"),N}),w=async()=>{if(!t.disabled){if(d.value.isOpen=!0,d.value.searchQuery="",await a.nextTick(),f(),d.value.highlightedIndex===-1){const N=g.value.findIndex(D=>!D.disabled);d.value.highlightedIndex=N>=0?N:0}if(t.searchable&&s.value){const N=s.value.$el?.querySelector("input");N&&N.focus()}document.addEventListener("keydown",j),r("focus",new FocusEvent("focus"))}},S=()=>{d.value.isOpen&&(d.value.isOpen=!1,d.value.highlightedIndex=-1,d.value.searchQuery="",document.removeEventListener("keydown",j),r("blur",new FocusEvent("blur")))},M=()=>{d.value.isOpen?S():w()},C=N=>N.value&&typeof N.value=="string"&&N.value.startsWith("__insert__")?!1:p.value.includes(N.value),A=N=>{if(!N.disabled)if(t.multiple){const D=[...p.value];if(N.value&&typeof N.value=="string"&&N.value.startsWith("__insert__")){const R=N.value.replace("__insert__","");D.includes(R)||D.push(R),d.value.searchQuery=""}else{const R=D.indexOf(N.value);R>-1?D.splice(R,1):D.push(N.value)}r("update:modelValue",D)}else r("update:modelValue",N.value),S()},$=N=>{if(["Enter"," ","ArrowDown","ArrowUp","Escape"].includes(N.key)&&(N.preventDefault(),!(d.value.isOpen&&(N.key==="ArrowDown"||N.key==="ArrowUp"))))switch(N.key){case"Enter":case" ":M();break;case"ArrowDown":case"ArrowUp":w();break;case"Escape":S();break}},U=N=>{switch(N.key){case"ArrowDown":N.preventDefault(),K(1);break;case"ArrowUp":N.preventDefault(),K(-1);break;case"Enter":if(N.preventDefault(),d.value.highlightedIndex>=0){const D=g.value[d.value.highlightedIndex];D&&!D.disabled&&A(D)}break;case"Escape":S();break}},j=N=>{if(d.value.isOpen)switch(N.key){case"Escape":S();break;case"ArrowDown":N.preventDefault(),K(1);break;case"ArrowUp":N.preventDefault(),K(-1);break;case"Enter":if(N.preventDefault(),d.value.highlightedIndex>=0){const D=g.value[d.value.highlightedIndex];D&&!D.disabled&&A(D)}break}},K=N=>{const D=g.value;if(D.length===0)return;let R=d.value.highlightedIndex+N;R<0?R=D.length-1:R>=D.length&&(R=0);let ke=0;for(;D[R]?.disabled&&ke<D.length;)R+=N,R<0&&(R=D.length-1),R>=D.length&&(R=0),ke++;d.value.highlightedIndex=R};return a.onUnmounted(()=>{d.value.isOpen&&S(),document.removeEventListener("keydown",j),h()}),(N,D)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{class:a.normalizeClass(["input-field-wrapper",[b.value,x.value]])},[a.renderSlot(N.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Ru,[a.renderSlot(N.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",{ref_key:"selectTriggerRef",ref:i,class:a.normalizeClass(["input-select-trigger",{"input-select-open":d.value.isOpen}]),onClick:M,onKeydown:$,tabindex:k.value,role:"combobox","aria-expanded":d.value.isOpen,"aria-haspopup":!0,"aria-controls":l.value,"aria-disabled":n.disabled},[a.createElementVNode("div",zu,[m.value?(a.openBlock(),a.createElementBlock("span",Pu,a.toDisplayString(m.value),1)):(a.openBlock(),a.createElementBlock("span",Vu,a.toDisplayString(n.placeholder||"Select an option..."),1))]),a.createElementVNode("div",{class:a.normalizeClass(["input-select-arrow",{"input-select-arrow-open":d.value.isOpen}])},[a.createVNode(a.unref(Pr))],2)],42,Lu),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",Fu,[a.renderSlot(N.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(N.$slots,"trailing",{},void 0,!0)],2),(a.openBlock(),a.createBlock(a.Teleport,{to:c.value},[d.value.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:o,id:l.value,class:a.normalizeClass(["input-dropdown",{"input-dropdown--multiple":n.multiple}]),style:a.normalizeStyle(a.unref(u)),role:"listbox","aria-multiselectable":n.multiple,onMousedown:D[1]||(D[1]=a.withModifiers(()=>{},["prevent"]))},[n.searchable?(a.openBlock(),a.createElementBlock("div",ju,[a.createVNode(ni,{ref_key:"searchInputRef",ref:s,modelValue:d.value.searchQuery,"onUpdate:modelValue":D[0]||(D[0]=R=>d.value.searchQuery=R),type:"search",placeholder:y.value,size:"sm",tabindex:v.value,onKeydown:U},{"leading-icon":a.withCtx(()=>[a.createVNode(a.unref(bu))]),_:1},8,["modelValue","placeholder","tabindex"])])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"input-dropdown-options",style:a.normalizeStyle({maxHeight:`${n.maxDropdownHeight}px`})},[g.value.length===0?(a.openBlock(),a.createElementBlock("div",Uu,[a.renderSlot(N.$slots,"zero-state",{},()=>[a.createTextVNode(a.toDisplayString(n.noOptionsText),1)],!0)])):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(g.value,(R,ke)=>(a.openBlock(),a.createElementBlock("div",{key:R.value,class:a.normalizeClass(["input-dropdown-option",{"input-dropdown-option--selected":C(R),"input-dropdown-option--highlighted":ke===d.value.highlightedIndex,"input-dropdown-option--disabled":R.disabled,"input-dropdown-option--insert":R.value&&typeof R.value=="string"&&R.value.startsWith("__insert__")}]),onClick:ri=>A(R),onMouseenter:ri=>d.value.highlightedIndex=ke,role:"option","aria-selected":C(R)},[a.createElementVNode("div",Wu,[a.createElementVNode("div",Ku,a.toDisplayString(R.label),1),R.description?(a.openBlock(),a.createElementBlock("div",Ju,a.toDisplayString(R.description),1)):a.createCommentVNode("",!0)]),n.multiple&&C(R)?(a.openBlock(),a.createElementBlock("div",Gu,[a.createVNode(a.unref(ru))])):a.createCommentVNode("",!0)],42,qu))),128))],4)],46,Hu)):a.createCommentVNode("",!0)],8,["to"]))],64))}}),Qu=de(Yu,[["__scopeId","data-v-e9ac7d68"]]),Xu={class:"input-leading-icon"},Zu=["src"],_u=["id","accept","multiple","disabled","required"],ef={class:"input-file-content"},tf={key:0,class:"input-file-selected"},nf={class:"input-file-list"},rf={class:"input-file-item"},of={class:"input-file-name"},sf={key:1,class:"input-file-prompt"},lf={class:"input-file-prompt-text"},af={key:0,class:"input-file-accept-text"},cf={key:2,class:"input-file-selected"},df={class:"input-file-selected-text"},uf={class:"input-file-list"},ff={class:"input-file-name"},hf={class:"input-file-size"},pf={key:0,class:"input-trailing-icon"},mf={key:1,class:"input-trailing-icon"},gf=a.defineComponent({__name:"UiInput.File",props:{accept:{},multiple:{type:Boolean,default:!1},maxFileSize:{default:10*1024*1024},dragDropText:{},selectedText:{},preview:{},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","file-error","clear-preview","blur","focus"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(),o=a.ref(!1),s=a.ref(null),l=a.ref([]),c=a.computed(()=>t.preview?t.preview:s.value);a.computed(()=>!!t.preview);const d=a.computed(()=>t.preview?t.preview:null),u=a.computed(()=>{const C=[];return t.error&&C.push("input-error"),t.disabled&&C.push("input-disabled"),C.push(`input-size-${t.size}`),C}),f=a.computed(()=>{const C=[];return C.push("input-padding-left-icon"),l.value.length>0||d.value||t.disabled?C.push("input-padding-right-icon"):C.push("input-padding-right"),C}),h=C=>{if(t.maxFileSize&&C.size>t.maxFileSize)return`File "${C.name}" is too large. Maximum size is ${y(t.maxFileSize)}.`;if(t.accept){const A=t.accept.split(",").map(K=>K.trim().toLowerCase()),$=C.type.toLowerCase(),U="."+C.name.split(".").pop()?.toLowerCase();if(!A.some(K=>{if(K.startsWith("."))return U===K;if(K.includes("*")){const N=K.split("/")[0];return $.startsWith(N)}return $===K}))return`File "${C.name}" is not an accepted file type.`}return null},p=C=>{for(const A of C){const $=h(A);if($){r("file-error",$);return}}t.multiple?l.value=[...l.value,...C]:l.value=C.slice(0,1),t.multiple?r("update:modelValue",l.value):r("update:modelValue",l.value[0]||null),!t.multiple&&l.value.length>0&&l.value[0].type.startsWith("image/")&&m(l.value[0])},m=C=>{s.value&&URL.revokeObjectURL(s.value);const A=new FileReader;A.onload=$=>{s.value=$.target?.result},A.readAsDataURL(C)},g=()=>{l.value=[],r("update:modelValue",t.multiple?[]:null),s.value&&(URL.revokeObjectURL(s.value),s.value=null),i.value&&(i.value.value=""),t.preview&&r("clear-preview")},y=C=>{if(C===0)return"0 Bytes";const A=1024,$=["Bytes","KB","MB","GB"],U=Math.floor(Math.log(C)/Math.log(A));return parseFloat((C/Math.pow(A,U)).toFixed(2))+" "+$[U]},k=()=>{!t.disabled&&i.value&&i.value.click()},v=C=>{const A=C.target,$=Array.from(A.files||[]);$.length>0&&p($)},b=C=>{t.disabled||(o.value=!0)},x=C=>{o.value=!1},w=C=>{if(t.disabled)return;o.value=!1;const A=Array.from(C.dataTransfer?.files||[]);A.length>0&&p(A)},S=C=>{r("blur",C)},M=C=>{r("focus",C)};return a.watch(()=>t.modelValue,C=>{C?Array.isArray(C)?l.value=C:(l.value=[C],C.type.startsWith("image/")&&m(C)):(l.value=[],s.value&&(URL.revokeObjectURL(s.value),s.value=null))},{immediate:!0}),a.onUnmounted(()=>{s.value&&URL.revokeObjectURL(s.value)}),(C,A)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper",[u.value,f.value]])},[a.renderSlot(C.$slots,"leading",{},void 0,!0),a.createElementVNode("div",Xu,[c.value?(a.openBlock(),a.createElementBlock("img",{key:0,src:c.value,alt:"Preview",class:"input-file-preview"},null,8,Zu)):t.hasLeadingIcon?a.renderSlot(C.$slots,"leading-icon",{key:1},void 0,!0):(a.openBlock(),a.createBlock(a.unref(du),{key:2}))]),a.createElementVNode("div",{class:a.normalizeClass(["input-file-area",{"input-file-dragover":o.value,"input-file-disabled":n.disabled}]),onClick:k,onDragover:a.withModifiers(b,["prevent"]),onDragleave:a.withModifiers(x,["prevent"]),onDrop:a.withModifiers(w,["prevent"])},[a.createElementVNode("input",{ref_key:"fileInputRef",ref:i,id:n.inputId,type:"file",accept:n.accept,multiple:n.multiple,disabled:n.disabled,required:n.required,class:"input-file-hidden",onChange:v,onBlur:S,onFocus:M},null,40,_u),a.createElementVNode("div",ef,[d.value&&l.value.length===0?(a.openBlock(),a.createElementBlock("div",tf,[A[0]||(A[0]=a.createElementVNode("div",{class:"input-file-selected-text"}," File loaded ",-1)),a.createElementVNode("div",nf,[a.createElementVNode("div",rf,[a.createElementVNode("span",of,a.toDisplayString(d.value),1)])])])):l.value.length===0?(a.openBlock(),a.createElementBlock("div",sf,[a.createElementVNode("div",lf,a.toDisplayString(n.dragDropText||"Click to select or drag and drop"),1),n.accept?(a.openBlock(),a.createElementBlock("div",af,a.toDisplayString(n.accept),1)):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",cf,[a.createElementVNode("div",df,a.toDisplayString(n.selectedText||`${l.value.length} file(s) selected`),1),a.createElementVNode("div",uf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,($,U)=>(a.openBlock(),a.createElementBlock("div",{key:U,class:"input-file-item"},[a.createElementVNode("span",ff,a.toDisplayString($.name),1),a.createElementVNode("span",hf,"("+a.toDisplayString(y($.size))+")",1)]))),128))])]))])],34),(l.value.length>0||d.value)&&!n.disabled?(a.openBlock(),a.createElementBlock("div",pf,[a.createElementVNode("button",{type:"button",class:"input-file-clear",onClick:a.withModifiers(g,["stop"]),"aria-label":"Clear selected files"},[a.createVNode(a.unref(fo))])])):t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",mf,[a.renderSlot(C.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(C.$slots,"trailing",{},void 0,!0)],2))}}),yf=de(gf,[["__scopeId","data-v-3c7bee41"]]),kf={class:"tabs-wrapper"},bf={key:0,class:"tabs-before"},vf=["aria-selected","id","onClick"],xf={key:1,class:"tabs-after"},wf=["aria-labelledby"],Cf=a.defineComponent({__name:"UiTabs",props:{modelValue:{},tabs:{},underlineWidth:{default:"5rem"},orientation:{default:"horizontal"},size:{default:"md"},variant:{default:"default"},tabWidth:{default:"fill"},sticky:{default:null}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,i=a.useSlots(),o=a.computed(()=>!!i.content),s=a.computed(()=>t.tabs.find(b=>b.value===t.modelValue)),l=a.ref([]),c=a.ref(!1),d=a.ref({width:"0px",height:"0px",left:"0px",top:"0px",opacity:"0"}),u=a.ref({width:"0px",height:"0px",left:"0px",top:"0px",opacity:"0"});let f=-1,h=!1;const p=(b,x)=>{const w=b.getBoundingClientRect(),S=x.getBoundingClientRect(),M=getComputedStyle(x),C=parseFloat(M.getPropertyValue("--underline-thickness")||"5");let A=5;t.size==="sm"?A=4:t.size==="lg"&&(A=6);const $=S.height;if(t.orientation==="vertical"){const U=w.top-S.top;return{height:w.height-A*4,top:U+A*2,width:C,left:A-C/2}}else{const U=w.left-S.left,j=w.width;if(t.underlineWidth==="full")return{width:j-30,left:U+15,height:C,top:$-A-C/2};let K;if(t.underlineWidth.endsWith("%")){const D=parseFloat(t.underlineWidth)/100;K=j*D}else if(t.underlineWidth.endsWith("px"))K=parseFloat(t.underlineWidth);else if(t.underlineWidth.endsWith("rem")){const D=parseFloat(t.underlineWidth),R=parseFloat(getComputedStyle(document.documentElement).fontSize);K=D*R}else K=parseFloat(t.underlineWidth)||j;const N=(j-K)/2;return{width:K,left:U+N,height:C,top:$-A-C/2}}},m=async(b,x)=>{h||(r("update:modelValue",b),await a.nextTick(),g(x))},g=async b=>{if(!l.value[b]||b===f)return;h=!0;const x=l.value[b],w=x.parentElement;if(!w)return;const S=p(x,w),M=x.getBoundingClientRect(),C=w.getBoundingClientRect();let A,$;if(t.orientation==="vertical"?(A=M.top-C.top,$=M.height):(A=M.left-C.left,$=M.width),f===-1){t.orientation==="vertical"?(d.value={height:`${S.height}px`,top:`${S.top}px`,width:`${S.width}px`,left:`${S.left}px`,opacity:"1"},u.value={height:`${$}px`,top:`${A}px`,width:`${M.width}px`,left:"0",opacity:"1"}):(d.value={width:`${S.width}px`,left:`${S.left}px`,height:`${S.height}px`,top:`${S.top}px`,opacity:"1"},u.value={width:`${$}px`,left:`${A}px`,height:"100%",top:"0",opacity:"1"}),f=b,h=!1;return}const U=l.value[f];if(p(U,w),U.getBoundingClientRect(),window.matchMedia("(prefers-reduced-motion: reduce)").matches){d.value={width:`${S.width||0}px`,left:`${S.left||0}px`,height:`${S.height||7}px`,top:`${S.top}px`,opacity:"1"},t.orientation==="vertical"?u.value={height:`${$}px`,top:`${A}px`,width:"100%",left:"0",opacity:"1"}:u.value={width:`${$}px`,left:`${A}px`,height:"100%",top:"0",opacity:"1"},f=b,h=!1;return}requestAnimationFrame(()=>{t.orientation==="vertical"?(d.value={height:`${S.height}px`,top:`${S.top}px`,width:`${S.width||7}px`,left:`${S.left}px`,opacity:"1"},u.value={height:`${$}px`,top:`${A}px`,width:"100%",left:"0",opacity:"1"}):(d.value={width:`${S.width}px`,left:`${S.left}px`,height:`${S.height||7}px`,top:`${S.top}px`,opacity:"1"},u.value={width:`${$}px`,left:`${A}px`,height:"100%",top:"0",opacity:"1"}),f=b,setTimeout(()=>{h=!1},200)})};let y=null;const k=()=>{const b=t.tabs.findIndex(x=>x.value===t.modelValue);if(b!==-1&&l.value&&l.value[b]){const x=c.value;c.value=!1;const w=l.value[b],S=w.parentElement;if(S){const M=p(w,S),C=w.getBoundingClientRect(),A=S.getBoundingClientRect();let $,U;t.orientation==="vertical"?($=C.top-A.top,U=C.height,d.value={height:`${M.height}px`,top:`${M.top}px`,width:`${M.width}px`,left:`${M.left}px`,opacity:"1"},u.value={height:`${U}px`,top:`${$}px`,width:`${C.width}px`,left:"0",opacity:"1"}):($=C.left-A.left,U=C.width,d.value={width:`${M.width}px`,left:`${M.left}px`,height:`${M.height}px`,top:`${M.top}px`,opacity:"1"},u.value={width:`${U}px`,left:`${$}px`,height:"100%",top:"0",opacity:"1"})}f=b,h=!1,setTimeout(()=>{c.value=x},10)}y&&clearTimeout(y),y=setTimeout(()=>{y=null},50)};a.onMounted(async()=>{await a.nextTick();const b=t.tabs.findIndex(x=>x.value===t.modelValue);b!==-1&&(g(b),setTimeout(()=>{c.value=!0},50)),window.addEventListener("resize",k)}),a.onUnmounted(()=>{window.removeEventListener("resize",k),y&&(clearTimeout(y),y=null)});const{modelValue:v}=a.toRefs(t);return a.watch(v,async()=>{await a.nextTick();const b=t.tabs.findIndex(x=>x.value===t.modelValue);b!==-1&&g(b)}),(b,x)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["tabs-container",[`tabs-container--${n.orientation}`,`tabs-container--${n.size}`,`tabs-container--${n.variant}`,{"tabs-container--with-content":o.value}]])},[a.createElementVNode("div",kf,[a.createElementVNode("div",{class:a.normalizeClass(["tabs-list",[`tabs-list--${n.orientation}`,`tabs-list--${n.size}`,`tabs-list--${n.variant}`]]),style:a.normalizeStyle(n.sticky?{position:"sticky",[n.sticky.side]:`${n.sticky.offset}px`,zIndex:10}:{})},[b.$slots.before?(a.openBlock(),a.createElementBlock("div",bf,[a.renderSlot(b.$slots,"before",{},void 0,!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(["tabs-buttons-wrapper",`tabs-buttons-wrapper--${n.tabWidth}`]),role:"tablist"},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.tabs,(w,S)=>(a.openBlock(),a.createElementBlock("button",{key:w.value,ref_for:!0,ref_key:"tabButtons",ref:l,class:a.normalizeClass(["tab-button",[`tab-button--${n.size}`,`tab-button--${n.variant}`,`tab-button--${n.tabWidth}`,{"tab-button-active":a.unref(v)===w.value}]]),"aria-selected":a.unref(v)===w.value,"aria-controls":"tabpanel",id:`tab-${w.value}`,role:"tab",onClick:M=>m(w.value,S)},a.toDisplayString(w.label),11,vf))),128)),a.createElementVNode("div",{class:a.normalizeClass(["tab-background",{"no-transition":!c.value}]),style:a.normalizeStyle(u.value)},null,6),a.createElementVNode("div",{class:a.normalizeClass(["tab-underline",{"no-transition":!c.value}]),style:a.normalizeStyle(d.value)},null,6)],2),b.$slots.after?(a.openBlock(),a.createElementBlock("div",xf,[a.renderSlot(b.$slots,"after",{},void 0,!0)])):a.createCommentVNode("",!0)],6)]),o.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["tabs-content",`tabs-content--${n.orientation}`]),role:"tabpanel","aria-labelledby":`tab-${a.unref(v)}`,id:"tabpanel"},[a.renderSlot(b.$slots,"content",{activeTab:s.value},void 0,!0)],10,wf)):a.createCommentVNode("",!0)],2))}}),Fr=de(Cf,[["__scopeId","data-v-901716e3"]]),Sf={key:0,class:"ui-divider-text"},Mf=a.defineComponent({__name:"UiDivider",props:{orientation:{default:"horizontal"},variant:{default:"solid"},text:{},textPosition:{default:"center"},color:{default:"var(--accui-divider-color)"},thickness:{default:"1px"},margin:{default:"1rem"},spacing:{default:"auto"}},setup(n){const e=n,t=a.useSlots(),r=a.computed(()=>!!(e.text||t.default)),i=a.computed(()=>{const o={};return e.orientation==="horizontal"?(o.width=e.spacing==="auto"?"100%":typeof e.spacing=="number"?`${e.spacing}px`:e.spacing,o.marginTop=typeof e.margin=="number"?`${e.margin}px`:e.margin,o.marginBottom=typeof e.margin=="number"?`${e.margin}px`:e.margin,r.value||(o.height=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness),o["--divider-color"]=e.color==="#e5e7eb"?"var(--accui-divider-color)":e.color,o["--divider-thickness"]=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness):(o.height=e.spacing==="auto"?"100%":typeof e.spacing=="number"?`${e.spacing}px`:e.spacing,o.marginLeft=typeof e.margin=="number"?`${e.margin}px`:e.margin,o.marginRight=typeof e.margin=="number"?`${e.margin}px`:e.margin,r.value||(o.width=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness),o["--divider-color"]=e.color==="#e5e7eb"?"var(--accui-divider-color)":e.color,o["--divider-thickness"]=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness),o});return(o,s)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["ui-divider",`ui-divider--${n.orientation}`,`ui-divider--${n.variant}`,{"ui-divider--with-text":r.value,[`ui-divider--text-${n.textPosition}`]:r.value}]),style:a.normalizeStyle(i.value)},[r.value?(a.openBlock(),a.createElementBlock("span",Sf,[a.renderSlot(o.$slots,"default",{},()=>[a.createTextVNode(a.toDisplayString(n.text),1)],!0)])):a.createCommentVNode("",!0)],6))}}),tt=de(Mf,[["__scopeId","data-v-1c798024"]]),Tf={class:"datetime-picker-wrapper"},Ef={class:"datetime-picker-leading-icon"},Nf={class:"datetime-picker-display"},Af={key:0,class:"datetime-picker-value"},Bf={key:1,class:"datetime-picker-placeholder"},Of={key:1,class:"datetime-picker-trailing-icon"},Df={key:1,class:"datetime-picker-panel"},If={class:"datetime-picker-header"},$f={class:"datetime-picker-month-year"},Rf=["value"],Lf=["value"],zf={class:"datetime-picker-weekdays"},Pf={class:"datetime-picker-grid"},Vf={key:2,class:"datetime-picker-panel datetime-picker-time-panel"},Ff={class:"time-selector"},Hf={class:"time-column"},jf={class:"time-scroll"},Uf={class:"time-column"},qf={class:"time-scroll"},Wf={key:0,class:"time-column"},Kf={class:"time-scroll"},Jf={class:"datetime-picker-footer"},Gf=a.defineComponent({__name:"UiDateTimePicker",props:{modelValue:{},type:{default:"date"},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},min:{},max:{},error:{type:Boolean,default:!1},size:{default:"md"},format:{default:"iso"},is24Hour:{type:Boolean,default:!0},minuteStep:{default:1}},emits:["update:modelValue","change"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(),o=a.ref(),s=a.ref(!1),{floatingStyle:l,updatePosition:c,cleanup:d}=Vr({trigger:i,floating:o,placement:"bottom-start",offset:8,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{f()}}}),u=async()=>{t.disabled||t.readonly||(s.value=!0,await a.nextTick(),c())},f=()=>{s.value=!1},h=()=>{s.value?f():u()},p=a.ref(t.type==="time"?"time":"date"),m=a.ref(new Date().getMonth()),g=a.ref(new Date().getFullYear()),y=a.ref(new Date().getHours()),k=a.ref(new Date().getMinutes()),v=a.ref("AM"),b=["January","February","March","April","May","June","July","August","September","October","November","December"],x=["Su","Mo","Tu","We","Th","Fr","Sa"],w=a.computed(()=>t.min?t.min instanceof Date?t.min:new Date(t.min):null),S=a.computed(()=>t.max?t.max instanceof Date?t.max:new Date(t.max):null),M=a.computed(()=>{if(!t.modelValue)return null;if(t.modelValue instanceof Date)return t.modelValue;if(t.type==="time"&&typeof t.modelValue=="string"){const L=t.modelValue.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);if(L){const I=new Date;return I.setHours(parseInt(L[1]),parseInt(L[2]),parseInt(L[3]||"0"),0),I}}return new Date(t.modelValue)}),C=a.computed(()=>{if(!M.value||isNaN(M.value.getTime()))return"";const L=M.value;if(t.type==="time"){if(t.is24Hour)return`${String(L.getHours()).padStart(2,"0")}:${String(L.getMinutes()).padStart(2,"0")}`;{const pt=L.getHours()%12||12,se=L.getHours()>=12?"PM":"AM";return`${pt}:${String(L.getMinutes()).padStart(2,"0")} ${se}`}}const I=L.getDate(),O=L.getMonth()+1,q=L.getFullYear();let we="";switch(t.format){case"us":we=`${O}/${I}/${q}`;break;case"eu":we=`${I}/${O}/${q}`;break;default:we=`${q}-${String(O).padStart(2,"0")}-${String(I).padStart(2,"0")}`;break}if(t.type==="date")return we;let $t="";if(t.is24Hour)$t=`${String(L.getHours()).padStart(2,"0")}:${String(L.getMinutes()).padStart(2,"0")}`;else{const pt=L.getHours()%12||12,se=L.getHours()>=12?"PM":"AM";$t=`${pt}:${String(L.getMinutes()).padStart(2,"0")} ${se}`}return`${we} ${$t}`}),A=a.computed(()=>{const L=[];return t.error&&L.push("datetime-picker-error"),t.disabled&&L.push("datetime-picker-disabled"),t.readonly&&L.push("datetime-picker-readonly"),L.push(`datetime-picker-size-${t.size}`),L}),$=a.computed(()=>t.type==="date"||t.type==="datetime"&&p.value==="date"),U=a.computed(()=>t.type==="time"||t.type==="datetime"&&p.value==="time"),j=a.computed(()=>[{label:"Date",value:"date"},{label:"Time",value:"time"}]),K=a.computed(()=>{const L=[],I=t.is24Hour?23:12,O=t.is24Hour?0:1;for(let q=O;q<=I;q++)L.push(q);return L}),N=a.computed(()=>{const L=[];for(let I=0;I<60;I+=t.minuteStep)L.push(I);return L}),D=a.computed(()=>{const L=new Date().getFullYear(),I=w.value?.getFullYear()||L-100,O=S.value?.getFullYear()||L+100,q=[];for(let we=I;we<=O;we++)q.push(we);return q}),R=a.computed(()=>w.value?new Date(g.value,m.value,1)<=w.value:!1),ke=a.computed(()=>S.value?new Date(g.value,m.value+1,0)>=S.value:!1),ri=a.computed(()=>{const L=[],I=g.value,O=m.value,q=new Date(I,O,1),we=new Date(q);we.setDate(we.getDate()-q.getDay());const $t=new Date;$t.setHours(0,0,0,0);for(let pt=0;pt<42;pt++){const se=new Date(we);se.setDate(we.getDate()+pt);const ad=se.getMonth()!==O,cd=se.getTime()===$t.getTime(),dd=M.value&&se.getFullYear()===M.value.getFullYear()&&se.getMonth()===M.value.getMonth()&&se.getDate()===M.value.getDate(),ud=!!(w.value&&se<w.value||S.value&&se>S.value);L.push({key:`${se.getFullYear()}-${se.getMonth()}-${se.getDate()}`,date:se.getDate(),month:se.getMonth(),year:se.getFullYear(),otherMonth:ad,isToday:cd,isSelected:dd||!1,isDisabled:ud})}return L}),rd=()=>{switch(t.type){case"time":return"Select time";case"datetime":return"Select date and time";default:return"Select date"}},id=()=>{m.value===0?(m.value=11,g.value--):m.value--},od=()=>{m.value===11?(m.value=0,g.value++):m.value++},sd=L=>{if(L.isDisabled||L.otherMonth)return;const I=M.value||new Date,O=new Date(L.year,L.month,L.date,I.getHours(),I.getMinutes());r("update:modelValue",O),r("change",O),t.type==="datetime"?p.value="time":t.type==="date"&&f()},Dn=(L,I)=>{let O=M.value?new Date(M.value):new Date;if(!M.value){const q=new Date;O.setFullYear(q.getFullYear(),q.getMonth(),q.getDate())}if(L==="hour"){let q=I;t.is24Hour||(v.value==="PM"&&q!==12&&(q+=12),v.value==="AM"&&q===12&&(q=0)),y.value=I,O.setHours(q)}else if(L==="minute")k.value=I,O.setMinutes(I);else if(L==="period"){v.value=I;let q=y.value;I==="PM"&&q!==12&&(q+=12),I==="AM"&&q===12&&(q=0),O.setHours(q)}r("update:modelValue",O),r("change",O)},ld=()=>{const L=new Date;w.value&&L<w.value||S.value&&L>S.value||(r("update:modelValue",L),r("change",L),f())},_o=()=>{r("update:modelValue",null),r("change",null)};return a.watch(()=>t.modelValue,L=>{if(L){const I=L instanceof Date?L:new Date(L);if(!isNaN(I.getTime())){if(m.value=I.getMonth(),g.value=I.getFullYear(),t.is24Hour)y.value=I.getHours();else{const O=I.getHours();y.value=O%12||12,v.value=O>=12?"PM":"AM"}k.value=I.getMinutes()}}},{immediate:!0}),a.onUnmounted(()=>{d()}),(L,I)=>(a.openBlock(),a.createElementBlock("div",Tf,[a.createElementVNode("div",{ref_key:"triggerElement",ref:i,class:a.normalizeClass(["datetime-picker-trigger",[A.value,{"datetime-picker-open":s.value}]]),onClick:h},[a.createElementVNode("div",Ef,[n.type==="date"?(a.openBlock(),a.createBlock(a.unref(nu),{key:0})):n.type==="time"?(a.openBlock(),a.createBlock(a.unref(su),{key:1})):(a.openBlock(),a.createBlock(a.unref(tu),{key:2}))]),a.createElementVNode("div",Nf,[C.value?(a.openBlock(),a.createElementBlock("span",Af,a.toDisplayString(C.value),1)):(a.openBlock(),a.createElementBlock("span",Bf,a.toDisplayString(n.placeholder||rd()),1))]),n.modelValue&&!n.disabled&&!n.readonly?(a.openBlock(),a.createElementBlock("div",{key:0,class:"datetime-picker-trailing-icon",onClick:a.withModifiers(_o,["stop"])},[a.createVNode(a.unref(fo))])):(a.openBlock(),a.createElementBlock("div",Of,[a.createVNode(a.unref(Pr))]))],2),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[s.value?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"floatingElement",ref:o,class:"datetime-picker-dropdown",style:a.normalizeStyle(a.unref(l))},[n.type==="datetime"?(a.openBlock(),a.createBlock(Fr,{key:0,modelValue:p.value,"onUpdate:modelValue":I[0]||(I[0]=O=>p.value=O),tabs:j.value,variant:"default",size:"sm",style:{"margin-bottom":"1rem"}},null,8,["modelValue","tabs"])):a.createCommentVNode("",!0),$.value?(a.openBlock(),a.createElementBlock("div",Df,[a.createElementVNode("div",If,[a.createVNode(W,{onClick:id,disabled:R.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:a.withCtx(()=>[a.createVNode(a.unref(iu))]),_:1},8,["disabled"]),a.createElementVNode("div",$f,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":I[1]||(I[1]=O=>m.value=O),class:"datetime-picker-select"},[(a.openBlock(),a.createElementBlock(a.Fragment,null,a.renderList(b,(O,q)=>a.createElementVNode("option",{key:q,value:q},a.toDisplayString(O),9,Rf)),64))],512),[[a.vModelSelect,m.value]]),a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":I[2]||(I[2]=O=>g.value=O),class:"datetime-picker-select"},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(D.value,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,Lf))),128))],512),[[a.vModelSelect,g.value]])]),a.createVNode(W,{onClick:od,disabled:ke.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:a.withCtx(()=>[a.createVNode(a.unref(ou))]),_:1},8,["disabled"])]),a.createElementVNode("div",zf,[(a.openBlock(),a.createElementBlock(a.Fragment,null,a.renderList(x,O=>a.createElementVNode("div",{key:O,class:"datetime-picker-weekday"},a.toDisplayString(O),1)),64))]),a.createElementVNode("div",Pf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ri.value,O=>(a.openBlock(),a.createBlock(W,{key:O.key,color:O.isSelected||O.isToday?"primary":"secondary",variant:O.isSelected?"primary":O.isToday?"outline":"primary",disabled:O.isDisabled||O.otherMonth,class:a.normalizeClass(["datetime-picker-day",{"datetime-picker-day-other":O.otherMonth,"datetime-picker-day-disabled":O.isDisabled}]),icon:"",squircle:"",onClick:q=>sd(O)},{icon:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(O.date),1)]),_:2},1032,["color","variant","disabled","class","onClick"]))),128))])])):a.createCommentVNode("",!0),U.value?(a.openBlock(),a.createElementBlock("div",Vf,[a.createElementVNode("div",Ff,[a.createElementVNode("div",Hf,[I[6]||(I[6]=a.createElementVNode("label",{class:"time-label"},"Hour",-1)),a.createElementVNode("div",jf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(K.value,O=>(a.openBlock(),a.createBlock(W,{key:O,color:y.value===O?"primary":"secondary",variant:y.value===O?"primary":"ghost",size:"sm",squircle:"",onClick:q=>Dn("hour",O)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(String(O).padStart(2,"0")),1)]),_:2},1032,["color","variant","onClick"]))),128))])]),a.createElementVNode("div",Uf,[I[7]||(I[7]=a.createElementVNode("label",{class:"time-label"},"Minute",-1)),a.createElementVNode("div",qf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(N.value,O=>(a.openBlock(),a.createBlock(W,{key:O,color:k.value===O?"primary":"secondary",variant:k.value===O?"primary":"ghost",size:"sm",squircle:"",onClick:q=>Dn("minute",O)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(String(O).padStart(2,"0")),1)]),_:2},1032,["color","variant","onClick"]))),128))])]),n.is24Hour?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",Wf,[I[10]||(I[10]=a.createElementVNode("label",{class:"time-label"},"Period",-1)),a.createElementVNode("div",Kf,[a.createVNode(W,{color:v.value==="AM"?"primary":"secondary",variant:v.value==="AM"?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:I[3]||(I[3]=O=>Dn("period","AM"))},{default:a.withCtx(()=>[...I[8]||(I[8]=[a.createTextVNode(" AM ",-1)])]),_:1},8,["color","variant"]),a.createVNode(W,{color:v.value==="PM"?"primary":"secondary",variant:v.value==="PM"?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:I[4]||(I[4]=O=>Dn("period","PM"))},{default:a.withCtx(()=>[...I[9]||(I[9]=[a.createTextVNode(" PM ",-1)])]),_:1},8,["color","variant"])])]))])])):a.createCommentVNode("",!0),a.createVNode(tt),a.createElementVNode("div",Jf,[a.createVNode(W,{onClick:ld,color:"primary",variant:"primary",squircle:"",style:{flex:"1"}},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(n.type==="time"?"Now":"Today"),1)]),_:1}),a.createVNode(W,{onClick:I[5]||(I[5]=O=>{_o(),f()}),color:"danger",variant:"primary",squircle:"",style:{flex:"1"}},{default:a.withCtx(()=>[...I[11]||(I[11]=[a.createTextVNode(" Clear ",-1)])]),_:1}),a.createVNode(W,{onClick:f,color:"secondary",variant:"primary",squircle:"",style:{flex:"1"}},{default:a.withCtx(()=>[...I[12]||(I[12]=[a.createTextVNode(" Close ",-1)])]),_:1})])],4)):a.createCommentVNode("",!0)]))]))}}),ho=de(Gf,[["__scopeId","data-v-f688c330"]]),Yf=a.defineComponent({__name:"UiInput.Date",props:{min:{},max:{},format:{default:"iso"},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(n,{emit:e}){const t=e,r=o=>{t("update:modelValue",o)},i=o=>{t("change",o)};return(o,s)=>(a.openBlock(),a.createBlock(ho,{"model-value":n.modelValue,type:"date",placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:n.required,min:n.min,max:n.max,error:!!n.error,size:n.size,format:n.format,"onUpdate:modelValue":r,onChange:i},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","format"]))}}),Qf=a.defineComponent({__name:"UiInput.Time",props:{is24Hour:{type:Boolean,default:!0},minuteStep:{default:1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(n,{emit:e}){const t=e,r=o=>{t("update:modelValue",o)},i=o=>{t("change",o)};return(o,s)=>(a.openBlock(),a.createBlock(ho,{"model-value":n.modelValue,type:"time",placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:n.required,error:!!n.error,size:n.size,is24Hour:n.is24Hour,minuteStep:n.minuteStep,"onUpdate:modelValue":r,onChange:i},null,8,["model-value","placeholder","disabled","readonly","required","error","size","is24Hour","minuteStep"]))}}),Xf=a.defineComponent({__name:"UiInput.DateTime",props:{min:{},max:{},format:{default:"iso"},is24Hour:{type:Boolean,default:!0},minuteStep:{default:1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(n,{emit:e}){const t=e,r=o=>{t("update:modelValue",o)},i=o=>{t("change",o)};return(o,s)=>(a.openBlock(),a.createBlock(ho,{"model-value":n.modelValue,type:"datetime",placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:n.required,min:n.min,max:n.max,error:!!n.error,size:n.size,format:n.format,is24Hour:n.is24Hour,minuteStep:n.minuteStep,"onUpdate:modelValue":r,onChange:i},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","format","is24Hour","minuteStep"]))}});function ue(n){this.content=n}ue.prototype={constructor:ue,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new ue(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ue(t)},addToStart:function(n,e){return new ue([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ue(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new ue(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ue.from(n),n.size?new ue(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ue.from(n),n.size?new ue(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ue.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};ue.from=function(n){if(n instanceof ue)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ue(e)};function Nl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=Nl(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function Al(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),l=e.child(--o),c=s.nodeSize;if(s==l){t-=c,r-=c;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let d=Al(s.content,l.content,t-1,r-1);if(d)return d}t-=c,r-=c}}class T{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,i=0,o){for(let s=0,l=0;l<t;s++){let c=this.content[s],d=l+c.nodeSize;if(d>e&&r(c,i+l,o||null,s)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),r,i+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",s=!0;return this.nodesBetween(e,t,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,t-c):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=d},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new T(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let l=this.content[o],c=s+l.nodeSize;c>e&&((s<e||c>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),i+=l.nodeSize),s=c}return new T(r,i)}cutByIndex(e,t){return e==t?T.empty:e==0&&t==this.content.length?this:new T(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new T(i,o)}addToStart(e){return new T([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new T(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 i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Nl(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Al(this,e,t,r)}findIndex(e){if(e==0)return In(0,e);if(e==this.size)return In(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 i=this.child(t),o=r+i.nodeSize;if(o>=e)return o==e?In(t+1,o):In(t,r);r=o}}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 T.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new T(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return T.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new T(t||e,r)}static from(e){if(!e)return T.empty;if(e instanceof T)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new T([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}T.empty=new T([],0);const ii={index:0,offset:0};function In(n,e){return ii.index=n,ii.offset=e,ii}function Yn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Yn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Yn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Y=class $i{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Yn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return $i.none;if(e instanceof $i)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Y.none=[];class Qn extends Error{}class B{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=Ol(this.content,e+this.openStart,t);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,t){return new B(Bl(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 B.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new B(T.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new B(e,r,i)}}B.empty=new B(T.empty,0,0);function Bl(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(i==e||o.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Bl(o.content,e-i-1,t-i-1)))}function Ol(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Ol(s.content,e-o-1,t,s);return l&&n.replaceChild(i,s.copy(l))}function Zf(n,e,t){if(t.openStart>n.depth)throw new Qn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Qn("Inconsistent open depths");return Dl(n,e,t,0)}function Dl(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=Dl(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return wt(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=_f(t,n);return wt(o,$l(n,s,l,e,r))}else return wt(o,Xn(n,e,r))}function Il(n,e){if(!e.type.compatibleContent(n.type))throw new Qn("Cannot join "+e.type.name+" onto "+n.type.name)}function Ri(n,e,t){let r=n.node(t);return Il(r,e.node(t)),r}function xt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function an(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(xt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)xt(i.child(l),r);e&&e.depth==t&&e.textOffset&&xt(e.nodeBefore,r)}function wt(n,e){return n.type.checkContent(e),n.copy(e)}function $l(n,e,t,r,i){let o=n.depth>i&&Ri(n,e,i+1),s=r.depth>i&&Ri(t,r,i+1),l=[];return an(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(Il(o,s),xt(wt(o,$l(n,e,t,r,i+1)),l)):(o&&xt(wt(o,Xn(n,e,i+1)),l),an(e,t,i,l),s&&xt(wt(s,Xn(t,r,i+1)),l)),an(r,null,i,l),new T(l)}function Xn(n,e,t){let r=[];if(an(null,n,t,r),n.depth>t){let i=Ri(n,e,t+1);xt(wt(i,Xn(n,e,t+1)),r)}return an(e,null,t,r),new T(r)}function _f(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(T.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class kn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Y.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){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)&&(!t||t(this.node(r))))return new Zn(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(o),d=o-c;if(r.push(s,l,i+c),!d||(s=s.child(l),s.isText))break;o=d-1,i+=c+1}return new kn(t,r,o)}static resolveCached(e,t){let r=ns.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else ns.set(e,r=new eh);let i=r.elts[r.i]=kn.resolve(e,t);return r.i=(r.i+1)%th,i}}class eh{constructor(){this.elts=[],this.i=0}}const th=12,ns=new WeakMap;class Zn{constructor(e,t,r){this.$from=e,this.$to=t,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 nh=Object.create(null);class Re{constructor(e,t,r,i=Y.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||T.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,t,r,i=0){this.content.nodesBetween(e,t,r,i,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,t,r,i){return this.content.textBetween(e,t,r,i)}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,t,r){return this.type==e&&Yn(this.attrs,t||e.defaultAttrs||nh)&&Y.sameSet(this.marks,r||Y.none)}copy(e=null){return e==this.content?this:new Re(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Re(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return B.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),l=i.start(s),d=i.node(s).content.cut(i.pos-l,o.pos-l);return new B(d,i.depth-s,o.depth-s)}replace(e,t,r){return Zf(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return kn.resolveCached(this,e)}resolveNoCache(e){return kn.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}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()+")"),Rl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=T.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let c=i;c<o;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);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=Y.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Y.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=T.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}Re.prototype.text=void 0;class _n extends Re{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new _n(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new _n(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Tt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new rh(e,t);if(r.next==null)return Tt.empty;let i=Ll(r);r.next&&r.err("Unexpected trailing text");let o=dh(ch(i));return uh(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(s,l){let c=s.matchFragment(e,r);if(c&&(!t||c.validEnd))return T.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=o(f,l.concat(u));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:c}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||c.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[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 t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
5
- `)}}Tt.empty=new Tt(!0);class rh{constructor(e,t){this.string=e,this.nodeTypes=t,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 Ll(n){let e=[];do e.push(ih(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ih(n){let e=[];do e.push(oh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function oh(n){let e=ah(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=sh(n,e);else break;return e}function rs(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function sh(n,e){let t=rs(n),r=t;return n.eat(",")&&(n.next!="}"?r=rs(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function lh(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function ah(n){if(n.eat("(")){let e=Ll(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=lh(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function ch(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,c){let d={term:c,to:l};return e[s].push(d),d}function i(s,l){s.forEach(c=>c.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(o(d,l)),[]);if(s.type=="seq")for(let c=0;;c++){let d=o(s.exprs[c],l);if(c==s.exprs.length-1)return d;i(d,l=t())}else if(s.type=="star"){let c=t();return r(l,c),i(o(s.expr,c),c),[r(c)]}else if(s.type=="plus"){let c=t();return i(o(s.expr,l),c),i(o(s.expr,c),c),[r(c)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let c=l;for(let d=0;d<s.min;d++){let u=t();i(o(s.expr,c),u),c=u}if(s.max==-1)i(o(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=t();r(c,u),i(o(s.expr,c),u),c=u}return[r(c)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function zl(n,e){return e-n}function is(n,e){let t=[];return r(e),t.sort(zl);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:l,to:c}=o[s];!l&&t.indexOf(c)==-1&&r(c)}}}function dh(n){let e=Object.create(null);return t(is(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<i.length;u++)i[u][0]==l&&(d=i[u][1]);is(n,c).forEach(u=>{d||i.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let o=e[r.join(",")]=new Tt(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(zl);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function uh(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:c,next:d}=i.next[l];s.push(c.name),o&&!(c.isText||c.hasRequiredAttrs())&&(o=!1),r.indexOf(d)==-1&&r.push(d)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pl(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Vl(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Fl(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Hl(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new hh(n,r,e[r]);return t}let ss=class jl{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Hl(e,r.attrs),this.defaultAttrs=Pl(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==Tt.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:Vl(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Re(this,this.computeAttrs(e),T.from(t),Y.setFrom(r))}createChecked(e=null,t,r){return t=T.from(t),this.checkContent(t),new Re(this,this.computeAttrs(e),t,Y.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=T.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(T.empty,!0);return o?new Re(this,e,t.append(o),Y.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){Fl(this.attrs,e,"node")}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Y.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new jl(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function fh(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class hh{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?fh(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Hr{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Hl(e,i.attrs),this.excluded=null;let o=Pl(this.attrs);this.instance=o?new Y(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Y(this,Vl(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Hr(o,i++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Fl(this.attrs,e,"mark")}excludes(e){return this.excluded.indexOf(e)>-1}}class Ul{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=ue.from(e.nodes),t.marks=ue.from(e.marks||{}),this.nodes=ss.compile(this.spec.nodes,this),this.marks=Hr.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Tt.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?ls(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:ls(this,s.split(" "))}this.nodeFromJSON=i=>Re.fromJSON(this,i),this.markFromJSON=i=>Y.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ss){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(t,r,i)}text(e,t){let r=this.nodes.text;return new _n(r,r.defaultAttrs,e,Y.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ls(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let l in n.marks){let c=n.marks[l];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function ph(n){return n.tag!=null}function mh(n){return n.style!=null}class lt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(ph(i))this.tags.push(i);else if(mh(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new cs(this,t,!1);return r.addAll(e,Y.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new cs(this,t,!0);return r.addAll(e,Y.none,t.from,t.to),B.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(kh(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],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)!=t))){if(s.getAttrs){let c=s.getAttrs(t);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=ds(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=ds(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new lt(e,lt.schemaRules(e)))}}const ql={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},gh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Wl={ol:!0,ul:!0},bn=1,Li=2,cn=4;function as(n,e,t){return e!=null?(e?bn:0)|(e==="full"?Li:0):n&&n.whitespace=="pre"?bn|Li:t&~cn}class $n{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=Y.none,this.match=o||(s&cn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(T.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&bn)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=T.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(T.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ql.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class cs{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,s=as(null,t.preserveWhitespace,0)|(r?cn:0);i?o=new $n(i.type,i.attrs,Y.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new $n(null,null,Y.none,!0,null,s):o=new $n(e.schema.topNodeType,null,Y.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,o=i.options&Li?"full":this.localPreserveWS||(i.options&bn)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
6
- `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[c]&&this.insertNode(s.text(l[c]),t,!/\S/.test(l[c]));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=i.content[i.content.length-1],c=e.previousSibling;(!l||c&&c.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Wl.hasOwnProperty(s)&&this.parser.normalizeLists&&yh(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(c?c.ignore:gh.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(ql.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),d=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=c&&c.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(o),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,c,d,c.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
7
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let l=void 0;;){let c=this.parser.matchStyle(o,s,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(d=>!c.clearMark(d)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(s,t.attrs||null,r,t.preserveWhitespace);c&&(o=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}o&&this.sync(l)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t,r){let i,o;for(let s=this.open,l=0;s>=0;s--){let c=this.nodes[s],d=c.findWrapping(e);if(d&&(!i||i.length>d.length+l)&&(i=d,o=c,!d.length))break;if(c.solid){if(r)break;l+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)t=this.enterInner(i[s],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=Y.none;for(let l of i.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):us(l.type,e.type))&&(s=l.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=as(e,o,s.options);s.options&cn&&s.content.length==0&&(l|=cn);let c=Y.none;return r=r.filter(d=>(s.type?s.type.allowsMarkType(d.type):us(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new $n(e,t,c,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=bn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,c)=>{for(;l>=0;l--){let d=t[l];if(d==""){if(l==t.length-1||l==0)continue;for(;c>=o;c--)if(s(l-1,c))return!0;return!1}else{let u=c>0||c==0&&i?this.nodes[c].type:r&&c>=o?r.node(c-o).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function yh(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Wl.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function kh(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ds(n){let e={};for(let t in n)e[t]=n[t];return e}function us(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=l=>{o.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class Ot{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=oi(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,c=0;for(;l<o.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(o[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<o.length;)i=o.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,t);u&&(o.push([d,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=qn(oi(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&qn(oi(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return qn(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ot(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=fs(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return fs(e.marks)}}function fs(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function oi(n){return n.document||window.document}const hs=new WeakMap;function bh(n){let e=hs.get(n);return e===void 0&&hs.set(n,e=vh(n)),e}function vh(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function qn(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=bh(r))&&o.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=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let l,c=t?n.createElementNS(t,i):n.createElement(i),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let h=f.indexOf(" ");h>0?c.setAttributeNS(f.slice(0,h),f.slice(h+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:p,contentDOM:m}=qn(n,h,t,r);if(c.appendChild(p),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const Kl=65535,Jl=Math.pow(2,16);function xh(n,e){return n+e*Jl}function ps(n){return n&Kl}function wh(n){return(n-(n&Kl))/Jl}const Gl=1,Yl=2,Wn=4,Ql=8;class zi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ql)>0}get deletedBefore(){return(this.delInfo&(Gl|Wn))>0}get deletedAfter(){return(this.delInfo&(Yl|Wn))>0}get deletedAcross(){return(this.delInfo&Wn)>0}}class Me{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Me.empty)return Me.empty}recover(e){let t=0,r=ps(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+wh(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 i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?i:0);if(c>e)break;let d=this.ranges[l+o],u=this.ranges[l+s],f=c+d;if(e<=f){let h=d?e==c?-1:e==f?1:t:t,p=c+i+(h<0?0:u);if(r)return p;let m=e==(t<0?c:f)?null:xh(l/3,e-c),g=e==c?Yl:e==f?Gl:Wn;return(t<0?e!=c:e!=f)&&(g|=Ql),new zi(p,g,m)}i+=u-d}return r?e+i:new zi(e+i,0,null)}touches(e,t){let r=0,i=ps(t),o=this.inverted?2:1,s=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+o],u=c+d;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+s]-d}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),c=s+(this.inverted?0:o),d=this.ranges[i+t],u=this.ranges[i+r];e(l,l+d,c,c+u),o+=u-d}}invert(){return new Me(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Me.empty:new Me(e<0?[0,-e,0]:[0,0,e])}}Me.empty=new Me([]);class vn{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new vn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new vn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],l=s.mapResult(e,t);if(l.recover!=null){let c=this.getMirror(o);if(c!=null&&c>o&&c<this.to){o=c,e=this._maps[c].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new zi(e,i,null)}}const si=Object.create(null);class ye{getMap(){return Me.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=si[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 si)throw new RangeError("Duplicate use of step JSON ID "+e);return si[e]=t,t.prototype.jsonID=e,t}}class ne{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ne(e,null)}static fail(e){return new ne(null,e)}static fromReplace(e,t,r,i){try{return ne.ok(e.replace(t,r,i))}catch(o){if(o instanceof Qn)return ne.fail(o.message);throw o}}}function po(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(po(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return T.fromArray(r)}class it extends ye{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),i=r.node(r.sharedDepth(this.to)),o=new B(po(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return ne.fromReplace(e,this.from,this.to,o)}invert(){return new $e(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 it(t.pos,r.pos,this.mark)}merge(e){return e instanceof it&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new it(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 it(t.from,t.to,e.markFromJSON(t.mark))}}ye.jsonID("addMark",it);class $e extends ye{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 B(po(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ne.fromReplace(e,this.from,this.to,r)}invert(){return new it(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 $e(t.pos,r.pos,this.mark)}merge(e){return e instanceof $e&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $e(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 $e(t.from,t.to,e.markFromJSON(t.mark))}}ye.jsonID("removeMark",$e);class ot extends ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ne.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ne.fromReplace(e,this.pos,this.pos+1,new B(T.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 i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new ot(this.pos,t.marks[i]);return new ot(this.pos,this.mark)}}return new Et(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ot(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 ot(t.pos,e.markFromJSON(t.mark))}}ye.jsonID("addNodeMark",ot);class Et extends ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ne.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ne.fromReplace(e,this.pos,this.pos+1,new B(T.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ot(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Et(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 Et(t.pos,e.markFromJSON(t.mark))}}ye.jsonID("removeNodeMark",Et);class le extends ye{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Pi(e,this.from,this.to)?ne.fail("Structure replace would overwrite content"):ne.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Me([this.from,this.to-this.from,this.slice.size])}invert(e){return new le(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 le(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof le)||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?B.empty:new B(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new le(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?B.empty:new B(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new le(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 le(t.from,t.to,B.fromJSON(e,t.slice),!!t.structure)}}ye.jsonID("replace",le);class ce extends ye{constructor(e,t,r,i,o,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Pi(e,this.from,this.gapFrom)||Pi(e,this.gapTo,this.to)))return ne.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ne.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ne.fromReplace(e,this.from,this.to,r):ne.fail("Content does not fit in gap")}getMap(){return new Me([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 ce(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),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new ce(t.pos,r.pos,i,o,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 ce(t.from,t.to,t.gapFrom,t.gapTo,B.fromJSON(e,t.slice),t.insert,!!t.structure)}}ye.jsonID("replaceAround",ce);function Pi(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Ch(n,e,t,r){let i=[],o=[],s,l;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(d,e),p=Math.min(d+c.nodeSize,t),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==h&&s.mark.eq(f[g])?s.to=p:i.push(s=new $e(h,p,f[g])));l&&l.to==h?l.to=p:o.push(l=new it(h,p,r))}}),i.forEach(c=>n.step(c)),o.forEach(c=>n.step(c))}function Sh(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;o++;let c=null;if(r instanceof Hr){let d=s.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(s.marks)&&(c=[r]):c=s.marks;if(c&&c.length){let d=Math.min(l+s.nodeSize,t);for(let u=0;u<c.length;u++){let f=c[u],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==o-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=d,h.step=o):i.push({style:f,from:Math.max(l,e),to:d,step:o})}}}),i.forEach(s=>n.step(new $e(s.from,s.to,s.style)))}function mo(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c<o.childCount;c++){let d=o.child(c),u=l+d.nodeSize,f=r.matchType(d.type);if(!f)s.push(new le(l,u,B.empty));else{r=f;for(let h=0;h<d.marks.length;h++)t.allowsMarkType(d.marks[h].type)||n.step(new $e(l,u,d.marks[h]));if(i&&d.isText&&t.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(d.text);)m||(m=new B(T.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),s.push(new le(l+h.index,l+h.index+h[0].length,m))}}l=u}if(!r.validEnd){let c=r.fillBefore(T.empty,!0);n.replace(l,l,new B(c,0,0))}for(let c=s.length-1;c>=0;c--)n.step(s[c])}function Mh(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function _t(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,o=0;;--r){let s=n.$from.node(r),l=n.$from.index(r)+i,c=n.$to.indexAfter(r)-o;if(r<n.depth&&s.canReplace(l,c,t))return r;if(r==0||s.type.spec.isolating||!Mh(s,l,c))break;l&&(i=1),c<s.childCount&&(o=1)}return null}function Th(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),c=s,d=l,u=T.empty,f=0;for(let m=o,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=T.from(r.node(m).copy(u)),f++):c--;let h=T.empty,p=0;for(let m=o,g=!1;m>t;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=T.from(i.node(m).copy(h)),p++):d++;n.step(new ce(c,d,s,l,new B(u.append(h),f,p),u.size-f,!0))}function go(n,e,t=null,r=n){let i=Eh(n,e),o=i&&Nh(r,e);return o?i.map(ms).concat({type:e,attrs:t}).concat(o.map(ms)):null}function ms(n){return{type:n,attrs:null}}function Eh(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function Nh(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=r;c&&d<i;d++)c=c.matchType(t.child(d).type);return!c||!c.validEnd?null:s}function Ah(n,e,t){let r=T.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[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=T.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new ce(i,o,i,o,new B(r,0,0),t.length,!0))}function Bh(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let c=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,c)&&Oh(n.doc,n.mapping.slice(o).map(l),r)){let d=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?d=!1:!p&&m&&(d=!0)}d===!1&&Zl(n,s,l,o),mo(n,n.mapping.slice(o).map(l,1),r,void 0,d===null);let u=n.mapping.slice(o),f=u.map(l,1),h=u.map(l+s.nodeSize,1);return n.step(new ce(f,h,f+1,h-1,new B(T.from(r.create(c,null,s.marks)),0,0),1,!0)),d===!0&&Xl(n,s,l,o),!1}})}function Xl(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let c=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Zl(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
8
- `))}})}function Oh(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Dh(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ce(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new B(T.from(s),0,0),1,!0))}function jt(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,u=t-2;d>o;d--,u--){let f=i.node(d),h=i.index(d);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let l=i.indexAfter(o),c=r&&r[0];return i.node(o).canReplaceWith(l,l,c?c.type:i.node(o+1).type)}function Ih(n,e,t=1,r){let i=n.doc.resolve(e),o=T.empty,s=T.empty;for(let l=i.depth,c=i.depth-t,d=t-1;l>c;l--,d--){o=T.from(i.node(l).copy(o));let u=r&&r[d];s=T.from(u?u.type.create(u.attrs,s):i.node(l).copy(s))}n.step(new le(e,e,new B(o.append(s),t,t),!0))}function ht(n,e){let t=n.resolve(e),r=t.index();return _l(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function $h(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function _l(n,e){return!!(n&&e&&!n.isLeaf&&$h(n,e))}function jr(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&_l(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Rh(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(i);u&&!f?r=!1:!u&&f&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Zl(n,u.node(),u.before(),l)}s.inlineContent&&mo(n,e+t-1,s,o.node().contentMatchAt(o.index()),r==null);let c=n.mapping.slice(l),d=c.map(e-t);if(n.step(new le(d,c.map(e+t,-1),B.empty,!0)),r===!0){let u=n.doc.resolve(d);Xl(n,u.node(),u.before(),n.steps.length)}return n}function Lh(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function ea(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)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,c=r.index(s)+(l>0?1:0),d=r.node(s),u=!1;if(o==1)u=d.canReplace(c,c,i);else{let f=d.contentMatchAt(c).findWrapping(i.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Ur(n,e,t=e,r=B.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return ta(i,o,r)?new le(e,t,r):new zh(i,o,r).fit()}function ta(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class zh{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=T.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=T.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let c=new B(o,s,l);return e>-1?new ce(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new le(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=li(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(t==1&&(s?d.matchType(s.type)||(f=d.fillBefore(T.from(s),!1)):o&&c.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:f};if(t==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:u};if(o&&d.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=li(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new B(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=li(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new B(rn(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new B(rn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,l=r?r.content:s.content,c=s.openStart-e,d=0,u=[],{match:f,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));f=f.matchFragment(i)}let p=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(f=y,u.push(na(g.mark(h.allowedMarks(g.marks)),d==1?c:0,d==l.childCount?p:-1)))}let m=d==l.childCount;m||(p=-1),this.placed=on(this.placed,t,T.from(u)),this.frontier[t].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<p;g++){let k=y.lastChild;this.frontier.push({type:k.type,match:k.contentMatchAt(k.childCount)}),y=k.content}this.unplaced=m?e==0?B.empty:new B(rn(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new B(rn(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ai(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=ai(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=ai(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=on(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=on(this.placed,this.depth,T.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(T.empty,!0);t.childCount&&(this.placed=on(this.placed,this.frontier.length,t))}}function rn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(rn(n.firstChild.content,e-1,t)))}function on(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(on(n.lastChild.content,e-1,t)))}function li(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function na(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,na(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(T.empty,!0)))),n.copy(r)}function ai(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!Ph(t,o.content,s)?l:null}function Ph(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Vh(n){return n.spec.defining||n.spec.definingForContent}function Fh(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(ta(i,o,r))return n.step(new le(e,t,r));let s=ia(i,o);s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(h)>-1?l=h:i.before(h)==p&&s.splice(1,0,-h)}let c=s.indexOf(l),d=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(d.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=d[h],m=Vh(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(l)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=d[p];if(m)for(let g=0;g<s.length;g++){let y=s[(g+c)%s.length],k=!0;y<0&&(k=!1,y=-y);let v=i.node(y-1),b=i.index(y-1);if(v.canReplaceWith(b,b,m.type,m.marks))return n.replace(i.before(y),k?o.after(y):t,new B(ra(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=s.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=s[h];p<0||(e=i.before(p),t=o.after(p))}}function ra(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(ra(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(T.empty,!0))}return n}function Hh(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Lh(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new B(T.from(r),0,0))}function jh(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=ia(r,i);for(let s=0;s<o.length;s++){let l=o[s],c=s==o.length-1;if(c&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(c||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function ia(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Ut extends ye{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 ne.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ne.fromReplace(e,this.pos,this.pos+1,new B(T.from(i),0,t.isLeaf?0:1))}getMap(){return Me.empty}invert(e){return new Ut(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 Ut(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 Ut(t.pos,t.attr,t.value)}}ye.jsonID("attr",Ut);class xn extends ye{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ne.ok(r)}getMap(){return Me.empty}invert(e){return new xn(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 xn(t.attr,t.value)}}ye.jsonID("docAttr",xn);let Kt=class extends Error{};Kt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Kt.prototype=Object.create(Error.prototype);Kt.prototype.constructor=Kt;Kt.prototype.name="TransformError";class oa{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new vn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Kt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=B.empty){let i=Ur(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new B(T.from(r),0,0))}delete(e,t){return this.replace(e,t,B.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Fh(this,e,t,r),this}replaceRangeWith(e,t,r){return Hh(this,e,t,r),this}deleteRange(e,t){return jh(this,e,t),this}lift(e,t){return Th(this,e,t),this}join(e,t=1){return Rh(this,e,t),this}wrap(e,t){return Ah(this,e,t),this}setBlockType(e,t=e,r,i=null){return Bh(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Dh(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Ut(e,t,r)),this}setDocAttribute(e,t){return this.step(new xn(e,t)),this}addNodeMark(e,t){return this.step(new ot(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Y)t.isInSet(r.marks)&&this.step(new Et(e,t));else{let i=r.marks,o,s=[];for(;o=t.isInSet(i);)s.push(new Et(e,o)),i=o.removeFromSet(i);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,r){return Ih(this,e,t,r),this}addMark(e,t,r){return Ch(this,e,t,r),this}removeMark(e,t,r){return Sh(this,e,t,r),this}clearIncompatible(e,t,r){return mo(this,e,t,r),this}}const ci=Object.create(null);class H{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Uh(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=B.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:c,$to:d}=s[l],u=e.mapping.slice(o);e.replaceRange(u.map(c.pos),u.map(d.pos),l?B.empty:t),l==0&&ks(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],c=e.mapping.slice(r),d=c.map(s.pos),u=c.map(l.pos);o?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),ks(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new V(e):zt(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?zt(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):zt(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Oe(e.node(0))}static atStart(e){return zt(e,e,0,0,1)||new Oe(e)}static atEnd(e){return zt(e,e,e.content.size,e.childCount,-1)||new Oe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ci[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 ci)throw new RangeError("Duplicate use of selection JSON ID "+e);return ci[e]=t,t.prototype.jsonID=e,t}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}}H.prototype.visible=!0;class Uh{constructor(e,t){this.$from=e,this.$to=t}}let gs=!1;function ys(n){!gs&&!n.parent.inlineContent&&(gs=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class V extends H{constructor(e,t=e){ys(e),ys(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 H.near(r);let i=e.resolve(t.map(this.anchor));return new V(i.parent.inlineContent?i:r,r)}replace(e,t=B.empty){if(super.replace(e,t),t==B.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 qr(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 V(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=H.findFrom(t,r,!0)||H.findFrom(t,-r,!0);if(o)t=o.$head;else return H.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(H.findFrom(e,-r,!0)||H.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new V(e,t)}}H.jsonID("text",V);class qr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new qr(e.map(this.anchor),e.map(this.head))}resolve(e){return V.between(e.resolve(this.anchor),e.resolve(this.head))}}class P extends H{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:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?H.near(o):new P(o)}content(){return new B(T.from(this.node),0,0)}eq(e){return e instanceof P&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new yo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new P(e.resolve(t.anchor))}static create(e,t){return new P(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}P.prototype.visible=!1;H.jsonID("node",P);class yo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new qr(r,r):new yo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&P.isSelectable(r)?new P(t):H.near(t)}}class Oe extends H{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=B.empty){if(t==B.empty){e.delete(0,e.doc.content.size);let r=H.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Oe(e)}map(e){return new Oe(e)}eq(e){return e instanceof Oe}getBookmark(){return qh}}H.jsonID("all",Oe);const qh={map(){return this},resolve(n){return new Oe(n)}};function zt(n,e,t,r,i,o=!1){if(e.inlineContent)return V.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&P.isSelectable(l))return P.create(n,t-(i<0?l.nodeSize:0))}else{let c=zt(n,l,t+i,i<0?l.childCount:0,i,o);if(c)return c}t+=l.nodeSize*i}return null}function ks(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof le||i instanceof ce))return;let o=n.mapping.maps[r],s;o.forEach((l,c,d,u)=>{s==null&&(s=u)}),n.setSelection(H.near(n.doc.resolve(s),t))}const bs=1,Rn=2,vs=4;class Wh extends oa{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|bs)&~Rn,this.storedMarks=null,this}get selectionSet(){return(this.updated&bs)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Rn,this}ensureMarks(e){return Y.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&Rn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Rn,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Y.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(H.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,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|=vs,this}get scrolledIntoView(){return(this.updated&vs)>0}}function xs(n,e){return!e||!n?n:n.bind(e)}class sn{constructor(e,t,r){this.name=e,this.init=xs(t.init,r),this.apply=xs(t.apply,r)}}const Kh=[new sn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new sn("selection",{init(n,e){return n.selection||H.atStart(e.doc)},apply(n){return n.selection}}),new sn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new sn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class di{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Kh.slice(),t&&t.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 sn(r.key,r.spec.state,r))})}}class Ht{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,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let c=i?i[s].n:0,d=i?i[s].state:this,u=c<t.length&&l.spec.appendTransaction.call(l,c?t.slice(c):t,d,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Ht(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new Wh(this)}static create(e){let t=new di(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ht(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new di(this.schema,e.plugins),r=t.fields,i=new Ht(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.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 i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new di(e.schema,e.plugins),o=new Ht(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Re.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=H.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let c=r[l],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){o[s.name]=d.fromJSON.call(c,e,t[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function sa(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=sa(i,e,{})),t[r]=i}return t}class Z{constructor(e){this.spec=e,this.props={},e.props&&sa(e.props,this,this.props),this.key=e.key?e.key.key:la("plugin")}getState(e){return e[this.key]}}const ui=Object.create(null);function la(n){return n in ui?n+"$"+ ++ui[n]:(ui[n]=0,n+"$")}class oe{constructor(e="key"){this.key=la(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Jh=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function aa(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Gh=(n,e,t)=>{let r=aa(n,t);if(!r)return!1;let i=ko(r);if(!i){let s=r.blockRange(),l=s&&_t(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(fa(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Jt(o,"end")||P.isSelectable(o)))for(let s=r.depth;;s--){let l=Ur(n.doc,r.before(s),r.after(s),B.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=n.tr.step(l);c.setSelection(Jt(o,"end")?H.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):P.create(c.doc,i.pos-o.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},Yh=(n,e,t)=>{let r=aa(n,t);if(!r)return!1;let i=ko(r);return i?ca(n,i,e):!1},Qh=(n,e,t)=>{let r=da(n,t);if(!r)return!1;let i=bo(r);return i?ca(n,i,e):!1};function ca(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Ur(n.doc,o,c,B.empty);if(!d||d.from!=o||d instanceof le&&d.slice.size>=c-o)return!1;if(t){let u=n.tr.step(d);u.setSelection(V.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Jt(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Xh=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=ko(r)}let s=o&&o.nodeBefore;return!s||!P.isSelectable(s)?!1:(e&&e(n.tr.setSelection(P.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function ko(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function da(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Zh=(n,e,t)=>{let r=da(n,t);if(!r)return!1;let i=bo(r);if(!i)return!1;let o=i.nodeAfter;if(fa(n,i,e,1))return!0;if(r.parent.content.size==0&&(Jt(o,"start")||P.isSelectable(o))){let s=Ur(n.doc,r.before(),r.after(),B.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Jt(o,"start")?H.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):P.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},_h=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=bo(r)}let s=o&&o.nodeAfter;return!s||!P.isSelectable(s)?!1:(e&&e(n.tr.setSelection(P.create(n.doc,o.pos)).scrollIntoView()),!0)};function bo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const ep=(n,e)=>{let t=n.selection,r=t instanceof P,i;if(r){if(t.node.isTextblock||!ht(n.doc,t.from))return!1;i=t.from}else if(i=jr(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(P.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},tp=(n,e)=>{let t=n.selection,r;if(t instanceof P){if(t.node.isTextblock||!ht(n.doc,t.to))return!1;r=t.to}else if(r=jr(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},np=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&_t(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},rp=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
9
- `).scrollIntoView()),!0)};function ua(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const ip=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=ua(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=t.after(),c=n.tr.replaceWith(l,l,s.createAndFill());c.setSelection(H.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},op=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Oe||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=ua(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(s,o.createAndFill());l.setSelection(V.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},sp=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(jt(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&_t(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},lp=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(P.create(n.doc,i))),!0)};function ap(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||ht(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function fa(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,c=i.type.spec.isolating||o.type.spec.isolating;if(!c&&ap(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(t){let p=e.pos+o.nodeSize,m=T.empty;for(let k=s.length-1;k>=0;k--)m=T.from(s[k].create(null,m));m=T.from(i.copy(m));let g=n.tr.step(new ce(e.pos-1,p,e.pos,p,new B(m,1,0),s.length,!0)),y=g.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==i.type&&ht(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&c?null:H.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),h=f&&_t(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(d&&Jt(o,"start",!0)&&Jt(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=o,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(t){let k=T.empty;for(let b=m.length-1;b>=0;b--)k=T.from(m[b].copy(k));let v=n.tr.step(new ce(e.pos-m.length,e.pos+o.nodeSize,e.pos+y,e.pos+o.nodeSize-y,new B(k,m.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function ha(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(V.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const cp=ha(-1),dp=ha(1);function up(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&go(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function ws(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[o];t.doc.nodesBetween(s,l,(c,d)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)i=!0;else{let u=t.doc.resolve(d),f=u.index();i=u.parent.canReplaceWith(f,f+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:c}}=t.selection.ranges[s];o.setBlockType(l,c,n,e)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function fp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o);if(!s)return!1;let l=r?t.tr:null;return hp(l,s,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function hp(n,e,t,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=s.resolve(e.start-2);o=new Zn(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Zn(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=go(o,t,r,e);return l?(n&&pp(n,e,l,i,t),!0):!1}function pp(n,e,t,r,i){let o=T.empty;for(let u=t.length-1;u>=0;u--)o=T.from(t[u].type.create(t[u].attrs,o));n.step(new ce(e.start-(r?2:0),e.end,e.start,e.end,new B(o,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==i&&(s=u+1);let l=t.length-s,c=e.start+t.length-(r?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&jt(n.doc,c,l)&&(n.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return n}function mp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?gp(e,t,n,o):yp(e,t,o):!0:!1}}function gp(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ce(o-1,s,o,s,new B(T.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Zn(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=_t(r);if(l==null)return!1;i.lift(r,l);let c=i.doc.resolve(i.mapping.map(o,-1)-1);return ht(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function yp(n,e,t){let r=n.tr,i=t.parent;for(let p=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,c=t.endIndex==i.childCount,d=o.node(-1),u=o.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(c?T.empty:T.from(i))))return!1;let f=o.pos,h=f+s.nodeSize;return r.step(new ce(f-(l?1:0),h+(c?1:0),f+1,h-1,new B((l?T.empty:T.from(i.copy(T.empty))).append(c?T.empty:T.from(i.copy(T.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function kp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,c=l.child(s-1);if(c.type!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==l.type,u=T.from(d?n.create():null),f=new B(T.from(n.create(null,T.from(l.type.create(null,u)))),d?3:1,0),h=o.start,p=o.end;t(e.tr.step(new ce(h-(d?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const fe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Gt=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Vi=null;const Ke=function(n,e,t){let r=Vi||(Vi=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},bp=function(){Vi=null},Nt=function(n,e,t,r){return t&&(Cs(n,e,t,r,-1)||Cs(n,e,t,r,1))},vp=/^(img|br|input|textarea|hr)$/i;function Cs(n,e,t,r,i){for(var o;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Be(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Nn(n)||vp.test(n.nodeName)||n.contentEditable=="false")return!1;e=fe(n)+(i<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else n=s,e=i<0?Be(n):0}else return!1}}function Be(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function xp(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Be(n)}else if(n.parentNode&&!Nn(n))e=fe(n),n=n.parentNode;else return null}}function wp(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Nn(n))e=fe(n)+1,n=n.parentNode;else return null}}function Cp(n,e,t){for(let r=e==0,i=e==Be(n);r||i;){if(n==t)return!0;let o=fe(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Be(n)}}function Nn(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Wr=function(n){return n.focusNode&&Nt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function gt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Sp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Mp(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Be(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Be(r.startContainer),r.startOffset)}}}const Fe=typeof navigator<"u"?navigator:null,Ss=typeof document<"u"?document:null,Dt=Fe&&Fe.userAgent||"",Fi=/Edge\/(\d+)/.exec(Dt),pa=/MSIE \d/.exec(Dt),Hi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dt),Se=!!(pa||Hi||Fi),at=pa?document.documentMode:Hi?+Hi[1]:Fi?+Fi[1]:0,Le=!Se&&/gecko\/(\d+)/i.test(Dt),ji=!Se&&/Chrome\/(\d+)/.exec(Dt),ae=!!ji,ma=ji?+ji[1]:0,ge=!Se&&!!Fe&&/Apple Computer/.test(Fe.vendor),Yt=ge&&(/Mobile\/\w+/.test(Dt)||!!Fe&&Fe.maxTouchPoints>2),Ae=Yt||(Fe?/Mac/.test(Fe.platform):!1),ga=Fe?/Win/.test(Fe.platform):!1,Je=/Android \d/.test(Dt),An=!!Ss&&"webkitFontSmoothing"in Ss.documentElement.style,Tp=An?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ep(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function je(n,e){return typeof n=="number"?n:n[e]}function Np(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Ms(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=Gt(s);continue}let l=s,c=l==o.body,d=c?Ep(o):Np(l),u=0,f=0;if(e.top<d.top+je(r,"top")?f=-(d.top-e.top+je(i,"top")):e.bottom>d.bottom-je(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+je(i,"top")-d.top:e.bottom-d.bottom+je(i,"bottom")),e.left<d.left+je(r,"left")?u=-(d.left-e.left+je(i,"left")):e.right>d.right-je(r,"right")&&(u=e.right-d.right+je(i,"right")),u||f)if(c)o.defaultView.scrollBy(u,f);else{let p=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let g=l.scrollLeft-p,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=c?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s=h=="absolute"?s.offsetParent:Gt(s)}}function Ap(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(o,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=t-20){r=l,i=c.top;break}}return{refDOM:r,refTop:i,stack:ya(n.dom)}}function ya(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Gt(r));return e}function Bp({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;ka(t,r==0?0:r-e)}function ka(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Rt=null;function Op(n){if(n.setActive)return n.setActive();if(Rt)return n.focus(Rt);let e=ya(n);n.focus(Rt==null?{get preventScroll(){return Rt={preventScroll:!0},!0}}:void 0),Rt||(Rt=!1,ka(e,0))}function ba(n,e){let t,r=2e8,i,o=0,s=e.top,l=e.top,c,d;for(let u=n.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Ke(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=u,r=g,i=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(o=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(o=f+1)}}return!t&&c&&(t=c,i=d,r=0),t&&t.nodeType==3?Dp(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:ba(t,i)}function Dp(n,e){let t=n.nodeValue.length,r=document.createRange(),i;for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let s=Xe(r,1);if(s.top!=s.bottom&&vo(e,s)){i={node:n,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function vo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Ip(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function $p(n,e,t){let{node:r,offset:i}=ba(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function Rp(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let l=n.docView.nearestDesc(o,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&c.left>r.left||c.top>r.top?i=l.posBefore:(!s&&c.right<r.left||c.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;o=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function va(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(vo(e,d))return va(s,e,d)}}if((o=(o+1)%r)==i)break}return n}function Lp(n,e){let t=n.dom.ownerDocument,r,i=0,o=Mp(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=n.dom.getBoundingClientRect();if(!vo(e,d)||(s=va(n.dom,e,d),!s))return null}if(ge)for(let d=s;r&&d;d=Gt(d))d.draggable&&(r=void 0);if(s=Ip(s,e),r){if(Le&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let d;An&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Rp(n,r,i,e))}l==null&&(l=$p(n,s,e));let c=n.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function Ts(n){return n.top<n.bottom||n.left<n.right}function Xe(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ts(r))return r}return Array.prototype.find.call(t,Ts)||n.getBoundingClientRect()}const zp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function xa(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=An||Le;if(r.nodeType==3)if(s&&(zp.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let c=Xe(Ke(r,i,i),t);if(Le&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=Xe(Ke(r,i-1,i-1),-1);if(d.top==c.top){let u=Xe(Ke(r,i,i+1),-1);if(u.top!=c.top)return tn(u,u.left<d.left)}}return c}else{let c=i,d=i,u=t<0?1:-1;return t<0&&!i?(d++,u=-1):t>=0&&i==r.nodeValue.length?(c--,u=1):t<0?c--:d++,tn(Xe(Ke(r,c,d),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==Be(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return fi(c.getBoundingClientRect(),!1)}if(o==null&&i<Be(r)){let c=r.childNodes[i];if(c.nodeType==1)return fi(c.getBoundingClientRect(),!0)}return fi(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==Be(r))){let c=r.childNodes[i-1],d=c.nodeType==3?Ke(c,Be(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return tn(Xe(d,1),!1)}if(o==null&&i<Be(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Ke(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return tn(Xe(d,-1),!0)}return tn(Xe(r.nodeType==3?Ke(r):r,-t),t>=0)}function tn(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function fi(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function wa(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Pp(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return wa(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=xa(n,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Ke(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Vp=/[\u0590-\u08ac]/;function Fp(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=n.domSelection();return l?!Vp.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:wa(n,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return h!=null&&(l.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let Es=null,Ns=null,As=!1;function Hp(n,e,t){return Es==e&&Ns==t?As:(Es=e,Ns=t,As=t=="up"||t=="down"?Pp(n,e,t):Fp(n,e,t))}const De=0,Bs=1,yt=2,He=3;class Bn{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=De,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].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 t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.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,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>fe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let l=i.children[s];if(l.size){i=l;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof Sa){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Ca&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?fe(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?fe(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,l=0;;l++){let c=this.children[l],d=s+c.size;if(i==-1&&e<=d){let u=s+c.border;if(e>=u&&t<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,u);e=s;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=fe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(d>t||l==this.children.length-1)){t=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=fe(f.dom);break}t+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],y=m+g.size;if(o>m&&s<y)return g.setSelection(e-m-g.border,t-m-g.border,r,i);m=y}let l=this.domFromPos(e,e?-1:1),c=t==e?l:this.domFromPos(t,t?-1:1),d=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((Le||ge)&&e==t){let{node:p,offset:m}=l;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==`
10
- `),f&&m==p.nodeValue.length)for(let g=p,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=c={node:y.parentNode,offset:fe(y)+1});break}let k=g.pmViewDesc;if(k&&k.node&&k.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Le&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&ge)&&Nt(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Nt(c.node,c.offset,u.focusNode,u.focusOffset))return;let h=!1;if((d.extend||e==t)&&!(f&&Le)){d.collapse(l.node,l.offset);try{e!=t&&d.extend(c.node,c.offset),h=!0}catch{}}if(!h){if(e>t){let m=l;l=c,c=m}let p=document.createRange();p.setEnd(c.node,c.offset),p.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let l=r+o.border,c=s-o.border;if(e>=l&&t<=c){this.dirty=e==r||t==s?yt:Bs,e==l&&t==c&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=He:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?yt:He}r=s}this.dirty=yt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?yt:Bs;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Ca extends Bn{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!t.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=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==De&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(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 jp extends Bn{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class At extends Bn{constructor(e,t,r,i,o){super(e,[],r,i),this.mark=t,this.spec=o}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=Ot.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new At(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&He||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=He&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=De){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=De}}slice(e,t,r){let i=At.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=qi(o,t,s,r)),e>0&&(o=qi(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ct extends Bn{constructor(e,t,r,i,o,s,l,c,d){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,o,s){let l=o.nodeViews[t.type.name],c,d=l&&l(t,o,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=d&&d.dom,f=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Ot.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=Ea(u,r,t),d?c=new Up(e,t,r,i,u,f||null,h,d,o,s+1):t.isText?new Kr(e,t,r,i,u,h,o):new ct(e,t,r,i,u,f||null,h,o,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 t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>T.empty)}return e}matchesNode(e,t,r){return this.dirty==De&&e.eq(this.node)&&er(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,c=new Wp(this,s&&s.node,e);Gp(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?Y.none:this.node.child(u).marks,r,e),c.placeWidget(d,e,i)},(d,u,f,h)=>{c.syncToMarks(d.marks,r,e);let p;c.findNodeMatch(d,u,f,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+d.nodeSize&&(p=c.findIndexWithChild(o.node))>-1&&c.updateNodeAt(d,u,f,p,e)||c.updateNextNode(d,u,f,e,h,i)||c.addNode(d,u,f,e,i),i+=d.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==yt)&&(s&&this.protectLocalComposition(e,s),Ma(this.contentDOM,this.children,e),Yt&&Yp(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof V)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=Qp(this.node.content,s,r-t,i-t);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new jp(this,o,t,i);e.input.compositionNodes.push(s),this.children=qi(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==He||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=De}updateOuterDeco(e){if(er(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ta(this.dom,this.nodeDOM,Ui(this.outerDeco,this.node,t),Ui(e,this.node,t)),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 Os(n,e,t,r,i){Ea(r,e,n);let o=new ct(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Kr extends ct{constructor(e,t,r,i,o,s,l){super(e,t,r,i,o,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,t,r,i){return this.dirty==He||this.dirty!=De&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=De||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=De,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),o=document.createTextNode(i.text);return new Kr(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=He)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Sa extends Bn{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==De&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Up extends ct{constructor(e,t,r,i,o,s,l,c,d,u){super(e,t,r,i,o,s,l,d,u),this.spec=c}update(e,t,r,i){if(this.dirty==He)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}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 Ma(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=Ds(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof At){let c=r?r.previousSibling:n.lastChild;Ma(s.contentDOM,s.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=Ds(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const dn=function(n){n&&(this.nodeName=n)};dn.prototype=Object.create(null);const kt=[new dn];function Ui(n,e,t){if(n.length==0)return kt;let r=t?kt[0]:new dn,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new dn(s.nodeName));for(let l in s){let c=s[l];c!=null&&(t&&i.length==1&&i.push(r=new dn(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+c:l=="style"?r.style=(r.style?r.style+";":"")+c:l!="nodeName"&&(r[l]=c))}}}return i}function Ta(n,e,t,r){if(t==kt&&r==kt)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=t[o];if(o){let c;l&&l.nodeName==s.nodeName&&i!=n&&(c=i.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(i),l=kt[0]),i=c}qp(i,l||kt[0],s)}return i}function qp(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function Ea(n,e,t){return Ta(n,n,kt,Ui(e,t,n.nodeType!=1))}function er(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Ds(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Wp{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Kp(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=De,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let d=this.top.children[c];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){l=c;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=At.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,t,r)&&!this.preMatch.matched.has(d)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==He&&s.dom==s.contentDOM&&(s.dirty=yt),s.update(e,t,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof ct){let d=this.preMatch.matched.get(c);if(d!=null&&d!=o)return!1;let u=c.dom,f,h=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=He&&er(t,c.outerDeco));if(!h&&c.update(e,t,r,i))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(c,e,t,r,i,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=yt,f.updateChildren(i,s+1),f.dirty=De),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!er(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=ct.create(this.top,t,r,i,o,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,t,r,i,o){let s=ct.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new Ca(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof At;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Kr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ge||ae)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.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 i=new Sa(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Kp(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let d=t.children[r-1];if(d instanceof At)t=d,r=d.children.length;else{l=d,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let c=l.node;if(c){if(c!=n.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function Jp(n,e){return n.type.side-e.type.side}function Gp(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);r(u,i,e.forChild(o,u),d),o+=u.nodeSize}return}let s=0,l=[],c=null;for(let d=0;;){let u,f;for(;s<i.length&&i[s].to==o;){let y=i[s++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(Jp);for(let y=0;y<f.length;y++)t(f[y],d,!!c)}else t(u,d,!!c);let h,p;if(c)p=-1,h=c,c=null;else if(d<n.childCount)p=d,h=n.child(d++);else break;for(let y=0;y<l.length;y++)l[y].to<=o&&l.splice(y--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let m=o+h.nodeSize;if(h.isText){let y=m;s<i.length&&i[s].from<y&&(y=i[s].from);for(let k=0;k<l.length;k++)l[k].to<y&&(y=l[k].to);y<m&&(c=h.cut(y-o),h=h.cut(0,y-o),m=y,p=-1)}else for(;s<i.length&&i[s].to<m;)s++;let g=h.isInline&&!h.isLeaf?l.filter(y=>!y.inline):l.slice();r(h,g,e.forChild(o,h),p),o=m}}function Yp(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Qp(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let c=s.text;for(;i<n.childCount;){let d=n.child(i++);if(o+=d.nodeSize,!d.isText)break;c+=d.text}if(o>=t){if(o>=r&&c.slice(r-e.length-l,r-l)==e)return r-e.length;let d=l<r?c.lastIndexOf(e,r-l-1):-1;if(d>=0&&d+e.length+l>=t)return l+d;if(t==r&&c.length>=r+e.length-l&&c.slice(r-l,r-l+e.length)==e)return r}}return-1}function qi(n,e,t,r,i){let o=[];for(let s=0,l=0;s<n.length;s++){let c=n[s],d=l,u=l+=c.size;d>=t||u<=e?o.push(c):(d<e&&o.push(c.slice(0,e-d,r)),i&&(o.push(i),i=void 0),u>t&&o.push(c.slice(t-d,c.size,r)))}return o}function xo(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),c,d;if(Wr(t)){for(c=s;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&P.isSelectable(f)&&i.parent&&!(f.isInline&&Cp(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;d=new P(s==h?l:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=s,h=s;for(let p=0;p<t.rangeCount;p++){let m=t.getRangeAt(p);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,s]=h==n.state.selection.anchor?[h,f]:[f,h],l=r.resolve(s)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!d){let f=e=="pointer"||n.state.selection.head<l.pos&&!o?1:-1;d=wo(n,u,l,f)}return d}function Na(n){return n.editable?n.hasFocus():Ba(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ge(n,e=!1){let t=n.state.selection;if(Aa(n,t),!!Na(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ae){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Nt(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Zp(n);else{let{anchor:r,head:i}=t,o,s;Is&&!(t instanceof V)&&(t.$from.parent.inlineContent||(o=$s(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=$s(n,t.to))),n.docView.setSelection(r,i,n,e),Is&&(o&&Rs(o),s&&Rs(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Xp(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Is=ge||ae&&ma<63;function $s(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(ge&&i&&i.contentEditable=="false")return hi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return hi(i);if(o)return hi(o)}}function hi(n){return n.contentEditable="true",ge&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Rs(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Xp(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Na(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Zp(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,fe(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Se&&at<=11&&(t.disabled=!0,t.disabled=!1)}function Aa(n,e){if(e instanceof P){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Ls(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Ls(n)}function Ls(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function wo(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||V.between(e,t,r)}function zs(n){return n.editable&&!n.hasFocus()?!1:Ba(n)}function Ba(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function _p(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Nt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Wi(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&H.findFrom(o,e)}function Ze(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ps(n,e,t){let r=n.state.selection;if(r instanceof V)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return Ze(n,new V(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Wi(n.state,e);return i&&i instanceof P?Ze(n,i):!1}else if(!(Ae&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?P.isSelectable(o)?Ze(n,new P(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):An?Ze(n,new V(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof P&&r.node.isInline)return Ze(n,new V(e>0?r.$to:r.$from));{let i=Wi(n.state,e);return i?Ze(n,i):!1}}}function tr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function un(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Lt(n,e){return e<0?em(n):tm(n)}function em(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(Le&&t.nodeType==1&&r<tr(t)&&un(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(un(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Oa(t))break;{let l=t.previousSibling;for(;l&&un(l,-1);)i=t.parentNode,o=fe(l),l=l.previousSibling;if(l)t=l,r=tr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Ki(n,t,r):i&&Ki(n,i,o)}function tm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=tr(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(un(l,1))o=t,s=++r;else break}else{if(Oa(t))break;{let l=t.nextSibling;for(;l&&un(l,1);)o=l.parentNode,s=fe(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=tr(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Ki(n,o,s)}function Oa(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function nm(n,e){for(;n&&e==n.childNodes.length&&!Nn(n);)e=fe(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function rm(n,e){for(;n&&!e&&!Nn(n);)e=fe(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Ki(n,e,t){if(e.nodeType!=3){let o,s;(s=nm(e,t))?(e=s,t=0):(o=rm(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Wr(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Ge(n)},50)}function Vs(n,e){let t=n.state.doc.resolve(e);if(!(ae||ga)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Fs(n,e,t){let r=n.state.selection;if(r instanceof V&&!r.empty||t.indexOf("s")>-1||Ae&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Wi(n.state,e);if(s&&s instanceof P)return Ze(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Oe?H.near(s,e):H.findFrom(s,e);return l?Ze(n,l):!1}return!1}function Hs(n,e){if(!(n.state.selection instanceof V))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function js(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function im(n){if(!ge||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;js(n,r,"true"),setTimeout(()=>js(n,r,"false"),20)}return!1}function om(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function sm(n,e){let t=e.keyCode,r=om(e);if(t==8||Ae&&t==72&&r=="c")return Hs(n,-1)||Lt(n,-1);if(t==46&&!e.shiftKey||Ae&&t==68&&r=="c")return Hs(n,1)||Lt(n,1);if(t==13||t==27)return!0;if(t==37||Ae&&t==66&&r=="c"){let i=t==37?Vs(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ps(n,i,r)||Lt(n,i)}else if(t==39||Ae&&t==70&&r=="c"){let i=t==39?Vs(n,n.state.selection.from)=="ltr"?1:-1:1;return Ps(n,i,r)||Lt(n,i)}else{if(t==38||Ae&&t==80&&r=="c")return Fs(n,-1,r)||Lt(n,-1);if(t==40||Ae&&t==78&&r=="c")return im(n)||Fs(n,1,r)||Lt(n,1);if(r==(Ae?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Co(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=n.someProp("clipboardSerializer")||Ot.fromSchema(n.state.schema),l=za(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=La[d.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=l.createElement(u[p]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${o}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
4
+ `,xd={key:0,class:"loader-icon"},wd=["width","height"],Cd=["d"],Sd=["stroke-width"],Md=["stroke-width"],Td=["width","height"],Ed={key:3,class:"loader-text"},Nd=a.defineComponent({__name:"UiLoader",props:{size:{default:"md"},color:{default:"primary"},variant:{default:"circle"},text:{},centered:{type:Boolean,default:!0},weight:{default:30},fullWidth:{type:Boolean,default:!1}},setup(n){const t=vd.replace(/<svg[^>]*>/,"").replace(/<\/svg>/,"").trim().match(/d="([^"]*)"/)?.[1]||"",r=n,i={sm:32,md:48,lg:64,xl:80},o=a.computed(()=>typeof r.size=="number"?r.size:i[r.size]||i.md);return(s,l)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["loader-container",[{"loader-centered":n.centered},`loader-color-${n.color}`]])},[n.variant==="spinner"?(a.openBlock(),a.createElementBlock("div",xd,[(a.openBlock(),a.createElementBlock("svg",{width:o.value,height:o.value,viewBox:"0 0 500 500"},[a.createElementVNode("defs",null,[a.createElementVNode("path",{id:"logo-path",d:a.unref(t),transform:"translate(81, 13) scale(1.0)"},null,8,Cd)]),a.createElementVNode("use",{href:"#logo-path",fill:"none",stroke:"var(--loader-semi-color)","stroke-width":n.weight,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,Sd),a.createElementVNode("use",{href:"#logo-path",fill:"none",stroke:"var(--loader-solid-color)","stroke-width":n.weight,"stroke-linecap":"round","stroke-linejoin":"round",class:"loader-animated-path"},null,8,Md)],8,wd))])):n.variant==="circle"?(a.openBlock(),a.createElementBlock("div",{key:1,class:"loader-circle",style:a.normalizeStyle({width:`${o.value}px`,height:`${o.value}px`})},[(a.openBlock(),a.createElementBlock("svg",{width:o.value,height:o.value,viewBox:"0 0 50 50"},[...l[0]||(l[0]=[a.createElementVNode("circle",{cx:"25",cy:"25",r:"20",fill:"none",stroke:"var(--loader-solid-color)","stroke-width":"4","stroke-linecap":"round",class:"loader-circle-path"},null,-1)])],8,Td))],4)):n.variant==="bar"?(a.openBlock(),a.createElementBlock("div",{key:2,class:"loader-bar",style:a.normalizeStyle({width:n.fullWidth?"100%":`${o.value*1.5}px`,height:`${Math.max(o.value*.1,4)}px`})},[...l[1]||(l[1]=[a.createElementVNode("div",{class:"loader-bar-track"},[a.createElementVNode("div",{class:"loader-bar-fill"})],-1)])],4)):a.createCommentVNode("",!0),n.text?(a.openBlock(),a.createElementBlock("p",Ed,a.toDisplayString(n.text),1)):a.createCommentVNode("",!0)],2))}}),zr=de(Nd,[["__scopeId","data-v-4b565c5d"]]),Ad={key:0,class:"button-loading-content"},Bd={key:0},Od={key:0,class:"leading-icon"},Dd={class:"button-text-content"},Id={key:1,class:"trailing-icon"},$d=a.defineComponent({__name:"UiButton.Content",props:{loading:{type:Boolean,default:!1},loadingText:{},icon:{type:Boolean,default:!1},size:{},textAlign:{default:"center"}},setup(n){const e=a.useSlots(),t=a.computed(()=>!!e["leading-icon"]),r=a.computed(()=>!!e["trailing-icon"]),i=n,o=a.computed(()=>{switch(i.size){case"xs":return 16;case"sm":return 18;case"md":return 20;case"lg":return 24;case"xl":return 28;default:return 20}}),s=a.computed(()=>i.size?`button-content-${i.size}`:"button-content-md");return(l,c)=>n.loading?(a.openBlock(),a.createElementBlock("span",Ad,[a.createVNode(zr,{variant:"circle",size:o.value,centered:!1,color:"white"},null,8,["size"]),n.icon?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("span",Bd,a.toDisplayString(n.loadingText||"Loading..."),1))])):(a.openBlock(),a.createElementBlock("span",{key:1,class:a.normalizeClass(["button-content",s.value,`button-content-align-${n.textAlign}`])},[n.icon?a.renderSlot(l.$slots,"icon",{key:0},void 0,!0):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[t.value?(a.openBlock(),a.createElementBlock("span",Od,[a.renderSlot(l.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(l.$slots,"icon",{},void 0,!0),a.createElementVNode("span",Dd,[a.renderSlot(l.$slots,"default",{},void 0,!0)]),r.value?(a.openBlock(),a.createElementBlock("span",Id,[a.renderSlot(l.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0)],64))],2))}}),Wt=de($d,[["__scopeId","data-v-12d1d1fc"]]),Rd=["href","target","rel"],Oi=a.defineComponent({__name:"UiButton.Anchor",props:{to:{},href:{},external:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{},icon:{type:Boolean,default:!1},buttonClasses:{},buttonStyles:{},textAlign:{default:"center"}},emits:["click"],setup(n,{emit:e}){const t=n,r=e,i=a.computed(()=>{if(t.href)return t.href;if(t.to){if(typeof t.to=="string")return t.to;if(typeof t.to=="object"&&t.to)return"#route-object-not-supported"}return"#"}),o=s=>{if(t.disabled||t.loading){s.preventDefault();return}r("click",s)};return(s,l)=>(a.openBlock(),a.createElementBlock("a",{href:i.value,target:n.external?"_blank":void 0,rel:n.external?"noopener noreferrer":void 0,class:a.normalizeClass(n.buttonClasses),style:a.normalizeStyle(n.buttonStyles),onClick:o},[a.createVNode(Wt,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"text-align":n.textAlign},{"leading-icon":a.withCtx(()=>[a.renderSlot(s.$slots,"leading-icon")]),icon:a.withCtx(()=>[a.renderSlot(s.$slots,"icon")]),default:a.withCtx(()=>[a.renderSlot(s.$slots,"default")]),"trailing-icon":a.withCtx(()=>[a.renderSlot(s.$slots,"trailing-icon")]),_:3},8,["loading","loading-text","icon","text-align"])],14,Rd))}}),Di=a.defineComponent({__name:"UiButton.Nuxt",props:{to:{},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{},icon:{type:Boolean,default:!1},buttonClasses:{},buttonStyles:{},textAlign:{default:"center"}},emits:["click"],setup(n,{emit:e}){const t=a.getCurrentInstance(),r=a.computed(()=>t?.appContext.app.component("NuxtLink")?"NuxtLink":t?.appContext.app.component("RouterLink")?"RouterLink":"a"),i=n,o=e,s=l=>{if(i.disabled||i.loading){l.preventDefault();return}o("click",l)};return(l,c)=>(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r.value),{to:r.value!=="a"?n.to:void 0,href:r.value==="a"?typeof n.to=="string"?n.to:"/":void 0,class:a.normalizeClass(n.buttonClasses),style:a.normalizeStyle(n.buttonStyles),onClick:s},{default:a.withCtx(()=>[a.createVNode(Wt,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"text-align":n.textAlign},{"leading-icon":a.withCtx(()=>[a.renderSlot(l.$slots,"leading-icon")]),icon:a.withCtx(()=>[a.renderSlot(l.$slots,"icon")]),default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),"trailing-icon":a.withCtx(()=>[a.renderSlot(l.$slots,"trailing-icon")]),_:3},8,["loading","loading-text","icon","text-align"])]),_:3},8,["to","href","class","style"]))}}),Ii=a.defineComponent({__name:"UiButton.Vue",props:{to:{},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{},icon:{type:Boolean,default:!1},buttonClasses:{},buttonStyles:{},textAlign:{default:"center"}},emits:["click"],setup(n,{emit:e}){const t=n,r=e,i=o=>{if(t.disabled||t.loading){o.preventDefault();return}r("click",o)};return(o,s)=>{const l=a.resolveComponent("router-link");return a.openBlock(),a.createBlock(l,{to:n.to,class:a.normalizeClass(n.buttonClasses),style:a.normalizeStyle(n.buttonStyles),onClick:i},{default:a.withCtx(()=>[a.createVNode(Wt,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"text-align":n.textAlign},{"leading-icon":a.withCtx(()=>[a.renderSlot(o.$slots,"leading-icon")]),icon:a.withCtx(()=>[a.renderSlot(o.$slots,"icon")]),default:a.withCtx(()=>[a.renderSlot(o.$slots,"default")]),"trailing-icon":a.withCtx(()=>[a.renderSlot(o.$slots,"trailing-icon")]),_:3},8,["loading","loading-text","icon","text-align"])]),_:3},8,["to","class","style"])}}}),Ld={class:"ui-tooltip-content"},zd=a.defineComponent({inheritAttrs:!1,__name:"UiTooltip",props:{content:{default:""},position:{default:"top"},delay:{default:500},disabled:{type:Boolean,default:!1},offset:{default:8},maxWidth:{default:250}},setup(n){const e=n,t=a.ref(),r=a.ref(),i=a.ref(!1),o=a.ref(!1);let s=null,l=null;const c=a.ref({}),d=async()=>{if(!t.value||!r.value||!o.value)return;await a.nextTick();const h=t.value.getBoundingClientRect();r.value.style.visibility="hidden",r.value.style.opacity="1";const p=r.value.getBoundingClientRect(),m=p.width,g=p.height;r.value.style.visibility="",r.value.style.opacity="";const y=window.innerWidth,k=window.innerHeight;let v=0,b=0;switch(e.position){case"top":v=h.top-g-e.offset,b=h.left+h.width/2-m/2;break;case"bottom":v=h.bottom+e.offset,b=h.left+h.width/2-m/2;break;case"left":v=h.top+h.height/2-g/2,b=h.left-m-e.offset;break;case"right":v=h.top+h.height/2-g/2,b=h.right+e.offset;break}const x=8;b<x?b=x:b+m>y-x&&(b=y-m-x),v<x?v=x:v+g>k-x&&(v=k-g-x),c.value={position:"fixed",top:`${v}px`,left:`${b}px`,zIndex:"9999"}},u=()=>{e.disabled||(l&&(clearTimeout(l),l=null),o.value=!0,a.nextTick(()=>{d()}),s=setTimeout(()=>{i.value=!0},e.delay))},f=()=>{s&&(clearTimeout(s),s=null),l=setTimeout(()=>{i.value=!1,setTimeout(()=>{o.value=!1},200)},100)};return a.onUnmounted(()=>{s&&clearTimeout(s),l&&clearTimeout(l)}),(h,p)=>(a.openBlock(),a.createElementBlock("div",a.mergeProps({ref_key:"tooltipContainer",ref:t,class:"ui-tooltip-container"},h.$attrs,{onMouseenter:u,onMouseleave:f}),[a.renderSlot(h.$slots,"default",{},void 0,!0),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[o.value?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"tooltipRef",ref:r,class:a.normalizeClass(["ui-tooltip",[`ui-tooltip--${n.position}`,{"ui-tooltip--visible":i.value}]]),style:a.normalizeStyle(c.value),role:"tooltip"},[a.createElementVNode("div",Ld,[a.renderSlot(h.$slots,"tooltip",{},()=>[a.createTextVNode(a.toDisplayString(n.content),1)],!0)]),a.createElementVNode("div",{class:a.normalizeClass(["ui-tooltip-arrow",`ui-tooltip-arrow--${n.position}`])},null,2)],6)):a.createCommentVNode("",!0)]))],16))}}),Tl=de(zd,[["__scopeId","data-v-ba66edda"]]),Pd=["type","disabled","tabindex"],Vd=["type","disabled","tabindex"],Fd=a.defineComponent({inheritAttrs:!1,__name:"UiButton",props:{variant:{default:"primary"},size:{default:"md"},type:{default:"button"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{},fullWidth:{type:Boolean,default:!1},color:{default:"primary"},fontWeight:{default:600},icon:{type:Boolean,default:!1},squircle:{type:Boolean,default:!1},to:{},href:{},external:{type:Boolean,default:!1},tabindex:{},title:{},textAlign:{default:"center"}},emits:["click"],setup(n,{emit:e}){const t=n,r=a.computed(()=>t.title?typeof t.title=="string"?{content:t.title,position:"top",disabled:t.disabled||t.loading}:{...t.title,disabled:t.title.disabled??(t.disabled||t.loading)}:null),i=a.computed(()=>!!(typeof process<"u"&&process.client!==void 0||typeof window<"u"&&(window.__NUXT__||window.$nuxt))),o=a.computed(()=>{try{if(typeof window<"u"&&window.Vue?.Router)return!0}catch{}return!1}),s=a.computed(()=>["ui-button",`ui-button-${t.variant}`,`ui-button-${t.size}`,`ui-button-color-${t.color}`,t.loading?"ui-button-loading":"",t.disabled?"ui-button-disabled":"",t.fullWidth?"ui-button-full-width":"",t.icon?"ui-button-icon":"",t.squircle?"ui-button-squircle":""].filter(Boolean)),l=a.computed(()=>s.value.join(" ")),c=a.computed(()=>({fontWeight:t.fontWeight})),d=a.computed(()=>t.disabled||t.loading?-1:t.tabindex??void 0);return(u,f)=>n.title?(a.openBlock(),a.createBlock(Tl,a.normalizeProps(a.mergeProps({key:0},r.value)),{default:a.withCtx(()=>[n.to?i.value&&n.to?(a.openBlock(),a.createBlock(Di,{key:1,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,"text-align":n.textAlign,onClick:f[1]||(f[1]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):o.value&&n.to?(a.openBlock(),a.createBlock(Ii,{key:2,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,"text-align":n.textAlign,onClick:f[2]||(f[2]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):(a.openBlock(),a.createBlock(Oi,{key:3,to:n.to,href:n.href,external:n.external,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,"text-align":n.textAlign,onClick:f[3]||(f[3]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","href","external","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):(a.openBlock(),a.createElementBlock("button",a.mergeProps({key:0},u.$attrs,{type:n.type,disabled:n.disabled||n.loading,class:l.value,style:c.value,tabindex:d.value,onClick:f[0]||(f[0]=h=>u.$emit("click",h))}),[a.createVNode(Wt,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,size:n.size,"text-align":n.textAlign},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","text-align"])],16,Pd))]),_:3},16)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[n.to?i.value&&n.to?(a.openBlock(),a.createBlock(Di,{key:1,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,"text-align":n.textAlign,onClick:f[5]||(f[5]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):o.value&&n.to?(a.openBlock(),a.createBlock(Ii,{key:2,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,"text-align":n.textAlign,onClick:f[6]||(f[6]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):(a.openBlock(),a.createBlock(Oi,{key:3,to:n.to,href:n.href,external:n.external,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":s.value,"button-styles":c.value,tabindex:d.value,"text-align":n.textAlign,onClick:f[7]||(f[7]=h=>u.$emit("click",h))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","href","external","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):(a.openBlock(),a.createElementBlock("button",a.mergeProps({key:0},u.$attrs,{type:n.type,disabled:n.disabled||n.loading,class:l.value,style:c.value,tabindex:d.value,onClick:f[4]||(f[4]=h=>u.$emit("click",h))}),[a.createVNode(Wt,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,size:n.size,"text-align":n.textAlign},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(u.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(u.$slots,"default",{},void 0,!0)]),_:2},[u.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,u.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","text-align"])],16,Vd))],64))}}),W=de(Fd,[["__scopeId","data-v-0e5b129a"]]),Hd={key:0,class:"ui-card-header"},jd={key:0,class:"ui-card-title-wrapper"},Ud={key:0,class:"ui-card-title"},qd={key:0,class:"ui-card-subtitle"},Wd={key:1,class:"ui-card-content"},Kd={key:2,class:"ui-card-footer"},Jd=a.defineComponent({inheritAttrs:!1,__name:"UiCard",props:{variant:{default:"default"},padding:{default:"md"},shadow:{default:"sm"},color:{default:"default"},title:{},subtitle:{}},setup(n){const e=a.useAttrs();return(t,r)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["ui-card",[`ui-card-${n.variant}`,`ui-card-padding-${n.padding}`,`ui-card-shadow-${n.shadow}`,`ui-card-color-${n.color}`,a.unref(e).class]])},[t.$slots.header||n.title||n.subtitle||t.$slots["leading-icon"]||t.$slots["trailing-icon"]?(a.openBlock(),a.createElementBlock("div",Hd,[a.renderSlot(t.$slots,"header",{},()=>[a.renderSlot(t.$slots,"leading-icon",{},void 0,!0),n.title||t.$slots.title||n.subtitle||t.$slots.subtitle?(a.openBlock(),a.createElementBlock("div",jd,[n.title||t.$slots.title?a.renderSlot(t.$slots,"title",{key:0},()=>[n.title?(a.openBlock(),a.createElementBlock("h2",Ud,a.toDisplayString(n.title),1)):a.createCommentVNode("",!0)],!0):a.createCommentVNode("",!0),n.subtitle||t.$slots.subtitle?a.renderSlot(t.$slots,"subtitle",{key:1},()=>[n.subtitle?(a.openBlock(),a.createElementBlock("p",qd,a.toDisplayString(n.subtitle),1)):a.createCommentVNode("",!0)],!0):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.renderSlot(t.$slots,"trailing-icon",{},void 0,!0),a.renderSlot(t.$slots,"actions",{},void 0,!0)],!0)])):a.createCommentVNode("",!0),t.$slots.default?(a.openBlock(),a.createElementBlock("div",Wd,[a.renderSlot(t.$slots,"default",{},void 0,!0)])):a.createCommentVNode("",!0),t.$slots.footer?(a.openBlock(),a.createElementBlock("div",Kd,[a.renderSlot(t.$slots,"footer",{},void 0,!0)])):a.createCommentVNode("",!0)],2))}}),uo=de(Jd,[["__scopeId","data-v-374e57b2"]]);const es=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Gd=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),Yd=n=>{const e=Gd(n);return e.charAt(0).toUpperCase()+e.slice(1)},Qd=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim(),ts=n=>n==="";var en={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Xd=({name:n,iconNode:e,absoluteStrokeWidth:t,"absolute-stroke-width":r,strokeWidth:i,"stroke-width":o,size:s=en.width,color:l=en.stroke,...c},{slots:d})=>a.h("svg",{...en,...c,width:s,height:s,stroke:l,"stroke-width":ts(t)||ts(r)||t===!0||r===!0?Number(i||o||en["stroke-width"])*24/Number(s):i||o||en["stroke-width"],class:Qd("lucide",c.class,...n?[`lucide-${es(Yd(n))}-icon`,`lucide-${es(n)}`]:["lucide-icon"])},[...e.map(u=>a.h(...u)),...d.default?[d.default()]:[]]);const J=(n,e)=>(t,{slots:r,attrs:i})=>a.h(Xd,{...i,...t,iconNode:e,name:n},r);const Zd=J("align-center",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const _d=J("align-left",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const eu=J("align-right",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const tu=J("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const nu=J("calendar-clock",[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);const ru=J("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const iu=J("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Pr=J("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const ou=J("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const su=J("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const lu=J("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const au=J("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const cu=J("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const du=J("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const uu=J("file-input",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);const fu=J("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);const hu=J("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);const pu=J("heading-3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);const mu=J("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const gu=J("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);const yu=J("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);const El=J("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const ku=J("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const bu=J("redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);const vu=J("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const xu=J("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);const wu=J("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);const Cu=J("undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);const fo=J("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Su={key:0,class:"input-leading-icon"},Mu=["id","type","value","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","tabindex"],Tu={key:1,class:"input-trailing-icon"},Eu={key:2,class:"input-trailing-icon"},Nu={key:3,class:"input-trailing-icon"},Au=a.defineComponent({__name:"UiInput.Text",props:{type:{default:"text"},min:{},max:{},step:{},autocomplete:{},spellcheck:{type:Boolean,default:!0},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","keydown"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(!1),o=a.computed(()=>t.type==="password"?i.value?"text":"password":t.type),s=a.computed(()=>t.hasTrailingIcon||t.type==="password"||t.type==="search"&&t.modelValue),l=a.computed(()=>{if(t.tabindex!==void 0)return t.tabindex+1}),c=a.computed(()=>{const y=[];return t.error&&y.push("input-error"),t.disabled&&y.push("input-disabled"),t.readonly&&y.push("input-readonly"),y.push(`input-size-${t.size}`),y}),d=a.computed(()=>{const y=[];return t.hasLeadingIcon?y.push("input-padding-left-icon"):y.push("input-padding-left"),s.value?y.push("input-padding-right-icon"):y.push("input-padding-right"),y}),u=y=>{let v=y.target.value;t.type==="number"&&v!==""&&(v=parseFloat(v)||0),r("update:modelValue",v)},f=y=>{r("blur",y)},h=y=>{r("focus",y)},p=y=>{r("keydown",y)},m=()=>{i.value=!i.value},g=()=>{r("update:modelValue","")};return(y,k)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper",c.value])},[a.renderSlot(y.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Su,[a.renderSlot(y.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.createElementVNode("input",{id:n.inputId,type:o.value,value:n.modelValue,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:n.required,min:n.min,max:n.max,step:n.step,autocomplete:n.autocomplete,spellcheck:n.spellcheck,tabindex:n.tabindex,class:a.normalizeClass(["input-base",d.value]),onInput:u,onBlur:f,onFocus:h,onKeydown:p},null,42,Mu),n.type==="password"?(a.openBlock(),a.createElementBlock("div",Tu,[a.createVNode(W,{color:i.value?"primary":"secondary",variant:i.value?"primary":"ghost",size:"sm",icon:"",squircle:"",tabindex:l.value,"aria-label":i.value?"Hide password":"Show password",onClick:m},{icon:a.withCtx(()=>[i.value?(a.openBlock(),a.createBlock(a.unref(cu),{key:0})):(a.openBlock(),a.createBlock(a.unref(du),{key:1}))]),_:1},8,["color","variant","tabindex","aria-label"])])):n.type==="search"&&n.modelValue&&!n.disabled&&!n.readonly?(a.openBlock(),a.createElementBlock("div",Eu,[a.createVNode(W,{color:"danger",variant:"ghost",size:"sm",icon:"",squircle:"",tabindex:l.value,"aria-label":"Clear search",onClick:g},{icon:a.withCtx(()=>[a.createVNode(a.unref(fo))]),_:1},8,["tabindex"])])):t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",Nu,[a.renderSlot(y.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(y.$slots,"trailing",{},void 0,!0)],2))}}),Bu=de(Au,[["__scopeId","data-v-4807b700"]]),Ou={key:0,class:"input-leading-icon"},Du=["id","value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck"],Iu={key:1,class:"input-trailing-icon"},$u=a.defineComponent({__name:"UiInput.Textarea",props:{rows:{default:3},cols:{},maxlength:{},autocomplete:{},spellcheck:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","keydown"],setup(n,{emit:e}){const t=n,r=e,i=a.computed(()=>{const u=[];return t.error&&u.push("input-error"),t.disabled&&u.push("input-disabled"),t.readonly&&u.push("input-readonly"),u.push(`input-size-${t.size}`),u}),o=a.computed(()=>{const u=[];return t.hasLeadingIcon?u.push("input-padding-left-icon"):u.push("input-padding-left"),t.hasTrailingIcon?u.push("input-padding-right-icon"):u.push("input-padding-right"),u}),s=u=>{const f=u.target;r("update:modelValue",f.value)},l=u=>{r("blur",u)},c=u=>{r("focus",u)},d=u=>{r("keydown",u)};return(u,f)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper input-textarea",i.value])},[a.renderSlot(u.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Ou,[a.renderSlot(u.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(["textarea-wrapper",{"textarea-resizable":n.resizable}])},[a.createElementVNode("textarea",{id:n.inputId,value:n.modelValue,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:n.required,rows:n.rows,cols:n.cols,maxlength:n.maxlength,autocomplete:n.autocomplete,spellcheck:n.spellcheck,class:a.normalizeClass(["input-base",[{"input-textarea-resize":n.resizable},o.value]]),onInput:s,onBlur:l,onFocus:c,onKeydown:d},null,42,Du)],2),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",Iu,[a.renderSlot(u.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(u.$slots,"trailing",{},void 0,!0)],2))}}),Ru=de($u,[["__scopeId","data-v-7d410607"]]);function Vr(n){const{trigger:e,floating:t,placement:r="bottom-start",offset:i=8,flip:o=!0,shift:s=!0,sameWidth:l=!1,autoUpdate:c=!1,clickOutside:d}=n,u=a.ref({position:"fixed",top:"0px",left:"0px",zIndex:"9999"}),f=async()=>{if(await a.nextTick(),!e.value||!t.value||typeof e.value.getBoundingClientRect!="function"||typeof t.value.getBoundingClientRect!="function")return;const b=e.value.getBoundingClientRect(),x=t.value.getBoundingClientRect(),[w,S="start"]=r.split("-");let M=0,C=0;switch(w){case"bottom":M=b.left,C=b.bottom+i;break;case"top":M=b.left,C=b.top-x.height-i;break;case"right":M=b.right+i,C=b.top;break;case"left":M=b.left-x.width-i,C=b.top;break}if(w==="top"||w==="bottom")switch(S){case"center":M=b.left+(b.width-x.width)/2;break;case"end":M=b.right-x.width;break}else if(w==="left"||w==="right")switch(S){case"center":C=b.top+(b.height-x.height)/2;break;case"end":C=b.bottom-x.height;break}let A=l?b.width:void 0;const $=window.innerWidth,U=window.innerHeight,j=8;let K=!1,N=!1;if(o){if(w==="bottom"&&C+x.height>U-j){const R=b.top-x.height-i;R>=j&&(C=R,K=!0)}else if(w==="top"&&C<j){const R=b.bottom+i;R+x.height<=U-j&&(C=R,K=!1)}if(w==="right"&&M+x.width>$-j){const R=b.left-x.width-i;R>=j&&(M=R,N=!0)}else if(w==="left"&&M<j){const R=b.right+i;R+x.width<=$-j&&(M=R,N=!1)}}s&&(M<j?M=j:M+x.width>$-j&&(M=$-x.width-j),C<j?C=j:C+x.height>U-j&&(C=U-x.height-j));const D={position:"fixed",zIndex:"9999",...A?{width:`${A}px`}:{}};K?D.bottom=`${U-C-x.height}px`:D.top=`${C}px`,N?D.right=`${$-M-x.width}px`:D.left=`${M}px`,u.value=D},h=()=>{f()};let p=null;const m=()=>{h()},g=()=>{if(h(),d?.enabled&&d.handler&&e.value){if(typeof e.value.getBoundingClientRect!="function")return;const b=e.value.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth;(b.bottom<0||b.top>x||b.right<0||b.left>w)&&d.handler()}},y=b=>{if(!d?.enabled||!d.handler)return;const x=b.target;if(!x||!e.value||!t.value||typeof e.value.contains!="function"||typeof t.value.contains!="function")return;const w=e.value.contains(x),S=t.value.contains(x);!w&&!S&&d.handler()},k=()=>{c&&(window.addEventListener("resize",m),window.addEventListener("scroll",g,!0),typeof ResizeObserver<"u"&&(p=new ResizeObserver(()=>{h()}),a.nextTick(()=>{e.value&&p&&typeof e.value.getBoundingClientRect=="function"&&p.observe(e.value),t.value&&p&&typeof t.value.getBoundingClientRect=="function"&&p.observe(t.value)}))),d?.enabled&&document.addEventListener("click",y,!0)},v=()=>{c&&(window.removeEventListener("resize",m),window.removeEventListener("scroll",g,!0)),d?.enabled&&document.removeEventListener("click",y,!0),p&&(p.disconnect(),p=null)};return a.onMounted(()=>{k()}),a.onUnmounted(()=>{v()}),{floatingStyle:u,updatePosition:h,cleanup:v}}const Lu={key:0,class:"input-leading-icon"},zu=["tabindex","aria-expanded","aria-controls","aria-disabled"],Pu={class:"input-select-value"},Vu={key:0,class:"input-select-text"},Fu={key:1,class:"input-select-placeholder"},Hu={key:1,class:"input-trailing-icon"},ju=["id","aria-multiselectable"],Uu={key:0,class:"input-dropdown-search"},qu={key:0,class:"input-dropdown-no-options"},Wu=["onClick","onMouseenter","aria-selected"],Ku={class:"input-dropdown-option-content"},Ju={class:"input-dropdown-option-text"},Gu={key:0,class:"input-dropdown-option-description"},Yu={key:0,class:"input-dropdown-option-check"},Qu=a.defineComponent({__name:"UiInput.Select",props:{options:{default:()=>[]},multiple:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},allowInsert:{type:Boolean,default:!1},maxDropdownHeight:{default:400},noOptionsText:{default:"No options available"},searchPlaceholder:{default:""},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(),o=a.ref(),s=a.ref(),l=a.computed(()=>`dropdown-${t.inputId||Math.random().toString(36).substr(2,9)}`),c=a.computed(()=>{if(i.value){const N=i.value.closest('[role="dialog"][aria-modal="true"]');if(N)return N}return"body"}),d=a.ref({isOpen:!1,searchQuery:"",highlightedIndex:-1}),{floatingStyle:u,updatePosition:f,cleanup:h}=Vr({trigger:i,floating:o,placement:"bottom-start",offset:10,shift:!0,flip:!0,sameWidth:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{S()}}}),p=a.computed(()=>t.multiple?Array.isArray(t.modelValue)?t.modelValue:[]:t.modelValue!==void 0?[t.modelValue]:[]),m=a.computed(()=>{if(t.multiple){const N=t.options.filter(D=>p.value.includes(D.value));return N.length>0?`${N.length} selected`:null}else return t.options.find(D=>D.value===t.modelValue)?.label||null}),g=a.computed(()=>{let N=t.options;if(t.searchable&&d.value.searchQuery){const D=d.value.searchQuery.toLowerCase();N=t.options.filter(R=>R.label.toLowerCase().includes(D)||R.description?.toLowerCase().includes(D)),t.allowInsert&&t.multiple&&d.value.searchQuery.trim()&&(t.options.some(ke=>ke.label.toLowerCase()===d.value.searchQuery.toLowerCase())||(N=[{value:`__insert__${d.value.searchQuery}`,label:`Add "${d.value.searchQuery}"`,description:"Add as new item",disabled:!1},...N]))}return N}),y=a.computed(()=>t.searchPlaceholder&&t.searchPlaceholder.trim()!==""?t.searchPlaceholder:t.allowInsert&&t.multiple?"Search or create...":"Search..."),k=a.computed(()=>t.disabled?-1:t.tabindex??0),v=a.computed(()=>{if(t.tabindex!==void 0)return t.tabindex+1}),b=a.computed(()=>{const N=[];return t.error&&N.push("input-error"),t.disabled&&N.push("input-disabled"),N.push(`input-size-${t.size}`),N}),x=a.computed(()=>{const N=[];return t.hasLeadingIcon?N.push("input-padding-left-icon"):N.push("input-padding-left"),t.hasTrailingIcon?N.push("input-padding-right-icon"):N.push("input-padding-right"),N}),w=async()=>{if(!t.disabled){if(d.value.isOpen=!0,d.value.searchQuery="",await a.nextTick(),f(),d.value.highlightedIndex===-1){const N=g.value.findIndex(D=>!D.disabled);d.value.highlightedIndex=N>=0?N:0}if(t.searchable&&s.value){const N=s.value.$el?.querySelector("input");N&&N.focus()}document.addEventListener("keydown",j),r("focus",new FocusEvent("focus"))}},S=()=>{d.value.isOpen&&(d.value.isOpen=!1,d.value.highlightedIndex=-1,d.value.searchQuery="",document.removeEventListener("keydown",j),r("blur",new FocusEvent("blur")))},M=()=>{d.value.isOpen?S():w()},C=N=>N.value&&typeof N.value=="string"&&N.value.startsWith("__insert__")?!1:p.value.includes(N.value),A=N=>{if(!N.disabled)if(t.multiple){const D=[...p.value];if(N.value&&typeof N.value=="string"&&N.value.startsWith("__insert__")){const R=N.value.replace("__insert__","");D.includes(R)||D.push(R),d.value.searchQuery=""}else{const R=D.indexOf(N.value);R>-1?D.splice(R,1):D.push(N.value)}r("update:modelValue",D)}else r("update:modelValue",N.value),S()},$=N=>{if(["Enter"," ","ArrowDown","ArrowUp","Escape"].includes(N.key)&&(N.preventDefault(),!(d.value.isOpen&&(N.key==="ArrowDown"||N.key==="ArrowUp"))))switch(N.key){case"Enter":case" ":M();break;case"ArrowDown":case"ArrowUp":w();break;case"Escape":S();break}},U=N=>{switch(N.key){case"ArrowDown":N.preventDefault(),K(1);break;case"ArrowUp":N.preventDefault(),K(-1);break;case"Enter":if(N.preventDefault(),d.value.highlightedIndex>=0){const D=g.value[d.value.highlightedIndex];D&&!D.disabled&&A(D)}break;case"Escape":S();break}},j=N=>{if(d.value.isOpen)switch(N.key){case"Escape":S();break;case"ArrowDown":N.preventDefault(),K(1);break;case"ArrowUp":N.preventDefault(),K(-1);break;case"Enter":if(N.preventDefault(),d.value.highlightedIndex>=0){const D=g.value[d.value.highlightedIndex];D&&!D.disabled&&A(D)}break}},K=N=>{const D=g.value;if(D.length===0)return;let R=d.value.highlightedIndex+N;R<0?R=D.length-1:R>=D.length&&(R=0);let ke=0;for(;D[R]?.disabled&&ke<D.length;)R+=N,R<0&&(R=D.length-1),R>=D.length&&(R=0),ke++;d.value.highlightedIndex=R};return a.onUnmounted(()=>{d.value.isOpen&&S(),document.removeEventListener("keydown",j),h()}),(N,D)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{class:a.normalizeClass(["input-field-wrapper",[b.value,x.value]])},[a.renderSlot(N.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Lu,[a.renderSlot(N.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",{ref_key:"selectTriggerRef",ref:i,class:a.normalizeClass(["input-select-trigger",{"input-select-open":d.value.isOpen}]),onClick:M,onKeydown:$,tabindex:k.value,role:"combobox","aria-expanded":d.value.isOpen,"aria-haspopup":!0,"aria-controls":l.value,"aria-disabled":n.disabled},[a.createElementVNode("div",Pu,[m.value?(a.openBlock(),a.createElementBlock("span",Vu,a.toDisplayString(m.value),1)):(a.openBlock(),a.createElementBlock("span",Fu,a.toDisplayString(n.placeholder||"Select an option..."),1))]),a.createElementVNode("div",{class:a.normalizeClass(["input-select-arrow",{"input-select-arrow-open":d.value.isOpen}])},[a.createVNode(a.unref(Pr))],2)],42,zu),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",Hu,[a.renderSlot(N.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(N.$slots,"trailing",{},void 0,!0)],2),(a.openBlock(),a.createBlock(a.Teleport,{to:c.value},[d.value.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:o,id:l.value,class:a.normalizeClass(["input-dropdown",{"input-dropdown--multiple":n.multiple}]),style:a.normalizeStyle(a.unref(u)),role:"listbox","aria-multiselectable":n.multiple,onMousedown:D[1]||(D[1]=a.withModifiers(()=>{},["prevent"]))},[n.searchable?(a.openBlock(),a.createElementBlock("div",Uu,[a.createVNode(ni,{ref_key:"searchInputRef",ref:s,modelValue:d.value.searchQuery,"onUpdate:modelValue":D[0]||(D[0]=R=>d.value.searchQuery=R),type:"search",placeholder:y.value,size:"sm",tabindex:v.value,onKeydown:U},{"leading-icon":a.withCtx(()=>[a.createVNode(a.unref(vu))]),_:1},8,["modelValue","placeholder","tabindex"])])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"input-dropdown-options",style:a.normalizeStyle({maxHeight:`${n.maxDropdownHeight}px`})},[g.value.length===0?(a.openBlock(),a.createElementBlock("div",qu,[a.renderSlot(N.$slots,"zero-state",{},()=>[a.createTextVNode(a.toDisplayString(n.noOptionsText),1)],!0)])):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(g.value,(R,ke)=>(a.openBlock(),a.createElementBlock("div",{key:R.value,class:a.normalizeClass(["input-dropdown-option",{"input-dropdown-option--selected":C(R),"input-dropdown-option--highlighted":ke===d.value.highlightedIndex,"input-dropdown-option--disabled":R.disabled,"input-dropdown-option--insert":R.value&&typeof R.value=="string"&&R.value.startsWith("__insert__")}]),onClick:ri=>A(R),onMouseenter:ri=>d.value.highlightedIndex=ke,role:"option","aria-selected":C(R)},[a.createElementVNode("div",Ku,[a.createElementVNode("div",Ju,a.toDisplayString(R.label),1),R.description?(a.openBlock(),a.createElementBlock("div",Gu,a.toDisplayString(R.description),1)):a.createCommentVNode("",!0)]),n.multiple&&C(R)?(a.openBlock(),a.createElementBlock("div",Yu,[a.createVNode(a.unref(iu))])):a.createCommentVNode("",!0)],42,Wu))),128))],4)],46,ju)):a.createCommentVNode("",!0)],8,["to"]))],64))}}),Xu=de(Qu,[["__scopeId","data-v-e9ac7d68"]]),Zu={class:"input-leading-icon"},_u=["src"],ef=["id","accept","multiple","disabled","required"],tf={class:"input-file-content"},nf={key:0,class:"input-file-selected"},rf={class:"input-file-list"},of={class:"input-file-item"},sf={class:"input-file-name"},lf={key:1,class:"input-file-prompt"},af={class:"input-file-prompt-text"},cf={key:0,class:"input-file-accept-text"},df={key:2,class:"input-file-selected"},uf={class:"input-file-selected-text"},ff={class:"input-file-list"},hf={class:"input-file-name"},pf={class:"input-file-size"},mf={key:0,class:"input-trailing-icon"},gf={key:1,class:"input-trailing-icon"},yf=a.defineComponent({__name:"UiInput.File",props:{accept:{},multiple:{type:Boolean,default:!1},maxFileSize:{default:10*1024*1024},dragDropText:{},selectedText:{},preview:{},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","file-error","clear-preview","blur","focus"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(),o=a.ref(!1),s=a.ref(null),l=a.ref([]),c=a.computed(()=>t.preview?t.preview:s.value);a.computed(()=>!!t.preview);const d=a.computed(()=>t.preview?t.preview:null),u=a.computed(()=>{const C=[];return t.error&&C.push("input-error"),t.disabled&&C.push("input-disabled"),C.push(`input-size-${t.size}`),C}),f=a.computed(()=>{const C=[];return C.push("input-padding-left-icon"),l.value.length>0||d.value||t.disabled?C.push("input-padding-right-icon"):C.push("input-padding-right"),C}),h=C=>{if(t.maxFileSize&&C.size>t.maxFileSize)return`File "${C.name}" is too large. Maximum size is ${y(t.maxFileSize)}.`;if(t.accept){const A=t.accept.split(",").map(K=>K.trim().toLowerCase()),$=C.type.toLowerCase(),U="."+C.name.split(".").pop()?.toLowerCase();if(!A.some(K=>{if(K.startsWith("."))return U===K;if(K.includes("*")){const N=K.split("/")[0];return $.startsWith(N)}return $===K}))return`File "${C.name}" is not an accepted file type.`}return null},p=C=>{for(const A of C){const $=h(A);if($){r("file-error",$);return}}t.multiple?l.value=[...l.value,...C]:l.value=C.slice(0,1),t.multiple?r("update:modelValue",l.value):r("update:modelValue",l.value[0]||null),!t.multiple&&l.value.length>0&&l.value[0].type.startsWith("image/")&&m(l.value[0])},m=C=>{s.value&&URL.revokeObjectURL(s.value);const A=new FileReader;A.onload=$=>{s.value=$.target?.result},A.readAsDataURL(C)},g=()=>{l.value=[],r("update:modelValue",t.multiple?[]:null),s.value&&(URL.revokeObjectURL(s.value),s.value=null),i.value&&(i.value.value=""),t.preview&&r("clear-preview")},y=C=>{if(C===0)return"0 Bytes";const A=1024,$=["Bytes","KB","MB","GB"],U=Math.floor(Math.log(C)/Math.log(A));return parseFloat((C/Math.pow(A,U)).toFixed(2))+" "+$[U]},k=()=>{!t.disabled&&i.value&&i.value.click()},v=C=>{const A=C.target,$=Array.from(A.files||[]);$.length>0&&p($)},b=C=>{t.disabled||(o.value=!0)},x=C=>{o.value=!1},w=C=>{if(t.disabled)return;o.value=!1;const A=Array.from(C.dataTransfer?.files||[]);A.length>0&&p(A)},S=C=>{r("blur",C)},M=C=>{r("focus",C)};return a.watch(()=>t.modelValue,C=>{C?Array.isArray(C)?l.value=C:(l.value=[C],C.type.startsWith("image/")&&m(C)):(l.value=[],s.value&&(URL.revokeObjectURL(s.value),s.value=null))},{immediate:!0}),a.onUnmounted(()=>{s.value&&URL.revokeObjectURL(s.value)}),(C,A)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper",[u.value,f.value]])},[a.renderSlot(C.$slots,"leading",{},void 0,!0),a.createElementVNode("div",Zu,[c.value?(a.openBlock(),a.createElementBlock("img",{key:0,src:c.value,alt:"Preview",class:"input-file-preview"},null,8,_u)):t.hasLeadingIcon?a.renderSlot(C.$slots,"leading-icon",{key:1},void 0,!0):(a.openBlock(),a.createBlock(a.unref(uu),{key:2}))]),a.createElementVNode("div",{class:a.normalizeClass(["input-file-area",{"input-file-dragover":o.value,"input-file-disabled":n.disabled}]),onClick:k,onDragover:a.withModifiers(b,["prevent"]),onDragleave:a.withModifiers(x,["prevent"]),onDrop:a.withModifiers(w,["prevent"])},[a.createElementVNode("input",{ref_key:"fileInputRef",ref:i,id:n.inputId,type:"file",accept:n.accept,multiple:n.multiple,disabled:n.disabled,required:n.required,class:"input-file-hidden",onChange:v,onBlur:S,onFocus:M},null,40,ef),a.createElementVNode("div",tf,[d.value&&l.value.length===0?(a.openBlock(),a.createElementBlock("div",nf,[A[0]||(A[0]=a.createElementVNode("div",{class:"input-file-selected-text"}," File loaded ",-1)),a.createElementVNode("div",rf,[a.createElementVNode("div",of,[a.createElementVNode("span",sf,a.toDisplayString(d.value),1)])])])):l.value.length===0?(a.openBlock(),a.createElementBlock("div",lf,[a.createElementVNode("div",af,a.toDisplayString(n.dragDropText||"Click to select or drag and drop"),1),n.accept?(a.openBlock(),a.createElementBlock("div",cf,a.toDisplayString(n.accept),1)):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",df,[a.createElementVNode("div",uf,a.toDisplayString(n.selectedText||`${l.value.length} file(s) selected`),1),a.createElementVNode("div",ff,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,($,U)=>(a.openBlock(),a.createElementBlock("div",{key:U,class:"input-file-item"},[a.createElementVNode("span",hf,a.toDisplayString($.name),1),a.createElementVNode("span",pf,"("+a.toDisplayString(y($.size))+")",1)]))),128))])]))])],34),(l.value.length>0||d.value)&&!n.disabled?(a.openBlock(),a.createElementBlock("div",mf,[a.createElementVNode("button",{type:"button",class:"input-file-clear",onClick:a.withModifiers(g,["stop"]),"aria-label":"Clear selected files"},[a.createVNode(a.unref(fo))])])):t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",gf,[a.renderSlot(C.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(C.$slots,"trailing",{},void 0,!0)],2))}}),kf=de(yf,[["__scopeId","data-v-3c7bee41"]]),bf={class:"tabs-wrapper"},vf={key:0,class:"tabs-before"},xf=["aria-selected","id","onClick"],wf={key:1,class:"tabs-after"},Cf=["aria-labelledby"],Sf=a.defineComponent({__name:"UiTabs",props:{modelValue:{},tabs:{},underlineWidth:{default:"5rem"},orientation:{default:"horizontal"},size:{default:"md"},variant:{default:"default"},tabWidth:{default:"fill"},sticky:{default:null}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,i=a.useSlots(),o=a.computed(()=>!!i.content),s=a.computed(()=>t.tabs.find(b=>b.value===t.modelValue)),l=a.ref([]),c=a.ref(!1),d=a.ref({width:"0px",height:"0px",left:"0px",top:"0px",opacity:"0"}),u=a.ref({width:"0px",height:"0px",left:"0px",top:"0px",opacity:"0"});let f=-1,h=!1;const p=(b,x)=>{const w=b.getBoundingClientRect(),S=x.getBoundingClientRect(),M=getComputedStyle(x),C=parseFloat(M.getPropertyValue("--underline-thickness")||"5");let A=5;t.size==="sm"?A=4:t.size==="lg"&&(A=6);const $=S.height;if(t.orientation==="vertical"){const U=w.top-S.top;return{height:w.height-A*4,top:U+A*2,width:C,left:A-C/2}}else{const U=w.left-S.left,j=w.width;if(t.underlineWidth==="full")return{width:j-30,left:U+15,height:C,top:$-A-C/2};let K;if(t.underlineWidth.endsWith("%")){const D=parseFloat(t.underlineWidth)/100;K=j*D}else if(t.underlineWidth.endsWith("px"))K=parseFloat(t.underlineWidth);else if(t.underlineWidth.endsWith("rem")){const D=parseFloat(t.underlineWidth),R=parseFloat(getComputedStyle(document.documentElement).fontSize);K=D*R}else K=parseFloat(t.underlineWidth)||j;const N=(j-K)/2;return{width:K,left:U+N,height:C,top:$-A-C/2}}},m=async(b,x)=>{h||(r("update:modelValue",b),await a.nextTick(),g(x))},g=async b=>{if(!l.value[b]||b===f)return;h=!0;const x=l.value[b],w=x.parentElement;if(!w)return;const S=p(x,w),M=x.getBoundingClientRect(),C=w.getBoundingClientRect();let A,$;if(t.orientation==="vertical"?(A=M.top-C.top,$=M.height):(A=M.left-C.left,$=M.width),f===-1){t.orientation==="vertical"?(d.value={height:`${S.height}px`,top:`${S.top}px`,width:`${S.width}px`,left:`${S.left}px`,opacity:"1"},u.value={height:`${$}px`,top:`${A}px`,width:`${M.width}px`,left:"0",opacity:"1"}):(d.value={width:`${S.width}px`,left:`${S.left}px`,height:`${S.height}px`,top:`${S.top}px`,opacity:"1"},u.value={width:`${$}px`,left:`${A}px`,height:"100%",top:"0",opacity:"1"}),f=b,h=!1;return}const U=l.value[f];if(p(U,w),U.getBoundingClientRect(),window.matchMedia("(prefers-reduced-motion: reduce)").matches){d.value={width:`${S.width||0}px`,left:`${S.left||0}px`,height:`${S.height||7}px`,top:`${S.top}px`,opacity:"1"},t.orientation==="vertical"?u.value={height:`${$}px`,top:`${A}px`,width:"100%",left:"0",opacity:"1"}:u.value={width:`${$}px`,left:`${A}px`,height:"100%",top:"0",opacity:"1"},f=b,h=!1;return}requestAnimationFrame(()=>{t.orientation==="vertical"?(d.value={height:`${S.height}px`,top:`${S.top}px`,width:`${S.width||7}px`,left:`${S.left}px`,opacity:"1"},u.value={height:`${$}px`,top:`${A}px`,width:"100%",left:"0",opacity:"1"}):(d.value={width:`${S.width}px`,left:`${S.left}px`,height:`${S.height||7}px`,top:`${S.top}px`,opacity:"1"},u.value={width:`${$}px`,left:`${A}px`,height:"100%",top:"0",opacity:"1"}),f=b,setTimeout(()=>{h=!1},200)})};let y=null;const k=()=>{const b=t.tabs.findIndex(x=>x.value===t.modelValue);if(b!==-1&&l.value&&l.value[b]){const x=c.value;c.value=!1;const w=l.value[b],S=w.parentElement;if(S){const M=p(w,S),C=w.getBoundingClientRect(),A=S.getBoundingClientRect();let $,U;t.orientation==="vertical"?($=C.top-A.top,U=C.height,d.value={height:`${M.height}px`,top:`${M.top}px`,width:`${M.width}px`,left:`${M.left}px`,opacity:"1"},u.value={height:`${U}px`,top:`${$}px`,width:`${C.width}px`,left:"0",opacity:"1"}):($=C.left-A.left,U=C.width,d.value={width:`${M.width}px`,left:`${M.left}px`,height:`${M.height}px`,top:`${M.top}px`,opacity:"1"},u.value={width:`${U}px`,left:`${$}px`,height:"100%",top:"0",opacity:"1"})}f=b,h=!1,setTimeout(()=>{c.value=x},10)}y&&clearTimeout(y),y=setTimeout(()=>{y=null},50)};a.onMounted(async()=>{await a.nextTick();const b=t.tabs.findIndex(x=>x.value===t.modelValue);b!==-1&&(g(b),setTimeout(()=>{c.value=!0},50)),window.addEventListener("resize",k)}),a.onUnmounted(()=>{window.removeEventListener("resize",k),y&&(clearTimeout(y),y=null)});const{modelValue:v}=a.toRefs(t);return a.watch(v,async()=>{await a.nextTick();const b=t.tabs.findIndex(x=>x.value===t.modelValue);b!==-1&&g(b)}),(b,x)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["tabs-container",[`tabs-container--${n.orientation}`,`tabs-container--${n.size}`,`tabs-container--${n.variant}`,{"tabs-container--with-content":o.value}]])},[a.createElementVNode("div",bf,[a.createElementVNode("div",{class:a.normalizeClass(["tabs-list",[`tabs-list--${n.orientation}`,`tabs-list--${n.size}`,`tabs-list--${n.variant}`]]),style:a.normalizeStyle(n.sticky?{position:"sticky",[n.sticky.side]:`${n.sticky.offset}px`,zIndex:10}:{})},[b.$slots.before?(a.openBlock(),a.createElementBlock("div",vf,[a.renderSlot(b.$slots,"before",{},void 0,!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(["tabs-buttons-wrapper",`tabs-buttons-wrapper--${n.tabWidth}`]),role:"tablist"},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.tabs,(w,S)=>(a.openBlock(),a.createElementBlock("button",{key:w.value,ref_for:!0,ref_key:"tabButtons",ref:l,class:a.normalizeClass(["tab-button",[`tab-button--${n.size}`,`tab-button--${n.variant}`,`tab-button--${n.tabWidth}`,{"tab-button-active":a.unref(v)===w.value}]]),"aria-selected":a.unref(v)===w.value,"aria-controls":"tabpanel",id:`tab-${w.value}`,role:"tab",onClick:M=>m(w.value,S)},a.toDisplayString(w.label),11,xf))),128)),a.createElementVNode("div",{class:a.normalizeClass(["tab-background",{"no-transition":!c.value}]),style:a.normalizeStyle(u.value)},null,6),a.createElementVNode("div",{class:a.normalizeClass(["tab-underline",{"no-transition":!c.value}]),style:a.normalizeStyle(d.value)},null,6)],2),b.$slots.after?(a.openBlock(),a.createElementBlock("div",wf,[a.renderSlot(b.$slots,"after",{},void 0,!0)])):a.createCommentVNode("",!0)],6)]),o.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["tabs-content",`tabs-content--${n.orientation}`]),role:"tabpanel","aria-labelledby":`tab-${a.unref(v)}`,id:"tabpanel"},[a.renderSlot(b.$slots,"content",{activeTab:s.value},void 0,!0)],10,Cf)):a.createCommentVNode("",!0)],2))}}),Fr=de(Sf,[["__scopeId","data-v-901716e3"]]),Mf={key:0,class:"ui-divider-text"},Tf=a.defineComponent({__name:"UiDivider",props:{orientation:{default:"horizontal"},variant:{default:"solid"},text:{},textPosition:{default:"center"},color:{default:"var(--accui-divider-color)"},thickness:{default:"1px"},margin:{default:"1rem"},spacing:{default:"auto"}},setup(n){const e=n,t=a.useSlots(),r=a.computed(()=>!!(e.text||t.default)),i=a.computed(()=>{const o={};return e.orientation==="horizontal"?(o.width=e.spacing==="auto"?"100%":typeof e.spacing=="number"?`${e.spacing}px`:e.spacing,o.marginTop=typeof e.margin=="number"?`${e.margin}px`:e.margin,o.marginBottom=typeof e.margin=="number"?`${e.margin}px`:e.margin,r.value||(o.height=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness),o["--divider-color"]=e.color==="#e5e7eb"?"var(--accui-divider-color)":e.color,o["--divider-thickness"]=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness):(o.height=e.spacing==="auto"?"100%":typeof e.spacing=="number"?`${e.spacing}px`:e.spacing,o.marginLeft=typeof e.margin=="number"?`${e.margin}px`:e.margin,o.marginRight=typeof e.margin=="number"?`${e.margin}px`:e.margin,r.value||(o.width=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness),o["--divider-color"]=e.color==="#e5e7eb"?"var(--accui-divider-color)":e.color,o["--divider-thickness"]=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness),o});return(o,s)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["ui-divider",`ui-divider--${n.orientation}`,`ui-divider--${n.variant}`,{"ui-divider--with-text":r.value,[`ui-divider--text-${n.textPosition}`]:r.value}]),style:a.normalizeStyle(i.value)},[r.value?(a.openBlock(),a.createElementBlock("span",Mf,[a.renderSlot(o.$slots,"default",{},()=>[a.createTextVNode(a.toDisplayString(n.text),1)],!0)])):a.createCommentVNode("",!0)],6))}}),tt=de(Tf,[["__scopeId","data-v-1c798024"]]),Ef={class:"datetime-picker-wrapper"},Nf={class:"datetime-picker-leading-icon"},Af={class:"datetime-picker-display"},Bf={key:0,class:"datetime-picker-value"},Of={key:1,class:"datetime-picker-placeholder"},Df={key:1,class:"datetime-picker-trailing-icon"},If={key:1,class:"datetime-picker-panel"},$f={class:"datetime-picker-header"},Rf={class:"datetime-picker-month-year"},Lf=["value"],zf=["value"],Pf={class:"datetime-picker-weekdays"},Vf={class:"datetime-picker-grid"},Ff={key:2,class:"datetime-picker-panel datetime-picker-time-panel"},Hf={class:"time-selector"},jf={class:"time-column"},Uf={class:"time-scroll"},qf={class:"time-column"},Wf={class:"time-scroll"},Kf={key:0,class:"time-column"},Jf={class:"time-scroll"},Gf={class:"datetime-picker-footer"},Yf=a.defineComponent({__name:"UiDateTimePicker",props:{modelValue:{},type:{default:"date"},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},min:{},max:{},error:{type:Boolean,default:!1},size:{default:"md"},format:{default:"iso"},is24Hour:{type:Boolean,default:!0},minuteStep:{default:1}},emits:["update:modelValue","change"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(),o=a.ref(),s=a.ref(!1),{floatingStyle:l,updatePosition:c,cleanup:d}=Vr({trigger:i,floating:o,placement:"bottom-start",offset:8,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{f()}}}),u=async()=>{t.disabled||t.readonly||(s.value=!0,await a.nextTick(),c())},f=()=>{s.value=!1},h=()=>{s.value?f():u()},p=a.ref(t.type==="time"?"time":"date"),m=a.ref(new Date().getMonth()),g=a.ref(new Date().getFullYear()),y=a.ref(new Date().getHours()),k=a.ref(new Date().getMinutes()),v=a.ref("AM"),b=["January","February","March","April","May","June","July","August","September","October","November","December"],x=["Su","Mo","Tu","We","Th","Fr","Sa"],w=a.computed(()=>t.min?t.min instanceof Date?t.min:new Date(t.min):null),S=a.computed(()=>t.max?t.max instanceof Date?t.max:new Date(t.max):null),M=a.computed(()=>{if(!t.modelValue)return null;if(t.modelValue instanceof Date)return t.modelValue;if(t.type==="time"&&typeof t.modelValue=="string"){const L=t.modelValue.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);if(L){const I=new Date;return I.setHours(parseInt(L[1]),parseInt(L[2]),parseInt(L[3]||"0"),0),I}}return new Date(t.modelValue)}),C=a.computed(()=>{if(!M.value||isNaN(M.value.getTime()))return"";const L=M.value;if(t.type==="time"){if(t.is24Hour)return`${String(L.getHours()).padStart(2,"0")}:${String(L.getMinutes()).padStart(2,"0")}`;{const pt=L.getHours()%12||12,se=L.getHours()>=12?"PM":"AM";return`${pt}:${String(L.getMinutes()).padStart(2,"0")} ${se}`}}const I=L.getDate(),O=L.getMonth()+1,q=L.getFullYear();let we="";switch(t.format){case"us":we=`${O}/${I}/${q}`;break;case"eu":we=`${I}/${O}/${q}`;break;default:we=`${q}-${String(O).padStart(2,"0")}-${String(I).padStart(2,"0")}`;break}if(t.type==="date")return we;let $t="";if(t.is24Hour)$t=`${String(L.getHours()).padStart(2,"0")}:${String(L.getMinutes()).padStart(2,"0")}`;else{const pt=L.getHours()%12||12,se=L.getHours()>=12?"PM":"AM";$t=`${pt}:${String(L.getMinutes()).padStart(2,"0")} ${se}`}return`${we} ${$t}`}),A=a.computed(()=>{const L=[];return t.error&&L.push("datetime-picker-error"),t.disabled&&L.push("datetime-picker-disabled"),t.readonly&&L.push("datetime-picker-readonly"),L.push(`datetime-picker-size-${t.size}`),L}),$=a.computed(()=>t.type==="date"||t.type==="datetime"&&p.value==="date"),U=a.computed(()=>t.type==="time"||t.type==="datetime"&&p.value==="time"),j=a.computed(()=>[{label:"Date",value:"date"},{label:"Time",value:"time"}]),K=a.computed(()=>{const L=[],I=t.is24Hour?23:12,O=t.is24Hour?0:1;for(let q=O;q<=I;q++)L.push(q);return L}),N=a.computed(()=>{const L=[];for(let I=0;I<60;I+=t.minuteStep)L.push(I);return L}),D=a.computed(()=>{const L=new Date().getFullYear(),I=w.value?.getFullYear()||L-100,O=S.value?.getFullYear()||L+100,q=[];for(let we=I;we<=O;we++)q.push(we);return q}),R=a.computed(()=>w.value?new Date(g.value,m.value,1)<=w.value:!1),ke=a.computed(()=>S.value?new Date(g.value,m.value+1,0)>=S.value:!1),ri=a.computed(()=>{const L=[],I=g.value,O=m.value,q=new Date(I,O,1),we=new Date(q);we.setDate(we.getDate()-q.getDay());const $t=new Date;$t.setHours(0,0,0,0);for(let pt=0;pt<42;pt++){const se=new Date(we);se.setDate(we.getDate()+pt);const ad=se.getMonth()!==O,cd=se.getTime()===$t.getTime(),dd=M.value&&se.getFullYear()===M.value.getFullYear()&&se.getMonth()===M.value.getMonth()&&se.getDate()===M.value.getDate(),ud=!!(w.value&&se<w.value||S.value&&se>S.value);L.push({key:`${se.getFullYear()}-${se.getMonth()}-${se.getDate()}`,date:se.getDate(),month:se.getMonth(),year:se.getFullYear(),otherMonth:ad,isToday:cd,isSelected:dd||!1,isDisabled:ud})}return L}),rd=()=>{switch(t.type){case"time":return"Select time";case"datetime":return"Select date and time";default:return"Select date"}},id=()=>{m.value===0?(m.value=11,g.value--):m.value--},od=()=>{m.value===11?(m.value=0,g.value++):m.value++},sd=L=>{if(L.isDisabled||L.otherMonth)return;const I=M.value||new Date,O=new Date(L.year,L.month,L.date,I.getHours(),I.getMinutes());r("update:modelValue",O),r("change",O),t.type==="datetime"?p.value="time":t.type==="date"&&f()},Dn=(L,I)=>{let O=M.value?new Date(M.value):new Date;if(!M.value){const q=new Date;O.setFullYear(q.getFullYear(),q.getMonth(),q.getDate())}if(L==="hour"){let q=I;t.is24Hour||(v.value==="PM"&&q!==12&&(q+=12),v.value==="AM"&&q===12&&(q=0)),y.value=I,O.setHours(q)}else if(L==="minute")k.value=I,O.setMinutes(I);else if(L==="period"){v.value=I;let q=y.value;I==="PM"&&q!==12&&(q+=12),I==="AM"&&q===12&&(q=0),O.setHours(q)}r("update:modelValue",O),r("change",O)},ld=()=>{const L=new Date;w.value&&L<w.value||S.value&&L>S.value||(r("update:modelValue",L),r("change",L),f())},_o=()=>{r("update:modelValue",null),r("change",null)};return a.watch(()=>t.modelValue,L=>{if(L){const I=L instanceof Date?L:new Date(L);if(!isNaN(I.getTime())){if(m.value=I.getMonth(),g.value=I.getFullYear(),t.is24Hour)y.value=I.getHours();else{const O=I.getHours();y.value=O%12||12,v.value=O>=12?"PM":"AM"}k.value=I.getMinutes()}}},{immediate:!0}),a.onUnmounted(()=>{d()}),(L,I)=>(a.openBlock(),a.createElementBlock("div",Ef,[a.createElementVNode("div",{ref_key:"triggerElement",ref:i,class:a.normalizeClass(["datetime-picker-trigger",[A.value,{"datetime-picker-open":s.value}]]),onClick:h},[a.createElementVNode("div",Nf,[n.type==="date"?(a.openBlock(),a.createBlock(a.unref(ru),{key:0})):n.type==="time"?(a.openBlock(),a.createBlock(a.unref(lu),{key:1})):(a.openBlock(),a.createBlock(a.unref(nu),{key:2}))]),a.createElementVNode("div",Af,[C.value?(a.openBlock(),a.createElementBlock("span",Bf,a.toDisplayString(C.value),1)):(a.openBlock(),a.createElementBlock("span",Of,a.toDisplayString(n.placeholder||rd()),1))]),n.modelValue&&!n.disabled&&!n.readonly?(a.openBlock(),a.createElementBlock("div",{key:0,class:"datetime-picker-trailing-icon",onClick:a.withModifiers(_o,["stop"])},[a.createVNode(a.unref(fo))])):(a.openBlock(),a.createElementBlock("div",Df,[a.createVNode(a.unref(Pr))]))],2),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[s.value?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"floatingElement",ref:o,class:"datetime-picker-dropdown",style:a.normalizeStyle(a.unref(l))},[n.type==="datetime"?(a.openBlock(),a.createBlock(Fr,{key:0,modelValue:p.value,"onUpdate:modelValue":I[0]||(I[0]=O=>p.value=O),tabs:j.value,variant:"default",size:"sm",style:{"margin-bottom":"1rem"}},null,8,["modelValue","tabs"])):a.createCommentVNode("",!0),$.value?(a.openBlock(),a.createElementBlock("div",If,[a.createElementVNode("div",$f,[a.createVNode(W,{onClick:id,disabled:R.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:a.withCtx(()=>[a.createVNode(a.unref(ou))]),_:1},8,["disabled"]),a.createElementVNode("div",Rf,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":I[1]||(I[1]=O=>m.value=O),class:"datetime-picker-select"},[(a.openBlock(),a.createElementBlock(a.Fragment,null,a.renderList(b,(O,q)=>a.createElementVNode("option",{key:q,value:q},a.toDisplayString(O),9,Lf)),64))],512),[[a.vModelSelect,m.value]]),a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":I[2]||(I[2]=O=>g.value=O),class:"datetime-picker-select"},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(D.value,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,zf))),128))],512),[[a.vModelSelect,g.value]])]),a.createVNode(W,{onClick:od,disabled:ke.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:a.withCtx(()=>[a.createVNode(a.unref(su))]),_:1},8,["disabled"])]),a.createElementVNode("div",Pf,[(a.openBlock(),a.createElementBlock(a.Fragment,null,a.renderList(x,O=>a.createElementVNode("div",{key:O,class:"datetime-picker-weekday"},a.toDisplayString(O),1)),64))]),a.createElementVNode("div",Vf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ri.value,O=>(a.openBlock(),a.createBlock(W,{key:O.key,color:O.isSelected||O.isToday?"primary":"secondary",variant:O.isSelected?"primary":O.isToday?"outline":"primary",disabled:O.isDisabled||O.otherMonth,class:a.normalizeClass(["datetime-picker-day",{"datetime-picker-day-other":O.otherMonth,"datetime-picker-day-disabled":O.isDisabled}]),icon:"",squircle:"",onClick:q=>sd(O)},{icon:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(O.date),1)]),_:2},1032,["color","variant","disabled","class","onClick"]))),128))])])):a.createCommentVNode("",!0),U.value?(a.openBlock(),a.createElementBlock("div",Ff,[a.createElementVNode("div",Hf,[a.createElementVNode("div",jf,[I[6]||(I[6]=a.createElementVNode("label",{class:"time-label"},"Hour",-1)),a.createElementVNode("div",Uf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(K.value,O=>(a.openBlock(),a.createBlock(W,{key:O,color:y.value===O?"primary":"secondary",variant:y.value===O?"primary":"ghost",size:"sm",squircle:"",onClick:q=>Dn("hour",O)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(String(O).padStart(2,"0")),1)]),_:2},1032,["color","variant","onClick"]))),128))])]),a.createElementVNode("div",qf,[I[7]||(I[7]=a.createElementVNode("label",{class:"time-label"},"Minute",-1)),a.createElementVNode("div",Wf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(N.value,O=>(a.openBlock(),a.createBlock(W,{key:O,color:k.value===O?"primary":"secondary",variant:k.value===O?"primary":"ghost",size:"sm",squircle:"",onClick:q=>Dn("minute",O)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(String(O).padStart(2,"0")),1)]),_:2},1032,["color","variant","onClick"]))),128))])]),n.is24Hour?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",Kf,[I[10]||(I[10]=a.createElementVNode("label",{class:"time-label"},"Period",-1)),a.createElementVNode("div",Jf,[a.createVNode(W,{color:v.value==="AM"?"primary":"secondary",variant:v.value==="AM"?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:I[3]||(I[3]=O=>Dn("period","AM"))},{default:a.withCtx(()=>[...I[8]||(I[8]=[a.createTextVNode(" AM ",-1)])]),_:1},8,["color","variant"]),a.createVNode(W,{color:v.value==="PM"?"primary":"secondary",variant:v.value==="PM"?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:I[4]||(I[4]=O=>Dn("period","PM"))},{default:a.withCtx(()=>[...I[9]||(I[9]=[a.createTextVNode(" PM ",-1)])]),_:1},8,["color","variant"])])]))])])):a.createCommentVNode("",!0),a.createVNode(tt),a.createElementVNode("div",Gf,[a.createVNode(W,{onClick:ld,color:"primary",variant:"primary",squircle:"",style:{flex:"1"}},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(n.type==="time"?"Now":"Today"),1)]),_:1}),a.createVNode(W,{onClick:I[5]||(I[5]=O=>{_o(),f()}),color:"danger",variant:"primary",squircle:"",style:{flex:"1"}},{default:a.withCtx(()=>[...I[11]||(I[11]=[a.createTextVNode(" Clear ",-1)])]),_:1}),a.createVNode(W,{onClick:f,color:"secondary",variant:"primary",squircle:"",style:{flex:"1"}},{default:a.withCtx(()=>[...I[12]||(I[12]=[a.createTextVNode(" Close ",-1)])]),_:1})])],4)):a.createCommentVNode("",!0)]))]))}}),ho=de(Yf,[["__scopeId","data-v-f688c330"]]),Qf=a.defineComponent({__name:"UiInput.Date",props:{min:{},max:{},format:{default:"iso"},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(n,{emit:e}){const t=e,r=o=>{t("update:modelValue",o)},i=o=>{t("change",o)};return(o,s)=>(a.openBlock(),a.createBlock(ho,{"model-value":n.modelValue,type:"date",placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:n.required,min:n.min,max:n.max,error:!!n.error,size:n.size,format:n.format,"onUpdate:modelValue":r,onChange:i},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","format"]))}}),Xf=a.defineComponent({__name:"UiInput.Time",props:{is24Hour:{type:Boolean,default:!0},minuteStep:{default:1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(n,{emit:e}){const t=e,r=o=>{t("update:modelValue",o)},i=o=>{t("change",o)};return(o,s)=>(a.openBlock(),a.createBlock(ho,{"model-value":n.modelValue,type:"time",placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:n.required,error:!!n.error,size:n.size,is24Hour:n.is24Hour,minuteStep:n.minuteStep,"onUpdate:modelValue":r,onChange:i},null,8,["model-value","placeholder","disabled","readonly","required","error","size","is24Hour","minuteStep"]))}}),Zf=a.defineComponent({__name:"UiInput.DateTime",props:{min:{},max:{},format:{default:"iso"},is24Hour:{type:Boolean,default:!0},minuteStep:{default:1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{default:"md"},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(n,{emit:e}){const t=e,r=o=>{t("update:modelValue",o)},i=o=>{t("change",o)};return(o,s)=>(a.openBlock(),a.createBlock(ho,{"model-value":n.modelValue,type:"datetime",placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:n.required,min:n.min,max:n.max,error:!!n.error,size:n.size,format:n.format,is24Hour:n.is24Hour,minuteStep:n.minuteStep,"onUpdate:modelValue":r,onChange:i},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","format","is24Hour","minuteStep"]))}});function ue(n){this.content=n}ue.prototype={constructor:ue,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new ue(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ue(t)},addToStart:function(n,e){return new ue([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ue(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new ue(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ue.from(n),n.size?new ue(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ue.from(n),n.size?new ue(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ue.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};ue.from=function(n){if(n instanceof ue)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ue(e)};function Nl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=Nl(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function Al(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),l=e.child(--o),c=s.nodeSize;if(s==l){t-=c,r-=c;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let d=Al(s.content,l.content,t-1,r-1);if(d)return d}t-=c,r-=c}}class T{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,i=0,o){for(let s=0,l=0;l<t;s++){let c=this.content[s],d=l+c.nodeSize;if(d>e&&r(c,i+l,o||null,s)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),r,i+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",s=!0;return this.nodesBetween(e,t,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,t-c):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=d},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new T(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let l=this.content[o],c=s+l.nodeSize;c>e&&((s<e||c>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),i+=l.nodeSize),s=c}return new T(r,i)}cutByIndex(e,t){return e==t?T.empty:e==0&&t==this.content.length?this:new T(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new T(i,o)}addToStart(e){return new T([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new T(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 i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Nl(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Al(this,e,t,r)}findIndex(e){if(e==0)return In(0,e);if(e==this.size)return In(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 i=this.child(t),o=r+i.nodeSize;if(o>=e)return o==e?In(t+1,o):In(t,r);r=o}}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 T.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new T(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return T.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new T(t||e,r)}static from(e){if(!e)return T.empty;if(e instanceof T)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new T([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}T.empty=new T([],0);const ii={index:0,offset:0};function In(n,e){return ii.index=n,ii.offset=e,ii}function Yn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Yn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Yn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Y=class $i{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Yn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return $i.none;if(e instanceof $i)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Y.none=[];class Qn extends Error{}class B{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=Ol(this.content,e+this.openStart,t);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,t){return new B(Bl(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 B.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new B(T.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new B(e,r,i)}}B.empty=new B(T.empty,0,0);function Bl(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(i==e||o.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Bl(o.content,e-i-1,t-i-1)))}function Ol(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Ol(s.content,e-o-1,t,s);return l&&n.replaceChild(i,s.copy(l))}function _f(n,e,t){if(t.openStart>n.depth)throw new Qn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Qn("Inconsistent open depths");return Dl(n,e,t,0)}function Dl(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=Dl(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return wt(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=eh(t,n);return wt(o,$l(n,s,l,e,r))}else return wt(o,Xn(n,e,r))}function Il(n,e){if(!e.type.compatibleContent(n.type))throw new Qn("Cannot join "+e.type.name+" onto "+n.type.name)}function Ri(n,e,t){let r=n.node(t);return Il(r,e.node(t)),r}function xt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function an(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(xt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)xt(i.child(l),r);e&&e.depth==t&&e.textOffset&&xt(e.nodeBefore,r)}function wt(n,e){return n.type.checkContent(e),n.copy(e)}function $l(n,e,t,r,i){let o=n.depth>i&&Ri(n,e,i+1),s=r.depth>i&&Ri(t,r,i+1),l=[];return an(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(Il(o,s),xt(wt(o,$l(n,e,t,r,i+1)),l)):(o&&xt(wt(o,Xn(n,e,i+1)),l),an(e,t,i,l),s&&xt(wt(s,Xn(t,r,i+1)),l)),an(r,null,i,l),new T(l)}function Xn(n,e,t){let r=[];if(an(null,n,t,r),n.depth>t){let i=Ri(n,e,t+1);xt(wt(i,Xn(n,e,t+1)),r)}return an(e,null,t,r),new T(r)}function eh(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(T.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class kn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Y.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){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)&&(!t||t(this.node(r))))return new Zn(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(o),d=o-c;if(r.push(s,l,i+c),!d||(s=s.child(l),s.isText))break;o=d-1,i+=c+1}return new kn(t,r,o)}static resolveCached(e,t){let r=ns.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else ns.set(e,r=new th);let i=r.elts[r.i]=kn.resolve(e,t);return r.i=(r.i+1)%nh,i}}class th{constructor(){this.elts=[],this.i=0}}const nh=12,ns=new WeakMap;class Zn{constructor(e,t,r){this.$from=e,this.$to=t,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 rh=Object.create(null);class Re{constructor(e,t,r,i=Y.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||T.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,t,r,i=0){this.content.nodesBetween(e,t,r,i,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,t,r,i){return this.content.textBetween(e,t,r,i)}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,t,r){return this.type==e&&Yn(this.attrs,t||e.defaultAttrs||rh)&&Y.sameSet(this.marks,r||Y.none)}copy(e=null){return e==this.content?this:new Re(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Re(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return B.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),l=i.start(s),d=i.node(s).content.cut(i.pos-l,o.pos-l);return new B(d,i.depth-s,o.depth-s)}replace(e,t,r){return _f(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return kn.resolveCached(this,e)}resolveNoCache(e){return kn.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}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()+")"),Rl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=T.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let c=i;c<o;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);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=Y.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Y.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=T.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}Re.prototype.text=void 0;class _n extends Re{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new _n(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new _n(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Tt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new ih(e,t);if(r.next==null)return Tt.empty;let i=Ll(r);r.next&&r.err("Unexpected trailing text");let o=uh(dh(i));return fh(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(s,l){let c=s.matchFragment(e,r);if(c&&(!t||c.validEnd))return T.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=o(f,l.concat(u));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:c}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||c.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[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 t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
5
+ `)}}Tt.empty=new Tt(!0);class ih{constructor(e,t){this.string=e,this.nodeTypes=t,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 Ll(n){let e=[];do e.push(oh(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function oh(n){let e=[];do e.push(sh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function sh(n){let e=ch(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=lh(n,e);else break;return e}function rs(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function lh(n,e){let t=rs(n),r=t;return n.eat(",")&&(n.next!="}"?r=rs(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function ah(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function ch(n){if(n.eat("(")){let e=Ll(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=ah(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function dh(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,c){let d={term:c,to:l};return e[s].push(d),d}function i(s,l){s.forEach(c=>c.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(o(d,l)),[]);if(s.type=="seq")for(let c=0;;c++){let d=o(s.exprs[c],l);if(c==s.exprs.length-1)return d;i(d,l=t())}else if(s.type=="star"){let c=t();return r(l,c),i(o(s.expr,c),c),[r(c)]}else if(s.type=="plus"){let c=t();return i(o(s.expr,l),c),i(o(s.expr,c),c),[r(c)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let c=l;for(let d=0;d<s.min;d++){let u=t();i(o(s.expr,c),u),c=u}if(s.max==-1)i(o(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=t();r(c,u),i(o(s.expr,c),u),c=u}return[r(c)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function zl(n,e){return e-n}function is(n,e){let t=[];return r(e),t.sort(zl);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:l,to:c}=o[s];!l&&t.indexOf(c)==-1&&r(c)}}}function uh(n){let e=Object.create(null);return t(is(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<i.length;u++)i[u][0]==l&&(d=i[u][1]);is(n,c).forEach(u=>{d||i.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let o=e[r.join(",")]=new Tt(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(zl);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function fh(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:c,next:d}=i.next[l];s.push(c.name),o&&!(c.isText||c.hasRequiredAttrs())&&(o=!1),r.indexOf(d)==-1&&r.push(d)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pl(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Vl(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Fl(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Hl(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ph(n,r,e[r]);return t}let ss=class jl{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Hl(e,r.attrs),this.defaultAttrs=Pl(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==Tt.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:Vl(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Re(this,this.computeAttrs(e),T.from(t),Y.setFrom(r))}createChecked(e=null,t,r){return t=T.from(t),this.checkContent(t),new Re(this,this.computeAttrs(e),t,Y.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=T.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(T.empty,!0);return o?new Re(this,e,t.append(o),Y.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){Fl(this.attrs,e,"node")}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Y.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new jl(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function hh(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class ph{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?hh(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Hr{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Hl(e,i.attrs),this.excluded=null;let o=Pl(this.attrs);this.instance=o?new Y(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Y(this,Vl(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Hr(o,i++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Fl(this.attrs,e,"mark")}excludes(e){return this.excluded.indexOf(e)>-1}}class Ul{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=ue.from(e.nodes),t.marks=ue.from(e.marks||{}),this.nodes=ss.compile(this.spec.nodes,this),this.marks=Hr.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Tt.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?ls(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:ls(this,s.split(" "))}this.nodeFromJSON=i=>Re.fromJSON(this,i),this.markFromJSON=i=>Y.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ss){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(t,r,i)}text(e,t){let r=this.nodes.text;return new _n(r,r.defaultAttrs,e,Y.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ls(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let l in n.marks){let c=n.marks[l];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function mh(n){return n.tag!=null}function gh(n){return n.style!=null}class lt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(mh(i))this.tags.push(i);else if(gh(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new cs(this,t,!1);return r.addAll(e,Y.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new cs(this,t,!0);return r.addAll(e,Y.none,t.from,t.to),B.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(bh(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],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)!=t))){if(s.getAttrs){let c=s.getAttrs(t);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=ds(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=ds(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new lt(e,lt.schemaRules(e)))}}const ql={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},yh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Wl={ol:!0,ul:!0},bn=1,Li=2,cn=4;function as(n,e,t){return e!=null?(e?bn:0)|(e==="full"?Li:0):n&&n.whitespace=="pre"?bn|Li:t&~cn}class $n{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=Y.none,this.match=o||(s&cn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(T.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&bn)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=T.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(T.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ql.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class cs{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,s=as(null,t.preserveWhitespace,0)|(r?cn:0);i?o=new $n(i.type,i.attrs,Y.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new $n(null,null,Y.none,!0,null,s):o=new $n(e.schema.topNodeType,null,Y.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,o=i.options&Li?"full":this.localPreserveWS||(i.options&bn)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
6
+ `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[c]&&this.insertNode(s.text(l[c]),t,!/\S/.test(l[c]));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=i.content[i.content.length-1],c=e.previousSibling;(!l||c&&c.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Wl.hasOwnProperty(s)&&this.parser.normalizeLists&&kh(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(c?c.ignore:yh.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(ql.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),d=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=c&&c.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(o),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,c,d,c.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
7
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let l=void 0;;){let c=this.parser.matchStyle(o,s,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(d=>!c.clearMark(d)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(s,t.attrs||null,r,t.preserveWhitespace);c&&(o=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}o&&this.sync(l)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t,r){let i,o;for(let s=this.open,l=0;s>=0;s--){let c=this.nodes[s],d=c.findWrapping(e);if(d&&(!i||i.length>d.length+l)&&(i=d,o=c,!d.length))break;if(c.solid){if(r)break;l+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)t=this.enterInner(i[s],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=Y.none;for(let l of i.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):us(l.type,e.type))&&(s=l.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=as(e,o,s.options);s.options&cn&&s.content.length==0&&(l|=cn);let c=Y.none;return r=r.filter(d=>(s.type?s.type.allowsMarkType(d.type):us(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new $n(e,t,c,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=bn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,c)=>{for(;l>=0;l--){let d=t[l];if(d==""){if(l==t.length-1||l==0)continue;for(;c>=o;c--)if(s(l-1,c))return!0;return!1}else{let u=c>0||c==0&&i?this.nodes[c].type:r&&c>=o?r.node(c-o).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function kh(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Wl.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function bh(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ds(n){let e={};for(let t in n)e[t]=n[t];return e}function us(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=l=>{o.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class Ot{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=oi(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,c=0;for(;l<o.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(o[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<o.length;)i=o.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,t);u&&(o.push([d,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=qn(oi(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&qn(oi(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return qn(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ot(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=fs(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return fs(e.marks)}}function fs(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function oi(n){return n.document||window.document}const hs=new WeakMap;function vh(n){let e=hs.get(n);return e===void 0&&hs.set(n,e=xh(n)),e}function xh(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function qn(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=vh(r))&&o.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=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let l,c=t?n.createElementNS(t,i):n.createElement(i),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let h=f.indexOf(" ");h>0?c.setAttributeNS(f.slice(0,h),f.slice(h+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:p,contentDOM:m}=qn(n,h,t,r);if(c.appendChild(p),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const Kl=65535,Jl=Math.pow(2,16);function wh(n,e){return n+e*Jl}function ps(n){return n&Kl}function Ch(n){return(n-(n&Kl))/Jl}const Gl=1,Yl=2,Wn=4,Ql=8;class zi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ql)>0}get deletedBefore(){return(this.delInfo&(Gl|Wn))>0}get deletedAfter(){return(this.delInfo&(Yl|Wn))>0}get deletedAcross(){return(this.delInfo&Wn)>0}}class Me{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Me.empty)return Me.empty}recover(e){let t=0,r=ps(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+Ch(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 i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?i:0);if(c>e)break;let d=this.ranges[l+o],u=this.ranges[l+s],f=c+d;if(e<=f){let h=d?e==c?-1:e==f?1:t:t,p=c+i+(h<0?0:u);if(r)return p;let m=e==(t<0?c:f)?null:wh(l/3,e-c),g=e==c?Yl:e==f?Gl:Wn;return(t<0?e!=c:e!=f)&&(g|=Ql),new zi(p,g,m)}i+=u-d}return r?e+i:new zi(e+i,0,null)}touches(e,t){let r=0,i=ps(t),o=this.inverted?2:1,s=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+o],u=c+d;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+s]-d}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),c=s+(this.inverted?0:o),d=this.ranges[i+t],u=this.ranges[i+r];e(l,l+d,c,c+u),o+=u-d}}invert(){return new Me(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Me.empty:new Me(e<0?[0,-e,0]:[0,0,e])}}Me.empty=new Me([]);class vn{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new vn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new vn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],l=s.mapResult(e,t);if(l.recover!=null){let c=this.getMirror(o);if(c!=null&&c>o&&c<this.to){o=c,e=this._maps[c].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new zi(e,i,null)}}const si=Object.create(null);class ye{getMap(){return Me.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=si[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 si)throw new RangeError("Duplicate use of step JSON ID "+e);return si[e]=t,t.prototype.jsonID=e,t}}class ne{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ne(e,null)}static fail(e){return new ne(null,e)}static fromReplace(e,t,r,i){try{return ne.ok(e.replace(t,r,i))}catch(o){if(o instanceof Qn)return ne.fail(o.message);throw o}}}function po(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(po(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return T.fromArray(r)}class it extends ye{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),i=r.node(r.sharedDepth(this.to)),o=new B(po(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return ne.fromReplace(e,this.from,this.to,o)}invert(){return new $e(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 it(t.pos,r.pos,this.mark)}merge(e){return e instanceof it&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new it(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 it(t.from,t.to,e.markFromJSON(t.mark))}}ye.jsonID("addMark",it);class $e extends ye{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 B(po(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ne.fromReplace(e,this.from,this.to,r)}invert(){return new it(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 $e(t.pos,r.pos,this.mark)}merge(e){return e instanceof $e&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $e(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 $e(t.from,t.to,e.markFromJSON(t.mark))}}ye.jsonID("removeMark",$e);class ot extends ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ne.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ne.fromReplace(e,this.pos,this.pos+1,new B(T.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 i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new ot(this.pos,t.marks[i]);return new ot(this.pos,this.mark)}}return new Et(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ot(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 ot(t.pos,e.markFromJSON(t.mark))}}ye.jsonID("addNodeMark",ot);class Et extends ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ne.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ne.fromReplace(e,this.pos,this.pos+1,new B(T.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ot(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Et(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 Et(t.pos,e.markFromJSON(t.mark))}}ye.jsonID("removeNodeMark",Et);class le extends ye{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Pi(e,this.from,this.to)?ne.fail("Structure replace would overwrite content"):ne.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Me([this.from,this.to-this.from,this.slice.size])}invert(e){return new le(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 le(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof le)||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?B.empty:new B(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new le(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?B.empty:new B(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new le(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 le(t.from,t.to,B.fromJSON(e,t.slice),!!t.structure)}}ye.jsonID("replace",le);class ce extends ye{constructor(e,t,r,i,o,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Pi(e,this.from,this.gapFrom)||Pi(e,this.gapTo,this.to)))return ne.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ne.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ne.fromReplace(e,this.from,this.to,r):ne.fail("Content does not fit in gap")}getMap(){return new Me([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 ce(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),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new ce(t.pos,r.pos,i,o,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 ce(t.from,t.to,t.gapFrom,t.gapTo,B.fromJSON(e,t.slice),t.insert,!!t.structure)}}ye.jsonID("replaceAround",ce);function Pi(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Sh(n,e,t,r){let i=[],o=[],s,l;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(d,e),p=Math.min(d+c.nodeSize,t),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==h&&s.mark.eq(f[g])?s.to=p:i.push(s=new $e(h,p,f[g])));l&&l.to==h?l.to=p:o.push(l=new it(h,p,r))}}),i.forEach(c=>n.step(c)),o.forEach(c=>n.step(c))}function Mh(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;o++;let c=null;if(r instanceof Hr){let d=s.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(s.marks)&&(c=[r]):c=s.marks;if(c&&c.length){let d=Math.min(l+s.nodeSize,t);for(let u=0;u<c.length;u++){let f=c[u],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==o-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=d,h.step=o):i.push({style:f,from:Math.max(l,e),to:d,step:o})}}}),i.forEach(s=>n.step(new $e(s.from,s.to,s.style)))}function mo(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c<o.childCount;c++){let d=o.child(c),u=l+d.nodeSize,f=r.matchType(d.type);if(!f)s.push(new le(l,u,B.empty));else{r=f;for(let h=0;h<d.marks.length;h++)t.allowsMarkType(d.marks[h].type)||n.step(new $e(l,u,d.marks[h]));if(i&&d.isText&&t.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(d.text);)m||(m=new B(T.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),s.push(new le(l+h.index,l+h.index+h[0].length,m))}}l=u}if(!r.validEnd){let c=r.fillBefore(T.empty,!0);n.replace(l,l,new B(c,0,0))}for(let c=s.length-1;c>=0;c--)n.step(s[c])}function Th(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function _t(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,o=0;;--r){let s=n.$from.node(r),l=n.$from.index(r)+i,c=n.$to.indexAfter(r)-o;if(r<n.depth&&s.canReplace(l,c,t))return r;if(r==0||s.type.spec.isolating||!Th(s,l,c))break;l&&(i=1),c<s.childCount&&(o=1)}return null}function Eh(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),c=s,d=l,u=T.empty,f=0;for(let m=o,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=T.from(r.node(m).copy(u)),f++):c--;let h=T.empty,p=0;for(let m=o,g=!1;m>t;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=T.from(i.node(m).copy(h)),p++):d++;n.step(new ce(c,d,s,l,new B(u.append(h),f,p),u.size-f,!0))}function go(n,e,t=null,r=n){let i=Nh(n,e),o=i&&Ah(r,e);return o?i.map(ms).concat({type:e,attrs:t}).concat(o.map(ms)):null}function ms(n){return{type:n,attrs:null}}function Nh(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function Ah(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=r;c&&d<i;d++)c=c.matchType(t.child(d).type);return!c||!c.validEnd?null:s}function Bh(n,e,t){let r=T.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[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=T.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new ce(i,o,i,o,new B(r,0,0),t.length,!0))}function Oh(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let c=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,c)&&Dh(n.doc,n.mapping.slice(o).map(l),r)){let d=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?d=!1:!p&&m&&(d=!0)}d===!1&&Zl(n,s,l,o),mo(n,n.mapping.slice(o).map(l,1),r,void 0,d===null);let u=n.mapping.slice(o),f=u.map(l,1),h=u.map(l+s.nodeSize,1);return n.step(new ce(f,h,f+1,h-1,new B(T.from(r.create(c,null,s.marks)),0,0),1,!0)),d===!0&&Xl(n,s,l,o),!1}})}function Xl(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let c=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Zl(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
8
+ `))}})}function Dh(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Ih(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ce(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new B(T.from(s),0,0),1,!0))}function jt(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,u=t-2;d>o;d--,u--){let f=i.node(d),h=i.index(d);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let l=i.indexAfter(o),c=r&&r[0];return i.node(o).canReplaceWith(l,l,c?c.type:i.node(o+1).type)}function $h(n,e,t=1,r){let i=n.doc.resolve(e),o=T.empty,s=T.empty;for(let l=i.depth,c=i.depth-t,d=t-1;l>c;l--,d--){o=T.from(i.node(l).copy(o));let u=r&&r[d];s=T.from(u?u.type.create(u.attrs,s):i.node(l).copy(s))}n.step(new le(e,e,new B(o.append(s),t,t),!0))}function ht(n,e){let t=n.resolve(e),r=t.index();return _l(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Rh(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function _l(n,e){return!!(n&&e&&!n.isLeaf&&Rh(n,e))}function jr(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&_l(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Lh(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(i);u&&!f?r=!1:!u&&f&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Zl(n,u.node(),u.before(),l)}s.inlineContent&&mo(n,e+t-1,s,o.node().contentMatchAt(o.index()),r==null);let c=n.mapping.slice(l),d=c.map(e-t);if(n.step(new le(d,c.map(e+t,-1),B.empty,!0)),r===!0){let u=n.doc.resolve(d);Xl(n,u.node(),u.before(),n.steps.length)}return n}function zh(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function ea(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)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,c=r.index(s)+(l>0?1:0),d=r.node(s),u=!1;if(o==1)u=d.canReplace(c,c,i);else{let f=d.contentMatchAt(c).findWrapping(i.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Ur(n,e,t=e,r=B.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return ta(i,o,r)?new le(e,t,r):new Ph(i,o,r).fit()}function ta(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Ph{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=T.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=T.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let c=new B(o,s,l);return e>-1?new ce(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new le(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=li(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(t==1&&(s?d.matchType(s.type)||(f=d.fillBefore(T.from(s),!1)):o&&c.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:f};if(t==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:u};if(o&&d.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=li(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new B(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=li(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new B(rn(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new B(rn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,l=r?r.content:s.content,c=s.openStart-e,d=0,u=[],{match:f,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));f=f.matchFragment(i)}let p=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(f=y,u.push(na(g.mark(h.allowedMarks(g.marks)),d==1?c:0,d==l.childCount?p:-1)))}let m=d==l.childCount;m||(p=-1),this.placed=on(this.placed,t,T.from(u)),this.frontier[t].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<p;g++){let k=y.lastChild;this.frontier.push({type:k.type,match:k.contentMatchAt(k.childCount)}),y=k.content}this.unplaced=m?e==0?B.empty:new B(rn(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new B(rn(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ai(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=ai(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=ai(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=on(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=on(this.placed,this.depth,T.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(T.empty,!0);t.childCount&&(this.placed=on(this.placed,this.frontier.length,t))}}function rn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(rn(n.firstChild.content,e-1,t)))}function on(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(on(n.lastChild.content,e-1,t)))}function li(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function na(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,na(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(T.empty,!0)))),n.copy(r)}function ai(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!Vh(t,o.content,s)?l:null}function Vh(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Fh(n){return n.spec.defining||n.spec.definingForContent}function Hh(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(ta(i,o,r))return n.step(new le(e,t,r));let s=ia(i,o);s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(h)>-1?l=h:i.before(h)==p&&s.splice(1,0,-h)}let c=s.indexOf(l),d=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(d.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=d[h],m=Fh(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(l)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=d[p];if(m)for(let g=0;g<s.length;g++){let y=s[(g+c)%s.length],k=!0;y<0&&(k=!1,y=-y);let v=i.node(y-1),b=i.index(y-1);if(v.canReplaceWith(b,b,m.type,m.marks))return n.replace(i.before(y),k?o.after(y):t,new B(ra(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=s.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=s[h];p<0||(e=i.before(p),t=o.after(p))}}function ra(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(ra(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(T.empty,!0))}return n}function jh(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=zh(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new B(T.from(r),0,0))}function Uh(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=ia(r,i);for(let s=0;s<o.length;s++){let l=o[s],c=s==o.length-1;if(c&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(c||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function ia(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Ut extends ye{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 ne.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ne.fromReplace(e,this.pos,this.pos+1,new B(T.from(i),0,t.isLeaf?0:1))}getMap(){return Me.empty}invert(e){return new Ut(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 Ut(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 Ut(t.pos,t.attr,t.value)}}ye.jsonID("attr",Ut);class xn extends ye{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ne.ok(r)}getMap(){return Me.empty}invert(e){return new xn(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 xn(t.attr,t.value)}}ye.jsonID("docAttr",xn);let Kt=class extends Error{};Kt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Kt.prototype=Object.create(Error.prototype);Kt.prototype.constructor=Kt;Kt.prototype.name="TransformError";class oa{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new vn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Kt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=B.empty){let i=Ur(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new B(T.from(r),0,0))}delete(e,t){return this.replace(e,t,B.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Hh(this,e,t,r),this}replaceRangeWith(e,t,r){return jh(this,e,t,r),this}deleteRange(e,t){return Uh(this,e,t),this}lift(e,t){return Eh(this,e,t),this}join(e,t=1){return Lh(this,e,t),this}wrap(e,t){return Bh(this,e,t),this}setBlockType(e,t=e,r,i=null){return Oh(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Ih(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Ut(e,t,r)),this}setDocAttribute(e,t){return this.step(new xn(e,t)),this}addNodeMark(e,t){return this.step(new ot(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Y)t.isInSet(r.marks)&&this.step(new Et(e,t));else{let i=r.marks,o,s=[];for(;o=t.isInSet(i);)s.push(new Et(e,o)),i=o.removeFromSet(i);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,r){return $h(this,e,t,r),this}addMark(e,t,r){return Sh(this,e,t,r),this}removeMark(e,t,r){return Mh(this,e,t,r),this}clearIncompatible(e,t,r){return mo(this,e,t,r),this}}const ci=Object.create(null);class H{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new qh(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=B.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:c,$to:d}=s[l],u=e.mapping.slice(o);e.replaceRange(u.map(c.pos),u.map(d.pos),l?B.empty:t),l==0&&ks(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],c=e.mapping.slice(r),d=c.map(s.pos),u=c.map(l.pos);o?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),ks(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new V(e):zt(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?zt(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):zt(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Oe(e.node(0))}static atStart(e){return zt(e,e,0,0,1)||new Oe(e)}static atEnd(e){return zt(e,e,e.content.size,e.childCount,-1)||new Oe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ci[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 ci)throw new RangeError("Duplicate use of selection JSON ID "+e);return ci[e]=t,t.prototype.jsonID=e,t}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}}H.prototype.visible=!0;class qh{constructor(e,t){this.$from=e,this.$to=t}}let gs=!1;function ys(n){!gs&&!n.parent.inlineContent&&(gs=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class V extends H{constructor(e,t=e){ys(e),ys(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 H.near(r);let i=e.resolve(t.map(this.anchor));return new V(i.parent.inlineContent?i:r,r)}replace(e,t=B.empty){if(super.replace(e,t),t==B.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 qr(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 V(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=H.findFrom(t,r,!0)||H.findFrom(t,-r,!0);if(o)t=o.$head;else return H.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(H.findFrom(e,-r,!0)||H.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new V(e,t)}}H.jsonID("text",V);class qr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new qr(e.map(this.anchor),e.map(this.head))}resolve(e){return V.between(e.resolve(this.anchor),e.resolve(this.head))}}class P extends H{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:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?H.near(o):new P(o)}content(){return new B(T.from(this.node),0,0)}eq(e){return e instanceof P&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new yo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new P(e.resolve(t.anchor))}static create(e,t){return new P(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}P.prototype.visible=!1;H.jsonID("node",P);class yo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new qr(r,r):new yo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&P.isSelectable(r)?new P(t):H.near(t)}}class Oe extends H{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=B.empty){if(t==B.empty){e.delete(0,e.doc.content.size);let r=H.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Oe(e)}map(e){return new Oe(e)}eq(e){return e instanceof Oe}getBookmark(){return Wh}}H.jsonID("all",Oe);const Wh={map(){return this},resolve(n){return new Oe(n)}};function zt(n,e,t,r,i,o=!1){if(e.inlineContent)return V.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&P.isSelectable(l))return P.create(n,t-(i<0?l.nodeSize:0))}else{let c=zt(n,l,t+i,i<0?l.childCount:0,i,o);if(c)return c}t+=l.nodeSize*i}return null}function ks(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof le||i instanceof ce))return;let o=n.mapping.maps[r],s;o.forEach((l,c,d,u)=>{s==null&&(s=u)}),n.setSelection(H.near(n.doc.resolve(s),t))}const bs=1,Rn=2,vs=4;class Kh extends oa{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|bs)&~Rn,this.storedMarks=null,this}get selectionSet(){return(this.updated&bs)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Rn,this}ensureMarks(e){return Y.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&Rn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Rn,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Y.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(H.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,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|=vs,this}get scrolledIntoView(){return(this.updated&vs)>0}}function xs(n,e){return!e||!n?n:n.bind(e)}class sn{constructor(e,t,r){this.name=e,this.init=xs(t.init,r),this.apply=xs(t.apply,r)}}const Jh=[new sn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new sn("selection",{init(n,e){return n.selection||H.atStart(e.doc)},apply(n){return n.selection}}),new sn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new sn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class di{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Jh.slice(),t&&t.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 sn(r.key,r.spec.state,r))})}}class Ht{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,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let c=i?i[s].n:0,d=i?i[s].state:this,u=c<t.length&&l.spec.appendTransaction.call(l,c?t.slice(c):t,d,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Ht(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new Kh(this)}static create(e){let t=new di(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ht(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new di(this.schema,e.plugins),r=t.fields,i=new Ht(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.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 i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new di(e.schema,e.plugins),o=new Ht(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Re.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=H.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let c=r[l],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){o[s.name]=d.fromJSON.call(c,e,t[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function sa(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=sa(i,e,{})),t[r]=i}return t}class Z{constructor(e){this.spec=e,this.props={},e.props&&sa(e.props,this,this.props),this.key=e.key?e.key.key:la("plugin")}getState(e){return e[this.key]}}const ui=Object.create(null);function la(n){return n in ui?n+"$"+ ++ui[n]:(ui[n]=0,n+"$")}class oe{constructor(e="key"){this.key=la(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Gh=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function aa(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Yh=(n,e,t)=>{let r=aa(n,t);if(!r)return!1;let i=ko(r);if(!i){let s=r.blockRange(),l=s&&_t(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(fa(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Jt(o,"end")||P.isSelectable(o)))for(let s=r.depth;;s--){let l=Ur(n.doc,r.before(s),r.after(s),B.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=n.tr.step(l);c.setSelection(Jt(o,"end")?H.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):P.create(c.doc,i.pos-o.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},Qh=(n,e,t)=>{let r=aa(n,t);if(!r)return!1;let i=ko(r);return i?ca(n,i,e):!1},Xh=(n,e,t)=>{let r=da(n,t);if(!r)return!1;let i=bo(r);return i?ca(n,i,e):!1};function ca(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Ur(n.doc,o,c,B.empty);if(!d||d.from!=o||d instanceof le&&d.slice.size>=c-o)return!1;if(t){let u=n.tr.step(d);u.setSelection(V.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Jt(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Zh=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=ko(r)}let s=o&&o.nodeBefore;return!s||!P.isSelectable(s)?!1:(e&&e(n.tr.setSelection(P.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function ko(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function da(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const _h=(n,e,t)=>{let r=da(n,t);if(!r)return!1;let i=bo(r);if(!i)return!1;let o=i.nodeAfter;if(fa(n,i,e,1))return!0;if(r.parent.content.size==0&&(Jt(o,"start")||P.isSelectable(o))){let s=Ur(n.doc,r.before(),r.after(),B.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Jt(o,"start")?H.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):P.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},ep=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=bo(r)}let s=o&&o.nodeAfter;return!s||!P.isSelectable(s)?!1:(e&&e(n.tr.setSelection(P.create(n.doc,o.pos)).scrollIntoView()),!0)};function bo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const tp=(n,e)=>{let t=n.selection,r=t instanceof P,i;if(r){if(t.node.isTextblock||!ht(n.doc,t.from))return!1;i=t.from}else if(i=jr(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(P.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},np=(n,e)=>{let t=n.selection,r;if(t instanceof P){if(t.node.isTextblock||!ht(n.doc,t.to))return!1;r=t.to}else if(r=jr(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},rp=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&_t(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},ip=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
9
+ `).scrollIntoView()),!0)};function ua(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const op=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=ua(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=t.after(),c=n.tr.replaceWith(l,l,s.createAndFill());c.setSelection(H.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},sp=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Oe||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=ua(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(s,o.createAndFill());l.setSelection(V.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},lp=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(jt(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&_t(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},ap=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(P.create(n.doc,i))),!0)};function cp(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||ht(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function fa(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,c=i.type.spec.isolating||o.type.spec.isolating;if(!c&&cp(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(t){let p=e.pos+o.nodeSize,m=T.empty;for(let k=s.length-1;k>=0;k--)m=T.from(s[k].create(null,m));m=T.from(i.copy(m));let g=n.tr.step(new ce(e.pos-1,p,e.pos,p,new B(m,1,0),s.length,!0)),y=g.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==i.type&&ht(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&c?null:H.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),h=f&&_t(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(d&&Jt(o,"start",!0)&&Jt(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=o,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(t){let k=T.empty;for(let b=m.length-1;b>=0;b--)k=T.from(m[b].copy(k));let v=n.tr.step(new ce(e.pos-m.length,e.pos+o.nodeSize,e.pos+y,e.pos+o.nodeSize-y,new B(k,m.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function ha(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(V.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const dp=ha(-1),up=ha(1);function fp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&go(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function ws(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[o];t.doc.nodesBetween(s,l,(c,d)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)i=!0;else{let u=t.doc.resolve(d),f=u.index();i=u.parent.canReplaceWith(f,f+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:c}}=t.selection.ranges[s];o.setBlockType(l,c,n,e)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function hp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o);if(!s)return!1;let l=r?t.tr:null;return pp(l,s,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function pp(n,e,t,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=s.resolve(e.start-2);o=new Zn(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Zn(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=go(o,t,r,e);return l?(n&&mp(n,e,l,i,t),!0):!1}function mp(n,e,t,r,i){let o=T.empty;for(let u=t.length-1;u>=0;u--)o=T.from(t[u].type.create(t[u].attrs,o));n.step(new ce(e.start-(r?2:0),e.end,e.start,e.end,new B(o,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==i&&(s=u+1);let l=t.length-s,c=e.start+t.length-(r?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&jt(n.doc,c,l)&&(n.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return n}function gp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?yp(e,t,n,o):kp(e,t,o):!0:!1}}function yp(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ce(o-1,s,o,s,new B(T.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Zn(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=_t(r);if(l==null)return!1;i.lift(r,l);let c=i.doc.resolve(i.mapping.map(o,-1)-1);return ht(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function kp(n,e,t){let r=n.tr,i=t.parent;for(let p=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,c=t.endIndex==i.childCount,d=o.node(-1),u=o.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(c?T.empty:T.from(i))))return!1;let f=o.pos,h=f+s.nodeSize;return r.step(new ce(f-(l?1:0),h+(c?1:0),f+1,h-1,new B((l?T.empty:T.from(i.copy(T.empty))).append(c?T.empty:T.from(i.copy(T.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function bp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,c=l.child(s-1);if(c.type!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==l.type,u=T.from(d?n.create():null),f=new B(T.from(n.create(null,T.from(l.type.create(null,u)))),d?3:1,0),h=o.start,p=o.end;t(e.tr.step(new ce(h-(d?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const fe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Gt=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Vi=null;const Ke=function(n,e,t){let r=Vi||(Vi=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},vp=function(){Vi=null},Nt=function(n,e,t,r){return t&&(Cs(n,e,t,r,-1)||Cs(n,e,t,r,1))},xp=/^(img|br|input|textarea|hr)$/i;function Cs(n,e,t,r,i){for(var o;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Be(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Nn(n)||xp.test(n.nodeName)||n.contentEditable=="false")return!1;e=fe(n)+(i<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else n=s,e=i<0?Be(n):0}else return!1}}function Be(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function wp(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Be(n)}else if(n.parentNode&&!Nn(n))e=fe(n),n=n.parentNode;else return null}}function Cp(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Nn(n))e=fe(n)+1,n=n.parentNode;else return null}}function Sp(n,e,t){for(let r=e==0,i=e==Be(n);r||i;){if(n==t)return!0;let o=fe(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Be(n)}}function Nn(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Wr=function(n){return n.focusNode&&Nt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function gt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Mp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Tp(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Be(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Be(r.startContainer),r.startOffset)}}}const Fe=typeof navigator<"u"?navigator:null,Ss=typeof document<"u"?document:null,Dt=Fe&&Fe.userAgent||"",Fi=/Edge\/(\d+)/.exec(Dt),pa=/MSIE \d/.exec(Dt),Hi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dt),Se=!!(pa||Hi||Fi),at=pa?document.documentMode:Hi?+Hi[1]:Fi?+Fi[1]:0,Le=!Se&&/gecko\/(\d+)/i.test(Dt),ji=!Se&&/Chrome\/(\d+)/.exec(Dt),ae=!!ji,ma=ji?+ji[1]:0,ge=!Se&&!!Fe&&/Apple Computer/.test(Fe.vendor),Yt=ge&&(/Mobile\/\w+/.test(Dt)||!!Fe&&Fe.maxTouchPoints>2),Ae=Yt||(Fe?/Mac/.test(Fe.platform):!1),ga=Fe?/Win/.test(Fe.platform):!1,Je=/Android \d/.test(Dt),An=!!Ss&&"webkitFontSmoothing"in Ss.documentElement.style,Ep=An?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Np(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function je(n,e){return typeof n=="number"?n:n[e]}function Ap(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Ms(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=Gt(s);continue}let l=s,c=l==o.body,d=c?Np(o):Ap(l),u=0,f=0;if(e.top<d.top+je(r,"top")?f=-(d.top-e.top+je(i,"top")):e.bottom>d.bottom-je(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+je(i,"top")-d.top:e.bottom-d.bottom+je(i,"bottom")),e.left<d.left+je(r,"left")?u=-(d.left-e.left+je(i,"left")):e.right>d.right-je(r,"right")&&(u=e.right-d.right+je(i,"right")),u||f)if(c)o.defaultView.scrollBy(u,f);else{let p=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let g=l.scrollLeft-p,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=c?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s=h=="absolute"?s.offsetParent:Gt(s)}}function Bp(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(o,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=t-20){r=l,i=c.top;break}}return{refDOM:r,refTop:i,stack:ya(n.dom)}}function ya(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Gt(r));return e}function Op({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;ka(t,r==0?0:r-e)}function ka(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Rt=null;function Dp(n){if(n.setActive)return n.setActive();if(Rt)return n.focus(Rt);let e=ya(n);n.focus(Rt==null?{get preventScroll(){return Rt={preventScroll:!0},!0}}:void 0),Rt||(Rt=!1,ka(e,0))}function ba(n,e){let t,r=2e8,i,o=0,s=e.top,l=e.top,c,d;for(let u=n.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Ke(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=u,r=g,i=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(o=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(o=f+1)}}return!t&&c&&(t=c,i=d,r=0),t&&t.nodeType==3?Ip(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:ba(t,i)}function Ip(n,e){let t=n.nodeValue.length,r=document.createRange(),i;for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let s=Xe(r,1);if(s.top!=s.bottom&&vo(e,s)){i={node:n,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function vo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function $p(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Rp(n,e,t){let{node:r,offset:i}=ba(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function Lp(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let l=n.docView.nearestDesc(o,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&c.left>r.left||c.top>r.top?i=l.posBefore:(!s&&c.right<r.left||c.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;o=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function va(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(vo(e,d))return va(s,e,d)}}if((o=(o+1)%r)==i)break}return n}function zp(n,e){let t=n.dom.ownerDocument,r,i=0,o=Tp(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=n.dom.getBoundingClientRect();if(!vo(e,d)||(s=va(n.dom,e,d),!s))return null}if(ge)for(let d=s;r&&d;d=Gt(d))d.draggable&&(r=void 0);if(s=$p(s,e),r){if(Le&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let d;An&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Lp(n,r,i,e))}l==null&&(l=Rp(n,s,e));let c=n.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function Ts(n){return n.top<n.bottom||n.left<n.right}function Xe(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ts(r))return r}return Array.prototype.find.call(t,Ts)||n.getBoundingClientRect()}const Pp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function xa(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=An||Le;if(r.nodeType==3)if(s&&(Pp.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let c=Xe(Ke(r,i,i),t);if(Le&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=Xe(Ke(r,i-1,i-1),-1);if(d.top==c.top){let u=Xe(Ke(r,i,i+1),-1);if(u.top!=c.top)return tn(u,u.left<d.left)}}return c}else{let c=i,d=i,u=t<0?1:-1;return t<0&&!i?(d++,u=-1):t>=0&&i==r.nodeValue.length?(c--,u=1):t<0?c--:d++,tn(Xe(Ke(r,c,d),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==Be(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return fi(c.getBoundingClientRect(),!1)}if(o==null&&i<Be(r)){let c=r.childNodes[i];if(c.nodeType==1)return fi(c.getBoundingClientRect(),!0)}return fi(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==Be(r))){let c=r.childNodes[i-1],d=c.nodeType==3?Ke(c,Be(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return tn(Xe(d,1),!1)}if(o==null&&i<Be(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Ke(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return tn(Xe(d,-1),!0)}return tn(Xe(r.nodeType==3?Ke(r):r,-t),t>=0)}function tn(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function fi(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function wa(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Vp(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return wa(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=xa(n,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Ke(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Fp=/[\u0590-\u08ac]/;function Hp(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=n.domSelection();return l?!Fp.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:wa(n,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return h!=null&&(l.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let Es=null,Ns=null,As=!1;function jp(n,e,t){return Es==e&&Ns==t?As:(Es=e,Ns=t,As=t=="up"||t=="down"?Vp(n,e,t):Hp(n,e,t))}const De=0,Bs=1,yt=2,He=3;class Bn{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=De,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].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 t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.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,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>fe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let l=i.children[s];if(l.size){i=l;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof Sa){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Ca&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?fe(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?fe(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,l=0;;l++){let c=this.children[l],d=s+c.size;if(i==-1&&e<=d){let u=s+c.border;if(e>=u&&t<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,u);e=s;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=fe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(d>t||l==this.children.length-1)){t=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=fe(f.dom);break}t+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],y=m+g.size;if(o>m&&s<y)return g.setSelection(e-m-g.border,t-m-g.border,r,i);m=y}let l=this.domFromPos(e,e?-1:1),c=t==e?l:this.domFromPos(t,t?-1:1),d=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((Le||ge)&&e==t){let{node:p,offset:m}=l;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==`
10
+ `),f&&m==p.nodeValue.length)for(let g=p,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=c={node:y.parentNode,offset:fe(y)+1});break}let k=g.pmViewDesc;if(k&&k.node&&k.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Le&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&ge)&&Nt(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Nt(c.node,c.offset,u.focusNode,u.focusOffset))return;let h=!1;if((d.extend||e==t)&&!(f&&Le)){d.collapse(l.node,l.offset);try{e!=t&&d.extend(c.node,c.offset),h=!0}catch{}}if(!h){if(e>t){let m=l;l=c,c=m}let p=document.createRange();p.setEnd(c.node,c.offset),p.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let l=r+o.border,c=s-o.border;if(e>=l&&t<=c){this.dirty=e==r||t==s?yt:Bs,e==l&&t==c&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=He:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?yt:He}r=s}this.dirty=yt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?yt:Bs;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Ca extends Bn{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!t.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=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==De&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(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 Up extends Bn{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class At extends Bn{constructor(e,t,r,i,o){super(e,[],r,i),this.mark=t,this.spec=o}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=Ot.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new At(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&He||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=He&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=De){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=De}}slice(e,t,r){let i=At.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=qi(o,t,s,r)),e>0&&(o=qi(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ct extends Bn{constructor(e,t,r,i,o,s,l,c,d){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,o,s){let l=o.nodeViews[t.type.name],c,d=l&&l(t,o,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=d&&d.dom,f=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Ot.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=Ea(u,r,t),d?c=new qp(e,t,r,i,u,f||null,h,d,o,s+1):t.isText?new Kr(e,t,r,i,u,h,o):new ct(e,t,r,i,u,f||null,h,o,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 t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>T.empty)}return e}matchesNode(e,t,r){return this.dirty==De&&e.eq(this.node)&&er(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,c=new Kp(this,s&&s.node,e);Yp(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?Y.none:this.node.child(u).marks,r,e),c.placeWidget(d,e,i)},(d,u,f,h)=>{c.syncToMarks(d.marks,r,e);let p;c.findNodeMatch(d,u,f,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+d.nodeSize&&(p=c.findIndexWithChild(o.node))>-1&&c.updateNodeAt(d,u,f,p,e)||c.updateNextNode(d,u,f,e,h,i)||c.addNode(d,u,f,e,i),i+=d.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==yt)&&(s&&this.protectLocalComposition(e,s),Ma(this.contentDOM,this.children,e),Yt&&Qp(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof V)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=Xp(this.node.content,s,r-t,i-t);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new Up(this,o,t,i);e.input.compositionNodes.push(s),this.children=qi(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==He||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=De}updateOuterDeco(e){if(er(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ta(this.dom,this.nodeDOM,Ui(this.outerDeco,this.node,t),Ui(e,this.node,t)),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 Os(n,e,t,r,i){Ea(r,e,n);let o=new ct(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Kr extends ct{constructor(e,t,r,i,o,s,l){super(e,t,r,i,o,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,t,r,i){return this.dirty==He||this.dirty!=De&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=De||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=De,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),o=document.createTextNode(i.text);return new Kr(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=He)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Sa extends Bn{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==De&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class qp extends ct{constructor(e,t,r,i,o,s,l,c,d,u){super(e,t,r,i,o,s,l,d,u),this.spec=c}update(e,t,r,i){if(this.dirty==He)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}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 Ma(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=Ds(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof At){let c=r?r.previousSibling:n.lastChild;Ma(s.contentDOM,s.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=Ds(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const dn=function(n){n&&(this.nodeName=n)};dn.prototype=Object.create(null);const kt=[new dn];function Ui(n,e,t){if(n.length==0)return kt;let r=t?kt[0]:new dn,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new dn(s.nodeName));for(let l in s){let c=s[l];c!=null&&(t&&i.length==1&&i.push(r=new dn(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+c:l=="style"?r.style=(r.style?r.style+";":"")+c:l!="nodeName"&&(r[l]=c))}}}return i}function Ta(n,e,t,r){if(t==kt&&r==kt)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=t[o];if(o){let c;l&&l.nodeName==s.nodeName&&i!=n&&(c=i.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(i),l=kt[0]),i=c}Wp(i,l||kt[0],s)}return i}function Wp(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function Ea(n,e,t){return Ta(n,n,kt,Ui(e,t,n.nodeType!=1))}function er(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Ds(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Kp{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Jp(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=De,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let d=this.top.children[c];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){l=c;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=At.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,t,r)&&!this.preMatch.matched.has(d)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==He&&s.dom==s.contentDOM&&(s.dirty=yt),s.update(e,t,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof ct){let d=this.preMatch.matched.get(c);if(d!=null&&d!=o)return!1;let u=c.dom,f,h=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=He&&er(t,c.outerDeco));if(!h&&c.update(e,t,r,i))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(c,e,t,r,i,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=yt,f.updateChildren(i,s+1),f.dirty=De),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!er(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=ct.create(this.top,t,r,i,o,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,t,r,i,o){let s=ct.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new Ca(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof At;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Kr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ge||ae)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.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 i=new Sa(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Jp(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let d=t.children[r-1];if(d instanceof At)t=d,r=d.children.length;else{l=d,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let c=l.node;if(c){if(c!=n.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function Gp(n,e){return n.type.side-e.type.side}function Yp(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);r(u,i,e.forChild(o,u),d),o+=u.nodeSize}return}let s=0,l=[],c=null;for(let d=0;;){let u,f;for(;s<i.length&&i[s].to==o;){let y=i[s++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(Gp);for(let y=0;y<f.length;y++)t(f[y],d,!!c)}else t(u,d,!!c);let h,p;if(c)p=-1,h=c,c=null;else if(d<n.childCount)p=d,h=n.child(d++);else break;for(let y=0;y<l.length;y++)l[y].to<=o&&l.splice(y--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let m=o+h.nodeSize;if(h.isText){let y=m;s<i.length&&i[s].from<y&&(y=i[s].from);for(let k=0;k<l.length;k++)l[k].to<y&&(y=l[k].to);y<m&&(c=h.cut(y-o),h=h.cut(0,y-o),m=y,p=-1)}else for(;s<i.length&&i[s].to<m;)s++;let g=h.isInline&&!h.isLeaf?l.filter(y=>!y.inline):l.slice();r(h,g,e.forChild(o,h),p),o=m}}function Qp(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Xp(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let c=s.text;for(;i<n.childCount;){let d=n.child(i++);if(o+=d.nodeSize,!d.isText)break;c+=d.text}if(o>=t){if(o>=r&&c.slice(r-e.length-l,r-l)==e)return r-e.length;let d=l<r?c.lastIndexOf(e,r-l-1):-1;if(d>=0&&d+e.length+l>=t)return l+d;if(t==r&&c.length>=r+e.length-l&&c.slice(r-l,r-l+e.length)==e)return r}}return-1}function qi(n,e,t,r,i){let o=[];for(let s=0,l=0;s<n.length;s++){let c=n[s],d=l,u=l+=c.size;d>=t||u<=e?o.push(c):(d<e&&o.push(c.slice(0,e-d,r)),i&&(o.push(i),i=void 0),u>t&&o.push(c.slice(t-d,c.size,r)))}return o}function xo(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),c,d;if(Wr(t)){for(c=s;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&P.isSelectable(f)&&i.parent&&!(f.isInline&&Sp(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;d=new P(s==h?l:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=s,h=s;for(let p=0;p<t.rangeCount;p++){let m=t.getRangeAt(p);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,s]=h==n.state.selection.anchor?[h,f]:[f,h],l=r.resolve(s)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!d){let f=e=="pointer"||n.state.selection.head<l.pos&&!o?1:-1;d=wo(n,u,l,f)}return d}function Na(n){return n.editable?n.hasFocus():Ba(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ge(n,e=!1){let t=n.state.selection;if(Aa(n,t),!!Na(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ae){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Nt(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)_p(n);else{let{anchor:r,head:i}=t,o,s;Is&&!(t instanceof V)&&(t.$from.parent.inlineContent||(o=$s(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=$s(n,t.to))),n.docView.setSelection(r,i,n,e),Is&&(o&&Rs(o),s&&Rs(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Zp(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Is=ge||ae&&ma<63;function $s(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(ge&&i&&i.contentEditable=="false")return hi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return hi(i);if(o)return hi(o)}}function hi(n){return n.contentEditable="true",ge&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Rs(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Zp(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Na(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function _p(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,fe(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Se&&at<=11&&(t.disabled=!0,t.disabled=!1)}function Aa(n,e){if(e instanceof P){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Ls(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Ls(n)}function Ls(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function wo(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||V.between(e,t,r)}function zs(n){return n.editable&&!n.hasFocus()?!1:Ba(n)}function Ba(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function em(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Nt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Wi(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&H.findFrom(o,e)}function Ze(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ps(n,e,t){let r=n.state.selection;if(r instanceof V)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return Ze(n,new V(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Wi(n.state,e);return i&&i instanceof P?Ze(n,i):!1}else if(!(Ae&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?P.isSelectable(o)?Ze(n,new P(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):An?Ze(n,new V(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof P&&r.node.isInline)return Ze(n,new V(e>0?r.$to:r.$from));{let i=Wi(n.state,e);return i?Ze(n,i):!1}}}function tr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function un(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Lt(n,e){return e<0?tm(n):nm(n)}function tm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(Le&&t.nodeType==1&&r<tr(t)&&un(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(un(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Oa(t))break;{let l=t.previousSibling;for(;l&&un(l,-1);)i=t.parentNode,o=fe(l),l=l.previousSibling;if(l)t=l,r=tr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Ki(n,t,r):i&&Ki(n,i,o)}function nm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=tr(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(un(l,1))o=t,s=++r;else break}else{if(Oa(t))break;{let l=t.nextSibling;for(;l&&un(l,1);)o=l.parentNode,s=fe(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=tr(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Ki(n,o,s)}function Oa(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function rm(n,e){for(;n&&e==n.childNodes.length&&!Nn(n);)e=fe(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function im(n,e){for(;n&&!e&&!Nn(n);)e=fe(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Ki(n,e,t){if(e.nodeType!=3){let o,s;(s=rm(e,t))?(e=s,t=0):(o=im(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Wr(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Ge(n)},50)}function Vs(n,e){let t=n.state.doc.resolve(e);if(!(ae||ga)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Fs(n,e,t){let r=n.state.selection;if(r instanceof V&&!r.empty||t.indexOf("s")>-1||Ae&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Wi(n.state,e);if(s&&s instanceof P)return Ze(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Oe?H.near(s,e):H.findFrom(s,e);return l?Ze(n,l):!1}return!1}function Hs(n,e){if(!(n.state.selection instanceof V))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function js(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function om(n){if(!ge||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;js(n,r,"true"),setTimeout(()=>js(n,r,"false"),20)}return!1}function sm(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function lm(n,e){let t=e.keyCode,r=sm(e);if(t==8||Ae&&t==72&&r=="c")return Hs(n,-1)||Lt(n,-1);if(t==46&&!e.shiftKey||Ae&&t==68&&r=="c")return Hs(n,1)||Lt(n,1);if(t==13||t==27)return!0;if(t==37||Ae&&t==66&&r=="c"){let i=t==37?Vs(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ps(n,i,r)||Lt(n,i)}else if(t==39||Ae&&t==70&&r=="c"){let i=t==39?Vs(n,n.state.selection.from)=="ltr"?1:-1:1;return Ps(n,i,r)||Lt(n,i)}else{if(t==38||Ae&&t==80&&r=="c")return Fs(n,-1,r)||Lt(n,-1);if(t==40||Ae&&t==78&&r=="c")return om(n)||Fs(n,1,r)||Lt(n,1);if(r==(Ae?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Co(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=n.someProp("clipboardSerializer")||Ot.fromSchema(n.state.schema),l=za(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=La[d.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=l.createElement(u[p]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${o}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
11
11
 
12
12
  `);return{dom:c,text:h,slice:e}}function Da(n,e,t,r,i){let o=i.parent.type.spec.code,s,l;if(!t&&!e)return null;let c=!!e&&(r||o||!t);if(c){if(n.someProp("transformPastedText",h=>{e=h(e,o||r,n)}),o)return l=new B(T.from(n.state.schema.text(e.replace(/\r\n?/g,`
13
- `))),0,0),n.someProp("transformPasted",h=>{l=h(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",h=>h(e,i,r,n));if(f)l=f;else{let h=i.marks(),{schema:p}=n.state,m=Ot.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),s=dm(t),An&&um(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||lt.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!lm.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=fm(Us(l,+u[1],+u[2]),u[4]);else if(l=B.maxOpen(am(l.content,i),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=Us(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,c)}),l}const lm=/^(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 am(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,s=[];if(n.forEach(l=>{if(!s)return;let c=i.findWrapping(l.type),d;if(!c)return s=null;if(d=s.length&&o.length&&$a(c,o,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Ra(s[s.length-1],o.length));let u=Ia(l,c);s.push(u),i=i.matchType(u.type),o=c}}),s)return T.from(s)}return n}function Ia(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,T.from(n));return n}function $a(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=$a(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(T.from(Ia(t,n,i+1))))}}function Ra(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Ra(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(T.empty,!0);return n.copy(t.append(r))}function Ji(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(o=0),i<r-1&&(l=Ji(l,e,t,r,i+1,o)),i>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(T.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Us(n,e,t){return e<n.openStart&&(n=new B(Ji(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new B(Ji(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const La={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 qs=null;function za(){return qs||(qs=document.implementation.createHTMLDocument("title"))}let pi=null;function cm(n){let e=window.trustedTypes;return e?(pi||(pi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),pi.createHTML(n)):n}function dm(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=za().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&La[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=cm(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function um(n){let e=n.querySelectorAll(ae?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function fm(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let c=t.nodes[r[l]];if(!c||c.hasRequiredAttrs())break;i=T.from(c.create(r[l+1],i)),o++,s++}return new B(i,o,s)}const ve={},xe={},hm={touchstart:!0,touchmove:!0};class pm{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 mm(n){for(let e in ve){let t=ve[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{ym(n,r)&&!So(n,r)&&(n.editable||!(r.type in xe))&&t(n,r)},hm[e]?{passive:!0}:void 0)}ge&&n.dom.addEventListener("input",()=>null),Gi(n)}function st(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function gm(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Gi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>So(n,r))})}function So(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function ym(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function km(n,e){!So(n,e)&&ve[e.type]&&(n.editable||!(e.type in xe))&&ve[e.type](n,e)}xe.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Va(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Je&&ae&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Yt&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,gt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||sm(n,t)?t.preventDefault():st(n,"key")};xe.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};xe.keypress=(n,e)=>{let t=e;if(Va(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ae&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof V)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),o=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i,o))&&n.dispatch(o()),t.preventDefault()}};function Jr(n){return{left:n.clientX,top:n.clientY}}function bm(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Mo(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,l=>s>o.depth?l(n,t,o.nodeAfter,o.before(s),i,!0):l(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function qt(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function vm(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&P.isSelectable(r)?(qt(n,new P(t)),!0):!1}function xm(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof P&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(P.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(qt(n,P.create(n.state.doc,i)),!0):!1}function wm(n,e,t,r,i){return Mo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?xm(n,t):vm(n,t))}function Cm(n,e,t,r){return Mo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Sm(n,e,t,r){return Mo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Mm(n,t,r)}function Mm(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(qt(n,V.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)qt(n,V.create(r,l+1,l+1+s.content.size));else if(P.isSelectable(s))qt(n,P.create(r,l));else continue;return!0}}function To(n){return nr(n)}const Pa=Ae?"metaKey":"ctrlKey";ve.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=To(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&bm(t,n.input.lastClick)&&!t[Pa]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o,button:t.button};let s=n.posAtCoords(Jr(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Tm(n,s,t,!!r)):(o=="doubleClick"?Cm:Sm)(n,s.pos,s.inside,t)?t.preventDefault():st(n,"pointer"))};class Tm{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Pa],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);o=u.parent,s=u.depth?u.before():0}const l=i?null:r.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||d instanceof P&&d.from<=s&&d.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Le&&!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)),st(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(()=>Ge(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Jr(e))),this.updateAllowDefault(e),this.allowDefault||!t?st(this.view,"pointer"):wm(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ge&&this.mightDrag&&!this.mightDrag.node.isAtom||ae&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(qt(this.view,H.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):st(this.view,"pointer")}move(e){this.updateAllowDefault(e),st(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)}}ve.touchstart=n=>{n.input.lastTouch=Date.now(),To(n),st(n,"pointer")};ve.touchmove=n=>{n.input.lastTouch=Date.now(),st(n,"pointer")};ve.contextmenu=n=>To(n);function Va(n,e){return n.composing?!0:ge&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Em=Je?5e3:-1;xe.compositionstart=xe.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof V&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ae&&ga&&Nm(n)))n.markCursor=n.state.storedMarks||t.marks(),nr(n,!0),n.markCursor=null;else if(nr(n,!e.selection.empty),Le&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}Fa(n,Em)};function Nm(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}xe.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Fa(n,20))};function Fa(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>nr(n),e))}function Ha(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Bm());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Am(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=xp(e.focusNode,e.focusOffset),r=wp(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function Bm(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function nr(n,e=!1){if(!(Je&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Ha(n),e||n.docView&&n.docView.dirty){let t=xo(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Om(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const wn=Se&&at<15||Yt&&Tp<604;ve.copy=xe.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=wn?null:t.clipboardData,s=r.content(),{dom:l,text:c}=Co(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",c)):Om(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Dm(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Im(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Cn(n,r.value,null,i,e):Cn(n,r.textContent,r.innerHTML,i,e)},50)}function Cn(n,e,t,r,i){let o=Da(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,i,o||B.empty)))return!0;if(!o)return!1;let s=Dm(o),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ja(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}xe.paste=(n,e)=>{let t=e;if(n.composing&&!Je)return;let r=wn?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Cn(n,ja(r),r.getData("text/html"),i,t)?t.preventDefault():Im(n,t)};class Ua{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const $m=Ae?"altKey":"ctrlKey";function qa(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[$m]}ve.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(Jr(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof P?i.to-1:i.to))){if(r&&r.mightDrag)s=P.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(s=P.create(n.state.doc,f.posBefore))}}let l=(s||n.state.selection).content(),{dom:c,text:d,slice:u}=Co(n,l);(!t.dataTransfer.files.length||!ae||ma>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(wn?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",wn||t.dataTransfer.setData("text/plain",d),n.dragging=new Ua(u,qa(n,t),s)};ve.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};xe.dragover=xe.dragenter=(n,e)=>e.preventDefault();xe.drop=(n,e)=>{try{Rm(n,e,n.dragging)}finally{n.dragging=null}};function Rm(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Jr(e));if(!r)return;let i=n.state.doc.resolve(r.pos),o=t&&t.slice;o?n.someProp("transformPasted",p=>{o=p(o,n,!1)}):o=Da(n,ja(e.dataTransfer),wn?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(t&&qa(n,e));if(n.someProp("handleDrop",p=>p(n,e,o||B.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let l=o?ea(n.state.doc,i.pos,o):i.pos;l==null&&(l=i.pos);let c=n.state.tr;if(s){let{node:p}=t;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(f))return;let h=c.doc.resolve(d);if(u&&P.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new P(h));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,k)=>p=k),c.setSelection(wo(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}ve.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Ge(n)},20))};ve.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};ve.beforeinput=(n,e)=>{if(ae&&Je&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,gt(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in xe)ve[n]=xe[n];function Sn(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class rr{constructor(e,t){this.toDOM=e,this.spec=t||Ct,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new be(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof rr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Sn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class dt{constructor(e,t){this.attrs=e,this.spec=t||Ct}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new be(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof dt&&Sn(this.attrs,e.attrs)&&Sn(this.spec,e.spec)}static is(e){return e.type instanceof dt}destroy(){}}class Eo{constructor(e,t){this.attrs=e,this.spec=t||Ct}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new be(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof Eo&&Sn(this.attrs,e.attrs)&&Sn(this.spec,e.spec)}destroy(){}}class be{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new be(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new be(e,e,new rr(t,r))}static inline(e,t,r,i){return new be(e,t,new dt(r,i))}static node(e,t,r,i){return new be(e,t,new Eo(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof dt}get widget(){return this.type instanceof rr}}const Pt=[],Ct={};class X{constructor(e,t){this.local=e.length?e:Pt,this.children=t.length?t:Pt}static create(e,t){return t.length?ir(t,e,0,Ct):me}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,i+l,o)}}map(e,t,r){return this==me||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Ct)}mapInner(e,t,r,i,o){let s;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,r,i);c&&c.type.valid(t,c)?(s||(s=[])).push(c):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?Lm(this.children,s||[],e,t,r,i,o):s?new X(s.sort(St),Pt):me}add(e,t){return t.length?this==me?X.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((l,c)=>{let d=c+r,u;if(u=Ka(t,l,d)){for(i||(i=this.children.slice());o<i.length&&i[o]<c;)o+=3;i[o]==c?i[o+2]=i[o+2].addInner(l,u,d+1):i.splice(o,0,c,c+l.nodeSize,ir(u,l,d+1,Ct)),o+=3}});let s=Wa(o?Ja(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new X(s.length?this.local.concat(s).sort(St):this.local,i||this.children)}remove(e){return e.length==0||this==me?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+t,c=r[o+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<c&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let d=r[o+2].removeInner(s,l+1);d!=me?r[o+2]=d:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let l=0;l<i.length;l++)i[l].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new X(i,r):me}forChild(e,t){if(this==me)return this;if(t.isLeaf)return X.empty;let r,i;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 o=e+1,s=o+t.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<s&&c.to>o&&c.type instanceof dt){let d=Math.max(o,c.from)-o,u=Math.min(s,c.to)-o;d<u&&(i||(i=[])).push(c.copy(d,u))}}if(i){let l=new X(i.sort(St),Pt);return r?new nt([l,r]):l}return r||me}eq(e){if(this==e)return!0;if(!(e instanceof X)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return No(this.localsInner(e))}localsInner(e){if(this==me)return Pt;if(e.inlineContent||!this.local.some(dt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof dt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}X.empty=new X([],[]);X.removeOverlap=No;const me=X.empty;class nt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Ct));return nt.from(r)}forChild(e,t){if(t.isLeaf)return X.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=me&&(o instanceof nt?r=r.concat(o.members):r.push(o))}return nt.from(r)}eq(e){if(!(e instanceof nt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?No(r?t:t.sort(St)):Pt}static from(e){switch(e.length){case 0:return me;case 1:return e[0];default:return new nt(e.every(t=>t instanceof X)?e:e.reduce((t,r)=>t.concat(r instanceof X?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Lm(n,e,t,r,i,o,s){let l=n.slice();for(let d=0,u=o;d<t.maps.length;d++){let f=0;t.maps[d].forEach((h,p,m,g)=>{let y=g-m-(p-h);for(let k=0;k<l.length;k+=3){let v=l[k+1];if(v<0||h>v+u-f)continue;let b=l[k]+u-f;p>=b?l[k+1]=h<=b?-2:-1:h>=u&&y&&(l[k]+=y,l[k+1]+=y)}f+=y}),u=t.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=t.map(n[d]+o),f=u-i;if(f<0||f>=r.content.size){c=!0;continue}let h=t.map(n[d+1]+o,-1),p=h-i,{index:m,offset:g}=r.content.findIndex(f),y=r.maybeChild(m);if(y&&g==f&&g+y.nodeSize==p){let k=l[d+2].mapInner(t,y,u+1,n[d]+o+1,s);k!=me?(l[d]=f,l[d+1]=p,l[d+2]=k):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=zm(l,n,e,t,i,o,s),u=ir(d,r,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new X(e.sort(St),l)}function Wa(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new be(i.from+e,i.to+e,i.type))}return t}function zm(n,e,t,r,i,o,s){function l(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(r,i,d);f?t.push(f):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&l(n[c+2],e[c]+o+1);return t}function Ka(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function Ja(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ir(n,e,t,r){let i=[],o=!1;e.forEach((l,c)=>{let d=Ka(n,l,c+t);if(d){o=!0;let u=ir(d,l,t+c+1,r);u!=me&&i.push(c,c+l.nodeSize,u)}});let s=Wa(o?Ja(n):n,-t).sort(St);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||i.length?new X(s,i):me}function St(n,e){return n.from-e.from||n.to-e.to}function No(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),Ws(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),Ws(e,i,r.copy(o.from,r.to)));break}}}return e}function Ws(n,e,t){for(;e<n.length&&St(t,n[e])>0;)e++;n.splice(e,0,t)}function mi(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=me&&e.push(r)}),n.cursorWrapper&&e.push(X.create(n.state.doc,[n.cursorWrapper.deco])),nt.from(e)}const Pm={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Vm=Se&&at<=11;class Fm{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 Hm{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Fm,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Se&&at<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Vm&&(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,Pm)),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 t=0;t<e.length;t++)this.queue.push(e[t]);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(zs(this.view)){if(this.suppressingSelectionUpdates)return Ge(this.view);if(Se&&at<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Nt(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 t=new Set,r;for(let o=e.focusNode;o;o=Gt(o))t.add(o);for(let o=e.anchorNode;o;o=Gt(o))if(t.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&zs(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,c=[];if(e.editable)for(let u=0;u<t.length;u++){let f=this.registerMutation(t[u],c);f&&(o=o<0?f.from:Math.min(f.from,o),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(Le&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||qm(e,f)!=p)&&h.remove()}}}else if((ae||ge)&&c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}let d=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Wr(r)&&(d=xo(e))&&d.eq(H.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ge(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),jm(e)),this.handleDOMChange(o,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ge(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.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 f=e.addedNodes[u];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(Se&&at<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:h}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?fe(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),c=o&&o.parentNode==e.target?fe(o):e.target.childNodes.length,d=r.localPosFromDOM(e.target,c,1);return{from:l,to:d}}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 Ks=new WeakMap,Js=!1;function jm(n){if(!Ks.has(n)&&(Ks.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Le,Js)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."),Js=!0}}function Gs(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return Nt(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function Um(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Gs(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Gs(n,t):null}function qm(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Wm(n,e,t){let{node:r,fromOffset:i,toOffset:o,from:s,to:l}=n.docView.parseRange(e,t),c=n.domSelectionRange(),d,u=c.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Wr(c)||d.push({node:c.focusNode,offset:c.focusOffset})),ae&&n.input.lastKeyCode===8)for(let y=o;y>i;y--){let k=r.childNodes[y-1],v=k.pmViewDesc;if(k.nodeName=="BR"&&!v){o=y;break}if(!v||v.size)break}let f=n.state.doc,h=n.someProp("domParser")||lt.fromSchema(n.state.schema),p=f.resolve(s),m=null,g=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:Km,context:p});if(d&&d[0].pos!=null){let y=d[0].pos,k=d[1]&&d[1].pos;k==null&&(k=y),m={anchor:y+s,head:k+s}}return{doc:g,sel:m,from:s,to:l}}function Km(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ge&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ge&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Jm=/^(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 Gm(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,C=xo(n,M);if(C&&!n.state.selection.eq(C)){if(ae&&Je&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",$=>$(n,gt(13,"Enter"))))return;let A=n.state.tr.setSelection(C);M=="pointer"?A.setMeta("pointer",!0):M=="key"&&A.scrollIntoView(),o&&A.setMeta("composition",o),n.dispatch(A)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let c=n.state.selection,d=Wm(n,e,t),u=n.state.doc,f=u.slice(d.from,d.to),h,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,p="end"):(h=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let m=Xm(f.content,d.doc.content,d.from,h,p);if(m&&n.input.domChangeCount++,(Yt&&n.input.lastIOSEnter>Date.now()-225||Je)&&i.some(M=>M.nodeType==1&&!Jm.test(M.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",M=>M(n,gt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof V&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let M=Ys(n,n.state.doc,d.sel);if(M&&!M.eq(n.state.selection)){let C=n.state.tr.setSelection(M);o&&C.setMeta("composition",o),n.dispatch(C)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof V&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),Se&&at<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),k=u.resolve(m.start),v=g.sameParent(y)&&g.parent.inlineContent&&k.end()>=m.endA;if((Yt&&n.input.lastIOSEnter>Date.now()-225&&(!v||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!v&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",M=>M(n,gt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Qm(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",M=>M(n,gt(8,"Backspace")))){Je&&ae&&n.domObserver.suppressSelectionUpdates();return}ae&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Je&&!v&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,gt(13,"Enter"))})},20));let b=m.start,x=m.endA,w=M=>{let C=M||n.state.tr.replace(b,x,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let A=Ys(n,C.doc,d.sel);A&&!(ae&&n.composing&&A.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(A.head==b||A.head==C.mapping.map(x)-1)||Se&&A.empty&&A.head==b)&&C.setSelection(A)}return o&&C.setMeta("composition",o),C.scrollIntoView()},S;if(v)if(g.pos==y.pos){Se&&at<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ge(n),20));let M=w(n.state.tr.delete(b,x)),C=u.resolve(m.start).marksAcross(u.resolve(m.endA));C&&M.ensureMarks(C),n.dispatch(M)}else if(m.endA==m.endB&&(S=Ym(g.parent.content.cut(g.parentOffset,y.parentOffset),k.parent.content.cut(k.parentOffset,m.endA-k.start())))){let M=w(n.state.tr);S.type=="add"?M.addMark(b,x,S.mark):M.removeMark(b,x,S.mark),n.dispatch(M)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,y.parentOffset),C=()=>w(n.state.tr.insertText(M,b,x));n.someProp("handleTextInput",A=>A(n,b,x,M,C))||n.dispatch(C())}else n.dispatch(w());else n.dispatch(w())}function Ys(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:wo(n,e.resolve(t.anchor),e.resolve(t.head))}function Ym(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,l,c;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)o=t[u].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",c=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(T.from(d).eq(n))return{mark:l,type:s}}function Qm(n,e,t,r,i){if(t-e<=i.pos-r.pos||gi(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&t==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(gi(o,!0,!0));return!s.parent.isTextblock||s.pos>t||gi(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function gi(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Xm(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s<o&&n.size<e.size){let c=r<=o&&r>=s?o-r:0;o-=c,o&&o<e.size&&Qs(e.textBetween(o-1,o+1))&&(o+=c?1:-1),l=o+(l-s),s=o}else if(l<o){let c=r<=o&&r>=l?o-r:0;o-=c,o&&o<n.size&&Qs(n.textBetween(o-1,o+1))&&(o+=c?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function Qs(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Ga{constructor(e,t){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 pm,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(tl),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=_s(this),Zs(this),this.nodeViews=el(this),this.docView=Os(this.state.doc,Xs(this),mi(this),this.dom,this),this.domObserver=new Hm(this,(r,i,o,s)=>Gm(this,r,i,o,s)),this.domObserver.start(),mm(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 t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Gi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(tl),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Ha(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=el(this);_m(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Gi(this),this.editable=_s(this),Zs(this);let c=mi(this),d=Xs(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(i.selection))&&(s=!0);let h=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Ap(this);if(s){this.domObserver.stop();let p=f&&(Se||ae)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Zm(i.selection,e.selection);if(f){let m=ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Am(this)),(o||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Os(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&_p(this))?Ge(this,p):(Aa(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&Bp(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof P){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ms(this,t.getBoundingClientRect(),e)}else Ms(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 t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Ua(e.slice,e.move,i<0?void 0:P.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=t?t(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(Se){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&&Op(this.dom),Ge(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Lp(this,e)}coordsAtPos(e,t=1){return xa(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Hp(this,t||this.state,e)}pasteHTML(e,t){return Cn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Cn(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Co(this,e)}destroy(){this.docView&&(gm(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],mi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,bp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return km(this,e)}domSelectionRange(){let e=this.domSelection();return e?ge&&this.root.nodeType===11&&Sp(this.dom.ownerDocument)==this.dom&&Um(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Ga.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Xs(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[be.node(0,n.state.doc.content.size,e)]}function Zs(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:be.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function _s(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Zm(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function el(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function _m(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function tl(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ut={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:"'"},or={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},eg=typeof navigator<"u"&&/Mac/.test(navigator.platform),tg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var he=0;he<10;he++)ut[48+he]=ut[96+he]=String(he);for(var he=1;he<=24;he++)ut[he+111]="F"+he;for(var he=65;he<=90;he++)ut[he]=String.fromCharCode(he+32),or[he]=String.fromCharCode(he);for(var yi in ut)or.hasOwnProperty(yi)||(or[yi]=ut[yi]);function ng(n){var e=eg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||tg&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?or:ut)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const rg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ig=typeof navigator<"u"&&/Win/.test(navigator.platform);function og(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,s;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))rg?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function sg(n){let e=Object.create(null);for(let t in n)e[og(t)]=n[t];return e}function ki(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function lg(n){return new Z({props:{handleKeyDown:Ya(n)}})}function Ya(n){let e=sg(n);return function(t,r){let i=ng(r),o,s=e[ki(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[ki(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(ig&&r.ctrlKey&&r.altKey)&&(o=ut[r.keyCode])&&o!=i){let l=e[ki(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var ag=Object.defineProperty,Ao=(n,e)=>{for(var t in e)ag(n,t,{get:e[t],enumerable:!0})};function Gr(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;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 o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}var Yr=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,o=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([s,l])=>[s,(...d)=>{const u=l(...d)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:o}=r,s=[],l=!!n,c=n||i.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),s.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(t).map(([f,h])=>[f,(...m)=>{const g=this.buildProps(c,e),y=h(...m)(g);return s.push(y),u}])),run:d};return u}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,o=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:o}=r,s={tr:n,editor:r,view:o,state:Gr({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...d)=>c(...d)(s)]))}};return s}},Qa={};Ao(Qa,{blur:()=>cg,clearContent:()=>dg,clearNodes:()=>ug,command:()=>fg,createParagraphNear:()=>hg,cut:()=>pg,deleteCurrentNode:()=>mg,deleteNode:()=>gg,deleteRange:()=>yg,deleteSelection:()=>kg,enter:()=>bg,exitCode:()=>vg,extendMarkRange:()=>xg,first:()=>wg,focus:()=>Sg,forEach:()=>Mg,insertContent:()=>Tg,insertContentAt:()=>Ag,joinBackward:()=>Dg,joinDown:()=>Og,joinForward:()=>Ig,joinItemBackward:()=>$g,joinItemForward:()=>Rg,joinTextblockBackward:()=>Lg,joinTextblockForward:()=>zg,joinUp:()=>Bg,keyboardShortcut:()=>Vg,lift:()=>Fg,liftEmptyBlock:()=>Hg,liftListItem:()=>jg,newlineInCode:()=>Ug,resetAttributes:()=>qg,scrollIntoView:()=>Wg,selectAll:()=>Kg,selectNodeBackward:()=>Jg,selectNodeForward:()=>Gg,selectParentNode:()=>Yg,selectTextblockEnd:()=>Qg,selectTextblockStart:()=>Xg,setContent:()=>Zg,setMark:()=>ky,setMeta:()=>by,setNode:()=>vy,setNodeSelection:()=>xy,setTextDirection:()=>wy,setTextSelection:()=>Cy,sinkListItem:()=>Sy,splitBlock:()=>My,splitListItem:()=>Ty,toggleList:()=>Ey,toggleMark:()=>Ny,toggleNode:()=>Ay,toggleWrap:()=>By,undoInputRule:()=>Oy,unsetAllMarks:()=>Dy,unsetMark:()=>Iy,unsetTextDirection:()=>$y,updateAttributes:()=>Ry,wrapIn:()=>Ly,wrapInList:()=>zy});var cg=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),dg=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),ug=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:s})=>{n.doc.nodesBetween(o.pos,s.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),h=d.resolve(u.map(c+l.nodeSize)),p=f.blockRange(h);if(!p)return;const m=_t(p);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},fg=n=>e=>n(e),hg=()=>({state:n,dispatch:e})=>op(n,e),pg=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new V(r.doc.resolve(Math.max(s-1,0)))),!0},mg=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const l=i.before(o),c=i.after(o);n.delete(l,c).scrollIntoView()}return!0}return!1};function re(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var gg=n=>({tr:e,state:t,dispatch:r})=>{const i=re(n,t.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const c=o.before(s),d=o.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},yg=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},kg=()=>({state:n,dispatch:e})=>Jh(n,e),bg=()=>({commands:n})=>n.keyboardShortcut("Enter"),vg=()=>({state:n,dispatch:e})=>ip(n,e);function Bo(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function sr(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Bo(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function Xa(n,e,t={}){return n.find(r=>r.type===e&&sr(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function nl(n,e,t={}){return!!Xa(n,e,t)}function Oo(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!Xa([...i.node.marks],e,t)))return;let s=i.index,l=n.start()+i.offset,c=s+1,d=l+i.node.nodeSize;for(;s>0&&nl([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;c<n.parent.childCount&&nl([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Ye(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var xg=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Ye(n,r.schema),{doc:s,selection:l}=t,{$from:c,from:d,to:u}=l;if(i){const f=Oo(c,o,e);if(f&&f.from<=d&&f.to>=u){const h=V.create(s,f.from,f.to);t.setSelection(h)}}return!0},wg=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Za(n){return n instanceof V}function bt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function _a(n,e=null){if(!e)return null;const t=H.atStart(n),r=H.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?V.create(n,bt(0,i,o),bt(n.content.size,i,o)):V.create(n,bt(e,i,o),bt(e,i,o))}function Cg(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Do(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Sg=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(Do()||Cg())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!Za(t.state.selection))return s(),!0;const l=_a(i.doc,n)||t.state.selection,c=t.state.selection.eq(l);return o&&(c||i.setSelection(l),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},Mg=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),Tg=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),ec=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&ec(r)}return n};function Ln(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return ec(t)}function Mn(n,e,t){if(n instanceof Re||n instanceof T)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return T.fromArray(n.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),Mn("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,l="";const c=new Ul({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:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?lt.fromSchema(c).parseSlice(Ln(n),t.parseOptions):lt.fromSchema(c).parse(Ln(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=lt.fromSchema(e);return t.slice?o.parseSlice(Ln(n),t.parseOptions).content:o.parse(Ln(n),t.parseOptions)}return Mn("",e,t)}function Eg(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof le||i instanceof ce))return;const o=n.mapping.maps[r];let s=0;o.forEach((l,c,d,u)=>{s===0&&(s=u)}),n.setSelection(H.near(n.doc.resolve(s),t))}var Ng=n=>!("type"in n),Ag=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const c=y=>{o.emit("contentError",{editor:o,error:y,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{Mn(e,o.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{l=Mn(e,o.schema,{parseOptions:d,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:o.options.enableContentCheck})}catch(y){return c(y),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,p=!0;if((Ng(l)?l:[l]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),u===f&&p){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,f+=1)}let g;if(h){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof T){let y="";e.forEach(k=>{k.text&&(y+=k.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,f)}else{g=l;const y=r.doc.resolve(u),k=y.node(),v=y.parentOffset===0,b=k.isText||k.isTextblock,x=k.content.size>0;v&&b&&x&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g)}t.updateSelection&&Eg(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},Bg=()=>({state:n,dispatch:e})=>ep(n,e),Og=()=>({state:n,dispatch:e})=>tp(n,e),Dg=()=>({state:n,dispatch:e})=>Gh(n,e),Ig=()=>({state:n,dispatch:e})=>Zh(n,e),$g=()=>({state:n,dispatch:e,tr:t})=>{try{const r=jr(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Rg=()=>({state:n,dispatch:e,tr:t})=>{try{const r=jr(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Lg=()=>({state:n,dispatch:e})=>Yh(n,e),zg=()=>({state:n,dispatch:e})=>Qh(n,e);function tc(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Pg(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,s;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))Do()||tc()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}var Vg=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=Pg(n).split(/-(?!$)/),s=o.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,l))});return c?.steps.forEach(d=>{const u=d.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function ft(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?re(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(i,h+f.nodeSize);l.push({node:f,from:p,to:m})});const c=i-r,d=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>sr(f.node.attrs,t,{strict:!1}));return o?!!d.length:d.reduce((f,h)=>f+h.to-h.from,0)>=c}var Fg=(n,e={})=>({state:t,dispatch:r})=>{const i=re(n,t.schema);return ft(t,i,e)?np(t,r):!1},Hg=()=>({state:n,dispatch:e})=>sp(n,e),jg=n=>({state:e,dispatch:t})=>{const r=re(n,e.schema);return mp(r)(e,t)},Ug=()=>({state:n,dispatch:e})=>rp(n,e);function Qr(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function rl(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var qg=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=Qr(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(o=re(n,r.schema)),l==="mark"&&(s=Ye(n,r.schema));let c=!1;return t.selection.ranges.forEach(d=>{r.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{o&&o===u.type&&(c=!0,i&&t.setNodeMarkup(f,void 0,rl(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(h=>{s===h.type&&(c=!0,i&&t.addMark(f,f+u.nodeSize,s.create(rl(h.attrs,e))))})})}),c},Wg=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Kg=()=>({tr:n,dispatch:e})=>{if(e){const t=new Oe(n.doc);n.setSelection(t)}return!0},Jg=()=>({state:n,dispatch:e})=>Xh(n,e),Gg=()=>({state:n,dispatch:e})=>_h(n,e),Yg=()=>({state:n,dispatch:e})=>lp(n,e),Qg=()=>({state:n,dispatch:e})=>dp(n,e),Xg=()=>({state:n,dispatch:e})=>cp(n,e);function Yi(n,e,t={},r={}){return Mn(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Zg=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{const{doc:c}=o;if(r.preserveWhitespace!=="full"){const d=Yi(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return s&&o.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t),!0}return s&&o.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:c.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function nc(n,e){const t=Ye(e,n.schema),{from:r,to:i,empty:o}=n.selection,s=[];o?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,c=>{s.push(...c.marks)});const l=s.find(c=>c.type.name===t.name);return l?{...l.attrs}:{}}function rc(n,e){const t=new oa(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function _g(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function ey(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function ty(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Xr(n){return e=>ty(e.$from,n)}function z(n,e,t){return n.config[e]===void 0&&n.parent?z(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?z(n.parent,e,t):null}):n.config[e]}function Io(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=z(e,"addExtensions",t);return r?[e,...Io(r())]:e}).flat(10)}function $o(n,e){const t=Ot.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function ic(n){return typeof n=="function"}function G(n,e=void 0,...t){return ic(n)?e?n.bind(e)(...t):n(...t):n}function ny(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Qt(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function oc(n){const e=[],{nodeExtensions:t,markExtensions:r}=Qt(n),i=[...t,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:i},c=z(s,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...o,...p}})})})})}),i.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},c=z(s,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const h={...o,...f};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:s.name,name:u,attribute:h})})}),e}function ie(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const l=o?String(o).split(" "):[],c=r[i]?r[i].split(" "):[],d=l.filter(u=>!c.includes(u));r[i]=[...c,...d].join(" ")}else if(i==="style"){const l=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],c=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,h]=u.split(":").map(p=>p.trim());d.set(f,h)}),l.forEach(u=>{const[f,h]=u.split(":").map(p=>p.trim());d.set(f,h)}),r[i]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[i]=o}),r},{})}function lr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>ie(t,r),{})}function ry(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function il(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(t):ry(t.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function ol(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&ny(t)?!1:t!=null))}function sl(n){var e,t;const r={};return!((e=n?.attribute)!=null&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),((t=n?.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function iy(n,e){var t;const r=oc(n),{nodeExtensions:i,markExtensions:o}=Qt(n),s=(t=i.find(d=>z(d,"topNode")))==null?void 0:t.name,l=Object.fromEntries(i.map(d=>{const u=r.filter(k=>k.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=n.reduce((k,v)=>{const b=z(v,"extendNodeSchema",f);return{...k,...b?b(d):{}}},{}),p=ol({...h,content:G(z(d,"content",f)),marks:G(z(d,"marks",f)),group:G(z(d,"group",f)),inline:G(z(d,"inline",f)),atom:G(z(d,"atom",f)),selectable:G(z(d,"selectable",f)),draggable:G(z(d,"draggable",f)),code:G(z(d,"code",f)),whitespace:G(z(d,"whitespace",f)),linebreakReplacement:G(z(d,"linebreakReplacement",f)),defining:G(z(d,"defining",f)),isolating:G(z(d,"isolating",f)),attrs:Object.fromEntries(u.map(sl))}),m=G(z(d,"parseHTML",f));m&&(p.parseDOM=m.map(k=>il(k,u)));const g=z(d,"renderHTML",f);g&&(p.toDOM=k=>g({node:k,HTMLAttributes:lr(k,u)}));const y=z(d,"renderText",f);return y&&(p.toText=y),[d.name,p]})),c=Object.fromEntries(o.map(d=>{const u=r.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=n.reduce((y,k)=>{const v=z(k,"extendMarkSchema",f);return{...y,...v?v(d):{}}},{}),p=ol({...h,inclusive:G(z(d,"inclusive",f)),excludes:G(z(d,"excludes",f)),group:G(z(d,"group",f)),spanning:G(z(d,"spanning",f)),code:G(z(d,"code",f)),attrs:Object.fromEntries(u.map(sl))}),m=G(z(d,"parseHTML",f));m&&(p.parseDOM=m.map(y=>il(y,u)));const g=z(d,"renderHTML",f);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:lr(y,u)})),[d.name,p]}));return new Ul({topNode:s,nodes:l,marks:c})}function oy(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Ro(n){return n.sort((t,r)=>{const i=z(t,"priority")||100,o=z(r,"priority")||100;return i>o?-1:i<o?1:0})}function sc(n){const e=Ro(Io(n)),t=oy(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function lc(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
13
+ `))),0,0),n.someProp("transformPasted",h=>{l=h(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",h=>h(e,i,r,n));if(f)l=f;else{let h=i.marks(),{schema:p}=n.state,m=Ot.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),s=um(t),An&&fm(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||lt.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!am.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=hm(Us(l,+u[1],+u[2]),u[4]);else if(l=B.maxOpen(cm(l.content,i),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=Us(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,c)}),l}const am=/^(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 cm(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,s=[];if(n.forEach(l=>{if(!s)return;let c=i.findWrapping(l.type),d;if(!c)return s=null;if(d=s.length&&o.length&&$a(c,o,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Ra(s[s.length-1],o.length));let u=Ia(l,c);s.push(u),i=i.matchType(u.type),o=c}}),s)return T.from(s)}return n}function Ia(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,T.from(n));return n}function $a(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=$a(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(T.from(Ia(t,n,i+1))))}}function Ra(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Ra(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(T.empty,!0);return n.copy(t.append(r))}function Ji(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(o=0),i<r-1&&(l=Ji(l,e,t,r,i+1,o)),i>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(T.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Us(n,e,t){return e<n.openStart&&(n=new B(Ji(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new B(Ji(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const La={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 qs=null;function za(){return qs||(qs=document.implementation.createHTMLDocument("title"))}let pi=null;function dm(n){let e=window.trustedTypes;return e?(pi||(pi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),pi.createHTML(n)):n}function um(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=za().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&La[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=dm(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function fm(n){let e=n.querySelectorAll(ae?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function hm(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let c=t.nodes[r[l]];if(!c||c.hasRequiredAttrs())break;i=T.from(c.create(r[l+1],i)),o++,s++}return new B(i,o,s)}const ve={},xe={},pm={touchstart:!0,touchmove:!0};class mm{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 gm(n){for(let e in ve){let t=ve[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{km(n,r)&&!So(n,r)&&(n.editable||!(r.type in xe))&&t(n,r)},pm[e]?{passive:!0}:void 0)}ge&&n.dom.addEventListener("input",()=>null),Gi(n)}function st(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function ym(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Gi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>So(n,r))})}function So(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function km(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function bm(n,e){!So(n,e)&&ve[e.type]&&(n.editable||!(e.type in xe))&&ve[e.type](n,e)}xe.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Va(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Je&&ae&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Yt&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,gt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||lm(n,t)?t.preventDefault():st(n,"key")};xe.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};xe.keypress=(n,e)=>{let t=e;if(Va(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ae&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof V)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),o=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i,o))&&n.dispatch(o()),t.preventDefault()}};function Jr(n){return{left:n.clientX,top:n.clientY}}function vm(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Mo(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,l=>s>o.depth?l(n,t,o.nodeAfter,o.before(s),i,!0):l(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function qt(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function xm(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&P.isSelectable(r)?(qt(n,new P(t)),!0):!1}function wm(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof P&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(P.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(qt(n,P.create(n.state.doc,i)),!0):!1}function Cm(n,e,t,r,i){return Mo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?wm(n,t):xm(n,t))}function Sm(n,e,t,r){return Mo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Mm(n,e,t,r){return Mo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Tm(n,t,r)}function Tm(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(qt(n,V.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)qt(n,V.create(r,l+1,l+1+s.content.size));else if(P.isSelectable(s))qt(n,P.create(r,l));else continue;return!0}}function To(n){return nr(n)}const Pa=Ae?"metaKey":"ctrlKey";ve.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=To(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&vm(t,n.input.lastClick)&&!t[Pa]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o,button:t.button};let s=n.posAtCoords(Jr(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Em(n,s,t,!!r)):(o=="doubleClick"?Sm:Mm)(n,s.pos,s.inside,t)?t.preventDefault():st(n,"pointer"))};class Em{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Pa],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);o=u.parent,s=u.depth?u.before():0}const l=i?null:r.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||d instanceof P&&d.from<=s&&d.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Le&&!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)),st(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(()=>Ge(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Jr(e))),this.updateAllowDefault(e),this.allowDefault||!t?st(this.view,"pointer"):Cm(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ge&&this.mightDrag&&!this.mightDrag.node.isAtom||ae&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(qt(this.view,H.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):st(this.view,"pointer")}move(e){this.updateAllowDefault(e),st(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)}}ve.touchstart=n=>{n.input.lastTouch=Date.now(),To(n),st(n,"pointer")};ve.touchmove=n=>{n.input.lastTouch=Date.now(),st(n,"pointer")};ve.contextmenu=n=>To(n);function Va(n,e){return n.composing?!0:ge&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Nm=Je?5e3:-1;xe.compositionstart=xe.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof V&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ae&&ga&&Am(n)))n.markCursor=n.state.storedMarks||t.marks(),nr(n,!0),n.markCursor=null;else if(nr(n,!e.selection.empty),Le&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}Fa(n,Nm)};function Am(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}xe.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Fa(n,20))};function Fa(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>nr(n),e))}function Ha(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Om());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Bm(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=wp(e.focusNode,e.focusOffset),r=Cp(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function Om(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function nr(n,e=!1){if(!(Je&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Ha(n),e||n.docView&&n.docView.dirty){let t=xo(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Dm(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const wn=Se&&at<15||Yt&&Ep<604;ve.copy=xe.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=wn?null:t.clipboardData,s=r.content(),{dom:l,text:c}=Co(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",c)):Dm(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Im(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function $m(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Cn(n,r.value,null,i,e):Cn(n,r.textContent,r.innerHTML,i,e)},50)}function Cn(n,e,t,r,i){let o=Da(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,i,o||B.empty)))return!0;if(!o)return!1;let s=Im(o),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ja(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}xe.paste=(n,e)=>{let t=e;if(n.composing&&!Je)return;let r=wn?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Cn(n,ja(r),r.getData("text/html"),i,t)?t.preventDefault():$m(n,t)};class Ua{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Rm=Ae?"altKey":"ctrlKey";function qa(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[Rm]}ve.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(Jr(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof P?i.to-1:i.to))){if(r&&r.mightDrag)s=P.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(s=P.create(n.state.doc,f.posBefore))}}let l=(s||n.state.selection).content(),{dom:c,text:d,slice:u}=Co(n,l);(!t.dataTransfer.files.length||!ae||ma>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(wn?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",wn||t.dataTransfer.setData("text/plain",d),n.dragging=new Ua(u,qa(n,t),s)};ve.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};xe.dragover=xe.dragenter=(n,e)=>e.preventDefault();xe.drop=(n,e)=>{try{Lm(n,e,n.dragging)}finally{n.dragging=null}};function Lm(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Jr(e));if(!r)return;let i=n.state.doc.resolve(r.pos),o=t&&t.slice;o?n.someProp("transformPasted",p=>{o=p(o,n,!1)}):o=Da(n,ja(e.dataTransfer),wn?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(t&&qa(n,e));if(n.someProp("handleDrop",p=>p(n,e,o||B.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let l=o?ea(n.state.doc,i.pos,o):i.pos;l==null&&(l=i.pos);let c=n.state.tr;if(s){let{node:p}=t;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(f))return;let h=c.doc.resolve(d);if(u&&P.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new P(h));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,k)=>p=k),c.setSelection(wo(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}ve.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Ge(n)},20))};ve.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};ve.beforeinput=(n,e)=>{if(ae&&Je&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,gt(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in xe)ve[n]=xe[n];function Sn(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class rr{constructor(e,t){this.toDOM=e,this.spec=t||Ct,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new be(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof rr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Sn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class dt{constructor(e,t){this.attrs=e,this.spec=t||Ct}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new be(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof dt&&Sn(this.attrs,e.attrs)&&Sn(this.spec,e.spec)}static is(e){return e.type instanceof dt}destroy(){}}class Eo{constructor(e,t){this.attrs=e,this.spec=t||Ct}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new be(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof Eo&&Sn(this.attrs,e.attrs)&&Sn(this.spec,e.spec)}destroy(){}}class be{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new be(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new be(e,e,new rr(t,r))}static inline(e,t,r,i){return new be(e,t,new dt(r,i))}static node(e,t,r,i){return new be(e,t,new Eo(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof dt}get widget(){return this.type instanceof rr}}const Pt=[],Ct={};class X{constructor(e,t){this.local=e.length?e:Pt,this.children=t.length?t:Pt}static create(e,t){return t.length?ir(t,e,0,Ct):me}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,i+l,o)}}map(e,t,r){return this==me||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Ct)}mapInner(e,t,r,i,o){let s;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,r,i);c&&c.type.valid(t,c)?(s||(s=[])).push(c):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?zm(this.children,s||[],e,t,r,i,o):s?new X(s.sort(St),Pt):me}add(e,t){return t.length?this==me?X.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((l,c)=>{let d=c+r,u;if(u=Ka(t,l,d)){for(i||(i=this.children.slice());o<i.length&&i[o]<c;)o+=3;i[o]==c?i[o+2]=i[o+2].addInner(l,u,d+1):i.splice(o,0,c,c+l.nodeSize,ir(u,l,d+1,Ct)),o+=3}});let s=Wa(o?Ja(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new X(s.length?this.local.concat(s).sort(St):this.local,i||this.children)}remove(e){return e.length==0||this==me?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+t,c=r[o+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<c&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let d=r[o+2].removeInner(s,l+1);d!=me?r[o+2]=d:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let l=0;l<i.length;l++)i[l].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new X(i,r):me}forChild(e,t){if(this==me)return this;if(t.isLeaf)return X.empty;let r,i;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 o=e+1,s=o+t.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<s&&c.to>o&&c.type instanceof dt){let d=Math.max(o,c.from)-o,u=Math.min(s,c.to)-o;d<u&&(i||(i=[])).push(c.copy(d,u))}}if(i){let l=new X(i.sort(St),Pt);return r?new nt([l,r]):l}return r||me}eq(e){if(this==e)return!0;if(!(e instanceof X)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return No(this.localsInner(e))}localsInner(e){if(this==me)return Pt;if(e.inlineContent||!this.local.some(dt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof dt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}X.empty=new X([],[]);X.removeOverlap=No;const me=X.empty;class nt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Ct));return nt.from(r)}forChild(e,t){if(t.isLeaf)return X.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=me&&(o instanceof nt?r=r.concat(o.members):r.push(o))}return nt.from(r)}eq(e){if(!(e instanceof nt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?No(r?t:t.sort(St)):Pt}static from(e){switch(e.length){case 0:return me;case 1:return e[0];default:return new nt(e.every(t=>t instanceof X)?e:e.reduce((t,r)=>t.concat(r instanceof X?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function zm(n,e,t,r,i,o,s){let l=n.slice();for(let d=0,u=o;d<t.maps.length;d++){let f=0;t.maps[d].forEach((h,p,m,g)=>{let y=g-m-(p-h);for(let k=0;k<l.length;k+=3){let v=l[k+1];if(v<0||h>v+u-f)continue;let b=l[k]+u-f;p>=b?l[k+1]=h<=b?-2:-1:h>=u&&y&&(l[k]+=y,l[k+1]+=y)}f+=y}),u=t.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=t.map(n[d]+o),f=u-i;if(f<0||f>=r.content.size){c=!0;continue}let h=t.map(n[d+1]+o,-1),p=h-i,{index:m,offset:g}=r.content.findIndex(f),y=r.maybeChild(m);if(y&&g==f&&g+y.nodeSize==p){let k=l[d+2].mapInner(t,y,u+1,n[d]+o+1,s);k!=me?(l[d]=f,l[d+1]=p,l[d+2]=k):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=Pm(l,n,e,t,i,o,s),u=ir(d,r,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new X(e.sort(St),l)}function Wa(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new be(i.from+e,i.to+e,i.type))}return t}function Pm(n,e,t,r,i,o,s){function l(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(r,i,d);f?t.push(f):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&l(n[c+2],e[c]+o+1);return t}function Ka(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function Ja(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ir(n,e,t,r){let i=[],o=!1;e.forEach((l,c)=>{let d=Ka(n,l,c+t);if(d){o=!0;let u=ir(d,l,t+c+1,r);u!=me&&i.push(c,c+l.nodeSize,u)}});let s=Wa(o?Ja(n):n,-t).sort(St);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||i.length?new X(s,i):me}function St(n,e){return n.from-e.from||n.to-e.to}function No(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),Ws(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),Ws(e,i,r.copy(o.from,r.to)));break}}}return e}function Ws(n,e,t){for(;e<n.length&&St(t,n[e])>0;)e++;n.splice(e,0,t)}function mi(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=me&&e.push(r)}),n.cursorWrapper&&e.push(X.create(n.state.doc,[n.cursorWrapper.deco])),nt.from(e)}const Vm={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Fm=Se&&at<=11;class Hm{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 jm{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Hm,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Se&&at<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Fm&&(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,Vm)),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 t=0;t<e.length;t++)this.queue.push(e[t]);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(zs(this.view)){if(this.suppressingSelectionUpdates)return Ge(this.view);if(Se&&at<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Nt(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 t=new Set,r;for(let o=e.focusNode;o;o=Gt(o))t.add(o);for(let o=e.anchorNode;o;o=Gt(o))if(t.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&zs(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,c=[];if(e.editable)for(let u=0;u<t.length;u++){let f=this.registerMutation(t[u],c);f&&(o=o<0?f.from:Math.min(f.from,o),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(Le&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||Wm(e,f)!=p)&&h.remove()}}}else if((ae||ge)&&c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}let d=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Wr(r)&&(d=xo(e))&&d.eq(H.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ge(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Um(e)),this.handleDOMChange(o,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ge(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.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 f=e.addedNodes[u];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(Se&&at<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:h}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?fe(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),c=o&&o.parentNode==e.target?fe(o):e.target.childNodes.length,d=r.localPosFromDOM(e.target,c,1);return{from:l,to:d}}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 Ks=new WeakMap,Js=!1;function Um(n){if(!Ks.has(n)&&(Ks.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Le,Js)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."),Js=!0}}function Gs(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return Nt(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function qm(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Gs(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Gs(n,t):null}function Wm(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Km(n,e,t){let{node:r,fromOffset:i,toOffset:o,from:s,to:l}=n.docView.parseRange(e,t),c=n.domSelectionRange(),d,u=c.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Wr(c)||d.push({node:c.focusNode,offset:c.focusOffset})),ae&&n.input.lastKeyCode===8)for(let y=o;y>i;y--){let k=r.childNodes[y-1],v=k.pmViewDesc;if(k.nodeName=="BR"&&!v){o=y;break}if(!v||v.size)break}let f=n.state.doc,h=n.someProp("domParser")||lt.fromSchema(n.state.schema),p=f.resolve(s),m=null,g=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:Jm,context:p});if(d&&d[0].pos!=null){let y=d[0].pos,k=d[1]&&d[1].pos;k==null&&(k=y),m={anchor:y+s,head:k+s}}return{doc:g,sel:m,from:s,to:l}}function Jm(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ge&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ge&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Gm=/^(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 Ym(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,C=xo(n,M);if(C&&!n.state.selection.eq(C)){if(ae&&Je&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",$=>$(n,gt(13,"Enter"))))return;let A=n.state.tr.setSelection(C);M=="pointer"?A.setMeta("pointer",!0):M=="key"&&A.scrollIntoView(),o&&A.setMeta("composition",o),n.dispatch(A)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let c=n.state.selection,d=Km(n,e,t),u=n.state.doc,f=u.slice(d.from,d.to),h,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,p="end"):(h=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let m=Zm(f.content,d.doc.content,d.from,h,p);if(m&&n.input.domChangeCount++,(Yt&&n.input.lastIOSEnter>Date.now()-225||Je)&&i.some(M=>M.nodeType==1&&!Gm.test(M.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",M=>M(n,gt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof V&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let M=Ys(n,n.state.doc,d.sel);if(M&&!M.eq(n.state.selection)){let C=n.state.tr.setSelection(M);o&&C.setMeta("composition",o),n.dispatch(C)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof V&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),Se&&at<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),k=u.resolve(m.start),v=g.sameParent(y)&&g.parent.inlineContent&&k.end()>=m.endA;if((Yt&&n.input.lastIOSEnter>Date.now()-225&&(!v||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!v&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",M=>M(n,gt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Xm(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",M=>M(n,gt(8,"Backspace")))){Je&&ae&&n.domObserver.suppressSelectionUpdates();return}ae&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Je&&!v&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,gt(13,"Enter"))})},20));let b=m.start,x=m.endA,w=M=>{let C=M||n.state.tr.replace(b,x,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let A=Ys(n,C.doc,d.sel);A&&!(ae&&n.composing&&A.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(A.head==b||A.head==C.mapping.map(x)-1)||Se&&A.empty&&A.head==b)&&C.setSelection(A)}return o&&C.setMeta("composition",o),C.scrollIntoView()},S;if(v)if(g.pos==y.pos){Se&&at<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ge(n),20));let M=w(n.state.tr.delete(b,x)),C=u.resolve(m.start).marksAcross(u.resolve(m.endA));C&&M.ensureMarks(C),n.dispatch(M)}else if(m.endA==m.endB&&(S=Qm(g.parent.content.cut(g.parentOffset,y.parentOffset),k.parent.content.cut(k.parentOffset,m.endA-k.start())))){let M=w(n.state.tr);S.type=="add"?M.addMark(b,x,S.mark):M.removeMark(b,x,S.mark),n.dispatch(M)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,y.parentOffset),C=()=>w(n.state.tr.insertText(M,b,x));n.someProp("handleTextInput",A=>A(n,b,x,M,C))||n.dispatch(C())}else n.dispatch(w());else n.dispatch(w())}function Ys(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:wo(n,e.resolve(t.anchor),e.resolve(t.head))}function Qm(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,l,c;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)o=t[u].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",c=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(T.from(d).eq(n))return{mark:l,type:s}}function Xm(n,e,t,r,i){if(t-e<=i.pos-r.pos||gi(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&t==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(gi(o,!0,!0));return!s.parent.isTextblock||s.pos>t||gi(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function gi(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Zm(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s<o&&n.size<e.size){let c=r<=o&&r>=s?o-r:0;o-=c,o&&o<e.size&&Qs(e.textBetween(o-1,o+1))&&(o+=c?1:-1),l=o+(l-s),s=o}else if(l<o){let c=r<=o&&r>=l?o-r:0;o-=c,o&&o<n.size&&Qs(n.textBetween(o-1,o+1))&&(o+=c?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function Qs(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Ga{constructor(e,t){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 mm,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(tl),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=_s(this),Zs(this),this.nodeViews=el(this),this.docView=Os(this.state.doc,Xs(this),mi(this),this.dom,this),this.domObserver=new jm(this,(r,i,o,s)=>Ym(this,r,i,o,s)),this.domObserver.start(),gm(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 t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Gi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(tl),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Ha(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=el(this);eg(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Gi(this),this.editable=_s(this),Zs(this);let c=mi(this),d=Xs(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(i.selection))&&(s=!0);let h=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Bp(this);if(s){this.domObserver.stop();let p=f&&(Se||ae)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&_m(i.selection,e.selection);if(f){let m=ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Bm(this)),(o||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Os(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&em(this))?Ge(this,p):(Aa(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&Op(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof P){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ms(this,t.getBoundingClientRect(),e)}else Ms(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 t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Ua(e.slice,e.move,i<0?void 0:P.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=t?t(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(Se){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&&Dp(this.dom),Ge(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return zp(this,e)}coordsAtPos(e,t=1){return xa(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return jp(this,t||this.state,e)}pasteHTML(e,t){return Cn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Cn(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Co(this,e)}destroy(){this.docView&&(ym(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],mi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,vp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return bm(this,e)}domSelectionRange(){let e=this.domSelection();return e?ge&&this.root.nodeType===11&&Mp(this.dom.ownerDocument)==this.dom&&qm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Ga.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Xs(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[be.node(0,n.state.doc.content.size,e)]}function Zs(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:be.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function _s(n){return!n.someProp("editable",e=>e(n.state)===!1)}function _m(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function el(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function eg(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function tl(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ut={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:"'"},or={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},tg=typeof navigator<"u"&&/Mac/.test(navigator.platform),ng=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var he=0;he<10;he++)ut[48+he]=ut[96+he]=String(he);for(var he=1;he<=24;he++)ut[he+111]="F"+he;for(var he=65;he<=90;he++)ut[he]=String.fromCharCode(he+32),or[he]=String.fromCharCode(he);for(var yi in ut)or.hasOwnProperty(yi)||(or[yi]=ut[yi]);function rg(n){var e=tg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ng&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?or:ut)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const ig=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),og=typeof navigator<"u"&&/Win/.test(navigator.platform);function sg(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,s;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))ig?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function lg(n){let e=Object.create(null);for(let t in n)e[sg(t)]=n[t];return e}function ki(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function ag(n){return new Z({props:{handleKeyDown:Ya(n)}})}function Ya(n){let e=lg(n);return function(t,r){let i=rg(r),o,s=e[ki(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[ki(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(og&&r.ctrlKey&&r.altKey)&&(o=ut[r.keyCode])&&o!=i){let l=e[ki(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var cg=Object.defineProperty,Ao=(n,e)=>{for(var t in e)cg(n,t,{get:e[t],enumerable:!0})};function Gr(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;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 o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}var Yr=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,o=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([s,l])=>[s,(...d)=>{const u=l(...d)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:o}=r,s=[],l=!!n,c=n||i.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),s.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(t).map(([f,h])=>[f,(...m)=>{const g=this.buildProps(c,e),y=h(...m)(g);return s.push(y),u}])),run:d};return u}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,o=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:o}=r,s={tr:n,editor:r,view:o,state:Gr({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...d)=>c(...d)(s)]))}};return s}},Qa={};Ao(Qa,{blur:()=>dg,clearContent:()=>ug,clearNodes:()=>fg,command:()=>hg,createParagraphNear:()=>pg,cut:()=>mg,deleteCurrentNode:()=>gg,deleteNode:()=>yg,deleteRange:()=>kg,deleteSelection:()=>bg,enter:()=>vg,exitCode:()=>xg,extendMarkRange:()=>wg,first:()=>Cg,focus:()=>Mg,forEach:()=>Tg,insertContent:()=>Eg,insertContentAt:()=>Bg,joinBackward:()=>Ig,joinDown:()=>Dg,joinForward:()=>$g,joinItemBackward:()=>Rg,joinItemForward:()=>Lg,joinTextblockBackward:()=>zg,joinTextblockForward:()=>Pg,joinUp:()=>Og,keyboardShortcut:()=>Fg,lift:()=>Hg,liftEmptyBlock:()=>jg,liftListItem:()=>Ug,newlineInCode:()=>qg,resetAttributes:()=>Wg,scrollIntoView:()=>Kg,selectAll:()=>Jg,selectNodeBackward:()=>Gg,selectNodeForward:()=>Yg,selectParentNode:()=>Qg,selectTextblockEnd:()=>Xg,selectTextblockStart:()=>Zg,setContent:()=>_g,setMark:()=>by,setMeta:()=>vy,setNode:()=>xy,setNodeSelection:()=>wy,setTextDirection:()=>Cy,setTextSelection:()=>Sy,sinkListItem:()=>My,splitBlock:()=>Ty,splitListItem:()=>Ey,toggleList:()=>Ny,toggleMark:()=>Ay,toggleNode:()=>By,toggleWrap:()=>Oy,undoInputRule:()=>Dy,unsetAllMarks:()=>Iy,unsetMark:()=>$y,unsetTextDirection:()=>Ry,updateAttributes:()=>Ly,wrapIn:()=>zy,wrapInList:()=>Py});var dg=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),ug=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),fg=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:s})=>{n.doc.nodesBetween(o.pos,s.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),h=d.resolve(u.map(c+l.nodeSize)),p=f.blockRange(h);if(!p)return;const m=_t(p);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},hg=n=>e=>n(e),pg=()=>({state:n,dispatch:e})=>sp(n,e),mg=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new V(r.doc.resolve(Math.max(s-1,0)))),!0},gg=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const l=i.before(o),c=i.after(o);n.delete(l,c).scrollIntoView()}return!0}return!1};function re(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var yg=n=>({tr:e,state:t,dispatch:r})=>{const i=re(n,t.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const c=o.before(s),d=o.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},kg=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},bg=()=>({state:n,dispatch:e})=>Gh(n,e),vg=()=>({commands:n})=>n.keyboardShortcut("Enter"),xg=()=>({state:n,dispatch:e})=>op(n,e);function Bo(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function sr(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Bo(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function Xa(n,e,t={}){return n.find(r=>r.type===e&&sr(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function nl(n,e,t={}){return!!Xa(n,e,t)}function Oo(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!Xa([...i.node.marks],e,t)))return;let s=i.index,l=n.start()+i.offset,c=s+1,d=l+i.node.nodeSize;for(;s>0&&nl([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;c<n.parent.childCount&&nl([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Ye(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var wg=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Ye(n,r.schema),{doc:s,selection:l}=t,{$from:c,from:d,to:u}=l;if(i){const f=Oo(c,o,e);if(f&&f.from<=d&&f.to>=u){const h=V.create(s,f.from,f.to);t.setSelection(h)}}return!0},Cg=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Za(n){return n instanceof V}function bt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function _a(n,e=null){if(!e)return null;const t=H.atStart(n),r=H.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?V.create(n,bt(0,i,o),bt(n.content.size,i,o)):V.create(n,bt(e,i,o),bt(e,i,o))}function Sg(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Do(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Mg=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(Do()||Sg())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!Za(t.state.selection))return s(),!0;const l=_a(i.doc,n)||t.state.selection,c=t.state.selection.eq(l);return o&&(c||i.setSelection(l),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},Tg=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),Eg=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),ec=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&ec(r)}return n};function Ln(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return ec(t)}function Mn(n,e,t){if(n instanceof Re||n instanceof T)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return T.fromArray(n.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),Mn("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,l="";const c=new Ul({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:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?lt.fromSchema(c).parseSlice(Ln(n),t.parseOptions):lt.fromSchema(c).parse(Ln(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=lt.fromSchema(e);return t.slice?o.parseSlice(Ln(n),t.parseOptions).content:o.parse(Ln(n),t.parseOptions)}return Mn("",e,t)}function Ng(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof le||i instanceof ce))return;const o=n.mapping.maps[r];let s=0;o.forEach((l,c,d,u)=>{s===0&&(s=u)}),n.setSelection(H.near(n.doc.resolve(s),t))}var Ag=n=>!("type"in n),Bg=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const c=y=>{o.emit("contentError",{editor:o,error:y,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{Mn(e,o.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{l=Mn(e,o.schema,{parseOptions:d,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:o.options.enableContentCheck})}catch(y){return c(y),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,p=!0;if((Ag(l)?l:[l]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),u===f&&p){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,f+=1)}let g;if(h){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof T){let y="";e.forEach(k=>{k.text&&(y+=k.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,f)}else{g=l;const y=r.doc.resolve(u),k=y.node(),v=y.parentOffset===0,b=k.isText||k.isTextblock,x=k.content.size>0;v&&b&&x&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g)}t.updateSelection&&Ng(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},Og=()=>({state:n,dispatch:e})=>tp(n,e),Dg=()=>({state:n,dispatch:e})=>np(n,e),Ig=()=>({state:n,dispatch:e})=>Yh(n,e),$g=()=>({state:n,dispatch:e})=>_h(n,e),Rg=()=>({state:n,dispatch:e,tr:t})=>{try{const r=jr(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Lg=()=>({state:n,dispatch:e,tr:t})=>{try{const r=jr(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},zg=()=>({state:n,dispatch:e})=>Qh(n,e),Pg=()=>({state:n,dispatch:e})=>Xh(n,e);function tc(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Vg(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,s;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))Do()||tc()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}var Fg=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=Vg(n).split(/-(?!$)/),s=o.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,l))});return c?.steps.forEach(d=>{const u=d.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function ft(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?re(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(i,h+f.nodeSize);l.push({node:f,from:p,to:m})});const c=i-r,d=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>sr(f.node.attrs,t,{strict:!1}));return o?!!d.length:d.reduce((f,h)=>f+h.to-h.from,0)>=c}var Hg=(n,e={})=>({state:t,dispatch:r})=>{const i=re(n,t.schema);return ft(t,i,e)?rp(t,r):!1},jg=()=>({state:n,dispatch:e})=>lp(n,e),Ug=n=>({state:e,dispatch:t})=>{const r=re(n,e.schema);return gp(r)(e,t)},qg=()=>({state:n,dispatch:e})=>ip(n,e);function Qr(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function rl(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var Wg=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=Qr(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(o=re(n,r.schema)),l==="mark"&&(s=Ye(n,r.schema));let c=!1;return t.selection.ranges.forEach(d=>{r.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{o&&o===u.type&&(c=!0,i&&t.setNodeMarkup(f,void 0,rl(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(h=>{s===h.type&&(c=!0,i&&t.addMark(f,f+u.nodeSize,s.create(rl(h.attrs,e))))})})}),c},Kg=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Jg=()=>({tr:n,dispatch:e})=>{if(e){const t=new Oe(n.doc);n.setSelection(t)}return!0},Gg=()=>({state:n,dispatch:e})=>Zh(n,e),Yg=()=>({state:n,dispatch:e})=>ep(n,e),Qg=()=>({state:n,dispatch:e})=>ap(n,e),Xg=()=>({state:n,dispatch:e})=>up(n,e),Zg=()=>({state:n,dispatch:e})=>dp(n,e);function Yi(n,e,t={},r={}){return Mn(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var _g=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{const{doc:c}=o;if(r.preserveWhitespace!=="full"){const d=Yi(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return s&&o.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t),!0}return s&&o.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:c.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function nc(n,e){const t=Ye(e,n.schema),{from:r,to:i,empty:o}=n.selection,s=[];o?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,c=>{s.push(...c.marks)});const l=s.find(c=>c.type.name===t.name);return l?{...l.attrs}:{}}function rc(n,e){const t=new oa(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function ey(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function ty(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function ny(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Xr(n){return e=>ny(e.$from,n)}function z(n,e,t){return n.config[e]===void 0&&n.parent?z(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?z(n.parent,e,t):null}):n.config[e]}function Io(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=z(e,"addExtensions",t);return r?[e,...Io(r())]:e}).flat(10)}function $o(n,e){const t=Ot.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function ic(n){return typeof n=="function"}function G(n,e=void 0,...t){return ic(n)?e?n.bind(e)(...t):n(...t):n}function ry(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Qt(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function oc(n){const e=[],{nodeExtensions:t,markExtensions:r}=Qt(n),i=[...t,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:i},c=z(s,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...o,...p}})})})})}),i.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},c=z(s,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const h={...o,...f};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:s.name,name:u,attribute:h})})}),e}function ie(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const l=o?String(o).split(" "):[],c=r[i]?r[i].split(" "):[],d=l.filter(u=>!c.includes(u));r[i]=[...c,...d].join(" ")}else if(i==="style"){const l=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],c=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,h]=u.split(":").map(p=>p.trim());d.set(f,h)}),l.forEach(u=>{const[f,h]=u.split(":").map(p=>p.trim());d.set(f,h)}),r[i]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[i]=o}),r},{})}function lr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>ie(t,r),{})}function iy(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function il(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(t):iy(t.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function ol(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&ry(t)?!1:t!=null))}function sl(n){var e,t;const r={};return!((e=n?.attribute)!=null&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),((t=n?.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function oy(n,e){var t;const r=oc(n),{nodeExtensions:i,markExtensions:o}=Qt(n),s=(t=i.find(d=>z(d,"topNode")))==null?void 0:t.name,l=Object.fromEntries(i.map(d=>{const u=r.filter(k=>k.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=n.reduce((k,v)=>{const b=z(v,"extendNodeSchema",f);return{...k,...b?b(d):{}}},{}),p=ol({...h,content:G(z(d,"content",f)),marks:G(z(d,"marks",f)),group:G(z(d,"group",f)),inline:G(z(d,"inline",f)),atom:G(z(d,"atom",f)),selectable:G(z(d,"selectable",f)),draggable:G(z(d,"draggable",f)),code:G(z(d,"code",f)),whitespace:G(z(d,"whitespace",f)),linebreakReplacement:G(z(d,"linebreakReplacement",f)),defining:G(z(d,"defining",f)),isolating:G(z(d,"isolating",f)),attrs:Object.fromEntries(u.map(sl))}),m=G(z(d,"parseHTML",f));m&&(p.parseDOM=m.map(k=>il(k,u)));const g=z(d,"renderHTML",f);g&&(p.toDOM=k=>g({node:k,HTMLAttributes:lr(k,u)}));const y=z(d,"renderText",f);return y&&(p.toText=y),[d.name,p]})),c=Object.fromEntries(o.map(d=>{const u=r.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=n.reduce((y,k)=>{const v=z(k,"extendMarkSchema",f);return{...y,...v?v(d):{}}},{}),p=ol({...h,inclusive:G(z(d,"inclusive",f)),excludes:G(z(d,"excludes",f)),group:G(z(d,"group",f)),spanning:G(z(d,"spanning",f)),code:G(z(d,"code",f)),attrs:Object.fromEntries(u.map(sl))}),m=G(z(d,"parseHTML",f));m&&(p.parseDOM=m.map(y=>il(y,u)));const g=z(d,"renderHTML",f);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:lr(y,u)})),[d.name,p]}));return new Ul({topNode:s,nodes:l,marks:c})}function sy(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Ro(n){return n.sort((t,r)=>{const i=z(t,"priority")||100,o=z(r,"priority")||100;return i>o?-1:i<o?1:0})}function sc(n){const e=Ro(Io(n)),t=sy(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function lc(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
14
14
 
15
- `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(r,i,(c,d,u,f)=>{var h;c.isBlock&&d>r&&(l+=o);const p=s?.[c.type.name];if(p)return u&&(l+=p({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(l+=(h=c?.text)==null?void 0:h.slice(Math.max(r,d)-d,i-d))}),l}function sy(n,e){const t={from:0,to:n.content.size};return lc(n,t,e)}function ac(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function ly(n,e){const t=re(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,l=>{o.push(l)});const s=o.reverse().find(l=>l.type.name===t.name);return s?{...s.attrs}:{}}function cc(n,e){const t=Qr(typeof e=="string"?e:e.name,n.schema);return t==="node"?ly(n,e):t==="mark"?nc(n,e):{}}function ay(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function cy(n){const e=ay(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,s)=>s!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function dc(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((l,c)=>{s.push({from:l,to:c})});else{const{from:l,to:c}=t[o];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{const d=e.slice(o).map(l,-1),u=e.slice(o).map(c),f=e.invert().map(d,-1),h=e.invert().map(u);r.push({oldRange:{from:f,to:h},newRange:{from:d,to:u}})})}),cy(r)}function Lo(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=Oo(o,i.type);s&&r.push({mark:i,...s})}):t.nodesBetween(n,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}var dy=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let o=r,s=null;for(;o>0&&s===null;){const l=i.node(o);l?.type.name===e?s=l:o-=1}return[s,o]};function bi(n,e){return e.nodes[n]||e.marks[n]||null}function Kn(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}var uy=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var c,d;const u=((d=(c=i.type.spec).toText)==null?void 0:d.call(c,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),t};function Qi(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Ye(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>sr(f.attrs,t,{strict:!1}));let s=0;const l=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;n.doc.nodesBetween(p,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const k=Math.max(p,y),v=Math.min(m,y+g.nodeSize),b=v-k;s+=b,l.push(...g.marks.map(x=>({mark:x,from:k,to:v})))})}),s===0)return!1;const c=l.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>sr(f.mark.attrs,t,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),d=l.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,h)=>f+h.to-h.from,0);return(c>0?c+d:c)>=s}function fy(n,e,t={}){if(!e)return ft(n,null,t)||Qi(n,null,t);const r=Qr(e,n.schema);return r==="node"?ft(n,e,t):r==="mark"?Qi(n,e,t):!1}var hy=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const o=Xr(l=>l.type.name===e)(n.selection);if(!o)return!1;const s=n.doc.resolve(o.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},py=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function ll(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function al(n,e){const{nodeExtensions:t}=Qt(e),r=t.find(s=>s.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=G(z(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Zr(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&(Zr(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function uc(n){return n instanceof P}var fc=class hc{constructor(e){this.position=e}static fromJSON(e){return new hc(e.position)}toJSON(){return{position:this.position}}};function my(n,e){const t=e.mapping.mapResult(n.position);return{position:new fc(t.pos),mapResult:t}}function gy(n){return new fc(n)}function yy(n,e,t){var r;const{selection:i}=e;let o=null;if(Za(i)&&(o=i.$cursor),o){const l=(r=n.storedMarks)!=null?r:o.marks();return o.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(d=>d.type.excludes(t)))}const{ranges:s}=i;return s.some(({$from:l,$to:c})=>{let d=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,c.pos,(u,f,h)=>{if(d)return!1;if(u.isInline){const p=!h||h.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=p&&m}return!d}),d})}var ky=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:l}=o,c=Ye(n,r.schema);if(i)if(s){const d=nc(r,c);t.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;r.doc.nodesBetween(u,f,(h,p)=>{const m=Math.max(p,u),g=Math.min(p+h.nodeSize,f);h.marks.find(k=>k.type===c)?h.marks.forEach(k=>{c===k.type&&t.addMark(m,g,c.create({...k.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return yy(r,t,c)},by=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),vy=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=re(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:l})=>ws(o,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>ws(o,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},xy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=bt(n,0,r.content.size),o=P.create(r,i);e.setSelection(o)}return!0},wy=(n,e)=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=r;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=o.from,l=o.to),i&&t.doc.nodesBetween(s,l,(c,d)=>{c.isText||t.setNodeMarkup(d,void 0,{...c.attrs,dir:n})}),!0},Cy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,s=V.atStart(r).from,l=V.atEnd(r).to,c=bt(i,s,l),d=bt(o,s,l),u=V.create(r,c,d);e.setSelection(u)}return!0},Sy=n=>({state:e,dispatch:t})=>{const r=re(n,e.schema);return kp(r)(e,t)};function cl(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}var My=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:l,$to:c}=o,d=i.extensionManager.attributes,u=Kn(d,l.node().type.name,l.node().attrs);if(o instanceof P&&o.node.isBlock)return!l.parentOffset||!jt(s,l.pos)?!1:(r&&(n&&cl(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,h=l.depth===0?void 0:_g(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=jt(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&jt(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:u}]:void 0),r){if(m&&(o instanceof V&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,p),h&&!f&&!l.parentOffset&&l.parent.type!==h)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}n&&cl(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},Ty=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const l=re(n,r.schema),{$from:c,$to:d}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==l)return!1;const h=o.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let k=T.empty;const v=c.index(-1)?1:c.index(-2)?2:3;for(let C=c.depth-v;C>=c.depth-3;C-=1)k=T.from(c.node(C).copy(k));const b=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,x={...Kn(h,c.node().type.name,c.node().attrs),...e},w=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(x))||void 0;k=k.append(T.from(l.createAndFill(null,w)||void 0));const S=c.before(c.depth-(v-1));t.replace(S,c.after(-b),new B(k,4-v,0));let M=-1;t.doc.nodesBetween(S,t.doc.content.size,(C,A)=>{if(M>-1)return!1;C.isTextblock&&C.content.size===0&&(M=A+1)}),M>-1&&t.setSelection(V.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const p=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Kn(h,f.type.name,f.attrs),...e},g={...Kn(h,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,d.pos);const y=p?[{type:l,attrs:m},{type:p,attrs:g}]:[{type:l,attrs:m}];if(!jt(t.doc,c.pos,2))return!1;if(i){const{selection:k,storedMarks:v}=r,{splittableMarks:b}=o.extensionManager,x=v||k.$to.parentOffset&&k.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!x||!i)return!0;const w=x.filter(S=>b.includes(S.type.name));t.ensureMarks(w)}return!0},vi=(n,e)=>{const t=Xr(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&ht(n.doc,t.pos)&&n.join(t.pos),!0},xi=(n,e)=>{const t=Xr(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&ht(n.doc,r)&&n.join(r),!0},Ey=(n,e,t,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=re(n,s.schema),m=re(e,s.schema),{selection:g,storedMarks:y}=s,{$from:k,$to:v}=g,b=k.blockRange(v),x=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const w=Xr(S=>al(S.type.name,f))(g);if(b.depth>=1&&w&&b.depth-w.depth<=1){if(w.node.type===p)return d.liftListItem(m);if(al(w.node.type.name,f)&&p.validContent(w.node.content)&&l)return c().command(()=>(o.setNodeMarkup(w.pos,p),!0)).command(()=>vi(o,p)).command(()=>xi(o,p)).run()}return!t||!x||!l?c().command(()=>u().wrapInList(p,r)?!0:d.clearNodes()).wrapInList(p,r).command(()=>vi(o,p)).command(()=>xi(o,p)).run():c().command(()=>{const S=u().wrapInList(p,r),M=x.filter(C=>h.includes(C.type.name));return o.ensureMarks(M),S?!0:d.clearNodes()}).wrapInList(p,r).command(()=>vi(o,p)).command(()=>xi(o,p)).run()},Ny=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Ye(n,r.schema);return Qi(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},Ay=(n,e,t={})=>({state:r,commands:i})=>{const o=re(n,r.schema),s=re(e,r.schema),l=ft(r,o,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),l?i.setNode(s,c):i.setNode(o,{...c,...t})},By=(n,e={})=>({state:t,commands:r})=>{const i=re(n,t.schema);return ft(t,i,e)?r.lift(i):r.wrapIn(i,e)},Oy=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const s=n.tr,l=o.transform;for(let c=l.steps.length-1;c>=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(o.text){const c=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,n.schema.text(o.text,c))}else s.delete(o.from,o.to)}return!0}}return!1},Dy=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},Iy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,c=Ye(n,r.schema),{$from:d,empty:u,ranges:f}=l;if(!i)return!0;if(u&&s){let{from:h,to:p}=l;const m=(o=d.marks().find(y=>y.type===c))==null?void 0:o.attrs,g=Oo(d,c,m);g&&(h=g.from,p=g.to),t.removeMark(h,p,c)}else f.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,c)});return t.removeStoredMark(c),!0},$y=n=>({tr:e,state:t,dispatch:r})=>{const{selection:i}=t;let o,s;return typeof n=="number"?(o=n,s=n):n&&"from"in n&&"to"in n?(o=n.from,s=n.to):(o=i.from,s=i.to),r&&e.doc.nodesBetween(o,s,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},Ry=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=Qr(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(o=re(n,r.schema)),l==="mark"&&(s=Ye(n,r.schema));let c=!1;return t.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let h,p,m,g;t.selection.empty?r.doc.nodesBetween(u,f,(y,k)=>{o&&o===y.type&&(c=!0,m=Math.max(k,u),g=Math.min(k+y.nodeSize,f),h=k,p=y)}):r.doc.nodesBetween(u,f,(y,k)=>{k<u&&o&&o===y.type&&(c=!0,m=Math.max(k,u),g=Math.min(k+y.nodeSize,f),h=k,p=y),k>=u&&k<=f&&(o&&o===y.type&&(c=!0,i&&t.setNodeMarkup(k,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(c=!0,i)){const b=Math.max(k,u),x=Math.min(k+y.nodeSize,f);t.addMark(b,x,s.create({...v.attrs,...e}))}}))}),p&&(h!==void 0&&i&&t.setNodeMarkup(h,void 0,{...p.attrs,...e}),s&&p.marks.length&&p.marks.forEach(y=>{s===y.type&&i&&t.addMark(m,g,s.create({...y.attrs,...e}))}))}),c},Ly=(n,e={})=>({state:t,dispatch:r})=>{const i=re(n,t.schema);return up(i,e)(t,r)},zy=(n,e={})=>({state:t,dispatch:r})=>{const i=re(n,t.schema);return fp(i,e)(t,r)},Py=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},_r=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},Vy=(n,e)=>{if(Bo(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function zn(n){var e;const{editor:t,from:r,to:i,text:o,rules:s,plugin:l}=n,{view:c}=t;if(c.composing)return!1;const d=c.state.doc.resolve(r);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const f=uy(d)+o;return s.forEach(h=>{if(u)return;const p=Vy(f,h.find);if(!p)return;const m=c.state.tr,g=Gr({state:c.state,transaction:m}),y={from:r-(p[0].length-o.length),to:i},{commands:k,chain:v,can:b}=new Yr({editor:t,state:g});h.handler({state:g,range:y,match:p,commands:k,chain:v,can:b})===null||!m.steps.length||(h.undoable&&m.setMeta(l,{transform:m,from:r,to:i,text:o}),c.dispatch(m),u=!0)}),u}function Fy(n){const{editor:e,rules:t}=n,r=new Z({state:{init(){return null},apply(i,o,s){const l=i.getMeta(r);if(l)return l;const c=i.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=$o(T.from(u),s.schema);const{from:f}=c,h=f+u.length;zn({editor:e,from:f,to:h,text:u,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,l){return zn({editor:e,from:o,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&zn({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?zn({editor:e,from:s.pos,to:s.pos,text:`
16
- `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Hy(n){return Object.prototype.toString.call(n).slice(8,-1)}function Pn(n){return Hy(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function pc(n,e){const t={...n};return Pn(n)&&Pn(e)&&Object.keys(e).forEach(r=>{Pn(e[r])&&Pn(n[r])?t[r]=pc(n[r],e[r]):t[r]=e[r]}),t}var zo=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...G(z(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...G(z(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>pc(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},It=class mc extends zo{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new mc(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(d=>d?.type.name===t.name))return!1;const c=s.find(d=>d?.type.name===t.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function jy(n){return typeof n=="number"}var Uy=class{constructor(n){this.find=n.find,this.handler=n.handler}},qy=(n,e,t)=>{if(Bo(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function Wy(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=n,{commands:c,chain:d,can:u}=new Yr({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,i,(p,m)=>{var g,y,k,v,b;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const x=(b=(v=(k=p.content)==null?void 0:k.size)!=null?v:p.nodeSize)!=null?b:0,w=Math.max(r,m),S=Math.min(i,m+x);if(w>=S)return;const M=p.isText?p.text||"":p.textBetween(w-m,S-m,void 0,"");qy(M,o.find,s).forEach(A=>{if(A.index===void 0)return;const $=w+A.index+1,U=$+A[0].length,j={from:t.tr.mapping.map($),to:t.tr.mapping.map(U)},K=o.handler({state:t,range:j,match:A,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:l});f.push(K)})}),f.every(p=>p!==null)}var Vn=null,Ky=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function Jy(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:f,to:h,rule:p,pasteEvt:m})=>{const g=u.tr,y=Gr({state:u,transaction:g});if(!(!Wy({editor:e,state:y,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new Z({view(f){const h=m=>{var g;r=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,r&&(Vn=e)},p=()=>{Vn&&(Vn=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(f,h)=>{if(o=r===f.dom.parentElement,l=h,!o){const p=Vn;p?.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,h)=>{var p;const m=(p=h.clipboardData)==null?void 0:p.getData("text/html");return s=h,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!i,y=m.getMeta("uiEvent")==="drop"&&!o,k=m.getMeta("applyPasteRules"),v=!!k;if(!g&&!y&&!v)return;if(v){let{text:w}=k;typeof w=="string"?w=w:w=$o(T.from(w),p.schema);const{from:S}=k,M=S+w.length,C=Ky(w);return c({rule:u,state:p,from:S,to:{b:M},pasteEvt:C})}const b=h.doc.content.findDiffStart(p.doc.content),x=h.doc.content.findDiffEnd(p.doc.content);if(!(!jy(b)||!x||b===x.b))return c({rule:u,state:p,from:b,to:x,pasteEvt:s})}}))}var ei=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=sc(n),this.schema=iy(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:bi(e.name,this.schema)},r=z(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return Ro([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:bi(r.name,this.schema)},o=[],s=z(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&z(r,"exitable",i)&&(l.ArrowRight=()=>It.handleExit({editor:n,mark:r})),s){const h=Object.fromEntries(Object.entries(s()).map(([p,m])=>[p,()=>m({editor:n})]));l={...l,...h}}const c=lg(l);o.push(c);const d=z(r,"addInputRules",i);if(ll(r,n.options.enableInputRules)&&d){const h=d();if(h&&h.length){const p=Fy({editor:n,rules:h}),m=Array.isArray(p)?p:[p];o.push(...m)}}const u=z(r,"addPasteRules",i);if(ll(r,n.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const p=Jy({editor:n,rules:h});o.push(...p)}}const f=z(r,"addProseMirrorPlugins",i);if(f){const h=f();o.push(...h)}return o})}get attributes(){return oc(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Qt(this.extensions);return Object.fromEntries(e.filter(t=>!!z(t,"addNodeView")).map(t=>{const r=this.attributes.filter(c=>c.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:re(t.name,this.schema)},o=z(t,"addNodeView",i);if(!o)return[];const s=o();if(!s)return[];const l=(c,d,u,f,h)=>{const p=lr(c,r);return s({node:c,view:d,getPos:u,decorations:f,innerDecorations:h,editor:n,extension:t,HTMLAttributes:p})};return[t.name,l]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=Qt(this.extensions);return Object.fromEntries(e.filter(t=>!!z(t,"addMarkView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Ye(t.name,this.schema)},o=z(t,"addMarkView",i);if(!o)return[];const s=(l,c,d)=>{const u=lr(l,r);return o()({mark:l,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{l0(l,n,f)}})};return[t.name,s]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:bi(e.name,this.schema)};e.type==="mark"&&((t=G(z(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const i=z(e,"onBeforeCreate",r),o=z(e,"onCreate",r),s=z(e,"onUpdate",r),l=z(e,"onSelectionUpdate",r),c=z(e,"onTransaction",r),d=z(e,"onFocus",r),u=z(e,"onBlur",r),f=z(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};ei.resolve=sc;ei.sort=Ro;ei.flatten=Io;var Gy={};Ao(Gy,{ClipboardTextSerializer:()=>yc,Commands:()=>kc,Delete:()=>bc,Drop:()=>vc,Editable:()=>xc,FocusEvents:()=>Cc,Keymap:()=>Sc,Paste:()=>Mc,Tabindex:()=>Tc,TextDirection:()=>Ec,focusEventsPluginKey:()=>wc});var te=class gc extends zo{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new gc(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},yc=te.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Z({key:new oe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),l=Math.max(...o.map(u=>u.$to.pos)),c=ac(t);return lc(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),kc=te.create({name:"commands",addCommands(){return{...Qa}}}),bc=te.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const o=()=>{var s,l,c,d;if((d=(c=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,n))!=null?d:n.getMeta("y-sync$"))return;const u=rc(n.before,[n,...e]);dc(u).forEach(p=>{u.mapping.mapResult(p.oldRange.from).deletedAfter&&u.mapping.mapResult(p.oldRange.to).deletedBefore&&u.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,k=p.oldRange.from<=g&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!k,editor:this.editor,transaction:n,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((p,m)=>{var g,y;if(p instanceof $e){const k=h.slice(m).map(p.from,-1),v=h.slice(m).map(p.to),b=h.invert().map(k,-1),x=h.invert().map(v),w=(g=u.doc.nodeAt(k-1))==null?void 0:g.marks.some(M=>M.eq(p.mark)),S=(y=u.doc.nodeAt(v))==null?void 0:y.marks.some(M=>M.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:b,to:x},newRange:{from:k,to:v},partial:!!(S||w),editor:this.editor,transaction:n,combinedTransform:u})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(o,0):o()}}),vc=te.create({name:"drop",addProseMirrorPlugins(){return[new Z({key:new oe("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),xc=te.create({name:"editable",addProseMirrorPlugins(){return[new Z({key:new oe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wc=new oe("focusEvents"),Cc=te.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Z({key:wc,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Sc=te.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:f}=c,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?l.doc.resolve(h-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,k=g&&m.parent.childCount===1?y===f.pos:H.atStart(d).from===h;return!u||!p.type.isTextblock||p.textContent.length||!k||k&&f.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:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 Do()||tc()?o:i},addProseMirrorPlugins(){return[new Z({key:new oe("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),i=n.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:l}=e.selection,c=H.atStart(e.doc).from,d=H.atEnd(e.doc).to;if(o||!(s===c&&l===d)||!Zr(t.doc))return;const h=t.tr,p=Gr({state:t,transaction:h}),{commands:m}=new Yr({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),Mc=te.create({name:"paste",addProseMirrorPlugins(){return[new Z({key:new oe("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Tc=te.create({name:"tabindex",addProseMirrorPlugins(){return[new Z({key:new oe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Ec=te.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Qt(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Z({key:new oe("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),Yy=class Vt{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}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 t=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}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,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),t=this.resolvedPos.doc.resolve(e);return new Vt(t,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 Vt(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 Vt(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,o=t.isAtom&&!t.isText,s=this.pos+r+(o?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!i&&l.depth<=this.depth)return;const c=new Vt(l,this.editor,i,i?t:null);i&&(c.actualDepth=this.depth+1),e.push(new Vt(l,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;)i.node.type.name===e&&(Object.keys(t).length>0||(r=i)),i=i.parent;return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(t);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(c=>t[c]===s.node.attrs[c])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Qy=`.ProseMirror {
15
+ `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(r,i,(c,d,u,f)=>{var h;c.isBlock&&d>r&&(l+=o);const p=s?.[c.type.name];if(p)return u&&(l+=p({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(l+=(h=c?.text)==null?void 0:h.slice(Math.max(r,d)-d,i-d))}),l}function ly(n,e){const t={from:0,to:n.content.size};return lc(n,t,e)}function ac(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function ay(n,e){const t=re(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,l=>{o.push(l)});const s=o.reverse().find(l=>l.type.name===t.name);return s?{...s.attrs}:{}}function cc(n,e){const t=Qr(typeof e=="string"?e:e.name,n.schema);return t==="node"?ay(n,e):t==="mark"?nc(n,e):{}}function cy(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function dy(n){const e=cy(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,s)=>s!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function dc(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((l,c)=>{s.push({from:l,to:c})});else{const{from:l,to:c}=t[o];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{const d=e.slice(o).map(l,-1),u=e.slice(o).map(c),f=e.invert().map(d,-1),h=e.invert().map(u);r.push({oldRange:{from:f,to:h},newRange:{from:d,to:u}})})}),dy(r)}function Lo(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=Oo(o,i.type);s&&r.push({mark:i,...s})}):t.nodesBetween(n,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}var uy=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let o=r,s=null;for(;o>0&&s===null;){const l=i.node(o);l?.type.name===e?s=l:o-=1}return[s,o]};function bi(n,e){return e.nodes[n]||e.marks[n]||null}function Kn(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}var fy=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var c,d;const u=((d=(c=i.type.spec).toText)==null?void 0:d.call(c,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),t};function Qi(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Ye(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>sr(f.attrs,t,{strict:!1}));let s=0;const l=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;n.doc.nodesBetween(p,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const k=Math.max(p,y),v=Math.min(m,y+g.nodeSize),b=v-k;s+=b,l.push(...g.marks.map(x=>({mark:x,from:k,to:v})))})}),s===0)return!1;const c=l.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>sr(f.mark.attrs,t,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),d=l.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,h)=>f+h.to-h.from,0);return(c>0?c+d:c)>=s}function hy(n,e,t={}){if(!e)return ft(n,null,t)||Qi(n,null,t);const r=Qr(e,n.schema);return r==="node"?ft(n,e,t):r==="mark"?Qi(n,e,t):!1}var py=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const o=Xr(l=>l.type.name===e)(n.selection);if(!o)return!1;const s=n.doc.resolve(o.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},my=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function ll(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function al(n,e){const{nodeExtensions:t}=Qt(e),r=t.find(s=>s.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=G(z(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Zr(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&(Zr(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function uc(n){return n instanceof P}var fc=class hc{constructor(e){this.position=e}static fromJSON(e){return new hc(e.position)}toJSON(){return{position:this.position}}};function gy(n,e){const t=e.mapping.mapResult(n.position);return{position:new fc(t.pos),mapResult:t}}function yy(n){return new fc(n)}function ky(n,e,t){var r;const{selection:i}=e;let o=null;if(Za(i)&&(o=i.$cursor),o){const l=(r=n.storedMarks)!=null?r:o.marks();return o.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(d=>d.type.excludes(t)))}const{ranges:s}=i;return s.some(({$from:l,$to:c})=>{let d=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,c.pos,(u,f,h)=>{if(d)return!1;if(u.isInline){const p=!h||h.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=p&&m}return!d}),d})}var by=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:l}=o,c=Ye(n,r.schema);if(i)if(s){const d=nc(r,c);t.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;r.doc.nodesBetween(u,f,(h,p)=>{const m=Math.max(p,u),g=Math.min(p+h.nodeSize,f);h.marks.find(k=>k.type===c)?h.marks.forEach(k=>{c===k.type&&t.addMark(m,g,c.create({...k.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return ky(r,t,c)},vy=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),xy=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=re(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:l})=>ws(o,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>ws(o,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},wy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=bt(n,0,r.content.size),o=P.create(r,i);e.setSelection(o)}return!0},Cy=(n,e)=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=r;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=o.from,l=o.to),i&&t.doc.nodesBetween(s,l,(c,d)=>{c.isText||t.setNodeMarkup(d,void 0,{...c.attrs,dir:n})}),!0},Sy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,s=V.atStart(r).from,l=V.atEnd(r).to,c=bt(i,s,l),d=bt(o,s,l),u=V.create(r,c,d);e.setSelection(u)}return!0},My=n=>({state:e,dispatch:t})=>{const r=re(n,e.schema);return bp(r)(e,t)};function cl(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}var Ty=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:l,$to:c}=o,d=i.extensionManager.attributes,u=Kn(d,l.node().type.name,l.node().attrs);if(o instanceof P&&o.node.isBlock)return!l.parentOffset||!jt(s,l.pos)?!1:(r&&(n&&cl(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,h=l.depth===0?void 0:ey(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=jt(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&jt(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:u}]:void 0),r){if(m&&(o instanceof V&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,p),h&&!f&&!l.parentOffset&&l.parent.type!==h)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}n&&cl(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},Ey=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const l=re(n,r.schema),{$from:c,$to:d}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==l)return!1;const h=o.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let k=T.empty;const v=c.index(-1)?1:c.index(-2)?2:3;for(let C=c.depth-v;C>=c.depth-3;C-=1)k=T.from(c.node(C).copy(k));const b=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,x={...Kn(h,c.node().type.name,c.node().attrs),...e},w=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(x))||void 0;k=k.append(T.from(l.createAndFill(null,w)||void 0));const S=c.before(c.depth-(v-1));t.replace(S,c.after(-b),new B(k,4-v,0));let M=-1;t.doc.nodesBetween(S,t.doc.content.size,(C,A)=>{if(M>-1)return!1;C.isTextblock&&C.content.size===0&&(M=A+1)}),M>-1&&t.setSelection(V.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const p=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Kn(h,f.type.name,f.attrs),...e},g={...Kn(h,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,d.pos);const y=p?[{type:l,attrs:m},{type:p,attrs:g}]:[{type:l,attrs:m}];if(!jt(t.doc,c.pos,2))return!1;if(i){const{selection:k,storedMarks:v}=r,{splittableMarks:b}=o.extensionManager,x=v||k.$to.parentOffset&&k.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!x||!i)return!0;const w=x.filter(S=>b.includes(S.type.name));t.ensureMarks(w)}return!0},vi=(n,e)=>{const t=Xr(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&ht(n.doc,t.pos)&&n.join(t.pos),!0},xi=(n,e)=>{const t=Xr(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&ht(n.doc,r)&&n.join(r),!0},Ny=(n,e,t,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=re(n,s.schema),m=re(e,s.schema),{selection:g,storedMarks:y}=s,{$from:k,$to:v}=g,b=k.blockRange(v),x=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const w=Xr(S=>al(S.type.name,f))(g);if(b.depth>=1&&w&&b.depth-w.depth<=1){if(w.node.type===p)return d.liftListItem(m);if(al(w.node.type.name,f)&&p.validContent(w.node.content)&&l)return c().command(()=>(o.setNodeMarkup(w.pos,p),!0)).command(()=>vi(o,p)).command(()=>xi(o,p)).run()}return!t||!x||!l?c().command(()=>u().wrapInList(p,r)?!0:d.clearNodes()).wrapInList(p,r).command(()=>vi(o,p)).command(()=>xi(o,p)).run():c().command(()=>{const S=u().wrapInList(p,r),M=x.filter(C=>h.includes(C.type.name));return o.ensureMarks(M),S?!0:d.clearNodes()}).wrapInList(p,r).command(()=>vi(o,p)).command(()=>xi(o,p)).run()},Ay=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Ye(n,r.schema);return Qi(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},By=(n,e,t={})=>({state:r,commands:i})=>{const o=re(n,r.schema),s=re(e,r.schema),l=ft(r,o,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),l?i.setNode(s,c):i.setNode(o,{...c,...t})},Oy=(n,e={})=>({state:t,commands:r})=>{const i=re(n,t.schema);return ft(t,i,e)?r.lift(i):r.wrapIn(i,e)},Dy=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const s=n.tr,l=o.transform;for(let c=l.steps.length-1;c>=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(o.text){const c=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,n.schema.text(o.text,c))}else s.delete(o.from,o.to)}return!0}}return!1},Iy=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},$y=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,c=Ye(n,r.schema),{$from:d,empty:u,ranges:f}=l;if(!i)return!0;if(u&&s){let{from:h,to:p}=l;const m=(o=d.marks().find(y=>y.type===c))==null?void 0:o.attrs,g=Oo(d,c,m);g&&(h=g.from,p=g.to),t.removeMark(h,p,c)}else f.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,c)});return t.removeStoredMark(c),!0},Ry=n=>({tr:e,state:t,dispatch:r})=>{const{selection:i}=t;let o,s;return typeof n=="number"?(o=n,s=n):n&&"from"in n&&"to"in n?(o=n.from,s=n.to):(o=i.from,s=i.to),r&&e.doc.nodesBetween(o,s,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},Ly=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=Qr(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(o=re(n,r.schema)),l==="mark"&&(s=Ye(n,r.schema));let c=!1;return t.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let h,p,m,g;t.selection.empty?r.doc.nodesBetween(u,f,(y,k)=>{o&&o===y.type&&(c=!0,m=Math.max(k,u),g=Math.min(k+y.nodeSize,f),h=k,p=y)}):r.doc.nodesBetween(u,f,(y,k)=>{k<u&&o&&o===y.type&&(c=!0,m=Math.max(k,u),g=Math.min(k+y.nodeSize,f),h=k,p=y),k>=u&&k<=f&&(o&&o===y.type&&(c=!0,i&&t.setNodeMarkup(k,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(c=!0,i)){const b=Math.max(k,u),x=Math.min(k+y.nodeSize,f);t.addMark(b,x,s.create({...v.attrs,...e}))}}))}),p&&(h!==void 0&&i&&t.setNodeMarkup(h,void 0,{...p.attrs,...e}),s&&p.marks.length&&p.marks.forEach(y=>{s===y.type&&i&&t.addMark(m,g,s.create({...y.attrs,...e}))}))}),c},zy=(n,e={})=>({state:t,dispatch:r})=>{const i=re(n,t.schema);return fp(i,e)(t,r)},Py=(n,e={})=>({state:t,dispatch:r})=>{const i=re(n,t.schema);return hp(i,e)(t,r)},Vy=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},_r=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},Fy=(n,e)=>{if(Bo(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function zn(n){var e;const{editor:t,from:r,to:i,text:o,rules:s,plugin:l}=n,{view:c}=t;if(c.composing)return!1;const d=c.state.doc.resolve(r);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const f=fy(d)+o;return s.forEach(h=>{if(u)return;const p=Fy(f,h.find);if(!p)return;const m=c.state.tr,g=Gr({state:c.state,transaction:m}),y={from:r-(p[0].length-o.length),to:i},{commands:k,chain:v,can:b}=new Yr({editor:t,state:g});h.handler({state:g,range:y,match:p,commands:k,chain:v,can:b})===null||!m.steps.length||(h.undoable&&m.setMeta(l,{transform:m,from:r,to:i,text:o}),c.dispatch(m),u=!0)}),u}function Hy(n){const{editor:e,rules:t}=n,r=new Z({state:{init(){return null},apply(i,o,s){const l=i.getMeta(r);if(l)return l;const c=i.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=$o(T.from(u),s.schema);const{from:f}=c,h=f+u.length;zn({editor:e,from:f,to:h,text:u,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,l){return zn({editor:e,from:o,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&zn({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?zn({editor:e,from:s.pos,to:s.pos,text:`
16
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function jy(n){return Object.prototype.toString.call(n).slice(8,-1)}function Pn(n){return jy(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function pc(n,e){const t={...n};return Pn(n)&&Pn(e)&&Object.keys(e).forEach(r=>{Pn(e[r])&&Pn(n[r])?t[r]=pc(n[r],e[r]):t[r]=e[r]}),t}var zo=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...G(z(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...G(z(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>pc(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},It=class mc extends zo{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new mc(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(d=>d?.type.name===t.name))return!1;const c=s.find(d=>d?.type.name===t.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Uy(n){return typeof n=="number"}var qy=class{constructor(n){this.find=n.find,this.handler=n.handler}},Wy=(n,e,t)=>{if(Bo(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function Ky(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=n,{commands:c,chain:d,can:u}=new Yr({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,i,(p,m)=>{var g,y,k,v,b;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const x=(b=(v=(k=p.content)==null?void 0:k.size)!=null?v:p.nodeSize)!=null?b:0,w=Math.max(r,m),S=Math.min(i,m+x);if(w>=S)return;const M=p.isText?p.text||"":p.textBetween(w-m,S-m,void 0,"");Wy(M,o.find,s).forEach(A=>{if(A.index===void 0)return;const $=w+A.index+1,U=$+A[0].length,j={from:t.tr.mapping.map($),to:t.tr.mapping.map(U)},K=o.handler({state:t,range:j,match:A,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:l});f.push(K)})}),f.every(p=>p!==null)}var Vn=null,Jy=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function Gy(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:f,to:h,rule:p,pasteEvt:m})=>{const g=u.tr,y=Gr({state:u,transaction:g});if(!(!Ky({editor:e,state:y,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new Z({view(f){const h=m=>{var g;r=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,r&&(Vn=e)},p=()=>{Vn&&(Vn=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(f,h)=>{if(o=r===f.dom.parentElement,l=h,!o){const p=Vn;p?.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,h)=>{var p;const m=(p=h.clipboardData)==null?void 0:p.getData("text/html");return s=h,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!i,y=m.getMeta("uiEvent")==="drop"&&!o,k=m.getMeta("applyPasteRules"),v=!!k;if(!g&&!y&&!v)return;if(v){let{text:w}=k;typeof w=="string"?w=w:w=$o(T.from(w),p.schema);const{from:S}=k,M=S+w.length,C=Jy(w);return c({rule:u,state:p,from:S,to:{b:M},pasteEvt:C})}const b=h.doc.content.findDiffStart(p.doc.content),x=h.doc.content.findDiffEnd(p.doc.content);if(!(!Uy(b)||!x||b===x.b))return c({rule:u,state:p,from:b,to:x,pasteEvt:s})}}))}var ei=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=sc(n),this.schema=oy(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:bi(e.name,this.schema)},r=z(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return Ro([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:bi(r.name,this.schema)},o=[],s=z(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&z(r,"exitable",i)&&(l.ArrowRight=()=>It.handleExit({editor:n,mark:r})),s){const h=Object.fromEntries(Object.entries(s()).map(([p,m])=>[p,()=>m({editor:n})]));l={...l,...h}}const c=ag(l);o.push(c);const d=z(r,"addInputRules",i);if(ll(r,n.options.enableInputRules)&&d){const h=d();if(h&&h.length){const p=Hy({editor:n,rules:h}),m=Array.isArray(p)?p:[p];o.push(...m)}}const u=z(r,"addPasteRules",i);if(ll(r,n.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const p=Gy({editor:n,rules:h});o.push(...p)}}const f=z(r,"addProseMirrorPlugins",i);if(f){const h=f();o.push(...h)}return o})}get attributes(){return oc(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Qt(this.extensions);return Object.fromEntries(e.filter(t=>!!z(t,"addNodeView")).map(t=>{const r=this.attributes.filter(c=>c.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:re(t.name,this.schema)},o=z(t,"addNodeView",i);if(!o)return[];const s=o();if(!s)return[];const l=(c,d,u,f,h)=>{const p=lr(c,r);return s({node:c,view:d,getPos:u,decorations:f,innerDecorations:h,editor:n,extension:t,HTMLAttributes:p})};return[t.name,l]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=Qt(this.extensions);return Object.fromEntries(e.filter(t=>!!z(t,"addMarkView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Ye(t.name,this.schema)},o=z(t,"addMarkView",i);if(!o)return[];const s=(l,c,d)=>{const u=lr(l,r);return o()({mark:l,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{a0(l,n,f)}})};return[t.name,s]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:bi(e.name,this.schema)};e.type==="mark"&&((t=G(z(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const i=z(e,"onBeforeCreate",r),o=z(e,"onCreate",r),s=z(e,"onUpdate",r),l=z(e,"onSelectionUpdate",r),c=z(e,"onTransaction",r),d=z(e,"onFocus",r),u=z(e,"onBlur",r),f=z(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};ei.resolve=sc;ei.sort=Ro;ei.flatten=Io;var Yy={};Ao(Yy,{ClipboardTextSerializer:()=>yc,Commands:()=>kc,Delete:()=>bc,Drop:()=>vc,Editable:()=>xc,FocusEvents:()=>Cc,Keymap:()=>Sc,Paste:()=>Mc,Tabindex:()=>Tc,TextDirection:()=>Ec,focusEventsPluginKey:()=>wc});var te=class gc extends zo{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new gc(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},yc=te.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Z({key:new oe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),l=Math.max(...o.map(u=>u.$to.pos)),c=ac(t);return lc(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),kc=te.create({name:"commands",addCommands(){return{...Qa}}}),bc=te.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const o=()=>{var s,l,c,d;if((d=(c=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,n))!=null?d:n.getMeta("y-sync$"))return;const u=rc(n.before,[n,...e]);dc(u).forEach(p=>{u.mapping.mapResult(p.oldRange.from).deletedAfter&&u.mapping.mapResult(p.oldRange.to).deletedBefore&&u.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,k=p.oldRange.from<=g&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!k,editor:this.editor,transaction:n,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((p,m)=>{var g,y;if(p instanceof $e){const k=h.slice(m).map(p.from,-1),v=h.slice(m).map(p.to),b=h.invert().map(k,-1),x=h.invert().map(v),w=(g=u.doc.nodeAt(k-1))==null?void 0:g.marks.some(M=>M.eq(p.mark)),S=(y=u.doc.nodeAt(v))==null?void 0:y.marks.some(M=>M.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:b,to:x},newRange:{from:k,to:v},partial:!!(S||w),editor:this.editor,transaction:n,combinedTransform:u})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(o,0):o()}}),vc=te.create({name:"drop",addProseMirrorPlugins(){return[new Z({key:new oe("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),xc=te.create({name:"editable",addProseMirrorPlugins(){return[new Z({key:new oe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wc=new oe("focusEvents"),Cc=te.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Z({key:wc,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Sc=te.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:f}=c,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?l.doc.resolve(h-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,k=g&&m.parent.childCount===1?y===f.pos:H.atStart(d).from===h;return!u||!p.type.isTextblock||p.textContent.length||!k||k&&f.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:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 Do()||tc()?o:i},addProseMirrorPlugins(){return[new Z({key:new oe("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),i=n.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:l}=e.selection,c=H.atStart(e.doc).from,d=H.atEnd(e.doc).to;if(o||!(s===c&&l===d)||!Zr(t.doc))return;const h=t.tr,p=Gr({state:t,transaction:h}),{commands:m}=new Yr({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),Mc=te.create({name:"paste",addProseMirrorPlugins(){return[new Z({key:new oe("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Tc=te.create({name:"tabindex",addProseMirrorPlugins(){return[new Z({key:new oe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Ec=te.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Qt(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Z({key:new oe("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),Qy=class Vt{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}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 t=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}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,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),t=this.resolvedPos.doc.resolve(e);return new Vt(t,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 Vt(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 Vt(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,o=t.isAtom&&!t.isText,s=this.pos+r+(o?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!i&&l.depth<=this.depth)return;const c=new Vt(l,this.editor,i,i?t:null);i&&(c.actualDepth=this.depth+1),e.push(new Vt(l,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;)i.node.type.name===e&&(Object.keys(t).length>0||(r=i)),i=i.parent;return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(t);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(c=>t[c]===s.node.attrs[c])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Xy=`.ProseMirror {
17
17
  position: relative;
18
18
  }
19
19
 
@@ -83,15 +83,15 @@ img.ProseMirror-separator {
83
83
 
84
84
  .ProseMirror-focused .ProseMirror-gapcursor {
85
85
  display: block;
86
- }`;function Xy(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var Zy=class extends Py{constructor(e={}){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,textDirection:void 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:i})=>{throw i},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:my,createMappablePosition:gy},this.setOptions(e),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:i,slice:o,moved:s})=>this.options.onDrop(i,o,s)),this.on("paste",({event:i,slice:o})=>this.options.onPaste(i,o)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=_a(t,this.options.autofocus);this.editorState=Ht.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){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(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.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(e){console.warn("Failed to remove CSS element:",e)}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=Xy(Qy,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&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:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=ic(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(o=>{const s=typeof o=="string"?`${o}$`:o.key;r=r.filter(l=>!l.key.startsWith(s))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[xc,yc.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),kc,Cc,Sc,Tc,vc,Mc,bc,Ec.configure({direction:this.options.textDirection})].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 ei(i,this)}createCommandManager(){this.commandManager=new Yr({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Yi(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,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(r=>r.name!=="collaboration"),this.createExtensionManager()}}),e=Yi(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new Ga(e,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)==null?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.prependClass(),this.injectCSS();const i=this.view.dom;i.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(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),i=!this.state.selection.eq(t.selection),o=r.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=r.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),c=l?.getMeta("focus"),d=l?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),d&&this.emit("blur",{editor:this,event:d.event,transaction:l}),!(e.getMeta("preventUpdate")||!r.some(u=>u.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return cc(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return fy(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $o(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
86
+ }`;function Zy(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var _y=class extends Vy{constructor(e={}){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,textDirection:void 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:i})=>{throw i},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:gy,createMappablePosition:yy},this.setOptions(e),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:i,slice:o,moved:s})=>this.options.onDrop(i,o,s)),this.on("paste",({event:i,slice:o})=>this.options.onPaste(i,o)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=_a(t,this.options.autofocus);this.editorState=Ht.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){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(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.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(e){console.warn("Failed to remove CSS element:",e)}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=Zy(Xy,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&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:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=ic(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(o=>{const s=typeof o=="string"?`${o}$`:o.key;r=r.filter(l=>!l.key.startsWith(s))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[xc,yc.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),kc,Cc,Sc,Tc,vc,Mc,bc,Ec.configure({direction:this.options.textDirection})].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 ei(i,this)}createCommandManager(){this.commandManager=new Yr({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Yi(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,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(r=>r.name!=="collaboration"),this.createExtensionManager()}}),e=Yi(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new Ga(e,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)==null?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.prependClass(),this.injectCSS();const i=this.view.dom;i.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(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),i=!this.state.selection.eq(t.selection),o=r.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=r.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),c=l?.getMeta("focus"),d=l?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),d&&this.emit("blur",{editor:this,event:d.event,transaction:l}),!(e.getMeta("preventUpdate")||!r.some(u=>u.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return cc(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return hy(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $o(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
87
87
 
88
- `,textSerializers:r={}}=e||{};return sy(this.state.doc,{blockSeparator:t,textSerializers:{...ac(this.schema),...r}})}get isEmpty(){return Zr(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Yy(t,this)}get $doc(){return this.$pos(0)}};function Xt(n){return new _r({find:n.find,handler:({state:e,range:t,match:r})=>{const i=G(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],l=r[0];if(s){const c=l.search(/\S/),d=t.from+l.indexOf(s),u=d+s.length;if(Lo(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;u<t.to&&o.delete(u,t.to),d>t.from&&o.delete(t.from+c,d);const h=t.from+c+s.length;o.addMark(t.from+c,h,n.type.create(i||{})),o.removeStoredMark(n.type)}},undoable:n.undoable})}function _y(n){return new _r({find:n.find,handler:({state:e,range:t,match:r})=>{const i=G(n.getAttributes,void 0,r)||{},{tr:o}=e,s=t.from;let l=t.to;const c=n.type.create(i);if(r[1]){const d=r[0].lastIndexOf(r[1]);let u=s+d;u>l?u=l:l=u+r[1].length;const f=r[0][r[0].length-1];o.insertText(f,s+r[0].length-1),o.replaceWith(u,l,c)}else if(r[0]){const d=n.type.isInline?s:s-1;o.insert(d,n.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()},undoable:n.undoable})}function Xi(n){return new _r({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=G(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)},undoable:n.undoable})}function Zt(n){return new _r({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=G(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),c=s.doc.resolve(t.from).blockRange(),d=c&&go(c,n.type,o);if(!d)return null;if(s.wrap(c,d),n.keepMarks&&n.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=n.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>p.includes(y.type.name));s.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,o).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&ht(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&s.join(t.from-1)},undoable:n.undoable})}function e0(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof P){const o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){const o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}var t0={};Ao(t0,{createAtomBlockMarkdownSpec:()=>n0,createBlockMarkdownSpec:()=>r0,createInlineMarkdownSpec:()=>s0,parseAttributes:()=>Po,parseIndentedBlocks:()=>Zi,renderNestedMarkdownContent:()=>Fo,serializeAttributes:()=>Vo});function Po(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,d=>(t.push(d),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const d=i.map(u=>u.trim().slice(1));e.class=d.join(" ")}const o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,d,u])=>{var f;const h=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),p=t[h];p&&(e[d]=p.slice(1,-1))});const c=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 c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Vo(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function n0(n){const{nodeName:e,name:t,parseAttributes:r=Po,serializeAttributes:i=Vo,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:l}=n,c=t||e,d=u=>{if(!l)return u;const f={};return l.forEach(h=>{h in u&&(f[h]=u[h])}),f};return{parseMarkdown:(u,f)=>{const h={...o,...u.attributes};return f.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const h=new RegExp(`^:::${c}(?:\\s|$)`,"m"),p=(f=u.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(u,f,h){const p=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(p);if(!m)return;const g=m[1]||"",y=r(g);if(!s.find(v=>!(v in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:u=>{const f=d(u.attrs||{}),h=i(f),p=h?` {${h}}`:"";return`:::${c}${p} :::`}}}function r0(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Po,serializeAttributes:o=Vo,defaultAttributes:s={},content:l="block",allowedAttributes:c}=n,d=t||e,u=f=>{if(!c)return f;const h={};return c.forEach(p=>{p in f&&(h[p]=f[p])}),h};return{parseMarkdown:(f,h)=>{let p;if(r){const g=r(f);p=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?p=h.parseChildren(f.tokens||[]):p=h.parseInline(f.tokens||[]);const m={...s,...f.attributes};return h.createNode(e,m,p)},markdownTokenizer:{name:e,level:"block",start(f){var h;const p=new RegExp(`^:::${d}`,"m"),m=(h=f.match(p))==null?void 0:h.index;return m!==void 0?m:-1},tokenize(f,h,p){var m;const g=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[k,v=""]=y,b=i(v);let x=1;const w=k.length;let S="";const M=/^:::([\w-]*)(\s.*)?/gm,C=f.slice(w);for(M.lastIndex=0;;){const A=M.exec(C);if(A===null)break;const $=A.index,U=A[1];if(!((m=A[2])!=null&&m.endsWith(":::"))){if(U)x+=1;else if(x-=1,x===0){const j=C.slice(0,$);S=j.trim();const K=f.slice(0,w+$+A[0].length);let N=[];if(S)if(l==="block")for(N=p.blockTokens(j),N.forEach(D=>{D.text&&(!D.tokens||D.tokens.length===0)&&(D.tokens=p.inlineTokens(D.text))});N.length>0;){const D=N[N.length-1];if(D.type==="paragraph"&&(!D.text||D.text.trim()===""))N.pop();else break}else N=p.inlineTokens(S);return{type:e,raw:K,attributes:b,content:S,tokens:N}}}}}},renderMarkdown:(f,h)=>{const p=u(f.attrs||{}),m=o(p),g=m?` {${m}}`:"",y=h.renderChildren(f.content||[],`
88
+ `,textSerializers:r={}}=e||{};return ly(this.state.doc,{blockSeparator:t,textSerializers:{...ac(this.schema),...r}})}get isEmpty(){return Zr(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Qy(t,this)}get $doc(){return this.$pos(0)}};function Xt(n){return new _r({find:n.find,handler:({state:e,range:t,match:r})=>{const i=G(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],l=r[0];if(s){const c=l.search(/\S/),d=t.from+l.indexOf(s),u=d+s.length;if(Lo(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;u<t.to&&o.delete(u,t.to),d>t.from&&o.delete(t.from+c,d);const h=t.from+c+s.length;o.addMark(t.from+c,h,n.type.create(i||{})),o.removeStoredMark(n.type)}},undoable:n.undoable})}function e0(n){return new _r({find:n.find,handler:({state:e,range:t,match:r})=>{const i=G(n.getAttributes,void 0,r)||{},{tr:o}=e,s=t.from;let l=t.to;const c=n.type.create(i);if(r[1]){const d=r[0].lastIndexOf(r[1]);let u=s+d;u>l?u=l:l=u+r[1].length;const f=r[0][r[0].length-1];o.insertText(f,s+r[0].length-1),o.replaceWith(u,l,c)}else if(r[0]){const d=n.type.isInline?s:s-1;o.insert(d,n.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()},undoable:n.undoable})}function Xi(n){return new _r({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=G(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)},undoable:n.undoable})}function Zt(n){return new _r({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=G(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),c=s.doc.resolve(t.from).blockRange(),d=c&&go(c,n.type,o);if(!d)return null;if(s.wrap(c,d),n.keepMarks&&n.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=n.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>p.includes(y.type.name));s.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,o).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&ht(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&s.join(t.from-1)},undoable:n.undoable})}function t0(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof P){const o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){const o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}var n0={};Ao(n0,{createAtomBlockMarkdownSpec:()=>r0,createBlockMarkdownSpec:()=>i0,createInlineMarkdownSpec:()=>l0,parseAttributes:()=>Po,parseIndentedBlocks:()=>Zi,renderNestedMarkdownContent:()=>Fo,serializeAttributes:()=>Vo});function Po(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,d=>(t.push(d),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const d=i.map(u=>u.trim().slice(1));e.class=d.join(" ")}const o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,d,u])=>{var f;const h=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),p=t[h];p&&(e[d]=p.slice(1,-1))});const c=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 c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Vo(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function r0(n){const{nodeName:e,name:t,parseAttributes:r=Po,serializeAttributes:i=Vo,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:l}=n,c=t||e,d=u=>{if(!l)return u;const f={};return l.forEach(h=>{h in u&&(f[h]=u[h])}),f};return{parseMarkdown:(u,f)=>{const h={...o,...u.attributes};return f.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const h=new RegExp(`^:::${c}(?:\\s|$)`,"m"),p=(f=u.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(u,f,h){const p=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(p);if(!m)return;const g=m[1]||"",y=r(g);if(!s.find(v=>!(v in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:u=>{const f=d(u.attrs||{}),h=i(f),p=h?` {${h}}`:"";return`:::${c}${p} :::`}}}function i0(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Po,serializeAttributes:o=Vo,defaultAttributes:s={},content:l="block",allowedAttributes:c}=n,d=t||e,u=f=>{if(!c)return f;const h={};return c.forEach(p=>{p in f&&(h[p]=f[p])}),h};return{parseMarkdown:(f,h)=>{let p;if(r){const g=r(f);p=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?p=h.parseChildren(f.tokens||[]):p=h.parseInline(f.tokens||[]);const m={...s,...f.attributes};return h.createNode(e,m,p)},markdownTokenizer:{name:e,level:"block",start(f){var h;const p=new RegExp(`^:::${d}`,"m"),m=(h=f.match(p))==null?void 0:h.index;return m!==void 0?m:-1},tokenize(f,h,p){var m;const g=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[k,v=""]=y,b=i(v);let x=1;const w=k.length;let S="";const M=/^:::([\w-]*)(\s.*)?/gm,C=f.slice(w);for(M.lastIndex=0;;){const A=M.exec(C);if(A===null)break;const $=A.index,U=A[1];if(!((m=A[2])!=null&&m.endsWith(":::"))){if(U)x+=1;else if(x-=1,x===0){const j=C.slice(0,$);S=j.trim();const K=f.slice(0,w+$+A[0].length);let N=[];if(S)if(l==="block")for(N=p.blockTokens(j),N.forEach(D=>{D.text&&(!D.tokens||D.tokens.length===0)&&(D.tokens=p.inlineTokens(D.text))});N.length>0;){const D=N[N.length-1];if(D.type==="paragraph"&&(!D.text||D.text.trim()===""))N.pop();else break}else N=p.inlineTokens(S);return{type:e,raw:K,attributes:b,content:S,tokens:N}}}}}},renderMarkdown:(f,h)=>{const p=u(f.attrs||{}),m=o(p),g=m?` {${m}}`:"",y=h.renderChildren(f.content||[],`
89
89
 
90
90
  `);return`:::${d}${g}
91
91
 
92
92
  ${y}
93
93
 
94
- :::`}}}function i0(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,o,s]=r;e[i]=o||s,r=t.exec(n)}return e}function o0(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function s0(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=i0,serializeAttributes:o=o0,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:c}=n,d=t||e,u=h=>{if(!c)return h;const p={};return c.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in h){const k=h[g];if(y!==void 0&&k===y)return;p[g]=k}}),p},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const m={...s,...h.attributes};if(l)return p.createNode(e,m);const g=r?r(h):h.content||"";return g?p.createNode(e,m,[p.createTextNode(g)]):p.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(h){const p=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=h.match(p),g=m?.index;return g!==void 0?g:-1},tokenize(h,p,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=h.match(g);if(!y)return;let k="",v="";if(l){const[,x]=y;v=x}else{const[,x,w]=y;v=x,k=w||""}const b=i(v.trim());return{type:e,raw:y[0],content:k.trim(),attributes:b}}},renderMarkdown:h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const m=u(h.attrs||{}),g=o(m),y=g?` ${g}`:"";return l?`[${d}${y}]`:`[${d}${y}]${p}[/${d}]`}}}function Zi(n,e,t){var r,i,o,s;const l=n.split(`
94
+ :::`}}}function o0(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,o,s]=r;e[i]=o||s,r=t.exec(n)}return e}function s0(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function l0(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=o0,serializeAttributes:o=s0,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:c}=n,d=t||e,u=h=>{if(!c)return h;const p={};return c.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in h){const k=h[g];if(y!==void 0&&k===y)return;p[g]=k}}),p},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const m={...s,...h.attributes};if(l)return p.createNode(e,m);const g=r?r(h):h.content||"";return g?p.createNode(e,m,[p.createTextNode(g)]):p.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(h){const p=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=h.match(p),g=m?.index;return g!==void 0?g:-1},tokenize(h,p,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=h.match(g);if(!y)return;let k="",v="";if(l){const[,x]=y;v=x}else{const[,x,w]=y;v=x,k=w||""}const b=i(v.trim());return{type:e,raw:y[0],content:k.trim(),attributes:b}}},renderMarkdown:h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const m=u(h.attrs||{}),g=o(m),y=g?` ${g}`:"";return l?`[${d}${y}]`:`[${d}${y}]${p}[/${d}]`}}}function Zi(n,e,t){var r,i,o,s;const l=n.split(`
95
95
  `),c=[];let d="",u=0;const f=e.baseIndentSize||2;for(;u<l.length;){const h=l[u],p=h.match(e.itemPattern);if(!p){if(c.length>0)break;if(h.trim()===""){u+=1,d=`${d}${h}
96
96
  `;continue}else return}const m=e.extractItemData(p),{indentLevel:g,mainContent:y}=m;d=`${d}${h}
97
97
  `;const k=[y];for(u+=1;u<l.length;){const w=l[u];if(w.trim()===""){const M=l.slice(u+1).findIndex($=>$.trim()!=="");if(M===-1)break;if((((i=(r=l[u+1+M].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>g){k.push(w),d=`${d}${w}
@@ -100,11 +100,11 @@ ${y}
100
100
  `);w.trim()&&(e.customNestedParser?v=e.customNestedParser(w):v=t.blockTokens(w))}const x=e.createToken(m,v);c.push(x)}if(c.length!==0)return{items:c,raw:d}}function Fo(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[o,...s]=n.content,l=e.renderChildren([o]),c=[`${i}${l}`];return s&&s.length>0&&s.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
101
101
  `).map(h=>h?e.indent(h):"").join(`
102
102
  `);c.push(f)}}),c.join(`
103
- `)}function l0(n,e,t={}){const{state:r}=e,{doc:i,tr:o}=r,s=n;i.descendants((l,c)=>{const d=o.mapping.map(c),u=o.mapping.map(c)+l.nodeSize;let f=null;if(l.marks.forEach(p=>{if(p!==s)return!1;f=p}),!f)return;let h=!1;if(Object.keys(t).forEach(p=>{t[p]!==f.attrs[p]&&(h=!0)}),h){const p=n.type.create({...n.attrs,...t});o.removeMark(d,u,n.type),o.addMark(d,u,p)}}),o.docChanged&&e.view.dispatch(o)}var Te=class Nc extends zo{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Nc(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Bt(n){return new Uy({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=G(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,l=r[r.length-1],c=r[0];let d=t.to;if(l){const u=c.search(/\S/),f=t.from+c.indexOf(l),h=f+l.length;if(Lo(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;h<t.to&&s.delete(h,t.to),f>t.from&&s.delete(t.from+u,f),d=t.from+u+l.length,s.addMark(t.from+u,d,n.type.create(o||{})),s.removeStoredMark(n.type)}}})}function dl(n){return a.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var a0=class extends Zy{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=dl(this.view.state),this.reactiveExtensionStorage=dl(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),a.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},c0=a.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=a.ref(),t=a.getCurrentInstance();return a.watchEffect(()=>{const r=n.editor;r&&r.options.element&&e.value&&a.nextTick(()=>{var i;if(!e.value||!((i=r.view.dom)!=null&&i.parentNode))return;const o=a.unref(e.value);e.value.append(...r.view.dom.parentNode.childNodes),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:o}),r.createNodeViews()})}),a.onBeforeUnmount(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return a.h("div",{ref:n=>{this.rootEl=n}})}});a.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return a.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});a.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return a.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}});var d0=(n={})=>{const e=a.shallowRef();return a.onMounted(()=>{e.value=new a0(n)}),a.onBeforeUnmount(()=>{var t,r,i,o;const s=(r=(t=e.value)==null?void 0:t.view.dom)==null?void 0:r.parentNode,l=s?.cloneNode(!0);(i=s?.parentNode)==null||i.replaceChild(l,s),(o=e.value)==null||o.destroy()}),e};a.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return a.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var ar=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},u0=/^\s*>\s$/,f0=Te.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return ar("blockquote",{...ie(this.options.HTMLAttributes,n),children:ar("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach(i=>{const l=e.renderChildren([i]).split(`
103
+ `)}function a0(n,e,t={}){const{state:r}=e,{doc:i,tr:o}=r,s=n;i.descendants((l,c)=>{const d=o.mapping.map(c),u=o.mapping.map(c)+l.nodeSize;let f=null;if(l.marks.forEach(p=>{if(p!==s)return!1;f=p}),!f)return;let h=!1;if(Object.keys(t).forEach(p=>{t[p]!==f.attrs[p]&&(h=!0)}),h){const p=n.type.create({...n.attrs,...t});o.removeMark(d,u,n.type),o.addMark(d,u,p)}}),o.docChanged&&e.view.dispatch(o)}var Te=class Nc extends zo{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Nc(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Bt(n){return new qy({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=G(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,l=r[r.length-1],c=r[0];let d=t.to;if(l){const u=c.search(/\S/),f=t.from+c.indexOf(l),h=f+l.length;if(Lo(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;h<t.to&&s.delete(h,t.to),f>t.from&&s.delete(t.from+u,f),d=t.from+u+l.length,s.addMark(t.from+u,d,n.type.create(o||{})),s.removeStoredMark(n.type)}}})}function dl(n){return a.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var c0=class extends _y{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=dl(this.view.state),this.reactiveExtensionStorage=dl(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),a.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},d0=a.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=a.ref(),t=a.getCurrentInstance();return a.watchEffect(()=>{const r=n.editor;r&&r.options.element&&e.value&&a.nextTick(()=>{var i;if(!e.value||!((i=r.view.dom)!=null&&i.parentNode))return;const o=a.unref(e.value);e.value.append(...r.view.dom.parentNode.childNodes),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:o}),r.createNodeViews()})}),a.onBeforeUnmount(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return a.h("div",{ref:n=>{this.rootEl=n}})}});a.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return a.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});a.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return a.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}});var u0=(n={})=>{const e=a.shallowRef();return a.onMounted(()=>{e.value=new c0(n)}),a.onBeforeUnmount(()=>{var t,r,i,o;const s=(r=(t=e.value)==null?void 0:t.view.dom)==null?void 0:r.parentNode,l=s?.cloneNode(!0);(i=s?.parentNode)==null||i.replaceChild(l,s),(o=e.value)==null||o.destroy()}),e};a.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return a.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var ar=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},f0=/^\s*>\s$/,h0=Te.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return ar("blockquote",{...ie(this.options.HTMLAttributes,n),children:ar("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach(i=>{const l=e.renderChildren([i]).split(`
104
104
  `).map(c=>c.trim()===""?t:`${t} ${c}`);r.push(l.join(`
105
105
  `))}),r.join(`
106
106
  ${t}
107
- `)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Zt({find:u0,type:this.type})]}}),h0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,p0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,m0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,g0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,y0=It.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return ar("strong",{...ie(this.options.HTMLAttributes,n),children:ar("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Xt({find:h0,type:this.type}),Xt({find:m0,type:this.type})]},addPasteRules(){return[Bt({find:p0,type:this.type}),Bt({find:g0,type:this.type})]}}),k0=/(^|[^`])`([^`]+)`(?!`)$/,b0=/(^|[^`])`([^`]+)`(?!`)/g,v0=It.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Xt({find:k0,type:this.type})]},addPasteRules(){return[Bt({find:b0,type:this.type})]}}),wi=4,x0=/^```([a-z]+)?[\s\n]$/,w0=/^~~~([a-z]+)?[\s\n]$/,C0=Te.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:wi,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const o=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",ie(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const i=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(`
107
+ `)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Zt({find:f0,type:this.type})]}}),p0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,m0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,g0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,y0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,k0=It.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return ar("strong",{...ie(this.options.HTMLAttributes,n),children:ar("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Xt({find:p0,type:this.type}),Xt({find:g0,type:this.type})]},addPasteRules(){return[Bt({find:m0,type:this.type}),Bt({find:y0,type:this.type})]}}),b0=/(^|[^`])`([^`]+)`(?!`)$/,v0=/(^|[^`])`([^`]+)`(?!`)/g,x0=It.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Xt({find:b0,type:this.type})]},addPasteRules(){return[Bt({find:v0,type:this.type})]}}),wi=4,w0=/^```([a-z]+)?[\s\n]$/,C0=/^~~~([a-z]+)?[\s\n]$/,S0=Te.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:wi,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const o=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",ie(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const i=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(`
108
108
  `):r=`\`\`\`${i}
109
109
 
110
110
  \`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:wi,{state:r}=n,{selection:i}=r,{$from:o,empty:s}=i;if(o.parent.type!==this.type)return!1;const l=" ".repeat(t);return s?n.commands.insertContent(l):n.commands.command(({tr:c})=>{const{from:d,to:u}=i,p=r.doc.textBetween(d,u,`
@@ -120,24 +120,24 @@ ${t}
120
120
  `).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",y=Math.min(g.length,t);return p.slice(y)}).join(`
121
121
  `);return l.replaceWith(c,d,r.schema.text(h)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
122
122
 
123
- `);return!o||!s?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:o}=t;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:d})=>(d.setSelection(H.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Xi({find:x0,type:this.type,getAttributes:n=>({language:n[1]})}),Xi({find:w0,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Z({key:new oe("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!t||!o)return!1;const{tr:s,schema:l}=n.state,c=l.text(t.replace(/\r\n?/g,`
124
- `));return s.replaceSelectionWith(this.type.create({language:o},c)),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),n.dispatch(s),!0}}})]}}),S0=Te.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
123
+ `);return!o||!s?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:o}=t;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:d})=>(d.setSelection(H.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Xi({find:w0,type:this.type,getAttributes:n=>({language:n[1]})}),Xi({find:C0,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Z({key:new oe("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!t||!o)return!1;const{tr:s,schema:l}=n.state,c=l.text(t.replace(/\r\n?/g,`
124
+ `));return s.replaceSelectionWith(this.type.create({language:o},c)),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),n.dispatch(s),!0}}})]}}),M0=Te.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
125
125
 
126
- `):""}),M0=Te.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",ie(this.options.HTMLAttributes,n)]},renderText(){return`
126
+ `):""}),T0=Te.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",ie(this.options.HTMLAttributes,n)]},renderText(){return`
127
127
  `},renderMarkdown:()=>`
128
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:o}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,c=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&s){const f=c.filter(h=>l.includes(h.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Ac=Te.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,ie(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Xi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),T0=Ac,E0=Te.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",ie(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!e0(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return uc(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:o,tr:s,dispatch:l})=>{if(l){const{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(V.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(P.create(s.doc,c.pos)):s.setSelection(V.create(s.doc,c.pos));else{const u=o.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,f=u?.create();f&&(s.insert(d,f),s.setSelection(V.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[_y({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),N0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,A0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,B0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,O0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,D0=It.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Xt({find:N0,type:this.type}),Xt({find:B0,type:this.type})]},addPasteRules(){return[Bt({find:A0,type:this.type}),Bt({find:O0,type:this.type})]}});const I0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",$0="ελ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",_i="numeric",eo="ascii",to="alpha",fn="asciinumeric",ln="alphanumeric",no="domain",Bc="emoji",R0="scheme",L0="slashscheme",Ci="whitespace";function z0(n,e){return n in e||(e[n]=[]),e[n]}function vt(n,e,t){e[_i]&&(e[fn]=!0,e[ln]=!0),e[eo]&&(e[fn]=!0,e[to]=!0),e[fn]&&(e[ln]=!0),e[to]&&(e[ln]=!0),e[ln]&&(e[no]=!0),e[Bc]&&(e[no]=!0);for(const r in e){const i=z0(r,t);i.indexOf(n)<0&&i.push(n)}}function P0(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Ce(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Ce.groups={};Ce.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||Ce.groups;let i;return e&&e.j?i=e:(i=new Ce(e),t&&r&&vt(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(n[s]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||Ce.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let s,l=i.go(n);if(l?(s=new Ce,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Ce,o){if(r)if(s.t&&typeof s.t=="string"){const c=Object.assign(P0(s.t,r),t);vt(o,c,r)}else t&&vt(o,t,r);s.t=o}return i.j[n]=s,s}};const F=(n,e,t,r,i)=>n.ta(e,t,r,i),_=(n,e,t,r,i)=>n.tr(e,t,r,i),ul=(n,e,t,r,i)=>n.ts(e,t,r,i),E=(n,e,t,r,i)=>n.tt(e,t,r,i),We="WORD",ro="UWORD",Oc="ASCIINUMERICAL",Dc="ALPHANUMERICAL",Tn="LOCALHOST",io="TLD",oo="UTLD",Jn="SCHEME",Ft="SLASH_SCHEME",Ho="NUM",so="WS",jo="NL",hn="OPENBRACE",pn="CLOSEBRACE",cr="OPENBRACKET",dr="CLOSEBRACKET",ur="OPENPAREN",fr="CLOSEPAREN",hr="OPENANGLEBRACKET",pr="CLOSEANGLEBRACKET",mr="FULLWIDTHLEFTPAREN",gr="FULLWIDTHRIGHTPAREN",yr="LEFTCORNERBRACKET",kr="RIGHTCORNERBRACKET",br="LEFTWHITECORNERBRACKET",vr="RIGHTWHITECORNERBRACKET",xr="FULLWIDTHLESSTHAN",wr="FULLWIDTHGREATERTHAN",Cr="AMPERSAND",Sr="APOSTROPHE",Mr="ASTERISK",_e="AT",Tr="BACKSLASH",Er="BACKTICK",Nr="CARET",rt="COLON",Uo="COMMA",Ar="DOLLAR",ze="DOT",Br="EQUALS",qo="EXCLAMATION",Ne="HYPHEN",mn="PERCENT",Or="PIPE",Dr="PLUS",Ir="POUND",gn="QUERY",Wo="QUOTE",Ic="FULLWIDTHMIDDLEDOT",Ko="SEMI",Pe="SLASH",yn="TILDE",$r="UNDERSCORE",$c="EMOJI",Rr="SYM";var Rc=Object.freeze({__proto__:null,ALPHANUMERICAL:Dc,AMPERSAND:Cr,APOSTROPHE:Sr,ASCIINUMERICAL:Oc,ASTERISK:Mr,AT:_e,BACKSLASH:Tr,BACKTICK:Er,CARET:Nr,CLOSEANGLEBRACKET:pr,CLOSEBRACE:pn,CLOSEBRACKET:dr,CLOSEPAREN:fr,COLON:rt,COMMA:Uo,DOLLAR:Ar,DOT:ze,EMOJI:$c,EQUALS:Br,EXCLAMATION:qo,FULLWIDTHGREATERTHAN:wr,FULLWIDTHLEFTPAREN:mr,FULLWIDTHLESSTHAN:xr,FULLWIDTHMIDDLEDOT:Ic,FULLWIDTHRIGHTPAREN:gr,HYPHEN:Ne,LEFTCORNERBRACKET:yr,LEFTWHITECORNERBRACKET:br,LOCALHOST:Tn,NL:jo,NUM:Ho,OPENANGLEBRACKET:hr,OPENBRACE:hn,OPENBRACKET:cr,OPENPAREN:ur,PERCENT:mn,PIPE:Or,PLUS:Dr,POUND:Ir,QUERY:gn,QUOTE:Wo,RIGHTCORNERBRACKET:kr,RIGHTWHITECORNERBRACKET:vr,SCHEME:Jn,SEMI:Ko,SLASH:Pe,SLASH_SCHEME:Ft,SYM:Rr,TILDE:yn,TLD:io,UNDERSCORE:$r,UTLD:oo,UWORD:ro,WORD:We,WS:so});const Ue=/[a-z]/,nn=new RegExp("\\p{L}","u"),Si=new RegExp("\\p{Emoji}","u"),qe=/\d/,Mi=/\s/,fl="\r",Ti=`
129
- `,V0="️",F0="‍",Ei="";let Fn=null,Hn=null;function H0(n=[]){const e={};Ce.groups=e;const t=new Ce;Fn==null&&(Fn=hl(I0)),Hn==null&&(Hn=hl($0)),E(t,"'",Sr),E(t,"{",hn),E(t,"}",pn),E(t,"[",cr),E(t,"]",dr),E(t,"(",ur),E(t,")",fr),E(t,"<",hr),E(t,">",pr),E(t,"(",mr),E(t,")",gr),E(t,"「",yr),E(t,"」",kr),E(t,"『",br),E(t,"』",vr),E(t,"<",xr),E(t,">",wr),E(t,"&",Cr),E(t,"*",Mr),E(t,"@",_e),E(t,"`",Er),E(t,"^",Nr),E(t,":",rt),E(t,",",Uo),E(t,"$",Ar),E(t,".",ze),E(t,"=",Br),E(t,"!",qo),E(t,"-",Ne),E(t,"%",mn),E(t,"|",Or),E(t,"+",Dr),E(t,"#",Ir),E(t,"?",gn),E(t,'"',Wo),E(t,"/",Pe),E(t,";",Ko),E(t,"~",yn),E(t,"_",$r),E(t,"\\",Tr),E(t,"・",Ic);const r=_(t,qe,Ho,{[_i]:!0});_(r,qe,r);const i=_(r,Ue,Oc,{[fn]:!0}),o=_(r,nn,Dc,{[ln]:!0}),s=_(t,Ue,We,{[eo]:!0});_(s,qe,i),_(s,Ue,s),_(i,qe,i),_(i,Ue,i);const l=_(t,nn,ro,{[to]:!0});_(l,Ue),_(l,qe,o),_(l,nn,l),_(o,qe,o),_(o,Ue),_(o,nn,o);const c=E(t,Ti,jo,{[Ci]:!0}),d=E(t,fl,so,{[Ci]:!0}),u=_(t,Mi,so,{[Ci]:!0});E(t,Ei,u),E(d,Ti,c),E(d,Ei,u),_(d,Mi,u),E(u,fl),E(u,Ti),_(u,Mi,u),E(u,Ei,u);const f=_(t,Si,$c,{[Bc]:!0});E(f,"#"),_(f,Si,f),E(f,V0,f);const h=E(f,F0);E(h,"#"),_(h,Si,f);const p=[[Ue,s],[qe,i]],m=[[Ue,null],[nn,l],[qe,o]];for(let g=0;g<Fn.length;g++)Qe(t,Fn[g],io,We,p);for(let g=0;g<Hn.length;g++)Qe(t,Hn[g],oo,ro,m);vt(io,{tld:!0,ascii:!0},e),vt(oo,{utld:!0,alpha:!0},e),Qe(t,"file",Jn,We,p),Qe(t,"mailto",Jn,We,p),Qe(t,"http",Ft,We,p),Qe(t,"https",Ft,We,p),Qe(t,"ftp",Ft,We,p),Qe(t,"ftps",Ft,We,p),vt(Jn,{scheme:!0,ascii:!0},e),vt(Ft,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],v=n[g][1]?{[R0]:!0}:{[L0]:!0};y.indexOf("-")>=0?v[no]=!0:Ue.test(y)?qe.test(y)?v[fn]=!0:v[eo]=!0:v[_i]=!0,ul(t,y,y,v)}return ul(t,"localhost",Tn,{ascii:!0}),t.jd=new Ce(Rr),{start:t,tokens:Object.assign({groups:e},Rc)}}function Lc(n,e){const t=j0(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let o=0,s=0;for(;s<r;){let l=n,c=null,d=0,u=null,f=-1,h=-1;for(;s<r&&(c=l.go(t[s]));)l=c,l.accepts()?(f=0,h=0,u=l):f>=0&&(f+=t[s].length,h++),d+=t[s].length,o+=t[s].length,s++;o-=f,s-=h,d-=f,i.push({t:u.t,v:e.slice(o-d,o),s:o-d,e:o})}return i}function j0(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,s=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function Qe(n,e,t,r,i){let o;const s=e.length;for(let l=0;l<s-1;l++){const c=e[l];n.j[c]?o=n.j[c]:(o=new Ce(r),o.jr=i.slice(),n.j[c]=o),n=o}return o=new Ce(t),o.jr=i.slice(),n.j[e[s-1]]=o,o}function hl(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+o),10);s>0;s--)t.pop();r+=o}else t.push(n[r]),r++}return e}const En={defaultProtocol:"http",events:null,format:pl,formatHref:pl,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Jo(n,e=null){let t=Object.assign({},En);n&&(t=Object.assign(t,n instanceof Jo?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Jo.prototype={o:En,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:En[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function pl(n){return n}function zc(n,e){this.t="token",this.v=n,this.tk=e}zc.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=En.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),s={},l=n.get("className",t,e),c=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return s.href=r,l&&(s.class=l),c&&(s.target=c),d&&(s.rel=d),u&&Object.assign(s,u),{tagName:i,attributes:s,content:o,eventListeners:f}}};function ti(n,e){class t extends zc{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const ml=ti("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gl=ti("text"),U0=ti("nl"),jn=ti("url",{isLink:!0,toHref(n=En.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Tn&&n[1].t===rt}}),Ee=n=>new Ce(n);function q0({groups:n}){const e=n.domain.concat([Cr,Mr,_e,Tr,Er,Nr,Ar,Br,Ne,Ho,mn,Or,Dr,Ir,Pe,Rr,yn,$r]),t=[Sr,rt,Uo,ze,qo,mn,gn,Wo,Ko,hr,pr,hn,pn,dr,cr,ur,fr,mr,gr,yr,kr,br,vr,xr,wr],r=[Cr,Sr,Mr,Tr,Er,Nr,Ar,Br,Ne,hn,pn,mn,Or,Dr,Ir,gn,Pe,Rr,yn,$r],i=Ee(),o=E(i,yn);F(o,r,o),F(o,n.domain,o);const s=Ee(),l=Ee(),c=Ee();F(i,n.domain,s),F(i,n.scheme,l),F(i,n.slashscheme,c),F(s,r,o),F(s,n.domain,s);const d=E(s,_e);E(o,_e,d),E(l,_e,d),E(c,_e,d);const u=E(o,ze);F(u,r,o),F(u,n.domain,o);const f=Ee();F(d,n.domain,f),F(f,n.domain,f);const h=E(f,ze);F(h,n.domain,f);const p=Ee(ml);F(h,n.tld,p),F(h,n.utld,p),E(d,Tn,p);const m=E(f,Ne);E(m,Ne,m),F(m,n.domain,f),F(p,n.domain,f),E(p,ze,h),E(p,Ne,m);const g=E(p,rt);F(g,n.numeric,ml);const y=E(s,Ne),k=E(s,ze);E(y,Ne,y),F(y,n.domain,s),F(k,r,o),F(k,n.domain,s);const v=Ee(jn);F(k,n.tld,v),F(k,n.utld,v),F(v,n.domain,s),F(v,r,o),E(v,ze,k),E(v,Ne,y),E(v,_e,d);const b=E(v,rt),x=Ee(jn);F(b,n.numeric,x);const w=Ee(jn),S=Ee();F(w,e,w),F(w,t,S),F(S,e,w),F(S,t,S),E(v,Pe,w),E(x,Pe,w);const M=E(l,rt),C=E(c,rt),A=E(C,Pe),$=E(A,Pe);F(l,n.domain,s),E(l,ze,k),E(l,Ne,y),F(c,n.domain,s),E(c,ze,k),E(c,Ne,y),F(M,n.domain,w),E(M,Pe,w),E(M,gn,w),F($,n.domain,w),F($,e,w),E($,Pe,w);const U=[[hn,pn],[cr,dr],[ur,fr],[hr,pr],[mr,gr],[yr,kr],[br,vr],[xr,wr]];for(let j=0;j<U.length;j++){const[K,N]=U[j],D=E(w,K);E(S,K,D),E(D,N,w);const R=Ee(jn);F(D,e,R);const ke=Ee();F(D,t),F(R,e,R),F(R,t,ke),F(ke,e,R),F(ke,t,ke),E(R,N,w),E(ke,N,w)}return E(i,Tn,v),E(i,jo,U0),{start:i,tokens:Rc}}function W0(n,e,t){let r=t.length,i=0,o=[],s=[];for(;i<r;){let l=n,c=null,d=null,u=0,f=null,h=-1;for(;i<r&&!(c=l.go(t[i].t));)s.push(t[i++]);for(;i<r&&(d=c||l.go(t[i].t));)c=null,l=d,l.accepts()?(h=0,f=l):h>=0&&h++,i++,u++;if(h<0)i-=u,i<r&&(s.push(t[i]),i++);else{s.length>0&&(o.push(Ni(gl,e,s)),s=[]),i-=h,u-=h;const p=f.t,m=t.slice(i-u,i);o.push(Ni(p,e,m))}}return s.length>0&&o.push(Ni(gl,e,s)),o}function Ni(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const K0=typeof console<"u"&&console&&console.warn||(()=>{}),J0="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Q={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function G0(){return Ce.groups={},Q.scanner=null,Q.parser=null,Q.tokenQueue=[],Q.pluginQueue=[],Q.customSchemes=[],Q.initialized=!1,Q}function yl(n,e=!1){if(Q.initialized&&K0(`linkifyjs: already initialized - will not register custom scheme "${n}" ${J0}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
128
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:o}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,c=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&s){const f=c.filter(h=>l.includes(h.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Ac=Te.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,ie(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Xi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),E0=Ac,N0=Te.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",ie(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!t0(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return uc(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:o,tr:s,dispatch:l})=>{if(l){const{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(V.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(P.create(s.doc,c.pos)):s.setSelection(V.create(s.doc,c.pos));else{const u=o.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,f=u?.create();f&&(s.insert(d,f),s.setSelection(V.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[e0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),A0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,B0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,O0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,D0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,I0=It.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Xt({find:A0,type:this.type}),Xt({find:O0,type:this.type})]},addPasteRules(){return[Bt({find:B0,type:this.type}),Bt({find:D0,type:this.type})]}});const $0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",R0="ελ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",_i="numeric",eo="ascii",to="alpha",fn="asciinumeric",ln="alphanumeric",no="domain",Bc="emoji",L0="scheme",z0="slashscheme",Ci="whitespace";function P0(n,e){return n in e||(e[n]=[]),e[n]}function vt(n,e,t){e[_i]&&(e[fn]=!0,e[ln]=!0),e[eo]&&(e[fn]=!0,e[to]=!0),e[fn]&&(e[ln]=!0),e[to]&&(e[ln]=!0),e[ln]&&(e[no]=!0),e[Bc]&&(e[no]=!0);for(const r in e){const i=P0(r,t);i.indexOf(n)<0&&i.push(n)}}function V0(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Ce(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Ce.groups={};Ce.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||Ce.groups;let i;return e&&e.j?i=e:(i=new Ce(e),t&&r&&vt(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(n[s]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||Ce.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let s,l=i.go(n);if(l?(s=new Ce,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Ce,o){if(r)if(s.t&&typeof s.t=="string"){const c=Object.assign(V0(s.t,r),t);vt(o,c,r)}else t&&vt(o,t,r);s.t=o}return i.j[n]=s,s}};const F=(n,e,t,r,i)=>n.ta(e,t,r,i),_=(n,e,t,r,i)=>n.tr(e,t,r,i),ul=(n,e,t,r,i)=>n.ts(e,t,r,i),E=(n,e,t,r,i)=>n.tt(e,t,r,i),We="WORD",ro="UWORD",Oc="ASCIINUMERICAL",Dc="ALPHANUMERICAL",Tn="LOCALHOST",io="TLD",oo="UTLD",Jn="SCHEME",Ft="SLASH_SCHEME",Ho="NUM",so="WS",jo="NL",hn="OPENBRACE",pn="CLOSEBRACE",cr="OPENBRACKET",dr="CLOSEBRACKET",ur="OPENPAREN",fr="CLOSEPAREN",hr="OPENANGLEBRACKET",pr="CLOSEANGLEBRACKET",mr="FULLWIDTHLEFTPAREN",gr="FULLWIDTHRIGHTPAREN",yr="LEFTCORNERBRACKET",kr="RIGHTCORNERBRACKET",br="LEFTWHITECORNERBRACKET",vr="RIGHTWHITECORNERBRACKET",xr="FULLWIDTHLESSTHAN",wr="FULLWIDTHGREATERTHAN",Cr="AMPERSAND",Sr="APOSTROPHE",Mr="ASTERISK",_e="AT",Tr="BACKSLASH",Er="BACKTICK",Nr="CARET",rt="COLON",Uo="COMMA",Ar="DOLLAR",ze="DOT",Br="EQUALS",qo="EXCLAMATION",Ne="HYPHEN",mn="PERCENT",Or="PIPE",Dr="PLUS",Ir="POUND",gn="QUERY",Wo="QUOTE",Ic="FULLWIDTHMIDDLEDOT",Ko="SEMI",Pe="SLASH",yn="TILDE",$r="UNDERSCORE",$c="EMOJI",Rr="SYM";var Rc=Object.freeze({__proto__:null,ALPHANUMERICAL:Dc,AMPERSAND:Cr,APOSTROPHE:Sr,ASCIINUMERICAL:Oc,ASTERISK:Mr,AT:_e,BACKSLASH:Tr,BACKTICK:Er,CARET:Nr,CLOSEANGLEBRACKET:pr,CLOSEBRACE:pn,CLOSEBRACKET:dr,CLOSEPAREN:fr,COLON:rt,COMMA:Uo,DOLLAR:Ar,DOT:ze,EMOJI:$c,EQUALS:Br,EXCLAMATION:qo,FULLWIDTHGREATERTHAN:wr,FULLWIDTHLEFTPAREN:mr,FULLWIDTHLESSTHAN:xr,FULLWIDTHMIDDLEDOT:Ic,FULLWIDTHRIGHTPAREN:gr,HYPHEN:Ne,LEFTCORNERBRACKET:yr,LEFTWHITECORNERBRACKET:br,LOCALHOST:Tn,NL:jo,NUM:Ho,OPENANGLEBRACKET:hr,OPENBRACE:hn,OPENBRACKET:cr,OPENPAREN:ur,PERCENT:mn,PIPE:Or,PLUS:Dr,POUND:Ir,QUERY:gn,QUOTE:Wo,RIGHTCORNERBRACKET:kr,RIGHTWHITECORNERBRACKET:vr,SCHEME:Jn,SEMI:Ko,SLASH:Pe,SLASH_SCHEME:Ft,SYM:Rr,TILDE:yn,TLD:io,UNDERSCORE:$r,UTLD:oo,UWORD:ro,WORD:We,WS:so});const Ue=/[a-z]/,nn=new RegExp("\\p{L}","u"),Si=new RegExp("\\p{Emoji}","u"),qe=/\d/,Mi=/\s/,fl="\r",Ti=`
129
+ `,F0="️",H0="‍",Ei="";let Fn=null,Hn=null;function j0(n=[]){const e={};Ce.groups=e;const t=new Ce;Fn==null&&(Fn=hl($0)),Hn==null&&(Hn=hl(R0)),E(t,"'",Sr),E(t,"{",hn),E(t,"}",pn),E(t,"[",cr),E(t,"]",dr),E(t,"(",ur),E(t,")",fr),E(t,"<",hr),E(t,">",pr),E(t,"(",mr),E(t,")",gr),E(t,"「",yr),E(t,"」",kr),E(t,"『",br),E(t,"』",vr),E(t,"<",xr),E(t,">",wr),E(t,"&",Cr),E(t,"*",Mr),E(t,"@",_e),E(t,"`",Er),E(t,"^",Nr),E(t,":",rt),E(t,",",Uo),E(t,"$",Ar),E(t,".",ze),E(t,"=",Br),E(t,"!",qo),E(t,"-",Ne),E(t,"%",mn),E(t,"|",Or),E(t,"+",Dr),E(t,"#",Ir),E(t,"?",gn),E(t,'"',Wo),E(t,"/",Pe),E(t,";",Ko),E(t,"~",yn),E(t,"_",$r),E(t,"\\",Tr),E(t,"・",Ic);const r=_(t,qe,Ho,{[_i]:!0});_(r,qe,r);const i=_(r,Ue,Oc,{[fn]:!0}),o=_(r,nn,Dc,{[ln]:!0}),s=_(t,Ue,We,{[eo]:!0});_(s,qe,i),_(s,Ue,s),_(i,qe,i),_(i,Ue,i);const l=_(t,nn,ro,{[to]:!0});_(l,Ue),_(l,qe,o),_(l,nn,l),_(o,qe,o),_(o,Ue),_(o,nn,o);const c=E(t,Ti,jo,{[Ci]:!0}),d=E(t,fl,so,{[Ci]:!0}),u=_(t,Mi,so,{[Ci]:!0});E(t,Ei,u),E(d,Ti,c),E(d,Ei,u),_(d,Mi,u),E(u,fl),E(u,Ti),_(u,Mi,u),E(u,Ei,u);const f=_(t,Si,$c,{[Bc]:!0});E(f,"#"),_(f,Si,f),E(f,F0,f);const h=E(f,H0);E(h,"#"),_(h,Si,f);const p=[[Ue,s],[qe,i]],m=[[Ue,null],[nn,l],[qe,o]];for(let g=0;g<Fn.length;g++)Qe(t,Fn[g],io,We,p);for(let g=0;g<Hn.length;g++)Qe(t,Hn[g],oo,ro,m);vt(io,{tld:!0,ascii:!0},e),vt(oo,{utld:!0,alpha:!0},e),Qe(t,"file",Jn,We,p),Qe(t,"mailto",Jn,We,p),Qe(t,"http",Ft,We,p),Qe(t,"https",Ft,We,p),Qe(t,"ftp",Ft,We,p),Qe(t,"ftps",Ft,We,p),vt(Jn,{scheme:!0,ascii:!0},e),vt(Ft,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],v=n[g][1]?{[L0]:!0}:{[z0]:!0};y.indexOf("-")>=0?v[no]=!0:Ue.test(y)?qe.test(y)?v[fn]=!0:v[eo]=!0:v[_i]=!0,ul(t,y,y,v)}return ul(t,"localhost",Tn,{ascii:!0}),t.jd=new Ce(Rr),{start:t,tokens:Object.assign({groups:e},Rc)}}function Lc(n,e){const t=U0(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let o=0,s=0;for(;s<r;){let l=n,c=null,d=0,u=null,f=-1,h=-1;for(;s<r&&(c=l.go(t[s]));)l=c,l.accepts()?(f=0,h=0,u=l):f>=0&&(f+=t[s].length,h++),d+=t[s].length,o+=t[s].length,s++;o-=f,s-=h,d-=f,i.push({t:u.t,v:e.slice(o-d,o),s:o-d,e:o})}return i}function U0(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,s=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function Qe(n,e,t,r,i){let o;const s=e.length;for(let l=0;l<s-1;l++){const c=e[l];n.j[c]?o=n.j[c]:(o=new Ce(r),o.jr=i.slice(),n.j[c]=o),n=o}return o=new Ce(t),o.jr=i.slice(),n.j[e[s-1]]=o,o}function hl(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+o),10);s>0;s--)t.pop();r+=o}else t.push(n[r]),r++}return e}const En={defaultProtocol:"http",events:null,format:pl,formatHref:pl,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Jo(n,e=null){let t=Object.assign({},En);n&&(t=Object.assign(t,n instanceof Jo?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Jo.prototype={o:En,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:En[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function pl(n){return n}function zc(n,e){this.t="token",this.v=n,this.tk=e}zc.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=En.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),s={},l=n.get("className",t,e),c=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return s.href=r,l&&(s.class=l),c&&(s.target=c),d&&(s.rel=d),u&&Object.assign(s,u),{tagName:i,attributes:s,content:o,eventListeners:f}}};function ti(n,e){class t extends zc{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const ml=ti("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gl=ti("text"),q0=ti("nl"),jn=ti("url",{isLink:!0,toHref(n=En.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Tn&&n[1].t===rt}}),Ee=n=>new Ce(n);function W0({groups:n}){const e=n.domain.concat([Cr,Mr,_e,Tr,Er,Nr,Ar,Br,Ne,Ho,mn,Or,Dr,Ir,Pe,Rr,yn,$r]),t=[Sr,rt,Uo,ze,qo,mn,gn,Wo,Ko,hr,pr,hn,pn,dr,cr,ur,fr,mr,gr,yr,kr,br,vr,xr,wr],r=[Cr,Sr,Mr,Tr,Er,Nr,Ar,Br,Ne,hn,pn,mn,Or,Dr,Ir,gn,Pe,Rr,yn,$r],i=Ee(),o=E(i,yn);F(o,r,o),F(o,n.domain,o);const s=Ee(),l=Ee(),c=Ee();F(i,n.domain,s),F(i,n.scheme,l),F(i,n.slashscheme,c),F(s,r,o),F(s,n.domain,s);const d=E(s,_e);E(o,_e,d),E(l,_e,d),E(c,_e,d);const u=E(o,ze);F(u,r,o),F(u,n.domain,o);const f=Ee();F(d,n.domain,f),F(f,n.domain,f);const h=E(f,ze);F(h,n.domain,f);const p=Ee(ml);F(h,n.tld,p),F(h,n.utld,p),E(d,Tn,p);const m=E(f,Ne);E(m,Ne,m),F(m,n.domain,f),F(p,n.domain,f),E(p,ze,h),E(p,Ne,m);const g=E(p,rt);F(g,n.numeric,ml);const y=E(s,Ne),k=E(s,ze);E(y,Ne,y),F(y,n.domain,s),F(k,r,o),F(k,n.domain,s);const v=Ee(jn);F(k,n.tld,v),F(k,n.utld,v),F(v,n.domain,s),F(v,r,o),E(v,ze,k),E(v,Ne,y),E(v,_e,d);const b=E(v,rt),x=Ee(jn);F(b,n.numeric,x);const w=Ee(jn),S=Ee();F(w,e,w),F(w,t,S),F(S,e,w),F(S,t,S),E(v,Pe,w),E(x,Pe,w);const M=E(l,rt),C=E(c,rt),A=E(C,Pe),$=E(A,Pe);F(l,n.domain,s),E(l,ze,k),E(l,Ne,y),F(c,n.domain,s),E(c,ze,k),E(c,Ne,y),F(M,n.domain,w),E(M,Pe,w),E(M,gn,w),F($,n.domain,w),F($,e,w),E($,Pe,w);const U=[[hn,pn],[cr,dr],[ur,fr],[hr,pr],[mr,gr],[yr,kr],[br,vr],[xr,wr]];for(let j=0;j<U.length;j++){const[K,N]=U[j],D=E(w,K);E(S,K,D),E(D,N,w);const R=Ee(jn);F(D,e,R);const ke=Ee();F(D,t),F(R,e,R),F(R,t,ke),F(ke,e,R),F(ke,t,ke),E(R,N,w),E(ke,N,w)}return E(i,Tn,v),E(i,jo,q0),{start:i,tokens:Rc}}function K0(n,e,t){let r=t.length,i=0,o=[],s=[];for(;i<r;){let l=n,c=null,d=null,u=0,f=null,h=-1;for(;i<r&&!(c=l.go(t[i].t));)s.push(t[i++]);for(;i<r&&(d=c||l.go(t[i].t));)c=null,l=d,l.accepts()?(h=0,f=l):h>=0&&h++,i++,u++;if(h<0)i-=u,i<r&&(s.push(t[i]),i++);else{s.length>0&&(o.push(Ni(gl,e,s)),s=[]),i-=h,u-=h;const p=f.t,m=t.slice(i-u,i);o.push(Ni(p,e,m))}}return s.length>0&&o.push(Ni(gl,e,s)),o}function Ni(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const J0=typeof console<"u"&&console&&console.warn||(()=>{}),G0="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Q={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Y0(){return Ce.groups={},Q.scanner=null,Q.parser=null,Q.tokenQueue=[],Q.pluginQueue=[],Q.customSchemes=[],Q.initialized=!1,Q}function yl(n,e=!1){if(Q.initialized&&J0(`linkifyjs: already initialized - will not register custom scheme "${n}" ${G0}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
130
130
  1. Must only contain digits, lowercase ASCII letters or "-"
131
131
  2. Cannot start or end with "-"
132
- 3. "-" cannot repeat`);Q.customSchemes.push([n,e])}function Y0(){Q.scanner=H0(Q.customSchemes);for(let n=0;n<Q.tokenQueue.length;n++)Q.tokenQueue[n][1]({scanner:Q.scanner});Q.parser=q0(Q.scanner.tokens);for(let n=0;n<Q.pluginQueue.length;n++)Q.pluginQueue[n][1]({scanner:Q.scanner,parser:Q.parser});return Q.initialized=!0,Q}function Go(n){return Q.initialized||Y0(),W0(Q.parser.start,n,Lc(Q.scanner.start,n))}Go.scan=Lc;function Pc(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Jo(t),i=Go(n),o=[];for(let s=0;s<i.length;s++){const l=i[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}var Yo="[\0-   ᠎ -\u2029  ]",Q0=new RegExp(Yo),X0=new RegExp(`${Yo}$`),Z0=new RegExp(Yo,"g");function _0(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function ek(n){return new Z({key:new oe("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),o=e.some(d=>d.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,l=rc(t.doc,[...e]);if(dc(l).forEach(({newRange:d})=>{const u=ey(r.doc,d,p=>p.isTextblock);let f,h;if(u.length>1)f=u[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const p=r.doc.textBetween(d.from,d.to," "," ");if(!X0.test(p))return;f=u[0],h=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&h){const p=h.split(Q0).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=f.pos+h.lastIndexOf(m);if(!m)return!1;const y=Go(m).map(k=>k.toObject(n.defaultProtocol));if(!_0(y))return!1;y.filter(k=>k.isLink).map(k=>({...k,from:g+k.start+1,to:g+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>n.validate(k.value)).filter(k=>n.shouldAutoLink(k.value)).forEach(k=>{Lo(k.from,k.to,r.doc).some(v=>v.mark.type===n.type)||s.addMark(k.from,k.to,n.type.create({href:k.href}))})}}),!!s.steps.length)return s}})}function tk(n){return new Z({key:new oe("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=!1;if(n.enableClickSelection&&(s=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{let f=r.target;const h=[];for(;f.nodeName!=="DIV";)h.push(f),f=f.parentNode;l=h.find(p=>p.nodeName==="A")}if(!l)return s;const c=cc(e.state,n.type.name),d=(i=l?.href)!=null?i:c.href,u=(o=l?.target)!=null?o:c.target;l&&d&&(window.open(d,u),s=!0)}return s}}})}function nk(n){return new Z({key:new oe("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:i}=n,{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let c="";r.content.forEach(u=>{c+=u.textContent});const d=Pc(c,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||i!==void 0&&!i(d.href)?!1:n.editor.commands.setMark(n.type,{href:d.href})}}})}function mt(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(Z0,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var rk=It.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(n=>{if(typeof n=="string"){yl(n);return}yl(n.scheme,n.optionalSlashes)})},onDestroy(){G0()},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:(n,e)=>!!mt(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.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:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!mt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!mt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ie(this.options.HTMLAttributes,n),0]:["a",ie(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!mt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!mt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Bt({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=Pc(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!mt(s,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(ek({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!mt(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(tk({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(nk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),ik=Object.defineProperty,ok=(n,e)=>{for(var t in e)ik(n,t,{get:e[t],enumerable:!0})},sk="listItem",kl="textStyle",bl=/^\s*([-+*])\s$/,Vc=Te.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:n}){return["ul",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
133
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(sk,this.editor.getAttributes(kl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Zt({find:bl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Zt({find:bl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(kl),editor:this.editor})),[n]}}),Fc=Te.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],n.tokens.length>1){const s=n.tokens.slice(1),l=e.parseChildren(s);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Fo(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),lk={};ok(lk,{findListItemPos:()=>On,getNextListDepth:()=>Qo,handleBackspace:()=>lo,handleDelete:()=>ao,hasListBefore:()=>Hc,hasListItemAfter:()=>ak,hasListItemBefore:()=>jc,listItemHasSubList:()=>Uc,nextListIsDeeper:()=>qc,nextListIsHigher:()=>Wc});var On=(n,e)=>{const{$from:t}=e.selection,r=re(n,e.schema);let i=null,o=t.depth,s=t.pos,l=null;for(;o>0&&l===null;)i=t.node(o),i.type===r?l=o:(o-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Qo=(n,e)=>{const t=On(n,e);if(!t)return!1;const[,r]=dy(e,n,t.$pos.pos+4);return r},Hc=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),o=n.doc.resolve(i).node();return!(!o||!t.includes(o.type.name))},jc=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},Uc=(n,e,t)=>{if(!t)return!1;const r=re(n,e.schema);let i=!1;return t.descendants(o=>{o.type===r&&(i=!0)}),i},lo=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!ft(n.state,e)&&Hc(n.state,e,t)){const{$anchor:l}=n.state.selection,c=n.state.doc.resolve(l.before()-1),d=[];c.node().descendants((h,p)=>{h.type.name===e&&d.push({node:h,pos:p})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(c.start()+u.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!ft(n.state,e)||!py(n.state))return!1;const r=On(e,n.state);if(!r)return!1;const o=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=Uc(e,n.state,o);return jc(e,n.state)&&!s?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},qc=(n,e)=>{const t=Qo(n,e),r=On(n,e);return!r||!t?!1:t>r.depth},Wc=(n,e)=>{const t=Qo(n,e),r=On(n,e);return!r||!t?!1:t<r.depth},ao=(n,e)=>{if(!ft(n.state,e)||!hy(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:qc(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Wc(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},ak=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},Kc=te.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ao(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ao(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&lo(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&lo(n,t,r)&&(e=!0)}),e}}}}),vl=/^(\s*)(\d+)\.\s+(.*)$/,ck=/^\s/;function dk(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],o=i.match(vl);if(!o)break;const[,s,l,c]=o,d=s.length;let u=c,f=t+1;const h=[i];for(;f<n.length;){const p=n[f];if(p.match(vl))break;if(p.trim()==="")h.push(p),u+=`
134
- `,f+=1;else if(p.match(ck))h.push(p),u+=`
132
+ 3. "-" cannot repeat`);Q.customSchemes.push([n,e])}function Q0(){Q.scanner=j0(Q.customSchemes);for(let n=0;n<Q.tokenQueue.length;n++)Q.tokenQueue[n][1]({scanner:Q.scanner});Q.parser=W0(Q.scanner.tokens);for(let n=0;n<Q.pluginQueue.length;n++)Q.pluginQueue[n][1]({scanner:Q.scanner,parser:Q.parser});return Q.initialized=!0,Q}function Go(n){return Q.initialized||Q0(),K0(Q.parser.start,n,Lc(Q.scanner.start,n))}Go.scan=Lc;function Pc(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Jo(t),i=Go(n),o=[];for(let s=0;s<i.length;s++){const l=i[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}var Yo="[\0-   ᠎ -\u2029  ]",X0=new RegExp(Yo),Z0=new RegExp(`${Yo}$`),_0=new RegExp(Yo,"g");function ek(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function tk(n){return new Z({key:new oe("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),o=e.some(d=>d.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,l=rc(t.doc,[...e]);if(dc(l).forEach(({newRange:d})=>{const u=ty(r.doc,d,p=>p.isTextblock);let f,h;if(u.length>1)f=u[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const p=r.doc.textBetween(d.from,d.to," "," ");if(!Z0.test(p))return;f=u[0],h=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&h){const p=h.split(X0).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=f.pos+h.lastIndexOf(m);if(!m)return!1;const y=Go(m).map(k=>k.toObject(n.defaultProtocol));if(!ek(y))return!1;y.filter(k=>k.isLink).map(k=>({...k,from:g+k.start+1,to:g+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>n.validate(k.value)).filter(k=>n.shouldAutoLink(k.value)).forEach(k=>{Lo(k.from,k.to,r.doc).some(v=>v.mark.type===n.type)||s.addMark(k.from,k.to,n.type.create({href:k.href}))})}}),!!s.steps.length)return s}})}function nk(n){return new Z({key:new oe("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=!1;if(n.enableClickSelection&&(s=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{let f=r.target;const h=[];for(;f.nodeName!=="DIV";)h.push(f),f=f.parentNode;l=h.find(p=>p.nodeName==="A")}if(!l)return s;const c=cc(e.state,n.type.name),d=(i=l?.href)!=null?i:c.href,u=(o=l?.target)!=null?o:c.target;l&&d&&(window.open(d,u),s=!0)}return s}}})}function rk(n){return new Z({key:new oe("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:i}=n,{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let c="";r.content.forEach(u=>{c+=u.textContent});const d=Pc(c,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||i!==void 0&&!i(d.href)?!1:n.editor.commands.setMark(n.type,{href:d.href})}}})}function mt(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(_0,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var ik=It.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(n=>{if(typeof n=="string"){yl(n);return}yl(n.scheme,n.optionalSlashes)})},onDestroy(){Y0()},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:(n,e)=>!!mt(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.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:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!mt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!mt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ie(this.options.HTMLAttributes,n),0]:["a",ie(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!mt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!mt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Bt({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=Pc(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!mt(s,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(tk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!mt(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(nk({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(rk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),ok=Object.defineProperty,sk=(n,e)=>{for(var t in e)ok(n,t,{get:e[t],enumerable:!0})},lk="listItem",kl="textStyle",bl=/^\s*([-+*])\s$/,Vc=Te.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:n}){return["ul",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
133
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(lk,this.editor.getAttributes(kl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Zt({find:bl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Zt({find:bl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(kl),editor:this.editor})),[n]}}),Fc=Te.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],n.tokens.length>1){const s=n.tokens.slice(1),l=e.parseChildren(s);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Fo(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ak={};sk(ak,{findListItemPos:()=>On,getNextListDepth:()=>Qo,handleBackspace:()=>lo,handleDelete:()=>ao,hasListBefore:()=>Hc,hasListItemAfter:()=>ck,hasListItemBefore:()=>jc,listItemHasSubList:()=>Uc,nextListIsDeeper:()=>qc,nextListIsHigher:()=>Wc});var On=(n,e)=>{const{$from:t}=e.selection,r=re(n,e.schema);let i=null,o=t.depth,s=t.pos,l=null;for(;o>0&&l===null;)i=t.node(o),i.type===r?l=o:(o-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Qo=(n,e)=>{const t=On(n,e);if(!t)return!1;const[,r]=uy(e,n,t.$pos.pos+4);return r},Hc=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),o=n.doc.resolve(i).node();return!(!o||!t.includes(o.type.name))},jc=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},Uc=(n,e,t)=>{if(!t)return!1;const r=re(n,e.schema);let i=!1;return t.descendants(o=>{o.type===r&&(i=!0)}),i},lo=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!ft(n.state,e)&&Hc(n.state,e,t)){const{$anchor:l}=n.state.selection,c=n.state.doc.resolve(l.before()-1),d=[];c.node().descendants((h,p)=>{h.type.name===e&&d.push({node:h,pos:p})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(c.start()+u.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!ft(n.state,e)||!my(n.state))return!1;const r=On(e,n.state);if(!r)return!1;const o=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=Uc(e,n.state,o);return jc(e,n.state)&&!s?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},qc=(n,e)=>{const t=Qo(n,e),r=On(n,e);return!r||!t?!1:t>r.depth},Wc=(n,e)=>{const t=Qo(n,e),r=On(n,e);return!r||!t?!1:t<r.depth},ao=(n,e)=>{if(!ft(n.state,e)||!py(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:qc(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Wc(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},ck=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},Kc=te.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ao(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ao(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&lo(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&lo(n,t,r)&&(e=!0)}),e}}}}),vl=/^(\s*)(\d+)\.\s+(.*)$/,dk=/^\s/;function uk(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],o=i.match(vl);if(!o)break;const[,s,l,c]=o,d=s.length;let u=c,f=t+1;const h=[i];for(;f<n.length;){const p=n[f];if(p.match(vl))break;if(p.trim()==="")h.push(p),u+=`
134
+ `,f+=1;else if(p.match(dk))h.push(p),u+=`
135
135
  ${p.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),content:u.trim(),raw:h.join(`
136
136
  `)}),r=f,t=f}return[e,r]}function Jc(n,e,t){var r;const i=[];let o=0;for(;o<n.length;){const s=n[o];if(s.indent===e){const l=s.content.split(`
137
137
  `),c=((r=l[0])==null?void 0:r.trim())||"",d=[];c&&d.push({type:"paragraph",raw:c,tokens:t.inlineTokens(c)});const u=l.slice(1).join(`
138
138
  `).trim();if(u){const p=t.blockTokens(u);d.push(...p)}let f=o+1;const h=[];for(;f<n.length&&n[f].indent>e;)h.push(n[f]),f+=1;if(h.length>0){const p=Math.min(...h.map(g=>g.indent)),m=Jc(h,p,t);d.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(g=>g.raw).join(`
139
- `)})}i.push({type:"list_item",raw:s.raw,tokens:d}),o=f}else o+=1}return i}function uk(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const o=e.parseChildren([i]);r.push({type:"paragraph",content:o})}else{const o=e.parseChildren([i]);o.length>0&&r.push(...o)}}),{type:"listItem",content:r}})}var fk="listItem",xl="textStyle",wl=/^(\d+)\.\s$/,Gc=Te.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ie(this.options.HTMLAttributes,t),0]:["ol",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?uk(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
139
+ `)})}i.push({type:"list_item",raw:s.raw,tokens:d}),o=f}else o+=1}return i}function fk(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const o=e.parseChildren([i]);r.push({type:"paragraph",content:o})}else{const o=e.parseChildren([i]);o.length>0&&r.push(...o)}}),{type:"listItem",content:r}})}var hk="listItem",xl="textStyle",wl=/^(\d+)\.\s$/,Gc=Te.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ie(this.options.HTMLAttributes,t),0]:["ol",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?fk(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
140
140
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const i=n.split(`
141
- `),[o,s]=dk(i);if(o.length===0)return;const l=Jc(o,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=o[0])==null?void 0:r.number)||1,items:l,raw:i.slice(0,s).join(`
142
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(fk,this.editor.getAttributes(xl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Zt({find:wl,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Zt({find:wl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(xl)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),hk=/^\s*(\[([( |x])?\])\s$/,pk=Te.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:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ie(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Fo(n,e,i)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),d=u=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return d(n),o.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:f}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=t();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{i.setAttribute(u,f)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,s),i.append(o,c),Object.entries(e).forEach(([u,f])=>{i.setAttribute(u,f)}),{dom:i,contentDOM:c,update:u=>u.type!==this.type?!1:(i.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,d(u),!0)}}},addInputRules(){return[Zt({find:hk,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),mk=Te.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:n}){return["ul",ie(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
143
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=o=>{const s=Zi(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:r},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(o)},i=Zi(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,s)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:s}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});te.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Vc.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Fc.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Kc.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Gc.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(pk.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(mk.configure(this.options.taskList)),n}});var gk=Te.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ie(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),yk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,kk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,bk=It.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Xt({find:yk,type:this.type})]},addPasteRules(){return[Bt({find:kk,type:this.type})]}}),vk=Te.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Yc=It.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ie(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const o=i[2].trim();return{type:"underline",raw:i[0],text:o,tokens:t.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),xk=Yc;function wk(n={}){return new Z({view(e){return new Ck(e,n)}})}class Ck{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.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),t=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=f?m.bottom:m.top;f&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!c||c==document.body&&getComputedStyle(c).position=="static")d=-pageXOffset,u=-pageYOffset;else{let f=c.getBoundingClientRect(),h=f.width/c.offsetWidth,p=f.height/c.offsetHeight;d=f.left-c.scrollLeft*h,u=f.top-c.scrollTop*p}this.element.style.left=(r.left-d)/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 t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ea(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 ee extends H{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ee.valid(r)?new ee(r):H.near(r)}content(){return B.empty}eq(e){return e instanceof ee&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ee(e.resolve(t.pos))}getBookmark(){return new Xo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Sk(e)||!Mk(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&ee.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let c=e.doc.resolve(i);if(ee.valid(c))return c}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!P.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(ee.valid(l))return l}return null}}}ee.prototype.visible=!1;ee.findFrom=ee.findGapCursorFrom;H.jsonID("gapcursor",ee);class Xo{constructor(e){this.pos=e}map(e){return new Xo(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ee.valid(t)?new ee(t):H.near(t)}}function Qc(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Sk(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Qc(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Mk(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Qc(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Tk(){return new Z({props:{decorations:Bk,createSelectionBetween(n,e,t){return e.pos==t.pos&&ee.valid(t)?new ee(t):null},handleClick:Nk,handleKeyDown:Ek,handleDOMEvents:{beforeinput:Ak}}})}const Ek=Ya({ArrowLeft:Un("horiz",-1),ArrowRight:Un("horiz",1),ArrowUp:Un("vert",-1),ArrowDown:Un("vert",1)});function Un(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,c=s.empty;if(s instanceof V){if(!o.endOfTextblock(t)||l.depth==0)return!1;c=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=ee.findGapCursorFrom(l,e,c);return d?(i&&i(r.tr.setSelection(new ee(d))),!0):!1}}function Nk(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ee.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&P.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ee(r))),!0)}function Ak(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ee))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=T.empty;for(let s=r.length-1;s>=0;s--)i=T.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new B(i,0,0));return o.setSelection(V.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function Bk(n){if(!(n.selection instanceof ee))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",X.create(n.doc,[be.widget(n.selection.head,e,{key:"gapcursor"})])}var Lr=200,pe=function(){};pe.prototype.append=function(e){return e.length?(e=pe.from(e),!this.length&&e||e.length<Lr&&this.leafAppend(e)||this.length<Lr&&e.leafPrepend(this)||this.appendInner(e)):this};pe.prototype.prepend=function(e){return e.length?pe.from(e).append(this):this};pe.prototype.appendInner=function(e){return new Ok(this,e)};pe.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};pe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};pe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};pe.from=function(e){return e instanceof pe?e:e&&e.length?new Xc(e):pe.empty};var Xc=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var c=o;c<s;c++)if(i(this.values[c],l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var c=o-1;c>=s;c--)if(i(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Lr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Lr)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(pe);pe.empty=new Xc([]);var Ok=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.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,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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})(pe);const Zc=pe,Dk=500;class Ie{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,c,d=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,u.push(f);return}if(i){u.push(new Ve(f.map));let p=f.step.map(i.slice(o)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],d.push(new Ve(m,void 0,void 0,d.length+u.length))),o--,m&&i.appendMap(m,o)}else s.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(o)):f.selection,c=new Ie(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:s,selection:l}}addTransform(e,t,r,i){let o=[],s=this.eventCount,l=this.items,c=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new Ve(e.mapping.maps[u],f,t),p;(p=c&&c.merge(h))&&(h=p,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(c=h)}let d=s-r.depth;return d>$k&&(l=Ik(l,d),s-=d),new Ie(l.append(o),s)}remapping(e,t){let r=new vn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new Ie(this.items.append(e.map(t=>new Ve(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let c=t;this.items.forEach(h=>{let p=o.getMirror(--c);if(p==null)return;s=Math.min(s,p);let m=o.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(o.slice(c+1,p));y&&l++,r.push(new Ve(m,g,y))}else r.push(new Ve(m))},i);let d=[];for(let h=t;h<s;h++)d.push(new Ve(o.maps[h]));let u=this.items.slice(0,i).append(d).append(r),f=new Ie(u,l);return f.emptyItemCount()>Dk&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let c=s.step.map(t.slice(r)),d=c&&c.getMap();if(r--,d&&t.appendMap(d,r),c){let u=s.selection&&s.selection.map(t.slice(r));u&&o++;let f=new Ve(d.invert(),c,u),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else s.map&&r--},this.items.length,0),new Ie(Zc.from(i.reverse()),o)}}Ie.empty=new Ie(Zc.empty,0);function Ik(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Ve{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Ve(t.getMap().invert(),t,this.selection)}}}class et{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const $k=20;function Rk(n,e,t,r){let i=t.getMeta(Mt),o;if(i)return i.historyState;t.getMeta(Pk)&&(n=new et(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Mt))return s.getMeta(Mt).redo?new et(n.done.addTransform(t,void 0,r,Gn(e)),n.undone,Cl(t.mapping.maps),n.prevTime,n.prevComposition):new et(n.done,n.undone.addTransform(t,void 0,r,Gn(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),c=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Lk(t,n.prevRanges)),d=s?Ai(n.prevRanges,t.mapping):Cl(t.mapping.maps);return new et(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Gn(e)),Ie.empty,d,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new et(n.done.rebased(t,o),n.undone.rebased(t,o),Ai(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new et(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ai(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Lk(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function Cl(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function Ai(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function zk(n,e,t){let r=Gn(e),i=Mt.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),c=new et(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(Mt,{redo:t,historyState:c})}let Bi=!1,Sl=null;function Gn(n){let e=n.plugins;if(Sl!=e){Bi=!1,Sl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Bi=!0;break}}return Bi}const Mt=new oe("history"),Pk=new oe("closeHistory");function Vk(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Z({key:Mt,state:{init(){return new et(Ie.empty,Ie.empty,null,0,-1)},apply(e,t,r){return Rk(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?ed:r=="historyRedo"?td:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function _c(n,e){return(t,r)=>{let i=Mt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=zk(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const ed=_c(!1,!0),td=_c(!0,!0);te.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.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=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Z({key:new oe("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const s=o-i,l=0,c=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(l,c);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,c=o-r,d=l-c,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Fk=te.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[wk(this.options)]}});te.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Z({key:new oe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!t||!r)return X.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((c,d)=>{if(c.isText)return;if(!(i>=d&&i<=d+c.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((c,d)=>{if(c.isText||!(i>=d&&i<=d+c.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";o.push(be.node(d,d+c.nodeSize,{class:this.options.className}))}),X.create(n,o)}}})]}});var Hk=te.create({name:"gapCursor",addProseMirrorPlugins(){return[Tk()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=G(z(n,"allowGapCursor",t)))!=null?e:null}}}),jk=te.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Z({key:new oe("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return n.descendants((s,l)=>{const c=r>=l&&r<=l+s.nodeSize,d=!s.isLeaf&&Zr(s);if((c||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const f=be.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:c}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),X.create(n,i)}}})]}});te.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Z({key:new oe("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||uc(t.selection)||n.view.dragging?null:X.create(t.doc,[be.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Ml({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Uk=te.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new oe(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new Z({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:c,schema:d}=s,u=e.getState(s),f=l.content.size,h=d.nodes[t];if(u)return c.insert(f,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!Ml({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!Ml({node:s,types:r})}}})]}}),qk=te.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>ed(n,e),redo:()=>({state:n,dispatch:e})=>td(n,e)}},addProseMirrorPlugins(){return[Vk(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()}}}),Wk=te.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(y0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(f0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Vc.configure(this.options.bulletList)),this.options.code!==!1&&i.push(v0.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(C0.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(S0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Fk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Hk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(M0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Ac.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(qk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(E0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(D0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Fc.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Kc.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(rk.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Gc.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(gk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(bk.configure(this.options.strike)),this.options.text!==!1&&i.push(vk.configure(this.options.text)),this.options.underline!==!1&&i.push(Yc.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(Uk.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Kk=Wk,Jk=te.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:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).some(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!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")}}}),Gk=Jk,Yk=jk;const Qk={class:"input-richtext-toolbar"},Xk={class:"input-richtext-group"},Zk={class:"input-richtext-group"},_k={class:"input-richtext-group"},e1={class:"input-richtext-group"},t1={class:"input-richtext-group"},n1={class:"input-richtext-group"},r1={key:0},i1={key:1,class:"input-richtext-dropdown-wrapper"},o1={key:0},s1=["onClick"],l1={class:"input-richtext-dropdown-item-label"},a1={class:"input-richtext-editor-wrapper"},c1=a.defineComponent({__name:"UiInput.RichText",props:{minHeight:{default:"200px"},maxHeight:{default:"400px"},customControls:{default:()=>[]},label:{},helpText:{},modelValue:{},value:{},placeholder:{default:"Start typing..."},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{},tabindex:{}},emits:["update:modelValue","blur","focus"],setup(n,{emit:e}){a.useCssVars(v=>({e662f704:v.minHeight,v5ec36e10:v.maxHeight}));const t=n,r=e,i=a.ref(typeof t.modelValue=="string"?t.modelValue:""),o=a.ref(null),s=a.ref([]),l=a.ref(),{floatingStyle:c,updatePosition:d,cleanup:u}=Vr({trigger:a.computed(()=>o.value!==null?s.value[o.value]:void 0),floating:l,placement:"bottom-start",offset:4,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{h()}}}),f=async v=>{o.value=v,await a.nextTick(),d()},h=()=>{o.value=null},p=v=>{o.value===v?h():f(v)},m=v=>{v.action&&k.value&&v.action(k.value)},g=v=>{k.value&&v.action(k.value),h()},y=(v,b)=>{v&&(s.value[b]=v.$el||v)},k=d0({content:i.value,editable:!t.disabled&&!t.readonly,extensions:[Kk,T0.configure({levels:[1,2,3]}),xk,Gk.configure({types:["heading","paragraph"]}),Yk.configure({placeholder:t.placeholder})],onUpdate:({editor:v})=>{const b=v.getHTML();i.value=b,r("update:modelValue",b)},onFocus:v=>{r("focus",v.event)},onBlur:v=>{r("blur",v.event)}});return a.watch(()=>t.modelValue,v=>{typeof v=="string"&&k.value&&k.value.getHTML()!==v&&(k.value.commands.setContent(v),i.value=v)}),a.watch(()=>t.disabled,v=>{k.value&&k.value.setEditable(!v&&!t.readonly)}),a.watch(()=>t.readonly,v=>{k.value&&k.value.setEditable(!t.disabled&&!v)}),a.onBeforeUnmount(()=>{k.value&&k.value.destroy(),u()}),(v,b)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-richtext-container",{"input-error":n.error,"input-disabled":n.disabled}])},[a.createElementVNode("div",Qk,[a.createElementVNode("div",Xk,[a.createVNode(W,{color:a.unref(k)?.isActive("bold")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[0]||(b[0]=x=>a.unref(k)?.chain().focus().toggleBold().run()),disabled:n.disabled,title:"Bold (Ctrl+B)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(eu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("italic")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[1]||(b[1]=x=>a.unref(k)?.chain().focus().toggleItalic().run()),disabled:n.disabled,title:"Italic (Ctrl+I)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(pu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("underline")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[2]||(b[2]=x=>a.unref(k)?.chain().focus().toggleUnderline().run()),disabled:n.disabled,title:"Underline (Ctrl+U)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(xu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("strike")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[3]||(b[3]=x=>a.unref(k)?.chain().focus().toggleStrike().run()),disabled:n.disabled,title:"Strikethrough"},{icon:a.withCtx(()=>[a.createVNode(a.unref(vu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",Zk,[a.createVNode(W,{color:a.unref(k)?.isActive("heading",{level:1})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[4]||(b[4]=x=>a.unref(k)?.chain().focus().toggleHeading({level:1}).run()),disabled:n.disabled,title:"Heading 1"},{icon:a.withCtx(()=>[a.createVNode(a.unref(uu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("heading",{level:2})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[5]||(b[5]=x=>a.unref(k)?.chain().focus().toggleHeading({level:2}).run()),disabled:n.disabled,title:"Heading 2"},{icon:a.withCtx(()=>[a.createVNode(a.unref(fu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("heading",{level:3})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[6]||(b[6]=x=>a.unref(k)?.chain().focus().toggleHeading({level:3}).run()),disabled:n.disabled,title:"Heading 3"},{icon:a.withCtx(()=>[a.createVNode(a.unref(hu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",_k,[a.createVNode(W,{color:a.unref(k)?.isActive({textAlign:"left"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[7]||(b[7]=x=>a.unref(k)?.chain().focus().setTextAlign("left").run()),disabled:n.disabled,title:"Align Left"},{icon:a.withCtx(()=>[a.createVNode(a.unref(Zd),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive({textAlign:"center"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[8]||(b[8]=x=>a.unref(k)?.chain().focus().setTextAlign("center").run()),disabled:n.disabled,title:"Align Center"},{icon:a.withCtx(()=>[a.createVNode(a.unref(Xd),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive({textAlign:"right"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[9]||(b[9]=x=>a.unref(k)?.chain().focus().setTextAlign("right").run()),disabled:n.disabled,title:"Align Right"},{icon:a.withCtx(()=>[a.createVNode(a.unref(_d),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",e1,[a.createVNode(W,{color:a.unref(k)?.isActive("bulletList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[10]||(b[10]=x=>a.unref(k)?.chain().focus().toggleBulletList().run()),disabled:n.disabled,title:"Bullet List"},{icon:a.withCtx(()=>[a.createVNode(a.unref(gu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("orderedList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[11]||(b[11]=x=>a.unref(k)?.chain().focus().toggleOrderedList().run()),disabled:n.disabled,title:"Numbered List"},{icon:a.withCtx(()=>[a.createVNode(a.unref(mu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("blockquote")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[12]||(b[12]=x=>a.unref(k)?.chain().focus().toggleBlockquote().run()),disabled:n.disabled,title:"Quote"},{icon:a.withCtx(()=>[a.createVNode(a.unref(yu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("codeBlock")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[13]||(b[13]=x=>a.unref(k)?.chain().focus().toggleCodeBlock().run()),disabled:n.disabled,title:"Code Block"},{icon:a.withCtx(()=>[a.createVNode(a.unref(lu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",t1,[a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",onClick:b[14]||(b[14]=x=>a.unref(k)?.chain().focus().setHorizontalRule().run()),disabled:n.disabled,title:"Horizontal Rule"},{icon:a.withCtx(()=>[a.createVNode(a.unref(El),{size:16})]),_:1},8,["disabled"]),a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!a.unref(k)?.can().undo()||n.disabled,onClick:b[15]||(b[15]=x=>a.unref(k)?.chain().focus().undo().run()),title:"Undo (Ctrl+Z)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(wu),{size:16})]),_:1},8,["disabled"]),a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!a.unref(k)?.can().redo()||n.disabled,onClick:b[16]||(b[16]=x=>a.unref(k)?.chain().focus().redo().run()),title:"Redo (Ctrl+Y)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(ku),{size:16})]),_:1},8,["disabled"])]),n.customControls&&n.customControls.length>0?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",n1,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.customControls,(x,w)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:w},[x.action?(a.openBlock(),a.createBlock(W,{key:0,color:"secondary",size:"sm",icon:!x.label,squircle:"",onClick:S=>m(x),disabled:n.disabled,title:x.tooltip||x.label},a.createSlots({default:a.withCtx(()=>[x.label&&x.icon?(a.openBlock(),a.createElementBlock("span",r1,a.toDisplayString(x.label),1)):x.label?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(x.label),1)],64)):a.createCommentVNode("",!0)]),_:2},[x.icon?{name:"icon",fn:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(x.icon),{size:16}))]),key:"0"}:void 0]),1032,["icon","onClick","disabled","title"])):x.list?(a.openBlock(),a.createElementBlock("div",i1,[a.createVNode(W,{ref_for:!0,ref:S=>y(S,w),color:"secondary",size:"sm",squircle:"",onClick:S=>p(w),disabled:n.disabled,title:x.tooltip||x.label,class:a.normalizeClass({"input-richtext-dropdown-open":o.value===w})},a.createSlots({"trailing-icon":a.withCtx(()=>[a.createVNode(a.unref(Pr),{size:14,class:"input-richtext-dropdown-arrow"})]),default:a.withCtx(()=>[x.label?(a.openBlock(),a.createElementBlock("span",o1,a.toDisplayString(x.label),1)):a.createCommentVNode("",!0)]),_:2},[x.icon?{name:"leading-icon",fn:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(x.icon),{size:16}))]),key:"0"}:void 0]),1032,["onClick","disabled","title","class"])])):a.createCommentVNode("",!0)],64))),128))])],64)):a.createCommentVNode("",!0)]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[o.value!==null&&n.customControls?.[o.value]?.list?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:l,class:"input-richtext-dropdown",style:a.normalizeStyle(a.unref(c))},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.customControls[o.value].list,(x,w)=>(a.openBlock(),a.createElementBlock("button",{key:w,class:"input-richtext-dropdown-item",onClick:S=>g(x),type:"button"},[x.icon?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(x.icon),{key:0,size:16,class:"input-richtext-dropdown-item-icon"})):a.createCommentVNode("",!0),a.createElementVNode("span",l1,a.toDisplayString(x.label),1)],8,s1))),128))],4)):a.createCommentVNode("",!0)])),a.createElementVNode("div",a1,[a.createVNode(a.unref(c0),{editor:a.unref(k),class:"input-richtext-editor",id:n.inputId},null,8,["editor","id"])])],2))}}),d1=de(c1,[["__scopeId","data-v-09a16a56"]]),u1={class:"pincode-inputs"},f1={key:0,class:"pincode-icon pincode-icon-leading"},h1=["value","disabled","readonly","tabindex","data-index","onInput","onKeydown","onFocus"],p1={key:1,class:"pincode-divider"},m1={key:1,class:"pincode-icon pincode-icon-trailing"},g1=a.defineComponent({__name:"UiInput.Pincode",props:{maxLength:{default:6},variant:{default:"numeric"},divider:{},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error]},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","complete"],setup(n,{emit:e}){const t=n,r=e,i=a.ref([]),o=a.ref(-1),s=a.computed(()=>{const b=(t.modelValue||"").split("");for(;b.length<t.maxLength;)b.push("");return b.slice(0,t.maxLength)}),l=a.computed(()=>t.divider?typeof t.divider=="number"?t.divider:t.divider.count:0),c=a.computed(()=>t.divider?typeof t.divider=="number"?"-":typeof t.divider=="object"&&"character"in t.divider&&t.divider.character||"-":""),d=a.computed(()=>typeof t.divider=="object"&&"component"in t.divider&&t.divider.component==="divider"),u=a.computed(()=>d.value?{orientation:"vertical",variant:"solid",thickness:"1px",margin:"0",spacing:"1.5rem",...t.divider.props}:{}),f=v=>!l.value||v===t.maxLength?!1:v%l.value===0,h=()=>{switch(t.variant){case"numeric":return/^[0-9]$/;case"alpha":return/^[a-zA-Z]$/;case"alphanumeric":return/^[a-zA-Z0-9]$/;default:return/^[0-9]$/}},p=(v,b)=>{const x=v.target,S=x.value.slice(-1);if(!h().test(S)&&S!==""){x.value=s.value[b];return}const C=[...s.value];C[b]=S;const A=C.join("");r("update:modelValue",A),S&&b<t.maxLength-1&&a.nextTick(()=>{const $=i.value[b+1];$&&($.focus(),$.select())}),A.length===t.maxLength&&r("complete",A)},m=(v,b)=>{const x=v.key;if(x==="Backspace"){v.preventDefault();const w=[...s.value];s.value[b]?(w[b]="",r("update:modelValue",w.join(""))):b>0&&(w[b-1]="",r("update:modelValue",w.join("")),a.nextTick(()=>{const S=i.value[b-1];S&&S.focus()}))}else if(x==="ArrowLeft"&&b>0){v.preventDefault();const w=i.value[b-1];w&&w.focus()}else if(x==="ArrowRight"&&b<t.maxLength-1){v.preventDefault();const w=i.value[b+1];w&&w.focus()}else if(x==="Delete"){v.preventDefault();const w=[...s.value];w[b]="",r("update:modelValue",w.join(""))}},g=v=>{v.preventDefault();const b=v.clipboardData?.getData("text")||"",x=h(),w=b.split("").filter(S=>x.test(S)).slice(0,t.maxLength).join("");if(w){r("update:modelValue",w);const S=w.length<t.maxLength?w.length:t.maxLength-1;a.nextTick(()=>{const M=i.value[S];M&&M.focus()}),w.length===t.maxLength&&r("complete",w)}},y=v=>{o.value=v;const b=i.value[v];b&&b.select()},k=v=>{o.value=-1,r("blur",v)};return a.watch(()=>t.modelValue,v=>{v||a.nextTick(()=>{const b=i.value[0];b&&!t.disabled&&!t.readonly&&b.focus()})}),(v,b)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["pincode-wrapper",[`pincode-size-${n.size}`,{"pincode-error":n.error}]])},[a.createElementVNode("div",u1,[a.renderSlot(v.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",f1,[a.renderSlot(v.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.maxLength,x=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:x},[a.createElementVNode("input",{ref_for:!0,ref_key:"pincodeRefs",ref:i,type:"text",class:a.normalizeClass(["pincode-input",{"pincode-input-filled":s.value[x-1],"pincode-input-focused":o.value===x-1}]),value:s.value[x-1],disabled:n.disabled,readonly:n.readonly,tabindex:n.disabled?-1:void 0,"data-index":x-1,maxlength:"1",onInput:w=>p(w,x-1),onKeydown:w=>m(w,x-1),onFocus:w=>y(x-1),onBlur:k,onPaste:g},null,42,h1),f(x)&&d.value?(a.openBlock(),a.createBlock(tt,a.mergeProps({key:0,ref_for:!0},u.value,{class:"pincode-custom-divider"}),null,16)):f(x)?(a.openBlock(),a.createElementBlock("span",p1,a.toDisplayString(c.value),1)):a.createCommentVNode("",!0)],64))),128)),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",m1,[a.renderSlot(v.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(v.$slots,"trailing",{},void 0,!0)])],2))}}),y1=de(g1,[["__scopeId","data-v-12f41567"]]);function k1(n,e){const t=n[e];if(!t)return!1;const r=t();return!r||r.length===0?!1:r.some(i=>!!(i.children&&i.children!==""||i.type&&typeof i.type=="object"||i.props&&Object.keys(i.props).length>0))}const b1=["for"],v1={key:0,class:"input-required"},x1={key:1,class:"input-hint"},w1={key:2,class:"input-error-text"},C1={key:3,class:"input-help-text"},S1=a.defineComponent({__name:"UiInput",props:{type:{},min:{},max:{},step:{},autocomplete:{},spellcheck:{type:Boolean},hasLeadingIcon:{type:Boolean},hasTrailingIcon:{type:Boolean},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error]},size:{},tabindex:{},options:{},multiple:{type:Boolean},searchable:{type:Boolean},allowInsert:{type:Boolean},maxDropdownHeight:{},noOptionsText:{},searchPlaceholder:{},rows:{},cols:{},maxlength:{},resizable:{type:Boolean},accept:{},maxFileSize:{},dragDropText:{},selectedText:{},preview:{},format:{},is24Hour:{type:Boolean},minuteStep:{},minHeight:{},maxHeight:{},customControls:{},maxLength:{},variant:{},divider:{}},emits:["update:modelValue","input","change","blur","focus","keydown","file-error","clear-preview","complete"],setup(n,{emit:e}){const t=n,r=e,i=a.useSlots(),o=a.ref(""),s=a.computed(()=>t.modelValue!==void 0?t.modelValue:t.value!==void 0?t.value:o.value);a.watch(()=>t.value,k=>{k!==void 0&&(o.value=k)},{immediate:!0}),a.watch(()=>t.modelValue,k=>{k!==void 0&&(o.value=k)},{immediate:!0});const l=a.computed(()=>`input-${Math.random().toString(36).substring(2,11)}`),c=k=>k1(i,k),d=a.computed(()=>{const k=["text","email","password","number","tel","url","search"],v=t.type||"text";return k.includes(v)}),u=k=>{o.value=k,r("update:modelValue",k),r("input",k),r("change",k)},f=k=>{r("blur",k)},h=k=>{r("focus",k)},p=k=>{r("keydown",k)},m=k=>{r("file-error",k)},g=()=>{r("clear-preview")},y=k=>{r("complete",k)};return(k,v)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-container",{"input-container--full-width":t.fullWidth,[`input-container--${t.size||"md"}`]:!0}])},[t.label?(a.openBlock(),a.createElementBlock("label",{key:0,for:l.value,tabindex:"-1",class:"input-label"},[a.createTextVNode(a.toDisplayString(t.label)+" ",1),t.required?(a.openBlock(),a.createElementBlock("span",v1,"*")):a.createCommentVNode("",!0)],8,b1)):a.createCommentVNode("",!0),a.createElementVNode("div",null,[d.value?(a.openBlock(),a.createBlock(Au,{key:0,"model-value":s.value,type:n.type,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,step:t.step,autocomplete:t.autocomplete,spellcheck:t.spellcheck,"input-id":l.value,error:!!(t.error&&t.error!==!0&&t.error!==""),size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h,onKeydown:p},{leading:a.withCtx(()=>[a.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","type","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="textarea"?(a.openBlock(),a.createBlock($u,{key:1,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,rows:t.rows,cols:t.cols,maxlength:t.maxlength,autocomplete:t.autocomplete,spellcheck:t.spellcheck,resizable:t.resizable,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h,onKeydown:p},{leading:a.withCtx(()=>[a.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck","resizable","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="select"?(a.openBlock(),a.createBlock(Qu,{key:2,"model-value":s.value,options:t.options,placeholder:n.placeholder,disabled:n.disabled,multiple:t.multiple,searchable:t.searchable,"allow-insert":t.allowInsert,"max-dropdown-height":t.maxDropdownHeight,"no-options-text":t.noOptionsText,"search-placeholder":t.searchPlaceholder,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h},{leading:a.withCtx(()=>[a.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","options","placeholder","disabled","multiple","searchable","allow-insert","max-dropdown-height","no-options-text","search-placeholder","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="file"?(a.openBlock(),a.createBlock(yf,{key:3,"model-value":s.value,accept:t.accept,multiple:t.multiple,"max-file-size":t.maxFileSize,"drag-drop-text":t.dragDropText,"selected-text":t.selectedText,preview:t.preview,disabled:n.disabled,required:t.required,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":u,onFileError:m,onClearPreview:g,onBlur:f,onFocus:h},{leading:a.withCtx(()=>[a.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","accept","multiple","max-file-size","drag-drop-text","selected-text","preview","disabled","required","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="date"?(a.openBlock(),a.createBlock(Yf,{key:4,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","min","max","input-id","error","size","tabindex"])):n.type==="time"?(a.openBlock(),a.createBlock(Qf,{key:5,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","input-id","error","size","tabindex"])):n.type==="datetime"?(a.openBlock(),a.createBlock(Xf,{key:6,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","min","max","input-id","error","size","tabindex"])):n.type==="richtext"?(a.openBlock(),a.createBlock(d1,{key:7,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,"input-id":l.value,error:t.error,"min-height":t.minHeight,"max-height":t.maxHeight,"custom-controls":t.customControls,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","input-id","error","min-height","max-height","custom-controls","tabindex"])):n.type==="pincode"?(a.openBlock(),a.createBlock(y1,{key:8,"model-value":s.value,"max-length":t.maxLength||6,variant:t.variant||"numeric",divider:t.divider,disabled:n.disabled,readonly:n.readonly,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h,onComplete:y},a.createSlots({_:2},[c("leading")?{name:"leading",fn:a.withCtx(()=>[a.renderSlot(k.$slots,"leading",{},void 0,!0)]),key:"0"}:void 0,c("leading-icon")?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),key:"1"}:void 0,c("trailing-icon")?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),key:"2"}:void 0,c("trailing")?{name:"trailing",fn:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing",{},void 0,!0)]),key:"3"}:void 0]),1032,["model-value","max-length","variant","divider","disabled","readonly","input-id","error","size","tabindex"])):a.createCommentVNode("",!0)]),k.$slots.hint?(a.openBlock(),a.createElementBlock("div",x1,[a.renderSlot(k.$slots,"hint",{},void 0,!0)])):a.createCommentVNode("",!0),t.error&&t.error!==!0?(a.openBlock(),a.createElementBlock("p",w1,a.toDisplayString(typeof t.error=="string"?t.error:t.error?.message||String(t.error)),1)):t.helpText?(a.openBlock(),a.createElementBlock("p",C1,a.toDisplayString(t.helpText),1)):a.createCommentVNode("",!0)],2))}}),ni=de(S1,[["__scopeId","data-v-faec04e1"]]),M1=["disabled","aria-disabled"],T1=["href","target","rel","aria-disabled"],E1=a.defineComponent({__name:"UiLink",props:{href:{},to:{},variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean,default:!1},external:{type:Boolean,default:!1},color:{}},emits:["click"],setup(n,{emit:e}){const t=n,r=e,i=a.computed(()=>{if(t.href)return t.href;if(t.to){if(typeof t.to=="string")return t.to;if(typeof t.to=="object"&&t.to)return"#route-object-not-supported"}return"#"});function o(){if(typeof window<"u"){const u=getComputedStyle(document.documentElement).getPropertyValue("--strands-accent").trim();if(u)return u}return"#EA00A8"}const s=()=>({primary:o(),success:"#059669",warning:"#d97706",danger:"#dc2626"}),l=u=>{const f=s();return`color-mix(in srgb, ${f[u]||f.primary} 85%, black 15%)`},c=a.computed(()=>{if(!t.color)return{};const u=s(),f=u[t.color]||u.primary,h=l(t.color),p={"--link-color":f,"--link-hover-color":h,color:f};return t.variant==="underline"?{...p,textDecorationColor:f}:p}),d=u=>{t.disabled||r("click",u)};return(u,f)=>!n.to&&!n.href?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:a.normalizeClass(["ui-link",[`ui-link-${n.variant}`,`ui-link-${n.size}`,{"ui-link-disabled":n.disabled},{"ui-link-custom-color":n.color}]]),style:a.normalizeStyle(c.value),disabled:n.disabled,"aria-disabled":n.disabled,onClick:d},[a.renderSlot(u.$slots,"default",{},void 0,!0)],14,M1)):(a.openBlock(),a.createElementBlock("a",{key:1,class:a.normalizeClass(["ui-link",[`ui-link-${n.variant}`,`ui-link-${n.size}`,{"ui-link-disabled":n.disabled},{"ui-link-custom-color":n.color}]]),style:a.normalizeStyle(c.value),href:i.value,target:n.external?"_blank":void 0,rel:n.external?"noopener noreferrer":void 0,"aria-disabled":n.disabled,onClick:d},[a.renderSlot(u.$slots,"default",{},void 0,!0)],14,T1))}}),Zo=de(E1,[["__scopeId","data-v-3bf99110"]]),N1={StrandsUiAlert:co,StrandsUiButton:W,StrandsUiCard:uo,StrandsUiInput:ni,StrandsUiLink:Zo,StrandsUiTabs:Fr,StrandsUiLoader:zr},nd={install(n,e={}){const{prefix:t=""}=e;Object.entries(N1).forEach(([r,i])=>{const o=t?`${t}${r}`:r;n.component(o,i)})}},A1=Object.freeze(Object.defineProperty({__proto__:null,StrandsUiAlert:co,StrandsUiButton:W,StrandsUiCard:uo,StrandsUiInput:ni,StrandsUiLink:Zo,StrandsUiLoader:zr,StrandsUiTabs:Fr,default:nd},Symbol.toStringTag,{value:"Module"}));exports.ChevronDown=Pr;exports.Minus=El;exports.StrandsUIPlugin=nd;exports.StrandsUIPlugin$1=A1;exports.StrandsUiAlert=co;exports.StrandsUiButton=W;exports.StrandsUiCard=uo;exports.StrandsUiInput=ni;exports.StrandsUiLink=Zo;exports.StrandsUiLoader=zr;exports.StrandsUiTabs=Fr;exports.UiButtonContent=Wt;exports.UiDivider=tt;exports.UiTooltip=Tl;exports._export_sfc=de;exports._sfc_main=Oi;exports._sfc_main$1=Di;exports._sfc_main$2=Ii;exports.createLucideIcon=J;exports.useFloatingPosition=Vr;
141
+ `),[o,s]=uk(i);if(o.length===0)return;const l=Jc(o,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=o[0])==null?void 0:r.number)||1,items:l,raw:i.slice(0,s).join(`
142
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(hk,this.editor.getAttributes(xl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Zt({find:wl,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Zt({find:wl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(xl)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),pk=/^\s*(\[([( |x])?\])\s$/,mk=Te.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:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ie(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Fo(n,e,i)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),d=u=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return d(n),o.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:f}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=t();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{i.setAttribute(u,f)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,s),i.append(o,c),Object.entries(e).forEach(([u,f])=>{i.setAttribute(u,f)}),{dom:i,contentDOM:c,update:u=>u.type!==this.type?!1:(i.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,d(u),!0)}}},addInputRules(){return[Zt({find:pk,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),gk=Te.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:n}){return["ul",ie(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
143
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=o=>{const s=Zi(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:r},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(o)},i=Zi(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,s)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:s}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});te.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Vc.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Fc.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Kc.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Gc.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(mk.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(gk.configure(this.options.taskList)),n}});var yk=Te.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ie(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),kk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,bk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,vk=It.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Xt({find:kk,type:this.type})]},addPasteRules(){return[Bt({find:bk,type:this.type})]}}),xk=Te.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Yc=It.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ie(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const o=i[2].trim();return{type:"underline",raw:i[0],text:o,tokens:t.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),wk=Yc;function Ck(n={}){return new Z({view(e){return new Sk(e,n)}})}class Sk{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.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),t=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=f?m.bottom:m.top;f&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!c||c==document.body&&getComputedStyle(c).position=="static")d=-pageXOffset,u=-pageYOffset;else{let f=c.getBoundingClientRect(),h=f.width/c.offsetWidth,p=f.height/c.offsetHeight;d=f.left-c.scrollLeft*h,u=f.top-c.scrollTop*p}this.element.style.left=(r.left-d)/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 t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ea(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 ee extends H{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ee.valid(r)?new ee(r):H.near(r)}content(){return B.empty}eq(e){return e instanceof ee&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ee(e.resolve(t.pos))}getBookmark(){return new Xo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Mk(e)||!Tk(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&ee.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let c=e.doc.resolve(i);if(ee.valid(c))return c}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!P.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(ee.valid(l))return l}return null}}}ee.prototype.visible=!1;ee.findFrom=ee.findGapCursorFrom;H.jsonID("gapcursor",ee);class Xo{constructor(e){this.pos=e}map(e){return new Xo(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ee.valid(t)?new ee(t):H.near(t)}}function Qc(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Mk(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Qc(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Tk(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Qc(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Ek(){return new Z({props:{decorations:Ok,createSelectionBetween(n,e,t){return e.pos==t.pos&&ee.valid(t)?new ee(t):null},handleClick:Ak,handleKeyDown:Nk,handleDOMEvents:{beforeinput:Bk}}})}const Nk=Ya({ArrowLeft:Un("horiz",-1),ArrowRight:Un("horiz",1),ArrowUp:Un("vert",-1),ArrowDown:Un("vert",1)});function Un(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,c=s.empty;if(s instanceof V){if(!o.endOfTextblock(t)||l.depth==0)return!1;c=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=ee.findGapCursorFrom(l,e,c);return d?(i&&i(r.tr.setSelection(new ee(d))),!0):!1}}function Ak(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ee.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&P.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ee(r))),!0)}function Bk(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ee))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=T.empty;for(let s=r.length-1;s>=0;s--)i=T.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new B(i,0,0));return o.setSelection(V.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function Ok(n){if(!(n.selection instanceof ee))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",X.create(n.doc,[be.widget(n.selection.head,e,{key:"gapcursor"})])}var Lr=200,pe=function(){};pe.prototype.append=function(e){return e.length?(e=pe.from(e),!this.length&&e||e.length<Lr&&this.leafAppend(e)||this.length<Lr&&e.leafPrepend(this)||this.appendInner(e)):this};pe.prototype.prepend=function(e){return e.length?pe.from(e).append(this):this};pe.prototype.appendInner=function(e){return new Dk(this,e)};pe.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};pe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};pe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};pe.from=function(e){return e instanceof pe?e:e&&e.length?new Xc(e):pe.empty};var Xc=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var c=o;c<s;c++)if(i(this.values[c],l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var c=o-1;c>=s;c--)if(i(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Lr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Lr)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(pe);pe.empty=new Xc([]);var Dk=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.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,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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})(pe);const Zc=pe,Ik=500;class Ie{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,c,d=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,u.push(f);return}if(i){u.push(new Ve(f.map));let p=f.step.map(i.slice(o)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],d.push(new Ve(m,void 0,void 0,d.length+u.length))),o--,m&&i.appendMap(m,o)}else s.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(o)):f.selection,c=new Ie(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:s,selection:l}}addTransform(e,t,r,i){let o=[],s=this.eventCount,l=this.items,c=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new Ve(e.mapping.maps[u],f,t),p;(p=c&&c.merge(h))&&(h=p,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(c=h)}let d=s-r.depth;return d>Rk&&(l=$k(l,d),s-=d),new Ie(l.append(o),s)}remapping(e,t){let r=new vn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new Ie(this.items.append(e.map(t=>new Ve(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let c=t;this.items.forEach(h=>{let p=o.getMirror(--c);if(p==null)return;s=Math.min(s,p);let m=o.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(o.slice(c+1,p));y&&l++,r.push(new Ve(m,g,y))}else r.push(new Ve(m))},i);let d=[];for(let h=t;h<s;h++)d.push(new Ve(o.maps[h]));let u=this.items.slice(0,i).append(d).append(r),f=new Ie(u,l);return f.emptyItemCount()>Ik&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let c=s.step.map(t.slice(r)),d=c&&c.getMap();if(r--,d&&t.appendMap(d,r),c){let u=s.selection&&s.selection.map(t.slice(r));u&&o++;let f=new Ve(d.invert(),c,u),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else s.map&&r--},this.items.length,0),new Ie(Zc.from(i.reverse()),o)}}Ie.empty=new Ie(Zc.empty,0);function $k(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Ve{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Ve(t.getMap().invert(),t,this.selection)}}}class et{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const Rk=20;function Lk(n,e,t,r){let i=t.getMeta(Mt),o;if(i)return i.historyState;t.getMeta(Vk)&&(n=new et(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Mt))return s.getMeta(Mt).redo?new et(n.done.addTransform(t,void 0,r,Gn(e)),n.undone,Cl(t.mapping.maps),n.prevTime,n.prevComposition):new et(n.done,n.undone.addTransform(t,void 0,r,Gn(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),c=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!zk(t,n.prevRanges)),d=s?Ai(n.prevRanges,t.mapping):Cl(t.mapping.maps);return new et(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Gn(e)),Ie.empty,d,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new et(n.done.rebased(t,o),n.undone.rebased(t,o),Ai(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new et(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ai(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function zk(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function Cl(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function Ai(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function Pk(n,e,t){let r=Gn(e),i=Mt.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),c=new et(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(Mt,{redo:t,historyState:c})}let Bi=!1,Sl=null;function Gn(n){let e=n.plugins;if(Sl!=e){Bi=!1,Sl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Bi=!0;break}}return Bi}const Mt=new oe("history"),Vk=new oe("closeHistory");function Fk(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Z({key:Mt,state:{init(){return new et(Ie.empty,Ie.empty,null,0,-1)},apply(e,t,r){return Lk(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?ed:r=="historyRedo"?td:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function _c(n,e){return(t,r)=>{let i=Mt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=Pk(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const ed=_c(!1,!0),td=_c(!0,!0);te.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.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=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Z({key:new oe("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const s=o-i,l=0,c=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(l,c);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,c=o-r,d=l-c,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Hk=te.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Ck(this.options)]}});te.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Z({key:new oe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!t||!r)return X.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((c,d)=>{if(c.isText)return;if(!(i>=d&&i<=d+c.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((c,d)=>{if(c.isText||!(i>=d&&i<=d+c.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";o.push(be.node(d,d+c.nodeSize,{class:this.options.className}))}),X.create(n,o)}}})]}});var jk=te.create({name:"gapCursor",addProseMirrorPlugins(){return[Ek()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=G(z(n,"allowGapCursor",t)))!=null?e:null}}}),Uk=te.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Z({key:new oe("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return n.descendants((s,l)=>{const c=r>=l&&r<=l+s.nodeSize,d=!s.isLeaf&&Zr(s);if((c||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const f=be.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:c}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),X.create(n,i)}}})]}});te.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Z({key:new oe("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||uc(t.selection)||n.view.dragging?null:X.create(t.doc,[be.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Ml({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var qk=te.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new oe(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new Z({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:c,schema:d}=s,u=e.getState(s),f=l.content.size,h=d.nodes[t];if(u)return c.insert(f,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!Ml({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!Ml({node:s,types:r})}}})]}}),Wk=te.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>ed(n,e),redo:()=>({state:n,dispatch:e})=>td(n,e)}},addProseMirrorPlugins(){return[Fk(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()}}}),Kk=te.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(k0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(h0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Vc.configure(this.options.bulletList)),this.options.code!==!1&&i.push(x0.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(S0.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(M0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Hk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(jk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(T0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Ac.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Wk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(N0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(I0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Fc.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Kc.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(ik.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Gc.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(yk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(vk.configure(this.options.strike)),this.options.text!==!1&&i.push(xk.configure(this.options.text)),this.options.underline!==!1&&i.push(Yc.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(qk.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Jk=Kk,Gk=te.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:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).some(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!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")}}}),Yk=Gk,Qk=Uk;const Xk={class:"input-richtext-toolbar"},Zk={class:"input-richtext-group"},_k={class:"input-richtext-group"},e1={class:"input-richtext-group"},t1={class:"input-richtext-group"},n1={class:"input-richtext-group"},r1={class:"input-richtext-group"},i1={key:0},o1={key:1,class:"input-richtext-dropdown-wrapper"},s1={key:0},l1=["onClick"],a1={class:"input-richtext-dropdown-item-label"},c1={class:"input-richtext-editor-wrapper"},d1=a.defineComponent({__name:"UiInput.RichText",props:{minHeight:{default:"200px"},maxHeight:{default:"400px"},customControls:{default:()=>[]},label:{},helpText:{},modelValue:{},value:{},placeholder:{default:"Start typing..."},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{},tabindex:{}},emits:["update:modelValue","blur","focus"],setup(n,{emit:e}){a.useCssVars(v=>({e662f704:v.minHeight,v5ec36e10:v.maxHeight}));const t=n,r=e,i=a.ref(typeof t.modelValue=="string"?t.modelValue:""),o=a.ref(null),s=a.ref([]),l=a.ref(),{floatingStyle:c,updatePosition:d,cleanup:u}=Vr({trigger:a.computed(()=>o.value!==null?s.value[o.value]:void 0),floating:l,placement:"bottom-start",offset:4,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{h()}}}),f=async v=>{o.value=v,await a.nextTick(),d()},h=()=>{o.value=null},p=v=>{o.value===v?h():f(v)},m=v=>{v.action&&k.value&&v.action(k.value)},g=v=>{k.value&&v.action(k.value),h()},y=(v,b)=>{v&&(s.value[b]=v.$el||v)},k=u0({content:i.value,editable:!t.disabled&&!t.readonly,extensions:[Jk,E0.configure({levels:[1,2,3]}),wk,Yk.configure({types:["heading","paragraph"]}),Qk.configure({placeholder:t.placeholder})],onUpdate:({editor:v})=>{const b=v.getHTML();i.value=b,r("update:modelValue",b)},onFocus:v=>{r("focus",v.event)},onBlur:v=>{r("blur",v.event)}});return a.watch(()=>t.modelValue,v=>{typeof v=="string"&&k.value&&k.value.getHTML()!==v&&(k.value.commands.setContent(v),i.value=v)}),a.watch(()=>t.disabled,v=>{k.value&&k.value.setEditable(!v&&!t.readonly)}),a.watch(()=>t.readonly,v=>{k.value&&k.value.setEditable(!t.disabled&&!v)}),a.onBeforeUnmount(()=>{k.value&&k.value.destroy(),u()}),(v,b)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-richtext-container",{"input-error":n.error,"input-disabled":n.disabled}])},[a.createElementVNode("div",Xk,[a.createElementVNode("div",Zk,[a.createVNode(W,{color:a.unref(k)?.isActive("bold")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[0]||(b[0]=x=>a.unref(k)?.chain().focus().toggleBold().run()),disabled:n.disabled,title:"Bold (Ctrl+B)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(tu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("italic")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[1]||(b[1]=x=>a.unref(k)?.chain().focus().toggleItalic().run()),disabled:n.disabled,title:"Italic (Ctrl+I)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(mu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("underline")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[2]||(b[2]=x=>a.unref(k)?.chain().focus().toggleUnderline().run()),disabled:n.disabled,title:"Underline (Ctrl+U)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(wu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("strike")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[3]||(b[3]=x=>a.unref(k)?.chain().focus().toggleStrike().run()),disabled:n.disabled,title:"Strikethrough"},{icon:a.withCtx(()=>[a.createVNode(a.unref(xu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",_k,[a.createVNode(W,{color:a.unref(k)?.isActive("heading",{level:1})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[4]||(b[4]=x=>a.unref(k)?.chain().focus().toggleHeading({level:1}).run()),disabled:n.disabled,title:"Heading 1"},{icon:a.withCtx(()=>[a.createVNode(a.unref(fu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("heading",{level:2})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[5]||(b[5]=x=>a.unref(k)?.chain().focus().toggleHeading({level:2}).run()),disabled:n.disabled,title:"Heading 2"},{icon:a.withCtx(()=>[a.createVNode(a.unref(hu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("heading",{level:3})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[6]||(b[6]=x=>a.unref(k)?.chain().focus().toggleHeading({level:3}).run()),disabled:n.disabled,title:"Heading 3"},{icon:a.withCtx(()=>[a.createVNode(a.unref(pu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",e1,[a.createVNode(W,{color:a.unref(k)?.isActive({textAlign:"left"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[7]||(b[7]=x=>a.unref(k)?.chain().focus().setTextAlign("left").run()),disabled:n.disabled,title:"Align Left"},{icon:a.withCtx(()=>[a.createVNode(a.unref(_d),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive({textAlign:"center"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[8]||(b[8]=x=>a.unref(k)?.chain().focus().setTextAlign("center").run()),disabled:n.disabled,title:"Align Center"},{icon:a.withCtx(()=>[a.createVNode(a.unref(Zd),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive({textAlign:"right"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[9]||(b[9]=x=>a.unref(k)?.chain().focus().setTextAlign("right").run()),disabled:n.disabled,title:"Align Right"},{icon:a.withCtx(()=>[a.createVNode(a.unref(eu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",t1,[a.createVNode(W,{color:a.unref(k)?.isActive("bulletList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[10]||(b[10]=x=>a.unref(k)?.chain().focus().toggleBulletList().run()),disabled:n.disabled,title:"Bullet List"},{icon:a.withCtx(()=>[a.createVNode(a.unref(yu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("orderedList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[11]||(b[11]=x=>a.unref(k)?.chain().focus().toggleOrderedList().run()),disabled:n.disabled,title:"Numbered List"},{icon:a.withCtx(()=>[a.createVNode(a.unref(gu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("blockquote")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[12]||(b[12]=x=>a.unref(k)?.chain().focus().toggleBlockquote().run()),disabled:n.disabled,title:"Quote"},{icon:a.withCtx(()=>[a.createVNode(a.unref(ku),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("codeBlock")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:b[13]||(b[13]=x=>a.unref(k)?.chain().focus().toggleCodeBlock().run()),disabled:n.disabled,title:"Code Block"},{icon:a.withCtx(()=>[a.createVNode(a.unref(au),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",n1,[a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",onClick:b[14]||(b[14]=x=>a.unref(k)?.chain().focus().setHorizontalRule().run()),disabled:n.disabled,title:"Horizontal Rule"},{icon:a.withCtx(()=>[a.createVNode(a.unref(El),{size:16})]),_:1},8,["disabled"]),a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!a.unref(k)?.can().undo()||n.disabled,onClick:b[15]||(b[15]=x=>a.unref(k)?.chain().focus().undo().run()),title:"Undo (Ctrl+Z)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(Cu),{size:16})]),_:1},8,["disabled"]),a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!a.unref(k)?.can().redo()||n.disabled,onClick:b[16]||(b[16]=x=>a.unref(k)?.chain().focus().redo().run()),title:"Redo (Ctrl+Y)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(bu),{size:16})]),_:1},8,["disabled"])]),n.customControls&&n.customControls.length>0?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",r1,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.customControls,(x,w)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:w},[x.action?(a.openBlock(),a.createBlock(W,{key:0,color:"secondary",size:"sm",icon:!x.label,squircle:"",onClick:S=>m(x),disabled:n.disabled,title:x.tooltip||x.label},a.createSlots({default:a.withCtx(()=>[x.label&&x.icon?(a.openBlock(),a.createElementBlock("span",i1,a.toDisplayString(x.label),1)):x.label?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(x.label),1)],64)):a.createCommentVNode("",!0)]),_:2},[x.icon?{name:"icon",fn:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(x.icon),{size:16}))]),key:"0"}:void 0]),1032,["icon","onClick","disabled","title"])):x.list?(a.openBlock(),a.createElementBlock("div",o1,[a.createVNode(W,{ref_for:!0,ref:S=>y(S,w),color:"secondary",size:"sm",squircle:"",onClick:S=>p(w),disabled:n.disabled,title:x.tooltip||x.label,class:a.normalizeClass({"input-richtext-dropdown-open":o.value===w})},a.createSlots({"trailing-icon":a.withCtx(()=>[a.createVNode(a.unref(Pr),{size:14,class:"input-richtext-dropdown-arrow"})]),default:a.withCtx(()=>[x.label?(a.openBlock(),a.createElementBlock("span",s1,a.toDisplayString(x.label),1)):a.createCommentVNode("",!0)]),_:2},[x.icon?{name:"leading-icon",fn:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(x.icon),{size:16}))]),key:"0"}:void 0]),1032,["onClick","disabled","title","class"])])):a.createCommentVNode("",!0)],64))),128))])],64)):a.createCommentVNode("",!0)]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[o.value!==null&&n.customControls?.[o.value]?.list?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:l,class:"input-richtext-dropdown",style:a.normalizeStyle(a.unref(c))},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.customControls[o.value].list,(x,w)=>(a.openBlock(),a.createElementBlock("button",{key:w,class:"input-richtext-dropdown-item",onClick:S=>g(x),type:"button"},[x.icon?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(x.icon),{key:0,size:16,class:"input-richtext-dropdown-item-icon"})):a.createCommentVNode("",!0),a.createElementVNode("span",a1,a.toDisplayString(x.label),1)],8,l1))),128))],4)):a.createCommentVNode("",!0)])),a.createElementVNode("div",c1,[a.createVNode(a.unref(d0),{editor:a.unref(k),class:"input-richtext-editor",id:n.inputId},null,8,["editor","id"])])],2))}}),u1=de(d1,[["__scopeId","data-v-09a16a56"]]),f1={class:"pincode-inputs"},h1={key:0,class:"pincode-icon pincode-icon-leading"},p1=["value","disabled","readonly","tabindex","data-index","onInput","onKeydown","onFocus"],m1={key:1,class:"pincode-divider"},g1={key:1,class:"pincode-icon pincode-icon-trailing"},y1=a.defineComponent({__name:"UiInput.Pincode",props:{maxLength:{default:6},variant:{default:"numeric"},divider:{},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error]},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","complete"],setup(n,{emit:e}){const t=n,r=e,i=a.ref([]),o=a.ref(-1),s=a.computed(()=>{const b=(t.modelValue||"").split("");for(;b.length<t.maxLength;)b.push("");return b.slice(0,t.maxLength)}),l=a.computed(()=>t.divider?typeof t.divider=="number"?t.divider:t.divider.count:0),c=a.computed(()=>t.divider?typeof t.divider=="number"?"-":typeof t.divider=="object"&&"character"in t.divider&&t.divider.character||"-":""),d=a.computed(()=>typeof t.divider=="object"&&"component"in t.divider&&t.divider.component==="divider"),u=a.computed(()=>d.value?{orientation:"vertical",variant:"solid",thickness:"1px",margin:"0",spacing:"1.5rem",...t.divider.props}:{}),f=v=>!l.value||v===t.maxLength?!1:v%l.value===0,h=()=>{switch(t.variant){case"numeric":return/^[0-9]$/;case"alpha":return/^[a-zA-Z]$/;case"alphanumeric":return/^[a-zA-Z0-9]$/;default:return/^[0-9]$/}},p=(v,b)=>{const x=v.target,S=x.value.slice(-1);if(!h().test(S)&&S!==""){x.value=s.value[b];return}const C=[...s.value];C[b]=S;const A=C.join("");r("update:modelValue",A),S&&b<t.maxLength-1&&a.nextTick(()=>{const $=i.value[b+1];$&&($.focus(),$.select())}),A.length===t.maxLength&&r("complete",A)},m=(v,b)=>{const x=v.key;if(x==="Backspace"){v.preventDefault();const w=[...s.value];s.value[b]?(w[b]="",r("update:modelValue",w.join(""))):b>0&&(w[b-1]="",r("update:modelValue",w.join("")),a.nextTick(()=>{const S=i.value[b-1];S&&S.focus()}))}else if(x==="ArrowLeft"&&b>0){v.preventDefault();const w=i.value[b-1];w&&w.focus()}else if(x==="ArrowRight"&&b<t.maxLength-1){v.preventDefault();const w=i.value[b+1];w&&w.focus()}else if(x==="Delete"){v.preventDefault();const w=[...s.value];w[b]="",r("update:modelValue",w.join(""))}},g=v=>{v.preventDefault();const b=v.clipboardData?.getData("text")||"",x=h(),w=b.split("").filter(S=>x.test(S)).slice(0,t.maxLength).join("");if(w){r("update:modelValue",w);const S=w.length<t.maxLength?w.length:t.maxLength-1;a.nextTick(()=>{const M=i.value[S];M&&M.focus()}),w.length===t.maxLength&&r("complete",w)}},y=v=>{o.value=v;const b=i.value[v];b&&b.select()},k=v=>{o.value=-1,r("blur",v)};return a.watch(()=>t.modelValue,v=>{v||a.nextTick(()=>{const b=i.value[0];b&&!t.disabled&&!t.readonly&&b.focus()})}),(v,b)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["pincode-wrapper",[`pincode-size-${n.size}`,{"pincode-error":n.error}]])},[a.createElementVNode("div",f1,[a.renderSlot(v.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",h1,[a.renderSlot(v.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.maxLength,x=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:x},[a.createElementVNode("input",{ref_for:!0,ref_key:"pincodeRefs",ref:i,type:"text",class:a.normalizeClass(["pincode-input",{"pincode-input-filled":s.value[x-1],"pincode-input-focused":o.value===x-1}]),value:s.value[x-1],disabled:n.disabled,readonly:n.readonly,tabindex:n.disabled?-1:void 0,"data-index":x-1,maxlength:"1",onInput:w=>p(w,x-1),onKeydown:w=>m(w,x-1),onFocus:w=>y(x-1),onBlur:k,onPaste:g},null,42,p1),f(x)&&d.value?(a.openBlock(),a.createBlock(tt,a.mergeProps({key:0,ref_for:!0},u.value,{class:"pincode-custom-divider"}),null,16)):f(x)?(a.openBlock(),a.createElementBlock("span",m1,a.toDisplayString(c.value),1)):a.createCommentVNode("",!0)],64))),128)),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",g1,[a.renderSlot(v.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(v.$slots,"trailing",{},void 0,!0)])],2))}}),k1=de(y1,[["__scopeId","data-v-12f41567"]]);function b1(n,e){const t=n[e];if(!t)return!1;const r=t();return!r||r.length===0?!1:r.some(i=>!!(i.children&&i.children!==""||i.type&&typeof i.type=="object"||i.props&&Object.keys(i.props).length>0))}const v1=["for"],x1={key:0,class:"input-required"},w1={key:1,class:"input-hint"},C1={key:2,class:"input-error-text"},S1={key:3,class:"input-help-text"},M1=a.defineComponent({__name:"UiInput",props:{type:{},min:{},max:{},step:{},autocomplete:{},spellcheck:{type:Boolean},hasLeadingIcon:{type:Boolean},hasTrailingIcon:{type:Boolean},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error]},size:{},tabindex:{},options:{},multiple:{type:Boolean},searchable:{type:Boolean},allowInsert:{type:Boolean},maxDropdownHeight:{},noOptionsText:{},searchPlaceholder:{},rows:{},cols:{},maxlength:{},resizable:{type:Boolean},accept:{},maxFileSize:{},dragDropText:{},selectedText:{},preview:{},format:{},is24Hour:{type:Boolean},minuteStep:{},minHeight:{},maxHeight:{},customControls:{},maxLength:{},variant:{},divider:{}},emits:["update:modelValue","input","change","blur","focus","keydown","file-error","clear-preview","complete"],setup(n,{emit:e}){const t=n,r=e,i=a.useSlots(),o=a.ref(""),s=a.computed(()=>t.modelValue!==void 0?t.modelValue:t.value!==void 0?t.value:o.value);a.watch(()=>t.value,k=>{k!==void 0&&(o.value=k)},{immediate:!0}),a.watch(()=>t.modelValue,k=>{k!==void 0&&(o.value=k)},{immediate:!0});const l=a.computed(()=>`input-${Math.random().toString(36).substring(2,11)}`),c=k=>b1(i,k),d=a.computed(()=>{const k=["text","email","password","number","tel","url","search"],v=t.type||"text";return k.includes(v)}),u=k=>{o.value=k,r("update:modelValue",k),r("input",k),r("change",k)},f=k=>{r("blur",k)},h=k=>{r("focus",k)},p=k=>{r("keydown",k)},m=k=>{r("file-error",k)},g=()=>{r("clear-preview")},y=k=>{r("complete",k)};return(k,v)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-container",{"input-container--full-width":t.fullWidth,[`input-container--${t.size||"md"}`]:!0}])},[t.label?(a.openBlock(),a.createElementBlock("label",{key:0,for:l.value,tabindex:"-1",class:"input-label"},[a.createTextVNode(a.toDisplayString(t.label)+" ",1),t.required?(a.openBlock(),a.createElementBlock("span",x1,"*")):a.createCommentVNode("",!0)],8,v1)):a.createCommentVNode("",!0),a.createElementVNode("div",null,[d.value?(a.openBlock(),a.createBlock(Bu,{key:0,"model-value":s.value,type:n.type,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,step:t.step,autocomplete:t.autocomplete,spellcheck:t.spellcheck,"input-id":l.value,error:!!(t.error&&t.error!==!0&&t.error!==""),size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h,onKeydown:p},{leading:a.withCtx(()=>[a.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","type","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="textarea"?(a.openBlock(),a.createBlock(Ru,{key:1,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,rows:t.rows,cols:t.cols,maxlength:t.maxlength,autocomplete:t.autocomplete,spellcheck:t.spellcheck,resizable:t.resizable,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h,onKeydown:p},{leading:a.withCtx(()=>[a.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck","resizable","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="select"?(a.openBlock(),a.createBlock(Xu,{key:2,"model-value":s.value,options:t.options,placeholder:n.placeholder,disabled:n.disabled,multiple:t.multiple,searchable:t.searchable,"allow-insert":t.allowInsert,"max-dropdown-height":t.maxDropdownHeight,"no-options-text":t.noOptionsText,"search-placeholder":t.searchPlaceholder,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h},{leading:a.withCtx(()=>[a.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","options","placeholder","disabled","multiple","searchable","allow-insert","max-dropdown-height","no-options-text","search-placeholder","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="file"?(a.openBlock(),a.createBlock(kf,{key:3,"model-value":s.value,accept:t.accept,multiple:t.multiple,"max-file-size":t.maxFileSize,"drag-drop-text":t.dragDropText,"selected-text":t.selectedText,preview:t.preview,disabled:n.disabled,required:t.required,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":u,onFileError:m,onClearPreview:g,onBlur:f,onFocus:h},{leading:a.withCtx(()=>[a.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","accept","multiple","max-file-size","drag-drop-text","selected-text","preview","disabled","required","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="date"?(a.openBlock(),a.createBlock(Qf,{key:4,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","min","max","input-id","error","size","tabindex"])):n.type==="time"?(a.openBlock(),a.createBlock(Xf,{key:5,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","input-id","error","size","tabindex"])):n.type==="datetime"?(a.openBlock(),a.createBlock(Zf,{key:6,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","min","max","input-id","error","size","tabindex"])):n.type==="richtext"?(a.openBlock(),a.createBlock(u1,{key:7,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,"input-id":l.value,error:t.error,"min-height":t.minHeight,"max-height":t.maxHeight,"custom-controls":t.customControls,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","input-id","error","min-height","max-height","custom-controls","tabindex"])):n.type==="pincode"?(a.openBlock(),a.createBlock(k1,{key:8,"model-value":s.value,"max-length":t.maxLength||6,variant:t.variant||"numeric",divider:t.divider,disabled:n.disabled,readonly:n.readonly,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h,onComplete:y},a.createSlots({_:2},[c("leading")?{name:"leading",fn:a.withCtx(()=>[a.renderSlot(k.$slots,"leading",{},void 0,!0)]),key:"0"}:void 0,c("leading-icon")?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),key:"1"}:void 0,c("trailing-icon")?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),key:"2"}:void 0,c("trailing")?{name:"trailing",fn:a.withCtx(()=>[a.renderSlot(k.$slots,"trailing",{},void 0,!0)]),key:"3"}:void 0]),1032,["model-value","max-length","variant","divider","disabled","readonly","input-id","error","size","tabindex"])):a.createCommentVNode("",!0)]),k.$slots.hint?(a.openBlock(),a.createElementBlock("div",w1,[a.renderSlot(k.$slots,"hint",{},void 0,!0)])):a.createCommentVNode("",!0),t.error&&t.error!==!0?(a.openBlock(),a.createElementBlock("p",C1,a.toDisplayString(typeof t.error=="string"?t.error:t.error?.message||String(t.error)),1)):t.helpText?(a.openBlock(),a.createElementBlock("p",S1,a.toDisplayString(t.helpText),1)):a.createCommentVNode("",!0)],2))}}),ni=de(M1,[["__scopeId","data-v-faec04e1"]]),T1=["disabled","aria-disabled"],E1=["href","target","rel","aria-disabled"],N1=a.defineComponent({__name:"UiLink",props:{href:{},to:{},variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean,default:!1},external:{type:Boolean,default:!1},color:{}},emits:["click"],setup(n,{emit:e}){const t=n,r=e,i=a.computed(()=>{if(t.href)return t.href;if(t.to){if(typeof t.to=="string")return t.to;if(typeof t.to=="object"&&t.to)return"#route-object-not-supported"}return"#"});function o(){if(typeof window<"u"){const u=getComputedStyle(document.documentElement).getPropertyValue("--strands-accent").trim();if(u)return u}return"#EA00A8"}const s=()=>({primary:o(),success:"#059669",warning:"#d97706",danger:"#dc2626"}),l=u=>{const f=s();return`color-mix(in srgb, ${f[u]||f.primary} 85%, black 15%)`},c=a.computed(()=>{if(!t.color)return{};const u=s(),f=u[t.color]||u.primary,h=l(t.color),p={"--link-color":f,"--link-hover-color":h,color:f};return t.variant==="underline"?{...p,textDecorationColor:f}:p}),d=u=>{t.disabled||r("click",u)};return(u,f)=>!n.to&&!n.href?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:a.normalizeClass(["ui-link",[`ui-link-${n.variant}`,`ui-link-${n.size}`,{"ui-link-disabled":n.disabled},{"ui-link-custom-color":n.color}]]),style:a.normalizeStyle(c.value),disabled:n.disabled,"aria-disabled":n.disabled,onClick:d},[a.renderSlot(u.$slots,"default",{},void 0,!0)],14,T1)):(a.openBlock(),a.createElementBlock("a",{key:1,class:a.normalizeClass(["ui-link",[`ui-link-${n.variant}`,`ui-link-${n.size}`,{"ui-link-disabled":n.disabled},{"ui-link-custom-color":n.color}]]),style:a.normalizeStyle(c.value),href:i.value,target:n.external?"_blank":void 0,rel:n.external?"noopener noreferrer":void 0,"aria-disabled":n.disabled,onClick:d},[a.renderSlot(u.$slots,"default",{},void 0,!0)],14,E1))}}),Zo=de(N1,[["__scopeId","data-v-3bf99110"]]),A1={StrandsUiAlert:co,StrandsUiButton:W,StrandsUiCard:uo,StrandsUiInput:ni,StrandsUiLink:Zo,StrandsUiTabs:Fr,StrandsUiLoader:zr},nd={install(n,e={}){const{prefix:t=""}=e;Object.entries(A1).forEach(([r,i])=>{const o=t?`${t}${r}`:r;n.component(o,i)})}},B1=Object.freeze(Object.defineProperty({__proto__:null,StrandsUiAlert:co,StrandsUiButton:W,StrandsUiCard:uo,StrandsUiInput:ni,StrandsUiLink:Zo,StrandsUiLoader:zr,StrandsUiTabs:Fr,default:nd},Symbol.toStringTag,{value:"Module"}));exports.ChevronDown=Pr;exports.Minus=El;exports.StrandsUIPlugin=nd;exports.StrandsUIPlugin$1=B1;exports.StrandsUiAlert=co;exports.StrandsUiButton=W;exports.StrandsUiCard=uo;exports.StrandsUiInput=ni;exports.StrandsUiLink=Zo;exports.StrandsUiLoader=zr;exports.StrandsUiTabs=Fr;exports.UiButtonContent=Wt;exports.UiDivider=tt;exports.UiTooltip=Tl;exports._export_sfc=de;exports._sfc_main=Oi;exports._sfc_main$1=Di;exports._sfc_main$2=Ii;exports.createLucideIcon=J;exports.useFloatingPosition=Vr;