@strands.gg/accui 2.17.66 → 2.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{StrandsUIPlugin-DZU1IjwD.cjs.js → StrandsUIPlugin-CMTkJfQt.cjs.js} +19 -19
- package/dist/{StrandsUIPlugin-AI0SbvpH.es.js → StrandsUIPlugin-CQONZWOX.es.js} +1133 -1127
- package/dist/accui.css +1 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.es.js +5615 -5516
- package/dist/nuxt/module.cjs.js +2 -2
- package/dist/nuxt/module.es.js +7 -6
- package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +1 -1
- package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +1 -1
- package/dist/nuxt/runtime/plugin.client.cjs.js +1 -1
- package/dist/nuxt/runtime/plugin.client.es.js +15 -13
- package/dist/types/index.d.ts +7 -0
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.es.js +1 -1
- package/dist/vue/components/index.d.ts +1 -1
- package/dist/vue/ui/UiCheckboxGroup.vue.d.ts +1 -0
- package/dist/vue/ui/UiMegaMenu.vue.d.ts +28 -1
- package/dist/vue/ui/UiRadioGroup.vue.d.ts +1 -0
- package/dist/vue/ui/UiTabs.vue.d.ts +2 -0
- package/dist/webcomponents/define-element.d.ts +1 -1
- package/dist/webcomponents/entries/sl-avatar-editor.d.ts +2 -0
- package/dist/webcomponents/entries/sl-color-picker.d.ts +2 -0
- package/dist/webcomponents/entries/sl-datetime-picker.d.ts +2 -0
- package/dist/webcomponents/entries/sl-font-picker.d.ts +2 -0
- package/dist/webcomponents/entries/sl-hero.d.ts +2 -0
- package/dist/webcomponents/entries/sl-level-progress.d.ts +2 -0
- package/dist/webcomponents/entries/sl-mega-menu.d.ts +5 -0
- package/dist/webcomponents/loader.d.ts +3 -3
- package/dist/webcomponents/registry.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/vue/{components → ui}/VirtualList.vue.d.ts +0 -0
- /package/dist/webcomponents/entries/{strands-alert.d.ts → sl-alert.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-button.d.ts → sl-button.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-card.d.ts → sl-card.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-checkbox-group.d.ts → sl-checkbox-group.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-divider.d.ts → sl-divider.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-input.d.ts → sl-input.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-link.d.ts → sl-link.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-loader-spinner.d.ts → sl-loader-spinner.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-modal.d.ts → sl-modal.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-pill.d.ts → sl-pill.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-radio-group.d.ts → sl-radio-group.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-slider.d.ts → sl-slider.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-table.d.ts → sl-table.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-tabs.d.ts → sl-tabs.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-theme-toggle.d.ts → sl-theme-toggle.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-toggle.d.ts → sl-toggle.d.ts} +0 -0
- /package/dist/webcomponents/entries/{strands-tooltip.d.ts → sl-tooltip.d.ts} +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";const a=require("vue"),se=(n,e)=>{const t=n.__vccOpts||n;for(const[r,i]of e)t[r]=i;return t},pd={class:"accui-component-scope"},md={class:"alert-content"},gd={class:"alert-icon-container"},yd={class:"alert-main-icon",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true"},kd=["d"],bd={class:"alert-text-container"},vd={key:0,class:"alert-dismiss-container"},xd=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",pd,[a.createElementVNode("div",{class:a.normalizeClass(t.value),role:"alert"},[a.createElementVNode("div",md,[a.createElementVNode("div",gd,[(a.openBlock(),a.createElementBlock("svg",yd,[a.createElementVNode("path",{"fill-rule":"evenodd",d:o.value,"clip-rule":"evenodd"},null,8,kd)]))]),a.createElementVNode("div",bd,[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",vd,[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)]))}}),fo=se(xd,[["__scopeId","data-v-68f69cce"]]),wd=`<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
|
-
`,Cd={key:0,class:"loader-icon"},Sd=["width","height"],Md=["d"],Td=["stroke-width"],Ed=["stroke-width"],Nd=["width","height"],Ad={key:3,class:"loader-text"},Bd=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=wd.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",Cd,[(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,Md)]),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,Td),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,Ed)],8,Sd))])):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,Nd))],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",Ad,a.toDisplayString(n.text),1)):a.createCommentVNode("",!0)],2))}}),jr=se(Bd,[["__scopeId","data-v-4b565c5d"]]),Od={key:0,class:"button-loading-content"},Id={key:0},Dd={key:0,class:"leading-icon"},$d={class:"button-text-content"},Rd={key:1,class:"trailing-icon"},Ld=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",Od,[a.createVNode(jr,{variant:"circle",size:o.value,centered:!1,color:"white"},null,8,["size"]),n.icon?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("span",Id,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",Dd,[a.renderSlot(l.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(l.$slots,"icon",{},void 0,!0),a.createElementVNode("span",$d,[a.renderSlot(l.$slots,"default",{},void 0,!0)]),r.value?(a.openBlock(),a.createElementBlock("span",Rd,[a.renderSlot(l.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0)],64))],2))}}),bn=se(Ld,[["__scopeId","data-v-12d1d1fc"]]),zd=["href","target","rel"],$i=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(bn,{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,zd))}}),Ri=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();let r=!1;const i=a.computed(()=>{r=!1;const u=t?.appContext?.components||{};return u.NuxtLink?(r=!0,u.NuxtLink):u.RouterLink?(r=!0,u.RouterLink):"a"}),o=a.computed(()=>r),s=n,l=e,c=d=>{if(s.disabled||s.loading){d.preventDefault();return}l("click",d)};return(d,u)=>(a.openBlock(),a.createBlock(a.resolveDynamicComponent(i.value),{to:o.value?n.to:void 0,href:o.value?void 0:typeof n.to=="string"?n.to:"/",class:a.normalizeClass(n.buttonClasses),style:a.normalizeStyle(n.buttonStyles),onClick:c},{default:a.withCtx(()=>[a.createVNode(bn,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"text-align":n.textAlign},{"leading-icon":a.withCtx(()=>[a.renderSlot(d.$slots,"leading-icon")]),icon:a.withCtx(()=>[a.renderSlot(d.$slots,"icon")]),default:a.withCtx(()=>[a.renderSlot(d.$slots,"default")]),"trailing-icon":a.withCtx(()=>[a.renderSlot(d.$slots,"trailing-icon")]),_:3},8,["loading","loading-text","icon","text-align"])]),_:3},8,["to","href","class","style"]))}}),Pd={class:"ui-tooltip-content"},Vd=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,b=window.innerHeight;let w=0,k=0;switch(e.position){case"top":w=h.top-g-e.offset,k=h.left+h.width/2-m/2;break;case"bottom":w=h.bottom+e.offset,k=h.left+h.width/2-m/2;break;case"left":w=h.top+h.height/2-g/2,k=h.left-m-e.offset;break;case"right":w=h.top+h.height/2-g/2,k=h.right+e.offset;break}const v=8;k<v?k=v:k+m>y-v&&(k=y-m-v),w<v?w=v:w+g>b-v&&(w=b-g-v),c.value={position:"fixed",top:`${w}px`,left:`${k}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",Pd,[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))}}),Nl=se(Vd,[["__scopeId","data-v-ba66edda"]]),Fd=["type","disabled","tabindex"],Hd=["type","disabled","tabindex"],jd=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(()=>["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)),o=a.computed(()=>i.value.join(" ")),s=a.computed(()=>({fontWeight:t.fontWeight})),l=a.computed(()=>t.disabled||t.loading?-1:t.tabindex??void 0);return(c,d)=>n.title?(a.openBlock(),a.createBlock(Nl,a.normalizeProps(a.mergeProps({key:0},r.value)),{default:a.withCtx(()=>[n.to?n.to?(a.openBlock(),a.createBlock(Ri,{key:1,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":i.value,"button-styles":s.value,tabindex:l.value,"text-align":n.textAlign,onClick:d[1]||(d[1]=u=>c.$emit("click",u))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):n.href?(a.openBlock(),a.createBlock($i,{key:2,href:n.href,external:n.external,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":i.value,"button-styles":s.value,tabindex:l.value,"text-align":n.textAlign,onClick:d[2]||(d[2]=u=>c.$emit("click",u))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["href","external","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",a.mergeProps({key:0},c.$attrs,{type:n.type,disabled:n.disabled||n.loading,class:o.value,style:s.value,tabindex:l.value,onClick:d[0]||(d[0]=u=>c.$emit("click",u))}),[a.createVNode(bn,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,size:n.size,"text-align":n.textAlign},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","text-align"])],16,Fd))]),_:3},16)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[n.to?n.to?(a.openBlock(),a.createBlock(Ri,{key:1,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":i.value,"button-styles":s.value,tabindex:l.value,"text-align":n.textAlign,onClick:d[4]||(d[4]=u=>c.$emit("click",u))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):n.href?(a.openBlock(),a.createBlock($i,{key:2,href:n.href,external:n.external,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":i.value,"button-styles":s.value,tabindex:l.value,"text-align":n.textAlign,onClick:d[5]||(d[5]=u=>c.$emit("click",u))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["href","external","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",a.mergeProps({key:0},c.$attrs,{type:n.type,disabled:n.disabled||n.loading,class:o.value,style:s.value,tabindex:l.value,onClick:d[3]||(d[3]=u=>c.$emit("click",u))}),[a.createVNode(bn,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,size:n.size,"text-align":n.textAlign},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","text-align"])],16,Hd))],64))}}),W=se(jd,[["__scopeId","data-v-6210c93f"]]),Ud={key:0,class:"ui-card-header"},qd={key:0,class:"ui-card-title-wrapper"},Wd={key:0,class:"ui-card-title"},Kd={key:0,class:"ui-card-subtitle"},Jd={key:1,class:"ui-card-content"},Gd={key:2,class:"ui-card-footer"},Yd=a.defineComponent({inheritAttrs:!1,__name:"UiCard",props:{variant:{default:"default"},padding:{default:"md"},shadow:{default:"sm"},color:{default:"default"},title:{},subtitle:{},to:{}},setup(n){const e=n,t=a.useAttrs(),r=a.computed(()=>{if(!e.to)return null;try{const d=a.resolveComponent("NuxtLink");if(typeof d!="string")return d}catch{}try{const d=a.resolveComponent("RouterLink");if(typeof d!="string")return d}catch{}return"a"}),i=a.computed(()=>!e.to||typeof e.to!="string"?!1:/^(https?:\/\/|mailto:|tel:)/.test(e.to)),o=a.computed(()=>e.to?i.value?"a":r.value||"a":"div"),s=a.computed(()=>typeof o.value!="string"),l=a.computed(()=>o.value==="a"&&!!e.to),c=a.computed(()=>[`ui-card-${e.variant}`,`ui-card-padding-${e.padding}`,`ui-card-shadow-${e.shadow}`,`ui-card-color-${e.color}`,t.class]);return(d,u)=>(a.openBlock(),a.createBlock(a.resolveDynamicComponent(o.value),{to:s.value?n.to:void 0,href:l.value?typeof n.to=="string"?n.to:"":void 0,class:a.normalizeClass(["ui-card",[c.value,{"ui-card-linkable":!!n.to}]])},{default:a.withCtx(()=>[d.$slots.header||n.title||n.subtitle||d.$slots["leading-icon"]||d.$slots["trailing-icon"]?(a.openBlock(),a.createElementBlock("div",Ud,[a.renderSlot(d.$slots,"header",{},()=>[a.renderSlot(d.$slots,"leading-icon",{},void 0,!0),n.title||d.$slots.title||n.subtitle||d.$slots.subtitle?(a.openBlock(),a.createElementBlock("div",qd,[n.title||d.$slots.title?a.renderSlot(d.$slots,"title",{key:0},()=>[n.title?(a.openBlock(),a.createElementBlock("h2",Wd,a.toDisplayString(n.title),1)):a.createCommentVNode("",!0)],!0):a.createCommentVNode("",!0),n.subtitle||d.$slots.subtitle?a.renderSlot(d.$slots,"subtitle",{key:1},()=>[n.subtitle?(a.openBlock(),a.createElementBlock("p",Kd,a.toDisplayString(n.subtitle),1)):a.createCommentVNode("",!0)],!0):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.renderSlot(d.$slots,"trailing-icon",{},void 0,!0),a.renderSlot(d.$slots,"actions",{},void 0,!0)],!0)])):a.createCommentVNode("",!0),d.$slots.default?(a.openBlock(),a.createElementBlock("div",Jd,[a.renderSlot(d.$slots,"default",{},void 0,!0)])):a.createCommentVNode("",!0),d.$slots.footer?(a.openBlock(),a.createElementBlock("div",Gd,[a.renderSlot(d.$slots,"footer",{},void 0,!0)])):a.createCommentVNode("",!0)]),_:3},8,["to","href","class"]))}}),ho=se(Yd,[["__scopeId","data-v-5d575f4a"]]);const es=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Qd=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),Xd=n=>{const e=Qd(n);return e.charAt(0).toUpperCase()+e.slice(1)},Zd=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim(),ts=n=>n==="";var tn={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 _d=({name:n,iconNode:e,absoluteStrokeWidth:t,"absolute-stroke-width":r,strokeWidth:i,"stroke-width":o,size:s=tn.width,color:l=tn.stroke,...c},{slots:d})=>a.h("svg",{...tn,...c,width:s,height:s,stroke:l,"stroke-width":ts(t)||ts(r)||t===!0||r===!0?Number(i||o||tn["stroke-width"])*24/Number(s):i||o||tn["stroke-width"],class:Zd("lucide",c.class,...n?[`lucide-${es(Xd(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(_d,{...i,...t,iconNode:e,name:n},r);const eu=J("align-center",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const tu=J("align-left",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const nu=J("align-right",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const ru=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 iu=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 ou=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 ns=J("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Ur=J("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const su=J("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const lu=J("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const au=J("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const cu=J("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const du=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 uu=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 fu=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 hu=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 pu=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 mu=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 gu=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 yu=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 ku=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 Al=J("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const bu=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 vu=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 xu=J("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const wu=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 Cu=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 Su=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 po=J("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Mu={key:0,class:"input-leading-icon"},Tu=["id","type","value","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","tabindex"],Eu={key:1,class:"input-trailing-icon"},Nu={key:2,class:"input-trailing-icon"},Au={key:3,class:"input-trailing-icon"},Bu=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","input","change","blur","focus","keydown"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(t.modelValue??""),o=a.computed(()=>i.value);a.watch(()=>t.modelValue,w=>{w!==void 0&&w!==i.value&&(i.value=w)},{immediate:!0});const s=a.ref(!1),l=a.computed(()=>t.type==="password"?s.value?"text":"password":t.type),c=a.computed(()=>t.hasTrailingIcon||t.type==="password"||t.type==="search"&&o.value),d=a.computed(()=>{if(t.tabindex!==void 0)return t.tabindex+1}),u=a.computed(()=>{const w=[];return t.error&&w.push("input-error"),t.disabled&&w.push("input-disabled"),t.readonly&&w.push("input-readonly"),w.push(`input-size-${t.size}`),w}),f=a.computed(()=>{const w=[];return t.hasLeadingIcon?w.push("input-padding-left-icon"):w.push("input-padding-left"),c.value?w.push("input-padding-right-icon"):w.push("input-padding-right"),w}),h=w=>{let v=w.target.value;t.type==="number"&&v!==""&&(v=parseFloat(v)||0),i.value=v,r("update:modelValue",v),r("input",v),r("change",v)},p=w=>{r("blur",w)},m=w=>{r("focus",w)},g=w=>{r("keydown",w)},y=()=>{s.value=!s.value},b=()=>{i.value="",r("update:modelValue","")};return(w,k)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper",u.value])},[a.renderSlot(w.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Mu,[a.renderSlot(w.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.createElementVNode("input",{id:n.inputId,type:l.value,value:o.value,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",f.value]),onInput:h,onBlur:p,onFocus:m,onKeydown:g},null,42,Tu),n.type==="password"?(a.openBlock(),a.createElementBlock("div",Eu,[a.createVNode(W,{color:s.value?"primary":"secondary",variant:s.value?"primary":"ghost",size:"sm",icon:"",squircle:"",tabindex:d.value,"aria-label":s.value?"Hide password":"Show password",onClick:y},{icon:a.withCtx(()=>[s.value?(a.openBlock(),a.createBlock(a.unref(du),{key:0})):(a.openBlock(),a.createBlock(a.unref(uu),{key:1}))]),_:1},8,["color","variant","tabindex","aria-label"])])):n.type==="search"&&o.value&&!n.disabled&&!n.readonly?(a.openBlock(),a.createElementBlock("div",Nu,[a.createVNode(W,{color:"danger",variant:"ghost",size:"sm",icon:"",squircle:"",tabindex:d.value,"aria-label":"Clear search",onClick:b},{icon:a.withCtx(()=>[a.createVNode(a.unref(po))]),_:1},8,["tabindex"])])):t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",Au,[a.renderSlot(w.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(w.$slots,"trailing",{},void 0,!0)],2))}}),Ou=se(Bu,[["__scopeId","data-v-118c0113"]]),Iu={key:0,class:"input-leading-icon"},Du=["id","value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck"],$u={key:1,class:"input-trailing-icon"},Ru=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.useSlots(),o=a.computed(()=>!!i.default),s=a.ref(null);a.onMounted(()=>{(t.modelValue===void 0||t.modelValue==="")&&o.value&&setTimeout(()=>{if(s.value){const p=s.value.textContent?.trim()||"";p&&r("update:modelValue",p)}},0)});const l=a.computed(()=>{const p=[];return t.error&&p.push("input-error"),t.disabled&&p.push("input-disabled"),t.readonly&&p.push("input-readonly"),p.push(`input-size-${t.size}`),p}),c=a.computed(()=>{const p=[];return t.hasLeadingIcon?p.push("input-padding-left-icon"):p.push("input-padding-left"),t.hasTrailingIcon?p.push("input-padding-right-icon"):p.push("input-padding-right"),p}),d=p=>{const m=p.target;r("update:modelValue",m.value)},u=p=>{r("blur",p)},f=p=>{r("focus",p)},h=p=>{r("keydown",p)};return(p,m)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper input-textarea",l.value])},[a.renderSlot(p.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Iu,[a.renderSlot(p.$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},c.value]]),onInput:d,onBlur:u,onFocus:f,onKeydown:h},null,42,Du)],2),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",$u,[a.renderSlot(p.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(p.$slots,"trailing",{},void 0,!0),o.value?(a.openBlock(),a.createElementBlock("span",{key:2,ref_key:"slotContentRef",ref:s,class:"sr-only","aria-hidden":"true"},[a.renderSlot(p.$slots,"default",{},void 0,!0)],512)):a.createCommentVNode("",!0)],2))}}),Lu=se(Ru,[["__scopeId","data-v-5728c58e"]]);function qr(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 k=e.value.getBoundingClientRect(),v=t.value.getBoundingClientRect(),[x,S="start"]=r.split("-");let C=0,M=0;switch(x){case"bottom":C=k.left,M=k.bottom+i;break;case"top":C=k.left,M=k.top-v.height-i;break;case"right":C=k.right+i,M=k.top;break;case"left":C=k.left-v.width-i,M=k.top;break}if(x==="top"||x==="bottom")switch(S){case"center":C=k.left+(k.width-v.width)/2;break;case"end":C=k.right-v.width;break}else if(x==="left"||x==="right")switch(S){case"center":M=k.top+(k.height-v.height)/2;break;case"end":M=k.bottom-v.height;break}let A=l?k.width:void 0;const I=window.innerWidth,U=window.innerHeight,j=8;let K=!1,Y=!1;if(o){if(x==="bottom"&&M+v.height>U-j){const $=k.top-v.height-i;$>=j&&(M=$,K=!0)}else if(x==="top"&&M<j){const $=k.bottom+i;$+v.height<=U-j&&(M=$,K=!1)}if(x==="right"&&C+v.width>I-j){const $=k.left-v.width-i;$>=j&&(C=$,Y=!0)}else if(x==="left"&&C<j){const $=k.right+i;$+v.width<=I-j&&(C=$,Y=!1)}}s&&(C<j?C=j:C+v.width>I-j&&(C=I-v.width-j),M<j?M=j:M+v.height>U-j&&(M=U-v.height-j));const E={position:"fixed",zIndex:"9999",...A?{width:`${A}px`}:{}};K?E.bottom=`${U-M-v.height}px`:E.top=`${M}px`,Y?E.right=`${I-C-v.width}px`:E.left=`${C}px`,u.value=E},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 k=e.value.getBoundingClientRect(),v=window.innerHeight,x=window.innerWidth;(k.bottom<0||k.top>v||k.right<0||k.left>x)&&d.handler()}},y=k=>{if(!d?.enabled||!d.handler)return;const v=k.target;if(!v||!e.value||!t.value||typeof e.value.contains!="function"||typeof t.value.contains!="function")return;const x=e.value.contains(v),S=t.value.contains(v);!x&&!S&&d.handler()},b=()=>{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)},w=()=>{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(()=>{b()}),a.onUnmounted(()=>{w()}),{floatingStyle:u,updatePosition:h,cleanup:w}}const zu={class:"accui-p-2 accui-border-b"},Pu=a.defineComponent({__name:"VirtualList",props:{items:{},itemHeight:{},containerHeight:{},itemKey:{type:[String,Function],default:"id"},overscan:{default:5}},setup(n,{expose:e}){const t=n,r=a.ref(),i=a.ref(0),o=a.computed(()=>{const h=Math.floor(i.value/t.itemHeight),p=Math.min(h+Math.ceil(t.containerHeight/t.itemHeight),t.items.length-1);return{start:Math.max(0,h-t.overscan),end:Math.min(t.items.length-1,p+t.overscan)}}),s=a.computed(()=>{const{start:h,end:p}=o.value,m=[];for(let g=h;g<=p;g++)m.push({index:g,data:t.items[g],top:g*t.itemHeight});return m}),l=a.computed(()=>t.items.length*t.itemHeight),c=h=>typeof t.itemKey=="function"?t.itemKey(h):h[t.itemKey]||h.id||Math.random();let d=null;const u=h=>{d&&clearTimeout(d),d=setTimeout(()=>{const p=h.target;i.value=p.scrollTop},16)};return a.onUnmounted(()=>{d&&clearTimeout(d)}),e({scrollToItem:(h,p="start")=>{if(!r.value)return;let m=h*t.itemHeight;p==="center"?m-=t.containerHeight/2-t.itemHeight/2:p==="end"&&(m-=t.containerHeight-t.itemHeight),r.value.scrollTop=Math.max(0,m)}}),(h,p)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"scrollContainer",ref:r,style:a.normalizeStyle({height:n.containerHeight+"px",overflowY:"auto"}),onScroll:u,class:"accui-virtual-list"},[a.createElementVNode("div",{style:a.normalizeStyle({height:l.value+"px",position:"relative"})},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,m=>(a.openBlock(),a.createElementBlock("div",{key:c(m.data),style:a.normalizeStyle({position:"absolute",top:m.top+"px",left:0,right:0,height:n.itemHeight+"px"})},[a.renderSlot(h.$slots,"default",{item:m.data,index:m.index},()=>[a.createElementVNode("div",zu,a.toDisplayString(JSON.stringify(m.data)),1)],!0)],4))),128))],4)],36))}}),Bl=se(Pu,[["__scopeId","data-v-1561f0b5"]]),Vu={key:0,class:"input-leading-icon"},Fu=["tabindex","aria-expanded","aria-controls","aria-disabled"],Hu={class:"input-select-value"},ju={key:0,class:"input-select-text"},Uu={key:1,class:"input-select-placeholder"},qu={key:1,class:"input-trailing-icon"},Wu=["id","aria-multiselectable"],Ku={key:0,class:"input-dropdown-search"},Ju={key:0,class:"input-dropdown-no-options"},Gu=["onClick","onMouseenter","aria-selected"],Yu={class:"input-dropdown-option-content"},Qu={class:"input-dropdown-option-text"},Xu={key:0,class:"input-dropdown-option-description"},Zu={key:0,class:"input-dropdown-option-check"},_u=["onClick","onMouseenter","aria-selected"],ef={class:"input-dropdown-option-content"},tf={class:"input-dropdown-option-text"},nf={key:0,class:"input-dropdown-option-description"},rf={key:0,class:"input-dropdown-option-check"},of=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},virtual:{type:Boolean,default:!1},virtualItemHeight:{default:44},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","search"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(),o=a.ref(),s=a.ref(),l=a.ref(),c=a.computed(()=>`dropdown-${t.inputId||Math.random().toString(36).substr(2,9)}`),d=a.computed(()=>{if(i.value){const E=i.value.closest('[role="dialog"][aria-modal="true"]');if(E)return E}return"body"}),u=a.ref({isOpen:!1,searchQuery:"",highlightedIndex:-1});a.watch(()=>u.value.searchQuery,E=>{r("search",E)});const{floatingStyle:f,updatePosition:h,cleanup:p}=qr({trigger:i,floating:o,placement:"bottom-start",offset:10,shift:!0,flip:!0,sameWidth:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{C()}}}),m=a.computed(()=>t.multiple?Array.isArray(t.modelValue)?t.modelValue:[]:t.modelValue!==void 0?[t.modelValue]:[]),g=a.computed(()=>{if(t.multiple){const E=t.options.filter($=>m.value.includes($.value));return E.length>0?`${E.length} selected`:null}else return t.options.find($=>$.value===t.modelValue)?.label||null}),y=a.computed(()=>{let E=t.options;if(t.searchable&&u.value.searchQuery){const $=u.value.searchQuery.toLowerCase();E=t.options.filter(L=>L.label.toLowerCase().includes($)||L.description?.toLowerCase().includes($)),t.allowInsert&&t.multiple&&u.value.searchQuery.trim()&&(t.options.some(Ee=>Ee.label.toLowerCase()===u.value.searchQuery.toLowerCase())||(E=[{value:`__insert__${u.value.searchQuery}`,label:`Add "${u.value.searchQuery}"`,description:"Add as new item",disabled:!1},...E]))}return E}),b=a.computed(()=>t.searchPlaceholder&&t.searchPlaceholder.trim()!==""?t.searchPlaceholder:t.allowInsert&&t.multiple?"Search or create...":"Search..."),w=a.computed(()=>t.disabled?-1:t.tabindex??0),k=a.computed(()=>{if(t.tabindex!==void 0)return t.tabindex+1}),v=a.computed(()=>{const E=[];return t.error&&E.push("input-error"),t.disabled&&E.push("input-disabled"),E.push(`input-size-${t.size}`),E}),x=a.computed(()=>{const E=[];return t.hasLeadingIcon?E.push("input-padding-left-icon"):E.push("input-padding-left"),t.hasTrailingIcon?E.push("input-padding-right-icon"):E.push("input-padding-right"),E}),S=async()=>{if(!t.disabled){if(u.value.isOpen=!0,u.value.searchQuery="",await a.nextTick(),h(),u.value.highlightedIndex===-1){const E=y.value.findIndex($=>!$.disabled);u.value.highlightedIndex=E>=0?E:0}if(t.searchable&&s.value){const E=s.value.$el?.querySelector("input");E&&E.focus()}document.addEventListener("keydown",K),r("focus",new FocusEvent("focus"))}},C=()=>{u.value.isOpen&&(u.value.isOpen=!1,u.value.highlightedIndex=-1,u.value.searchQuery="",document.removeEventListener("keydown",K),r("blur",new FocusEvent("blur")))},M=()=>{u.value.isOpen?C():S()},A=E=>E.value&&typeof E.value=="string"&&E.value.startsWith("__insert__")?!1:m.value.includes(E.value),I=E=>{if(!E.disabled)if(t.multiple){const $=[...m.value];if(E.value&&typeof E.value=="string"&&E.value.startsWith("__insert__")){const L=E.value.replace("__insert__","");$.includes(L)||$.push(L),u.value.searchQuery=""}else{const L=$.indexOf(E.value);L>-1?$.splice(L,1):$.push(E.value)}r("update:modelValue",$)}else r("update:modelValue",E.value),C()},U=E=>{if(["Enter"," ","ArrowDown","ArrowUp","Escape"].includes(E.key)&&(E.preventDefault(),!(u.value.isOpen&&(E.key==="ArrowDown"||E.key==="ArrowUp"))))switch(E.key){case"Enter":case" ":M();break;case"ArrowDown":case"ArrowUp":S();break;case"Escape":C();break}},j=E=>{switch(E.key){case"ArrowDown":E.preventDefault(),Y(1);break;case"ArrowUp":E.preventDefault(),Y(-1);break;case"Enter":if(E.preventDefault(),u.value.highlightedIndex>=0){const $=y.value[u.value.highlightedIndex];$&&!$.disabled&&I($)}break;case"Escape":C();break}},K=E=>{if(u.value.isOpen)switch(E.key){case"Escape":C();break;case"ArrowDown":E.preventDefault(),Y(1);break;case"ArrowUp":E.preventDefault(),Y(-1);break;case"Enter":if(E.preventDefault(),u.value.highlightedIndex>=0){const $=y.value[u.value.highlightedIndex];$&&!$.disabled&&I($)}break}},Y=E=>{const $=y.value;if($.length===0)return;let L=u.value.highlightedIndex+E;L<0?L=$.length-1:L>=$.length&&(L=0);let Ee=0;for(;$[L]?.disabled&&Ee<$.length;)L+=E,L<0&&(L=$.length-1),L>=$.length&&(L=0),Ee++;u.value.highlightedIndex=L};return a.onUnmounted(()=>{u.value.isOpen&&C(),document.removeEventListener("keydown",K),p()}),(E,$)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{class:a.normalizeClass(["input-field-wrapper",[v.value,x.value]])},[a.renderSlot(E.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Vu,[a.renderSlot(E.$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":u.value.isOpen}]),onClick:M,onKeydown:U,tabindex:w.value,role:"combobox","aria-expanded":u.value.isOpen,"aria-haspopup":!0,"aria-controls":c.value,"aria-disabled":n.disabled},[a.createElementVNode("div",Hu,[g.value?(a.openBlock(),a.createElementBlock("span",ju,a.toDisplayString(g.value),1)):(a.openBlock(),a.createElementBlock("span",Uu,a.toDisplayString(n.placeholder||"Select an option..."),1))]),a.createElementVNode("div",{class:a.normalizeClass(["input-select-arrow",{"input-select-arrow-open":u.value.isOpen}])},[a.createVNode(a.unref(Ur))],2)],42,Fu),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",qu,[a.renderSlot(E.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(E.$slots,"trailing",{},void 0,!0)],2),(a.openBlock(),a.createBlock(a.Teleport,{to:d.value},[u.value.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:o,id:c.value,class:a.normalizeClass(["input-dropdown",{"input-dropdown--multiple":n.multiple}]),style:a.normalizeStyle(a.unref(f)),role:"listbox","aria-multiselectable":n.multiple,onMousedown:$[1]||($[1]=a.withModifiers(()=>{},["prevent"]))},[n.searchable?(a.openBlock(),a.createElementBlock("div",Ku,[a.createVNode(li,{ref_key:"searchInputRef",ref:s,modelValue:u.value.searchQuery,"onUpdate:modelValue":$[0]||($[0]=L=>u.value.searchQuery=L),type:"search",placeholder:b.value,size:"sm",tabindex:k.value,onKeydown:j},{"leading-icon":a.withCtx(()=>[a.createVNode(a.unref(xu))]),_:1},8,["modelValue","placeholder","tabindex"])])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"input-dropdown-options",style:a.normalizeStyle({maxHeight:`${n.maxDropdownHeight}px`})},[y.value.length===0?(a.openBlock(),a.createElementBlock("div",Ju,[a.renderSlot(E.$slots,"zero-state",{},()=>[a.createTextVNode(a.toDisplayString(n.noOptionsText),1)],!0)])):n.virtual?(a.openBlock(),a.createBlock(Bl,{key:1,ref_key:"virtualListRef",ref:l,items:y.value,"item-height":n.virtualItemHeight,"container-height":Math.min(n.maxDropdownHeight,y.value.length*n.virtualItemHeight),"item-key":"value",overscan:5},{default:a.withCtx(({item:L,index:Ee})=>[a.createElementVNode("div",{class:a.normalizeClass(["input-dropdown-option",{"input-dropdown-option--selected":A(L),"input-dropdown-option--highlighted":Ee===u.value.highlightedIndex,"input-dropdown-option--disabled":L.disabled,"input-dropdown-option--insert":L.value&&typeof L.value=="string"&&L.value.startsWith("__insert__")}]),onClick:en=>I(L),onMouseenter:en=>u.value.highlightedIndex=Ee,role:"option","aria-selected":A(L)},[a.createElementVNode("div",Yu,[a.createElementVNode("div",Qu,a.toDisplayString(L.label),1),L.description?(a.openBlock(),a.createElementBlock("div",Xu,a.toDisplayString(L.description),1)):a.createCommentVNode("",!0)]),n.multiple&&A(L)?(a.openBlock(),a.createElementBlock("div",Zu,[a.createVNode(a.unref(ns))])):a.createCommentVNode("",!0)],42,Gu)]),_:1},8,["items","item-height","container-height"])):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:2},a.renderList(y.value,(L,Ee)=>(a.openBlock(),a.createElementBlock("div",{key:L.value,class:a.normalizeClass(["input-dropdown-option",{"input-dropdown-option--selected":A(L),"input-dropdown-option--highlighted":Ee===u.value.highlightedIndex,"input-dropdown-option--disabled":L.disabled,"input-dropdown-option--insert":L.value&&typeof L.value=="string"&&L.value.startsWith("__insert__")}]),onClick:en=>I(L),onMouseenter:en=>u.value.highlightedIndex=Ee,role:"option","aria-selected":A(L)},[a.createElementVNode("div",ef,[a.createElementVNode("div",tf,a.toDisplayString(L.label),1),L.description?(a.openBlock(),a.createElementBlock("div",nf,a.toDisplayString(L.description),1)):a.createCommentVNode("",!0)]),n.multiple&&A(L)?(a.openBlock(),a.createElementBlock("div",rf,[a.createVNode(a.unref(ns))])):a.createCommentVNode("",!0)],42,_u))),128))],4)],46,Wu)):a.createCommentVNode("",!0)],8,["to"]))],64))}}),sf=se(of,[["__scopeId","data-v-118125f7"]]),lf={class:"input-leading-icon"},af=["src"],cf=["id","accept","multiple","disabled","required"],df={class:"input-file-content"},uf={key:0,class:"input-file-selected"},ff={class:"input-file-list"},hf={class:"input-file-item"},pf={class:"input-file-name"},mf={key:1,class:"input-file-prompt"},gf={class:"input-file-prompt-text"},yf={key:0,class:"input-file-accept-text"},kf={key:2,class:"input-file-selected"},bf={class:"input-file-selected-text"},vf={class:"input-file-list"},xf={class:"input-file-name"},wf={class:"input-file-size"},Cf={key:0,class:"input-trailing-icon"},Sf={key:1,class:"input-trailing-icon"},Mf=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 M=[];return t.error&&M.push("input-error"),t.disabled&&M.push("input-disabled"),M.push(`input-size-${t.size}`),M}),f=a.computed(()=>{const M=[];return M.push("input-padding-left-icon"),l.value.length>0||d.value||t.disabled?M.push("input-padding-right-icon"):M.push("input-padding-right"),M}),h=M=>{if(t.maxFileSize&&M.size>t.maxFileSize)return`File "${M.name}" is too large. Maximum size is ${y(t.maxFileSize)}.`;if(t.accept){const A=t.accept.split(",").map(K=>K.trim().toLowerCase()),I=M.type.toLowerCase(),U="."+M.name.split(".").pop()?.toLowerCase();if(!A.some(K=>{if(K.startsWith("."))return U===K;if(K.includes("*")){const Y=K.split("/")[0];return I.startsWith(Y)}return I===K}))return`File "${M.name}" is not an accepted file type.`}return null},p=M=>{for(const A of M){const I=h(A);if(I){r("file-error",I);return}}t.multiple?l.value=[...l.value,...M]:l.value=M.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=M=>{s.value&&URL.revokeObjectURL(s.value);const A=new FileReader;A.onload=I=>{s.value=I.target?.result},A.readAsDataURL(M)},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=M=>{if(M===0)return"0 Bytes";const A=1024,I=["Bytes","KB","MB","GB"],U=Math.floor(Math.log(M)/Math.log(A));return parseFloat((M/Math.pow(A,U)).toFixed(2))+" "+I[U]},b=()=>{!t.disabled&&i.value&&i.value.click()},w=M=>{const A=M.target,I=Array.from(A.files||[]);I.length>0&&p(I)},k=M=>{t.disabled||(o.value=!0)},v=M=>{o.value=!1},x=M=>{if(t.disabled)return;o.value=!1;const A=Array.from(M.dataTransfer?.files||[]);A.length>0&&p(A)},S=M=>{r("blur",M)},C=M=>{r("focus",M)};return a.watch(()=>t.modelValue,M=>{M?Array.isArray(M)?l.value=M:(l.value=[M],M.type.startsWith("image/")&&m(M)):(l.value=[],s.value&&(URL.revokeObjectURL(s.value),s.value=null))},{immediate:!0}),a.onUnmounted(()=>{s.value&&URL.revokeObjectURL(s.value)}),(M,A)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper",[u.value,f.value]])},[a.renderSlot(M.$slots,"leading",{},void 0,!0),a.createElementVNode("div",lf,[c.value?(a.openBlock(),a.createElementBlock("img",{key:0,src:c.value,alt:"Preview",class:"input-file-preview"},null,8,af)):t.hasLeadingIcon?a.renderSlot(M.$slots,"leading-icon",{key:1},void 0,!0):(a.openBlock(),a.createBlock(a.unref(fu),{key:2}))]),a.createElementVNode("div",{class:a.normalizeClass(["input-file-area",{"input-file-dragover":o.value,"input-file-disabled":n.disabled}]),onClick:b,onDragover:a.withModifiers(k,["prevent"]),onDragleave:a.withModifiers(v,["prevent"]),onDrop:a.withModifiers(x,["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:w,onBlur:S,onFocus:C},null,40,cf),a.createElementVNode("div",df,[d.value&&l.value.length===0?(a.openBlock(),a.createElementBlock("div",uf,[A[0]||(A[0]=a.createElementVNode("div",{class:"input-file-selected-text"}," File loaded ",-1)),a.createElementVNode("div",ff,[a.createElementVNode("div",hf,[a.createElementVNode("span",pf,a.toDisplayString(d.value),1)])])])):l.value.length===0?(a.openBlock(),a.createElementBlock("div",mf,[a.createElementVNode("div",gf,a.toDisplayString(n.dragDropText||"Click to select or drag and drop"),1),n.accept?(a.openBlock(),a.createElementBlock("div",yf,a.toDisplayString(n.accept),1)):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",kf,[a.createElementVNode("div",bf,a.toDisplayString(n.selectedText||`${l.value.length} file(s) selected`),1),a.createElementVNode("div",vf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,(I,U)=>(a.openBlock(),a.createElementBlock("div",{key:U,class:"input-file-item"},[a.createElementVNode("span",xf,a.toDisplayString(I.name),1),a.createElementVNode("span",wf,"("+a.toDisplayString(y(I.size))+")",1)]))),128))])]))])],34),(l.value.length>0||d.value)&&!n.disabled?(a.openBlock(),a.createElementBlock("div",Cf,[a.createElementVNode("button",{type:"button",class:"input-file-clear",onClick:a.withModifiers(g,["stop"]),"aria-label":"Clear selected files"},[a.createVNode(a.unref(po))])])):t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",Sf,[a.renderSlot(M.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(M.$slots,"trailing",{},void 0,!0)],2))}}),Tf=se(Mf,[["__scopeId","data-v-3c7bee41"]]),Ef={class:"tabs-wrapper"},Nf={key:0,class:"tabs-before"},Af=["aria-selected","id","onClick"],Bf={key:1,class:"tabs-after"},Of=["aria-labelledby"],If=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(k=>k.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=(k,v)=>{const x=k.getBoundingClientRect(),S=v.getBoundingClientRect(),C=getComputedStyle(v),M=parseFloat(C.getPropertyValue("--underline-thickness")||"5");let A=5;t.size==="sm"?A=4:t.size==="lg"&&(A=6);const I=S.height;if(t.orientation==="vertical"){const U=x.top-S.top;return{height:x.height-A*4,top:U+A*2,width:M,left:A-M/2}}else{const U=x.left-S.left,j=x.width;if(t.underlineWidth==="full")return{width:j-30,left:U+15,height:M,top:I-A-M/2};let K;if(t.underlineWidth.endsWith("%")){const E=parseFloat(t.underlineWidth)/100;K=j*E}else if(t.underlineWidth.endsWith("px"))K=parseFloat(t.underlineWidth);else if(t.underlineWidth.endsWith("rem")){const E=parseFloat(t.underlineWidth),$=parseFloat(getComputedStyle(document.documentElement).fontSize);K=E*$}else K=parseFloat(t.underlineWidth)||j;const Y=(j-K)/2;return{width:K,left:U+Y,height:M,top:I-A-M/2}}},m=async(k,v)=>{h||(r("update:modelValue",k),await a.nextTick(),g(v))},g=async k=>{if(!l.value[k]||k===f)return;h=!0;const v=l.value[k],x=v.parentElement;if(!x)return;const S=p(v,x),C=v.getBoundingClientRect(),M=x.getBoundingClientRect();let A,I;if(t.orientation==="vertical"?(A=C.top-M.top,I=C.height):(A=C.left-M.left,I=C.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:`${I}px`,top:`${A}px`,width:`${C.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:`${I}px`,left:`${A}px`,height:"100%",top:"0",opacity:"1"}),f=k,h=!1;return}const U=l.value[f];if(p(U,x),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:`${I}px`,top:`${A}px`,width:"100%",left:"0",opacity:"1"}:u.value={width:`${I}px`,left:`${A}px`,height:"100%",top:"0",opacity:"1"},f=k,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:`${I}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:`${I}px`,left:`${A}px`,height:"100%",top:"0",opacity:"1"}),f=k,setTimeout(()=>{h=!1},200)})};let y=null;const b=()=>{const k=t.tabs.findIndex(v=>v.value===t.modelValue);if(k!==-1&&l.value&&l.value[k]){const v=c.value;c.value=!1;const x=l.value[k],S=x.parentElement;if(S){const C=p(x,S),M=x.getBoundingClientRect(),A=S.getBoundingClientRect();let I,U;t.orientation==="vertical"?(I=M.top-A.top,U=M.height,d.value={height:`${C.height}px`,top:`${C.top}px`,width:`${C.width}px`,left:`${C.left}px`,opacity:"1"},u.value={height:`${U}px`,top:`${I}px`,width:`${M.width}px`,left:"0",opacity:"1"}):(I=M.left-A.left,U=M.width,d.value={width:`${C.width}px`,left:`${C.left}px`,height:`${C.height}px`,top:`${C.top}px`,opacity:"1"},u.value={width:`${U}px`,left:`${I}px`,height:"100%",top:"0",opacity:"1"})}f=k,h=!1,setTimeout(()=>{c.value=v},10)}y&&clearTimeout(y),y=setTimeout(()=>{y=null},50)};a.onMounted(async()=>{await a.nextTick();const k=t.tabs.findIndex(v=>v.value===t.modelValue);k!==-1&&(g(k),setTimeout(()=>{c.value=!0},50)),window.addEventListener("resize",b)}),a.onUnmounted(()=>{window.removeEventListener("resize",b),y&&(clearTimeout(y),y=null)});const{modelValue:w}=a.toRefs(t);return a.watch(w,async()=>{await a.nextTick();const k=t.tabs.findIndex(v=>v.value===t.modelValue);k!==-1&&g(k)}),(k,v)=>(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",Ef,[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}:{})},[k.$slots.before?(a.openBlock(),a.createElementBlock("div",Nf,[a.renderSlot(k.$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,(x,S)=>(a.openBlock(),a.createElementBlock("button",{key:x.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(w)===x.value}]]),"aria-selected":a.unref(w)===x.value,"aria-controls":"tabpanel",id:`tab-${x.value}`,role:"tab",onClick:C=>m(x.value,S)},a.toDisplayString(x.label),11,Af))),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),k.$slots.after?(a.openBlock(),a.createElementBlock("div",Bf,[a.renderSlot(k.$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(w)}`,id:"tabpanel"},[a.renderSlot(k.$slots,"content",{activeTab:s.value},void 0,!0)],10,Of)):a.createCommentVNode("",!0)],2))}}),Wr=se(If,[["__scopeId","data-v-901716e3"]]),Df={key:0,class:"ui-divider-text"},$f=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",Df,[a.renderSlot(o.$slots,"default",{},()=>[a.createTextVNode(a.toDisplayString(n.text),1)],!0)])):a.createCommentVNode("",!0)],6))}}),nt=se($f,[["__scopeId","data-v-1c798024"]]),Rf={class:"datetime-picker-wrapper"},Lf={class:"datetime-picker-leading-icon"},zf={class:"datetime-picker-display"},Pf={key:0,class:"datetime-picker-value"},Vf={key:1,class:"datetime-picker-placeholder"},Ff={key:1,class:"datetime-picker-trailing-icon"},Hf={key:1,class:"datetime-picker-panel"},jf={class:"datetime-picker-header"},Uf={class:"datetime-picker-month-year"},qf=["value"],Wf=["value"],Kf={class:"datetime-picker-weekdays"},Jf={class:"datetime-picker-grid"},Gf={key:2,class:"datetime-picker-panel datetime-picker-time-panel"},Yf={class:"time-selector"},Qf={class:"time-column"},Xf={class:"time-scroll"},Zf={class:"time-column"},_f={class:"time-scroll"},eh={key:0,class:"time-column"},th={class:"time-scroll"},nh={class:"datetime-picker-footer"},rh=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}=qr({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()),b=a.ref(new Date().getMinutes()),w=a.ref("AM"),k=["January","February","March","April","May","June","July","August","September","October","November","December"],v=["Su","Mo","Tu","We","Th","Fr","Sa"],x=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),C=a.computed(()=>{if(!t.modelValue)return null;if(t.modelValue instanceof Date)return t.modelValue;if(t.type==="time"&&typeof t.modelValue=="string"){const R=t.modelValue.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);if(R){const D=new Date;return D.setHours(parseInt(R[1]),parseInt(R[2]),parseInt(R[3]||"0"),0),D}}return new Date(t.modelValue)}),M=a.computed(()=>{if(!C.value||isNaN(C.value.getTime()))return"";const R=C.value;if(t.type==="time"){if(t.is24Hour)return`${String(R.getHours()).padStart(2,"0")}:${String(R.getMinutes()).padStart(2,"0")}`;{const mt=R.getHours()%12||12,ae=R.getHours()>=12?"PM":"AM";return`${mt}:${String(R.getMinutes()).padStart(2,"0")} ${ae}`}}const D=R.getDate(),O=R.getMonth()+1,q=R.getFullYear();let we="";switch(t.format){case"us":we=`${O}/${D}/${q}`;break;case"eu":we=`${D}/${O}/${q}`;break;default:we=`${q}-${String(O).padStart(2,"0")}-${String(D).padStart(2,"0")}`;break}if(t.type==="date")return we;let Rt="";if(t.is24Hour)Rt=`${String(R.getHours()).padStart(2,"0")}:${String(R.getMinutes()).padStart(2,"0")}`;else{const mt=R.getHours()%12||12,ae=R.getHours()>=12?"PM":"AM";Rt=`${mt}:${String(R.getMinutes()).padStart(2,"0")} ${ae}`}return`${we} ${Rt}`}),A=a.computed(()=>{const R=[];return t.error&&R.push("datetime-picker-error"),t.disabled&&R.push("datetime-picker-disabled"),t.readonly&&R.push("datetime-picker-readonly"),R.push(`datetime-picker-size-${t.size}`),R}),I=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 R=[],D=t.is24Hour?23:12,O=t.is24Hour?0:1;for(let q=O;q<=D;q++)R.push(q);return R}),Y=a.computed(()=>{const R=[];for(let D=0;D<60;D+=t.minuteStep)R.push(D);return R}),E=a.computed(()=>{const R=new Date().getFullYear(),D=x.value?.getFullYear()||R-100,O=S.value?.getFullYear()||R+100,q=[];for(let we=D;we<=O;we++)q.push(we);return q}),$=a.computed(()=>x.value?new Date(g.value,m.value,1)<=x.value:!1),L=a.computed(()=>S.value?new Date(g.value,m.value+1,0)>=S.value:!1),Ee=a.computed(()=>{const R=[],D=g.value,O=m.value,q=new Date(D,O,1),we=new Date(q);we.setDate(we.getDate()-q.getDay());const Rt=new Date;Rt.setHours(0,0,0,0);for(let mt=0;mt<42;mt++){const ae=new Date(we);ae.setDate(we.getDate()+mt);const dd=ae.getMonth()!==O,ud=ae.getTime()===Rt.getTime(),fd=C.value&&ae.getFullYear()===C.value.getFullYear()&&ae.getMonth()===C.value.getMonth()&&ae.getDate()===C.value.getDate(),hd=!!(x.value&&ae<x.value||S.value&&ae>S.value);R.push({key:`${ae.getFullYear()}-${ae.getMonth()}-${ae.getDate()}`,date:ae.getDate(),month:ae.getMonth(),year:ae.getFullYear(),otherMonth:dd,isToday:ud,isSelected:fd||!1,isDisabled:hd})}return R}),en=()=>{switch(t.type){case"time":return"Select time";case"datetime":return"Select date and time";default:return"Select date"}},sd=()=>{m.value===0?(m.value=11,g.value--):m.value--},ld=()=>{m.value===11?(m.value=0,g.value++):m.value++},ad=R=>{if(R.isDisabled||R.otherMonth)return;const D=C.value||new Date,O=new Date(R.year,R.month,R.date,D.getHours(),D.getMinutes());r("update:modelValue",O),r("change",O),t.type==="datetime"?p.value="time":t.type==="date"&&f()},Rn=(R,D)=>{let O=C.value?new Date(C.value):new Date;if(!C.value){const q=new Date;O.setFullYear(q.getFullYear(),q.getMonth(),q.getDate())}if(R==="hour"){let q=D;t.is24Hour||(w.value==="PM"&&q!==12&&(q+=12),w.value==="AM"&&q===12&&(q=0)),y.value=D,O.setHours(q)}else if(R==="minute")b.value=D,O.setMinutes(D);else if(R==="period"){w.value=D;let q=y.value;D==="PM"&&q!==12&&(q+=12),D==="AM"&&q===12&&(q=0),O.setHours(q)}r("update:modelValue",O),r("change",O)},cd=()=>{const R=new Date;x.value&&R<x.value||S.value&&R>S.value||(r("update:modelValue",R),r("change",R),f())},_o=()=>{r("update:modelValue",null),r("change",null)};return a.watch(()=>t.modelValue,R=>{if(R){const D=R instanceof Date?R:new Date(R);if(!isNaN(D.getTime())){if(m.value=D.getMonth(),g.value=D.getFullYear(),t.is24Hour)y.value=D.getHours();else{const O=D.getHours();y.value=O%12||12,w.value=O>=12?"PM":"AM"}b.value=D.getMinutes()}}},{immediate:!0}),a.onUnmounted(()=>{d()}),(R,D)=>(a.openBlock(),a.createElementBlock("div",Rf,[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",Lf,[n.type==="date"?(a.openBlock(),a.createBlock(a.unref(ou),{key:0})):n.type==="time"?(a.openBlock(),a.createBlock(a.unref(au),{key:1})):(a.openBlock(),a.createBlock(a.unref(iu),{key:2}))]),a.createElementVNode("div",zf,[M.value?(a.openBlock(),a.createElementBlock("span",Pf,a.toDisplayString(M.value),1)):(a.openBlock(),a.createElementBlock("span",Vf,a.toDisplayString(n.placeholder||en()),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(po))])):(a.openBlock(),a.createElementBlock("div",Ff,[a.createVNode(a.unref(Ur))]))],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(Wr,{key:0,modelValue:p.value,"onUpdate:modelValue":D[0]||(D[0]=O=>p.value=O),tabs:j.value,variant:"default",size:"sm",style:{"margin-bottom":"1rem"}},null,8,["modelValue","tabs"])):a.createCommentVNode("",!0),I.value?(a.openBlock(),a.createElementBlock("div",Hf,[a.createElementVNode("div",jf,[a.createVNode(W,{onClick:sd,disabled:$.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:a.withCtx(()=>[a.createVNode(a.unref(su))]),_:1},8,["disabled"]),a.createElementVNode("div",Uf,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D[1]||(D[1]=O=>m.value=O),class:"datetime-picker-select"},[(a.openBlock(),a.createElementBlock(a.Fragment,null,a.renderList(k,(O,q)=>a.createElementVNode("option",{key:q,value:q},a.toDisplayString(O),9,qf)),64))],512),[[a.vModelSelect,m.value]]),a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D[2]||(D[2]=O=>g.value=O),class:"datetime-picker-select"},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(E.value,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,Wf))),128))],512),[[a.vModelSelect,g.value]])]),a.createVNode(W,{onClick:ld,disabled:L.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:a.withCtx(()=>[a.createVNode(a.unref(lu))]),_:1},8,["disabled"])]),a.createElementVNode("div",Kf,[(a.openBlock(),a.createElementBlock(a.Fragment,null,a.renderList(v,O=>a.createElementVNode("div",{key:O,class:"datetime-picker-weekday"},a.toDisplayString(O),1)),64))]),a.createElementVNode("div",Jf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Ee.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=>ad(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",Gf,[a.createElementVNode("div",Yf,[a.createElementVNode("div",Qf,[D[6]||(D[6]=a.createElementVNode("label",{class:"time-label"},"Hour",-1)),a.createElementVNode("div",Xf,[(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=>Rn("hour",O)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(String(O).padStart(2,"0")),1)]),_:2},1032,["color","variant","onClick"]))),128))])]),a.createElementVNode("div",Zf,[D[7]||(D[7]=a.createElementVNode("label",{class:"time-label"},"Minute",-1)),a.createElementVNode("div",_f,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Y.value,O=>(a.openBlock(),a.createBlock(W,{key:O,color:b.value===O?"primary":"secondary",variant:b.value===O?"primary":"ghost",size:"sm",squircle:"",onClick:q=>Rn("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",eh,[D[10]||(D[10]=a.createElementVNode("label",{class:"time-label"},"Period",-1)),a.createElementVNode("div",th,[a.createVNode(W,{color:w.value==="AM"?"primary":"secondary",variant:w.value==="AM"?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:D[3]||(D[3]=O=>Rn("period","AM"))},{default:a.withCtx(()=>[...D[8]||(D[8]=[a.createTextVNode(" AM ",-1)])]),_:1},8,["color","variant"]),a.createVNode(W,{color:w.value==="PM"?"primary":"secondary",variant:w.value==="PM"?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:D[4]||(D[4]=O=>Rn("period","PM"))},{default:a.withCtx(()=>[...D[9]||(D[9]=[a.createTextVNode(" PM ",-1)])]),_:1},8,["color","variant"])])]))])])):a.createCommentVNode("",!0),a.createVNode(nt),a.createElementVNode("div",nh,[a.createVNode(W,{onClick:cd,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:D[5]||(D[5]=O=>{_o(),f()}),color:"danger",variant:"primary",squircle:"",style:{flex:"1"}},{default:a.withCtx(()=>[...D[11]||(D[11]=[a.createTextVNode(" Clear ",-1)])]),_:1}),a.createVNode(W,{onClick:f,color:"secondary",variant:"primary",squircle:"",style:{flex:"1"}},{default:a.withCtx(()=>[...D[12]||(D[12]=[a.createTextVNode(" Close ",-1)])]),_:1})])],4)):a.createCommentVNode("",!0)]))]))}}),mo=se(rh,[["__scopeId","data-v-f688c330"]]),ih=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(mo,{"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"]))}}),oh=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(mo,{"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"]))}}),sh=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(mo,{"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 fe(n){this.content=n}fe.prototype={constructor:fe,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 fe(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 fe(t)},addToStart:function(n,e){return new fe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new fe(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 fe(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=fe.from(n),n.size?new fe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=fe.from(n),n.size?new fe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=fe.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}};fe.from=function(n){if(n instanceof fe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new fe(e)};function Ol(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=Ol(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function Il(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=Il(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 Ol(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Il(this,e,t,r)}findIndex(e){if(e==0)return Ln(0,e);if(e==this.size)return Ln(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?Ln(t+1,o):Ln(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 ai={index:0,offset:0};function Ln(n,e){return ai.index=n,ai.offset=e,ai}function _n(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(!_n(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!_n(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Q=class Li{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&&_n(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 Li.none;if(e instanceof Li)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Q.none=[];class er 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=$l(this.content,e+this.openStart,t);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,t){return new B(Dl(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 Dl(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(Dl(o.content,e-i-1,t-i-1)))}function $l(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=$l(s.content,e-o-1,t,s);return l&&n.replaceChild(i,s.copy(l))}function lh(n,e,t){if(t.openStart>n.depth)throw new er("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new er("Inconsistent open depths");return Rl(n,e,t,0)}function Rl(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=Rl(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 Ct(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=ah(t,n);return Ct(o,zl(n,s,l,e,r))}else return Ct(o,tr(n,e,r))}function Ll(n,e){if(!e.type.compatibleContent(n.type))throw new er("Cannot join "+e.type.name+" onto "+n.type.name)}function zi(n,e,t){let r=n.node(t);return Ll(r,e.node(t)),r}function wt(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 cn(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&&(wt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)wt(i.child(l),r);e&&e.depth==t&&e.textOffset&&wt(e.nodeBefore,r)}function Ct(n,e){return n.type.checkContent(e),n.copy(e)}function zl(n,e,t,r,i){let o=n.depth>i&&zi(n,e,i+1),s=r.depth>i&&zi(t,r,i+1),l=[];return cn(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(Ll(o,s),wt(Ct(o,zl(n,e,t,r,i+1)),l)):(o&&wt(Ct(o,tr(n,e,i+1)),l),cn(e,t,i,l),s&&wt(Ct(s,tr(t,r,i+1)),l)),cn(r,null,i,l),new T(l)}function tr(n,e,t){let r=[];if(cn(null,n,t,r),n.depth>t){let i=zi(n,e,t+1);wt(Ct(i,tr(n,e,t+1)),r)}return cn(e,null,t,r),new T(r)}function ah(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 vn{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 Q.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 nr(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 vn(t,r,o)}static resolveCached(e,t){let r=rs.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 rs.set(e,r=new ch);let i=r.elts[r.i]=vn.resolve(e,t);return r.i=(r.i+1)%dh,i}}class ch{constructor(){this.elts=[],this.i=0}}const dh=12,rs=new WeakMap;class nr{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 uh=Object.create(null);class Le{constructor(e,t,r,i=Q.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&&_n(this.attrs,t||e.defaultAttrs||uh)&&Q.sameSet(this.marks,r||Q.none)}copy(e=null){return e==this.content?this:new Le(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Le(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 lh(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 vn.resolveCached(this,e)}resolveNoCache(e){return vn.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()+")"),Pl(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=Q.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(!Q.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}}Le.prototype.text=void 0;class rr extends Le{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):Pl(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 rr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new rr(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 Pl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Et{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new fh(e,t);if(r.next==null)return Et.empty;let i=Vl(r);r.next&&r.err("Unexpected trailing text");let o=bh(kh(i));return vh(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(`
|
|
4
|
+
`,Cd={key:0,class:"loader-icon"},Sd=["width","height"],Md=["d"],Td=["stroke-width"],Ed=["stroke-width"],Nd=["width","height"],Ad={key:3,class:"loader-text"},Bd=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=wd.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",Cd,[(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,Md)]),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,Td),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,Ed)],8,Sd))])):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,Nd))],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",Ad,a.toDisplayString(n.text),1)):a.createCommentVNode("",!0)],2))}}),jr=se(Bd,[["__scopeId","data-v-4b565c5d"]]),Od={key:0,class:"button-loading-content"},Id={key:0},Dd={key:0,class:"leading-icon"},$d={class:"button-text-content"},Rd={key:1,class:"trailing-icon"},Ld=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",Od,[a.createVNode(jr,{variant:"circle",size:o.value,centered:!1,color:"white"},null,8,["size"]),n.icon?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("span",Id,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",Dd,[a.renderSlot(l.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(l.$slots,"icon",{},void 0,!0),a.createElementVNode("span",$d,[a.renderSlot(l.$slots,"default",{},void 0,!0)]),r.value?(a.openBlock(),a.createElementBlock("span",Rd,[a.renderSlot(l.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0)],64))],2))}}),bn=se(Ld,[["__scopeId","data-v-12d1d1fc"]]),zd=["href","target","rel"],$i=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(bn,{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,zd))}}),Ri=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();let r=!1;const i=a.computed(()=>{r=!1;const u=t?.appContext?.components||{};return u.NuxtLink?(r=!0,u.NuxtLink):u.RouterLink?(r=!0,u.RouterLink):"a"}),o=a.computed(()=>r),s=n,l=e,c=d=>{if(s.disabled||s.loading){d.preventDefault();return}l("click",d)};return(d,u)=>(a.openBlock(),a.createBlock(a.resolveDynamicComponent(i.value),{to:o.value?n.to:void 0,href:o.value?void 0:typeof n.to=="string"?n.to:"/",class:a.normalizeClass(n.buttonClasses),style:a.normalizeStyle(n.buttonStyles),onClick:c},{default:a.withCtx(()=>[a.createVNode(bn,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"text-align":n.textAlign},{"leading-icon":a.withCtx(()=>[a.renderSlot(d.$slots,"leading-icon")]),icon:a.withCtx(()=>[a.renderSlot(d.$slots,"icon")]),default:a.withCtx(()=>[a.renderSlot(d.$slots,"default")]),"trailing-icon":a.withCtx(()=>[a.renderSlot(d.$slots,"trailing-icon")]),_:3},8,["loading","loading-text","icon","text-align"])]),_:3},8,["to","href","class","style"]))}}),Pd={class:"ui-tooltip-content"},Vd=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,b=window.innerHeight;let C=0,v=0;switch(e.position){case"top":C=h.top-g-e.offset,v=h.left+h.width/2-m/2;break;case"bottom":C=h.bottom+e.offset,v=h.left+h.width/2-m/2;break;case"left":C=h.top+h.height/2-g/2,v=h.left-m-e.offset;break;case"right":C=h.top+h.height/2-g/2,v=h.right+e.offset;break}const k=8;v<k?v=k:v+m>y-k&&(v=y-m-k),C<k?C=k:C+g>b-k&&(C=b-g-k),c.value={position:"fixed",top:`${C}px`,left:`${v}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",Pd,[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))}}),Nl=se(Vd,[["__scopeId","data-v-ba66edda"]]),Fd=["type","disabled","tabindex"],Hd=["type","disabled","tabindex"],jd=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(()=>["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)),o=a.computed(()=>i.value.join(" ")),s=a.computed(()=>({fontWeight:t.fontWeight})),l=a.computed(()=>t.disabled||t.loading?-1:t.tabindex??void 0);return(c,d)=>n.title?(a.openBlock(),a.createBlock(Nl,a.normalizeProps(a.mergeProps({key:0},r.value)),{default:a.withCtx(()=>[n.to?n.to?(a.openBlock(),a.createBlock(Ri,{key:1,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":i.value,"button-styles":s.value,tabindex:l.value,"text-align":n.textAlign,onClick:d[1]||(d[1]=u=>c.$emit("click",u))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):n.href?(a.openBlock(),a.createBlock($i,{key:2,href:n.href,external:n.external,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":i.value,"button-styles":s.value,tabindex:l.value,"text-align":n.textAlign,onClick:d[2]||(d[2]=u=>c.$emit("click",u))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["href","external","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",a.mergeProps({key:0},c.$attrs,{type:n.type,disabled:n.disabled||n.loading,class:o.value,style:s.value,tabindex:l.value,onClick:d[0]||(d[0]=u=>c.$emit("click",u))}),[a.createVNode(bn,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,size:n.size,"text-align":n.textAlign},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","text-align"])],16,Fd))]),_:3},16)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[n.to?n.to?(a.openBlock(),a.createBlock(Ri,{key:1,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":i.value,"button-styles":s.value,tabindex:l.value,"text-align":n.textAlign,onClick:d[4]||(d[4]=u=>c.$emit("click",u))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):n.href?(a.openBlock(),a.createBlock($i,{key:2,href:n.href,external:n.external,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":i.value,"button-styles":s.value,tabindex:l.value,"text-align":n.textAlign,onClick:d[5]||(d[5]=u=>c.$emit("click",u))},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["href","external","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex","text-align"])):a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",a.mergeProps({key:0},c.$attrs,{type:n.type,disabled:n.disabled||n.loading,class:o.value,style:s.value,tabindex:l.value,onClick:d[3]||(d[3]=u=>c.$emit("click",u))}),[a.createVNode(bn,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,size:n.size,"text-align":n.textAlign},a.createSlots({icon:a.withCtx(()=>[a.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:a.withCtx(()=>[a.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","text-align"])],16,Hd))],64))}}),W=se(jd,[["__scopeId","data-v-6210c93f"]]),Ud={key:0,class:"ui-card-header"},qd={key:0,class:"ui-card-title-wrapper"},Wd={key:0,class:"ui-card-title"},Kd={key:0,class:"ui-card-subtitle"},Jd={key:1,class:"ui-card-content"},Gd={key:2,class:"ui-card-footer"},Yd=a.defineComponent({inheritAttrs:!1,__name:"UiCard",props:{variant:{default:"default"},padding:{default:"md"},shadow:{default:"sm"},color:{default:"default"},title:{},subtitle:{},to:{}},setup(n){const e=n,t=a.useAttrs(),r=a.computed(()=>{if(!e.to)return null;try{const d=a.resolveComponent("NuxtLink");if(typeof d!="string")return d}catch{}try{const d=a.resolveComponent("RouterLink");if(typeof d!="string")return d}catch{}return"a"}),i=a.computed(()=>!e.to||typeof e.to!="string"?!1:/^(https?:\/\/|mailto:|tel:)/.test(e.to)),o=a.computed(()=>e.to?i.value?"a":r.value||"a":"div"),s=a.computed(()=>typeof o.value!="string"),l=a.computed(()=>o.value==="a"&&!!e.to),c=a.computed(()=>[`ui-card-${e.variant}`,`ui-card-padding-${e.padding}`,`ui-card-shadow-${e.shadow}`,`ui-card-color-${e.color}`,t.class]);return(d,u)=>(a.openBlock(),a.createBlock(a.resolveDynamicComponent(o.value),{to:s.value?n.to:void 0,href:l.value?typeof n.to=="string"?n.to:"":void 0,class:a.normalizeClass(["ui-card",[c.value,{"ui-card-linkable":!!n.to}]])},{default:a.withCtx(()=>[d.$slots.header||n.title||n.subtitle||d.$slots["leading-icon"]||d.$slots["trailing-icon"]?(a.openBlock(),a.createElementBlock("div",Ud,[a.renderSlot(d.$slots,"header",{},()=>[a.renderSlot(d.$slots,"leading-icon",{},void 0,!0),n.title||d.$slots.title||n.subtitle||d.$slots.subtitle?(a.openBlock(),a.createElementBlock("div",qd,[n.title||d.$slots.title?a.renderSlot(d.$slots,"title",{key:0},()=>[n.title?(a.openBlock(),a.createElementBlock("h2",Wd,a.toDisplayString(n.title),1)):a.createCommentVNode("",!0)],!0):a.createCommentVNode("",!0),n.subtitle||d.$slots.subtitle?a.renderSlot(d.$slots,"subtitle",{key:1},()=>[n.subtitle?(a.openBlock(),a.createElementBlock("p",Kd,a.toDisplayString(n.subtitle),1)):a.createCommentVNode("",!0)],!0):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.renderSlot(d.$slots,"trailing-icon",{},void 0,!0),a.renderSlot(d.$slots,"actions",{},void 0,!0)],!0)])):a.createCommentVNode("",!0),d.$slots.default?(a.openBlock(),a.createElementBlock("div",Jd,[a.renderSlot(d.$slots,"default",{},void 0,!0)])):a.createCommentVNode("",!0),d.$slots.footer?(a.openBlock(),a.createElementBlock("div",Gd,[a.renderSlot(d.$slots,"footer",{},void 0,!0)])):a.createCommentVNode("",!0)]),_:3},8,["to","href","class"]))}}),ho=se(Yd,[["__scopeId","data-v-5d575f4a"]]);const es=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Qd=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),Xd=n=>{const e=Qd(n);return e.charAt(0).toUpperCase()+e.slice(1)},Zd=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim(),ts=n=>n==="";var tn={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 _d=({name:n,iconNode:e,absoluteStrokeWidth:t,"absolute-stroke-width":r,strokeWidth:i,"stroke-width":o,size:s=tn.width,color:l=tn.stroke,...c},{slots:d})=>a.h("svg",{...tn,...c,width:s,height:s,stroke:l,"stroke-width":ts(t)||ts(r)||t===!0||r===!0?Number(i||o||tn["stroke-width"])*24/Number(s):i||o||tn["stroke-width"],class:Zd("lucide",c.class,...n?[`lucide-${es(Xd(n))}-icon`,`lucide-${es(n)}`]:["lucide-icon"])},[...e.map(u=>a.h(...u)),...d.default?[d.default()]:[]]);const G=(n,e)=>(t,{slots:r,attrs:i})=>a.h(_d,{...i,...t,iconNode:e,name:n},r);const eu=G("align-center",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const tu=G("align-left",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const nu=G("align-right",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const ru=G("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 iu=G("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 ou=G("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 ns=G("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Ur=G("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const su=G("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const lu=G("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const au=G("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const cu=G("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const du=G("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 uu=G("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 fu=G("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 hu=G("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 pu=G("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 mu=G("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 gu=G("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 yu=G("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 ku=G("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 Al=G("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const bu=G("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 vu=G("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 xu=G("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const wu=G("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 Cu=G("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 Su=G("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 po=G("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Mu={key:0,class:"input-leading-icon"},Tu=["id","type","value","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","tabindex"],Eu={key:1,class:"input-trailing-icon"},Nu={key:2,class:"input-trailing-icon"},Au={key:3,class:"input-trailing-icon"},Bu=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","input","change","blur","focus","keydown"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(t.modelValue??""),o=a.computed(()=>i.value);a.watch(()=>t.modelValue,C=>{C!==void 0&&C!==i.value&&(i.value=C)},{immediate:!0});const s=a.ref(!1),l=a.computed(()=>t.type==="password"?s.value?"text":"password":t.type),c=a.computed(()=>t.hasTrailingIcon||t.type==="password"||t.type==="search"&&o.value),d=a.computed(()=>{if(t.tabindex!==void 0)return t.tabindex+1}),u=a.computed(()=>{const C=[];return t.error&&C.push("input-error"),t.disabled&&C.push("input-disabled"),t.readonly&&C.push("input-readonly"),C.push(`input-size-${t.size}`),C}),f=a.computed(()=>{const C=[];return t.hasLeadingIcon?C.push("input-padding-left-icon"):C.push("input-padding-left"),c.value?C.push("input-padding-right-icon"):C.push("input-padding-right"),C}),h=C=>{let k=C.target.value;t.type==="number"&&k!==""&&(k=parseFloat(k)||0),i.value=k,r("update:modelValue",k),r("input",k),r("change",k)},p=C=>{r("blur",C)},m=C=>{r("focus",C)},g=C=>{r("keydown",C)},y=()=>{s.value=!s.value},b=()=>{i.value="",r("update:modelValue","")};return(C,v)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper",u.value])},[a.renderSlot(C.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Mu,[a.renderSlot(C.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.createElementVNode("input",{id:n.inputId,type:l.value,value:o.value,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",f.value]),onInput:h,onBlur:p,onFocus:m,onKeydown:g},null,42,Tu),n.type==="password"?(a.openBlock(),a.createElementBlock("div",Eu,[a.createVNode(W,{color:s.value?"primary":"secondary",variant:s.value?"primary":"ghost",size:"sm",icon:"",squircle:"",tabindex:d.value,"aria-label":s.value?"Hide password":"Show password",onClick:y},{icon:a.withCtx(()=>[s.value?(a.openBlock(),a.createBlock(a.unref(du),{key:0})):(a.openBlock(),a.createBlock(a.unref(uu),{key:1}))]),_:1},8,["color","variant","tabindex","aria-label"])])):n.type==="search"&&o.value&&!n.disabled&&!n.readonly?(a.openBlock(),a.createElementBlock("div",Nu,[a.createVNode(W,{color:"danger",variant:"ghost",size:"sm",icon:"",squircle:"",tabindex:d.value,"aria-label":"Clear search",onClick:b},{icon:a.withCtx(()=>[a.createVNode(a.unref(po))]),_:1},8,["tabindex"])])):t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",Au,[a.renderSlot(C.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(C.$slots,"trailing",{},void 0,!0)],2))}}),Ou=se(Bu,[["__scopeId","data-v-118c0113"]]),Iu={key:0,class:"input-leading-icon"},Du=["id","value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck"],$u={key:1,class:"input-trailing-icon"},Ru=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.useSlots(),o=a.computed(()=>!!i.default),s=a.ref(null);a.onMounted(()=>{(t.modelValue===void 0||t.modelValue==="")&&o.value&&setTimeout(()=>{if(s.value){const p=s.value.textContent?.trim()||"";p&&r("update:modelValue",p)}},0)});const l=a.computed(()=>{const p=[];return t.error&&p.push("input-error"),t.disabled&&p.push("input-disabled"),t.readonly&&p.push("input-readonly"),p.push(`input-size-${t.size}`),p}),c=a.computed(()=>{const p=[];return t.hasLeadingIcon?p.push("input-padding-left-icon"):p.push("input-padding-left"),t.hasTrailingIcon?p.push("input-padding-right-icon"):p.push("input-padding-right"),p}),d=p=>{const m=p.target;r("update:modelValue",m.value)},u=p=>{r("blur",p)},f=p=>{r("focus",p)},h=p=>{r("keydown",p)};return(p,m)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper input-textarea",l.value])},[a.renderSlot(p.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Iu,[a.renderSlot(p.$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},c.value]]),onInput:d,onBlur:u,onFocus:f,onKeydown:h},null,42,Du)],2),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",$u,[a.renderSlot(p.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(p.$slots,"trailing",{},void 0,!0),o.value?(a.openBlock(),a.createElementBlock("span",{key:2,ref_key:"slotContentRef",ref:s,class:"sr-only","aria-hidden":"true"},[a.renderSlot(p.$slots,"default",{},void 0,!0)],512)):a.createCommentVNode("",!0)],2))}}),Lu=se(Ru,[["__scopeId","data-v-7b987c4a"]]);function qr(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 v=e.value.getBoundingClientRect(),k=t.value.getBoundingClientRect(),[x,S="start"]=r.split("-");let w=0,M=0;switch(x){case"bottom":w=v.left,M=v.bottom+i;break;case"top":w=v.left,M=v.top-k.height-i;break;case"right":w=v.right+i,M=v.top;break;case"left":w=v.left-k.width-i,M=v.top;break}if(x==="top"||x==="bottom")switch(S){case"center":w=v.left+(v.width-k.width)/2;break;case"end":w=v.right-k.width;break}else if(x==="left"||x==="right")switch(S){case"center":M=v.top+(v.height-k.height)/2;break;case"end":M=v.bottom-k.height;break}let A=l?v.width:void 0;const O=window.innerWidth,H=window.innerHeight,F=8;let J=!1,K=!1;if(o){if(x==="bottom"&&M+k.height>H-F){const D=v.top-k.height-i;D>=F&&(M=D,J=!0)}else if(x==="top"&&M<F){const D=v.bottom+i;D+k.height<=H-F&&(M=D,J=!1)}if(x==="right"&&w+k.width>O-F){const D=v.left-k.width-i;D>=F&&(w=D,K=!0)}else if(x==="left"&&w<F){const D=v.right+i;D+k.width<=O-F&&(w=D,K=!1)}}s&&(w<F?w=F:w+k.width>O-F&&(w=O-k.width-F),M<F?M=F:M+k.height>H-F&&(M=H-k.height-F));const E={position:"fixed",zIndex:"9999",...A?{width:`${A}px`}:{}};J?E.bottom=`${H-M-k.height}px`:E.top=`${M}px`,K?E.right=`${O-w-k.width}px`:E.left=`${w}px`,u.value=E},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 v=e.value.getBoundingClientRect(),k=window.innerHeight,x=window.innerWidth;(v.bottom<0||v.top>k||v.right<0||v.left>x)&&d.handler()}},y=v=>{if(!d?.enabled||!d.handler)return;const k=v.target;if(!k||!e.value||!t.value||typeof e.value.contains!="function"||typeof t.value.contains!="function")return;const x=e.value.contains(k),S=t.value.contains(k);!x&&!S&&d.handler()},b=()=>{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)},C=()=>{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(()=>{b()}),a.onUnmounted(()=>{C()}),{floatingStyle:u,updatePosition:h,cleanup:C}}const zu={class:"accui-p-2 accui-border-b"},Pu=a.defineComponent({__name:"VirtualList",props:{items:{},itemHeight:{},containerHeight:{},itemKey:{type:[String,Function],default:"id"},overscan:{default:5}},setup(n,{expose:e}){const t=n,r=a.ref(),i=a.ref(0),o=a.computed(()=>{const h=Math.floor(i.value/t.itemHeight),p=Math.min(h+Math.ceil(t.containerHeight/t.itemHeight),t.items.length-1);return{start:Math.max(0,h-t.overscan),end:Math.min(t.items.length-1,p+t.overscan)}}),s=a.computed(()=>{const{start:h,end:p}=o.value,m=[];for(let g=h;g<=p;g++)m.push({index:g,data:t.items[g],top:g*t.itemHeight});return m}),l=a.computed(()=>t.items.length*t.itemHeight),c=h=>typeof t.itemKey=="function"?t.itemKey(h):h[t.itemKey]||h.id||Math.random();let d=null;const u=h=>{d&&clearTimeout(d),d=setTimeout(()=>{const p=h.target;i.value=p.scrollTop},16)};return a.onUnmounted(()=>{d&&clearTimeout(d)}),e({scrollToItem:(h,p="start")=>{if(!r.value)return;let m=h*t.itemHeight;p==="center"?m-=t.containerHeight/2-t.itemHeight/2:p==="end"&&(m-=t.containerHeight-t.itemHeight),r.value.scrollTop=Math.max(0,m)}}),(h,p)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"scrollContainer",ref:r,style:a.normalizeStyle({height:n.containerHeight+"px",overflowY:"auto"}),onScroll:u,class:"accui-virtual-list"},[a.createElementVNode("div",{style:a.normalizeStyle({height:l.value+"px",position:"relative"})},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,m=>(a.openBlock(),a.createElementBlock("div",{key:c(m.data),style:a.normalizeStyle({position:"absolute",top:m.top+"px",left:0,right:0,height:n.itemHeight+"px"})},[a.renderSlot(h.$slots,"default",{item:m.data,index:m.index},()=>[a.createElementVNode("div",zu,a.toDisplayString(JSON.stringify(m.data)),1)],!0)],4))),128))],4)],36))}}),Bl=se(Pu,[["__scopeId","data-v-69953d3c"]]),Vu={key:0,class:"input-leading-icon"},Fu=["tabindex","aria-expanded","aria-controls","aria-disabled"],Hu={class:"input-select-value"},ju={key:0,class:"input-select-text"},Uu={key:1,class:"input-select-placeholder"},qu={key:1,class:"input-trailing-icon"},Wu=["id","aria-multiselectable"],Ku={key:0,class:"input-dropdown-search"},Ju={key:0,class:"input-dropdown-no-options"},Gu=["onClick","onMouseenter","aria-selected"],Yu={class:"input-dropdown-option-content"},Qu={class:"input-dropdown-option-text"},Xu={key:0,class:"input-dropdown-option-description"},Zu={key:0,class:"input-dropdown-option-check"},_u=["onClick","onMouseenter","aria-selected"],ef={class:"input-dropdown-option-content"},tf={class:"input-dropdown-option-text"},nf={key:0,class:"input-dropdown-option-description"},rf={key:0,class:"input-dropdown-option-check"},of=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},virtual:{type:Boolean,default:!1},virtualItemHeight:{default:44},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","search"],setup(n,{emit:e}){const t=n,r=e,i=a.ref(),o=a.ref(),s=a.ref(),l=a.ref(),c=a.computed(()=>`dropdown-${t.inputId||Math.random().toString(36).substr(2,9)}`),d=a.computed(()=>{if(i.value){const E=i.value.closest('[role="dialog"][aria-modal="true"]');if(E)return E}return"body"}),u=a.ref({isOpen:!1,searchQuery:"",highlightedIndex:-1});a.watch(()=>u.value.searchQuery,E=>{r("search",E)});const{floatingStyle:f,updatePosition:h,cleanup:p}=qr({trigger:i,floating:o,placement:"bottom-start",offset:10,shift:!0,flip:!0,sameWidth:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{w()}}}),m=a.computed(()=>t.multiple?Array.isArray(t.modelValue)?t.modelValue:[]:t.modelValue!==void 0?[t.modelValue]:[]),g=a.computed(()=>{if(t.multiple){const E=t.options.filter(D=>m.value.includes(D.value));return E.length>0?`${E.length} selected`:null}else return t.options.find(D=>D.value===t.modelValue)?.label||null}),y=a.computed(()=>{let E=t.options;if(t.searchable&&u.value.searchQuery){const D=u.value.searchQuery.toLowerCase();E=t.options.filter(L=>L.label.toLowerCase().includes(D)||L.description?.toLowerCase().includes(D)),t.allowInsert&&t.multiple&&u.value.searchQuery.trim()&&(t.options.some(Ee=>Ee.label.toLowerCase()===u.value.searchQuery.toLowerCase())||(E=[{value:`__insert__${u.value.searchQuery}`,label:`Add "${u.value.searchQuery}"`,description:"Add as new item",disabled:!1},...E]))}return E}),b=a.computed(()=>t.searchPlaceholder&&t.searchPlaceholder.trim()!==""?t.searchPlaceholder:t.allowInsert&&t.multiple?"Search or create...":"Search..."),C=a.computed(()=>t.disabled?-1:t.tabindex??0),v=a.computed(()=>{if(t.tabindex!==void 0)return t.tabindex+1}),k=a.computed(()=>{const E=[];return t.error&&E.push("input-error"),t.disabled&&E.push("input-disabled"),E.push(`input-size-${t.size}`),E}),x=a.computed(()=>{const E=[];return t.hasLeadingIcon?E.push("input-padding-left-icon"):E.push("input-padding-left"),t.hasTrailingIcon?E.push("input-padding-right-icon"):E.push("input-padding-right"),E}),S=async()=>{if(!t.disabled){if(u.value.isOpen=!0,u.value.searchQuery="",await a.nextTick(),h(),u.value.highlightedIndex===-1){const E=y.value.findIndex(D=>!D.disabled);u.value.highlightedIndex=E>=0?E:0}if(t.searchable&&s.value){const E=s.value.$el?.querySelector("input");E&&E.focus()}document.addEventListener("keydown",J),r("focus",new FocusEvent("focus"))}},w=()=>{u.value.isOpen&&(u.value.isOpen=!1,u.value.highlightedIndex=-1,u.value.searchQuery="",document.removeEventListener("keydown",J),r("blur",new FocusEvent("blur")))},M=()=>{u.value.isOpen?w():S()},A=E=>E.value&&typeof E.value=="string"&&E.value.startsWith("__insert__")?!1:m.value.includes(E.value),O=E=>{if(!E.disabled)if(t.multiple){const D=[...m.value];if(E.value&&typeof E.value=="string"&&E.value.startsWith("__insert__")){const L=E.value.replace("__insert__","");D.includes(L)||D.push(L),u.value.searchQuery=""}else{const L=D.indexOf(E.value);L>-1?D.splice(L,1):D.push(E.value)}r("update:modelValue",D)}else r("update:modelValue",E.value),w()},H=E=>{if(["Enter"," ","ArrowDown","ArrowUp","Escape"].includes(E.key)&&(E.preventDefault(),!(u.value.isOpen&&(E.key==="ArrowDown"||E.key==="ArrowUp"))))switch(E.key){case"Enter":case" ":M();break;case"ArrowDown":case"ArrowUp":S();break;case"Escape":w();break}},F=E=>{switch(E.key){case"ArrowDown":E.preventDefault(),K(1);break;case"ArrowUp":E.preventDefault(),K(-1);break;case"Enter":if(E.preventDefault(),u.value.highlightedIndex>=0){const D=y.value[u.value.highlightedIndex];D&&!D.disabled&&O(D)}break;case"Escape":w();break}},J=E=>{if(u.value.isOpen)switch(E.key){case"Escape":w();break;case"ArrowDown":E.preventDefault(),K(1);break;case"ArrowUp":E.preventDefault(),K(-1);break;case"Enter":if(E.preventDefault(),u.value.highlightedIndex>=0){const D=y.value[u.value.highlightedIndex];D&&!D.disabled&&O(D)}break}},K=E=>{const D=y.value;if(D.length===0)return;let L=u.value.highlightedIndex+E;L<0?L=D.length-1:L>=D.length&&(L=0);let Ee=0;for(;D[L]?.disabled&&Ee<D.length;)L+=E,L<0&&(L=D.length-1),L>=D.length&&(L=0),Ee++;u.value.highlightedIndex=L};return a.onUnmounted(()=>{u.value.isOpen&&w(),document.removeEventListener("keydown",J),p()}),(E,D)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{class:a.normalizeClass(["input-field-wrapper",[k.value,x.value]])},[a.renderSlot(E.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",Vu,[a.renderSlot(E.$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":u.value.isOpen}]),onClick:M,onKeydown:H,tabindex:C.value,role:"combobox","aria-expanded":u.value.isOpen,"aria-haspopup":!0,"aria-controls":c.value,"aria-disabled":n.disabled},[a.createElementVNode("div",Hu,[g.value?(a.openBlock(),a.createElementBlock("span",ju,a.toDisplayString(g.value),1)):(a.openBlock(),a.createElementBlock("span",Uu,a.toDisplayString(n.placeholder||"Select an option..."),1))]),a.createElementVNode("div",{class:a.normalizeClass(["input-select-arrow",{"input-select-arrow-open":u.value.isOpen}])},[a.createVNode(a.unref(Ur))],2)],42,Fu),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",qu,[a.renderSlot(E.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(E.$slots,"trailing",{},void 0,!0)],2),(a.openBlock(),a.createBlock(a.Teleport,{to:d.value},[u.value.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:o,id:c.value,class:a.normalizeClass(["input-dropdown",{"input-dropdown--multiple":n.multiple}]),style:a.normalizeStyle(a.unref(f)),role:"listbox","aria-multiselectable":n.multiple,onMousedown:D[1]||(D[1]=a.withModifiers(()=>{},["prevent"]))},[n.searchable?(a.openBlock(),a.createElementBlock("div",Ku,[a.createVNode(li,{ref_key:"searchInputRef",ref:s,modelValue:u.value.searchQuery,"onUpdate:modelValue":D[0]||(D[0]=L=>u.value.searchQuery=L),type:"search",placeholder:b.value,size:"sm",tabindex:v.value,onKeydown:F},{"leading-icon":a.withCtx(()=>[a.createVNode(a.unref(xu))]),_:1},8,["modelValue","placeholder","tabindex"])])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"input-dropdown-options",style:a.normalizeStyle({maxHeight:`${n.maxDropdownHeight}px`})},[y.value.length===0?(a.openBlock(),a.createElementBlock("div",Ju,[a.renderSlot(E.$slots,"zero-state",{},()=>[a.createTextVNode(a.toDisplayString(n.noOptionsText),1)],!0)])):n.virtual?(a.openBlock(),a.createBlock(Bl,{key:1,ref_key:"virtualListRef",ref:l,items:y.value,"item-height":n.virtualItemHeight,"container-height":Math.min(n.maxDropdownHeight,y.value.length*n.virtualItemHeight),"item-key":"value",overscan:5},{default:a.withCtx(({item:L,index:Ee})=>[a.createElementVNode("div",{class:a.normalizeClass(["input-dropdown-option",{"input-dropdown-option--selected":A(L),"input-dropdown-option--highlighted":Ee===u.value.highlightedIndex,"input-dropdown-option--disabled":L.disabled,"input-dropdown-option--insert":L.value&&typeof L.value=="string"&&L.value.startsWith("__insert__")}]),onClick:en=>O(L),onMouseenter:en=>u.value.highlightedIndex=Ee,role:"option","aria-selected":A(L)},[a.createElementVNode("div",Yu,[a.createElementVNode("div",Qu,a.toDisplayString(L.label),1),L.description?(a.openBlock(),a.createElementBlock("div",Xu,a.toDisplayString(L.description),1)):a.createCommentVNode("",!0)]),n.multiple&&A(L)?(a.openBlock(),a.createElementBlock("div",Zu,[a.createVNode(a.unref(ns))])):a.createCommentVNode("",!0)],42,Gu)]),_:1},8,["items","item-height","container-height"])):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:2},a.renderList(y.value,(L,Ee)=>(a.openBlock(),a.createElementBlock("div",{key:L.value,class:a.normalizeClass(["input-dropdown-option",{"input-dropdown-option--selected":A(L),"input-dropdown-option--highlighted":Ee===u.value.highlightedIndex,"input-dropdown-option--disabled":L.disabled,"input-dropdown-option--insert":L.value&&typeof L.value=="string"&&L.value.startsWith("__insert__")}]),onClick:en=>O(L),onMouseenter:en=>u.value.highlightedIndex=Ee,role:"option","aria-selected":A(L)},[a.createElementVNode("div",ef,[a.createElementVNode("div",tf,a.toDisplayString(L.label),1),L.description?(a.openBlock(),a.createElementBlock("div",nf,a.toDisplayString(L.description),1)):a.createCommentVNode("",!0)]),n.multiple&&A(L)?(a.openBlock(),a.createElementBlock("div",rf,[a.createVNode(a.unref(ns))])):a.createCommentVNode("",!0)],42,_u))),128))],4)],46,Wu)):a.createCommentVNode("",!0)],8,["to"]))],64))}}),sf=se(of,[["__scopeId","data-v-de208d8b"]]),lf={class:"input-leading-icon"},af=["src"],cf=["id","accept","multiple","disabled","required"],df={class:"input-file-content"},uf={key:0,class:"input-file-selected"},ff={class:"input-file-list"},hf={class:"input-file-item"},pf={class:"input-file-name"},mf={key:1,class:"input-file-prompt"},gf={class:"input-file-prompt-text"},yf={key:0,class:"input-file-accept-text"},kf={key:2,class:"input-file-selected"},bf={class:"input-file-selected-text"},vf={class:"input-file-list"},xf={class:"input-file-name"},wf={class:"input-file-size"},Cf={key:0,class:"input-trailing-icon"},Sf={key:1,class:"input-trailing-icon"},Mf=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 M=[];return t.error&&M.push("input-error"),t.disabled&&M.push("input-disabled"),M.push(`input-size-${t.size}`),M}),f=a.computed(()=>{const M=[];return M.push("input-padding-left-icon"),l.value.length>0||d.value||t.disabled?M.push("input-padding-right-icon"):M.push("input-padding-right"),M}),h=M=>{if(t.maxFileSize&&M.size>t.maxFileSize)return`File "${M.name}" is too large. Maximum size is ${y(t.maxFileSize)}.`;if(t.accept){const A=t.accept.split(",").map(J=>J.trim().toLowerCase()),O=M.type.toLowerCase(),H="."+M.name.split(".").pop()?.toLowerCase();if(!A.some(J=>{if(J.startsWith("."))return H===J;if(J.includes("*")){const K=J.split("/")[0];return O.startsWith(K)}return O===J}))return`File "${M.name}" is not an accepted file type.`}return null},p=M=>{for(const A of M){const O=h(A);if(O){r("file-error",O);return}}t.multiple?l.value=[...l.value,...M]:l.value=M.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=M=>{s.value&&URL.revokeObjectURL(s.value);const A=new FileReader;A.onload=O=>{s.value=O.target?.result},A.readAsDataURL(M)},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=M=>{if(M===0)return"0 Bytes";const A=1024,O=["Bytes","KB","MB","GB"],H=Math.floor(Math.log(M)/Math.log(A));return parseFloat((M/Math.pow(A,H)).toFixed(2))+" "+O[H]},b=()=>{!t.disabled&&i.value&&i.value.click()},C=M=>{const A=M.target,O=Array.from(A.files||[]);O.length>0&&p(O)},v=M=>{t.disabled||(o.value=!0)},k=M=>{o.value=!1},x=M=>{if(t.disabled)return;o.value=!1;const A=Array.from(M.dataTransfer?.files||[]);A.length>0&&p(A)},S=M=>{r("blur",M)},w=M=>{r("focus",M)};return a.watch(()=>t.modelValue,M=>{M?Array.isArray(M)?l.value=M:(l.value=[M],M.type.startsWith("image/")&&m(M)):(l.value=[],s.value&&(URL.revokeObjectURL(s.value),s.value=null))},{immediate:!0}),a.onUnmounted(()=>{s.value&&URL.revokeObjectURL(s.value)}),(M,A)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-field-wrapper",[u.value,f.value]])},[a.renderSlot(M.$slots,"leading",{},void 0,!0),a.createElementVNode("div",lf,[c.value?(a.openBlock(),a.createElementBlock("img",{key:0,src:c.value,alt:"Preview",class:"input-file-preview"},null,8,af)):t.hasLeadingIcon?a.renderSlot(M.$slots,"leading-icon",{key:1},void 0,!0):(a.openBlock(),a.createBlock(a.unref(fu),{key:2}))]),a.createElementVNode("div",{class:a.normalizeClass(["input-file-area",{"input-file-dragover":o.value,"input-file-disabled":n.disabled}]),onClick:b,onDragover:a.withModifiers(v,["prevent"]),onDragleave:a.withModifiers(k,["prevent"]),onDrop:a.withModifiers(x,["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:C,onBlur:S,onFocus:w},null,40,cf),a.createElementVNode("div",df,[d.value&&l.value.length===0?(a.openBlock(),a.createElementBlock("div",uf,[A[0]||(A[0]=a.createElementVNode("div",{class:"input-file-selected-text"}," File loaded ",-1)),a.createElementVNode("div",ff,[a.createElementVNode("div",hf,[a.createElementVNode("span",pf,a.toDisplayString(d.value),1)])])])):l.value.length===0?(a.openBlock(),a.createElementBlock("div",mf,[a.createElementVNode("div",gf,a.toDisplayString(n.dragDropText||"Click to select or drag and drop"),1),n.accept?(a.openBlock(),a.createElementBlock("div",yf,a.toDisplayString(n.accept),1)):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",kf,[a.createElementVNode("div",bf,a.toDisplayString(n.selectedText||`${l.value.length} file(s) selected`),1),a.createElementVNode("div",vf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,(O,H)=>(a.openBlock(),a.createElementBlock("div",{key:H,class:"input-file-item"},[a.createElementVNode("span",xf,a.toDisplayString(O.name),1),a.createElementVNode("span",wf,"("+a.toDisplayString(y(O.size))+")",1)]))),128))])]))])],34),(l.value.length>0||d.value)&&!n.disabled?(a.openBlock(),a.createElementBlock("div",Cf,[a.createElementVNode("button",{type:"button",class:"input-file-clear",onClick:a.withModifiers(g,["stop"]),"aria-label":"Clear selected files"},[a.createVNode(a.unref(po))])])):t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",Sf,[a.renderSlot(M.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(M.$slots,"trailing",{},void 0,!0)],2))}}),Tf=se(Mf,[["__scopeId","data-v-3c7bee41"]]),Ef={class:"tabs-wrapper"},Nf={key:0,class:"tabs-before"},Af=["aria-selected","id","onClick"],Bf={key:1,class:"tabs-after"},Of=["aria-labelledby"],If=a.defineComponent({__name:"UiTabs",props:{modelValue:{default:""},tabs:{default:()=>[]},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(k=>k.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=(k,x)=>{const S=k.getBoundingClientRect(),w=x.getBoundingClientRect(),M=getComputedStyle(x),A=parseFloat(M.getPropertyValue("--underline-thickness")||"5");let O=5;t.size==="sm"?O=4:t.size==="lg"&&(O=6);const H=w.height;if(t.orientation==="vertical"){const F=S.top-w.top;return{height:S.height-O*4,top:F+O*2,width:A,left:O-A/2}}else{const F=S.left-w.left,J=S.width;if(t.underlineWidth==="full")return{width:J-30,left:F+15,height:A,top:H-O-A/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),L=parseFloat(getComputedStyle(document.documentElement).fontSize);K=D*L}else K=parseFloat(t.underlineWidth)||J;const E=(J-K)/2;return{width:K,left:F+E,height:A,top:H-O-A/2}}},m=async(k,x)=>{h||(r("update:modelValue",k),await a.nextTick(),g(x))},g=async k=>{if(!l.value[k]||k===f)return;h=!0;const x=l.value[k],S=x.parentElement;if(!S)return;const w=p(x,S),M=x.getBoundingClientRect(),A=S.getBoundingClientRect();let O,H;if(t.orientation==="vertical"?(O=M.top-A.top,H=M.height):(O=M.left-A.left,H=M.width),f===-1){t.orientation==="vertical"?(d.value={height:`${w.height}px`,top:`${w.top}px`,width:`${w.width}px`,left:`${w.left}px`,opacity:"1"},u.value={height:`${H}px`,top:`${O}px`,width:`${M.width}px`,left:"0",opacity:"1"}):(d.value={width:`${w.width}px`,left:`${w.left}px`,height:`${w.height}px`,top:`${w.top}px`,opacity:"1"},u.value={width:`${H}px`,left:`${O}px`,height:"100%",top:"0",opacity:"1"}),f=k,h=!1;return}const F=l.value[f];if(p(F,S),F.getBoundingClientRect(),window.matchMedia("(prefers-reduced-motion: reduce)").matches){d.value={width:`${w.width||0}px`,left:`${w.left||0}px`,height:`${w.height||7}px`,top:`${w.top}px`,opacity:"1"},t.orientation==="vertical"?u.value={height:`${H}px`,top:`${O}px`,width:"100%",left:"0",opacity:"1"}:u.value={width:`${H}px`,left:`${O}px`,height:"100%",top:"0",opacity:"1"},f=k,h=!1;return}requestAnimationFrame(()=>{t.orientation==="vertical"?(d.value={height:`${w.height}px`,top:`${w.top}px`,width:`${w.width||7}px`,left:`${w.left}px`,opacity:"1"},u.value={height:`${H}px`,top:`${O}px`,width:"100%",left:"0",opacity:"1"}):(d.value={width:`${w.width}px`,left:`${w.left}px`,height:`${w.height||7}px`,top:`${w.top}px`,opacity:"1"},u.value={width:`${H}px`,left:`${O}px`,height:"100%",top:"0",opacity:"1"}),f=k,setTimeout(()=>{h=!1},200)})};let y=null;const b=()=>{const k=t.tabs.findIndex(x=>x.value===t.modelValue);if(k!==-1&&l.value&&l.value[k]){const x=c.value;c.value=!1;const S=l.value[k],w=S.parentElement;if(w){const M=p(S,w),A=S.getBoundingClientRect(),O=w.getBoundingClientRect();let H,F;t.orientation==="vertical"?(H=A.top-O.top,F=A.height,d.value={height:`${M.height}px`,top:`${M.top}px`,width:`${M.width}px`,left:`${M.left}px`,opacity:"1"},u.value={height:`${F}px`,top:`${H}px`,width:`${A.width}px`,left:"0",opacity:"1"}):(H=A.left-O.left,F=A.width,d.value={width:`${M.width}px`,left:`${M.left}px`,height:`${M.height}px`,top:`${M.top}px`,opacity:"1"},u.value={width:`${F}px`,left:`${H}px`,height:"100%",top:"0",opacity:"1"})}f=k,h=!1,setTimeout(()=>{c.value=x},10)}y&&clearTimeout(y),y=setTimeout(()=>{y=null},50)};a.onMounted(async()=>{await a.nextTick(),C(),setTimeout(()=>{c.value=!0},50),window.addEventListener("resize",b)}),a.onUnmounted(()=>{window.removeEventListener("resize",b),y&&(clearTimeout(y),y=null)});const C=()=>{if(!t.tabs.length||!t.modelValue)return;const k=t.tabs.findIndex(x=>x.value===t.modelValue);k!==-1&&g(k)};a.watch(()=>t.tabs,async k=>{k?.length&&(await a.nextTick(),C())},{deep:!0});const{modelValue:v}=a.toRefs(t);return a.watch(v,async()=>{if(await a.nextTick(),!t.tabs.length)return;const k=t.tabs.findIndex(x=>x.value===t.modelValue);k!==-1&&g(k)}),(k,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",Ef,[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}:{})},[k.$slots.before?(a.openBlock(),a.createElementBlock("div",Nf,[a.renderSlot(k.$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,(S,w)=>(a.openBlock(),a.createElementBlock("button",{key:S.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)===S.value}]]),"aria-selected":a.unref(v)===S.value,"aria-controls":"tabpanel",id:`tab-${S.value}`,role:"tab",onClick:M=>m(S.value,w)},a.toDisplayString(S.label),11,Af))),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),k.$slots.after?(a.openBlock(),a.createElementBlock("div",Bf,[a.renderSlot(k.$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(k.$slots,"content",{activeTab:s.value},void 0,!0)],10,Of)):a.createCommentVNode("",!0)],2))}}),Wr=se(If,[["__scopeId","data-v-03b92515"]]),Df={key:0,class:"ui-divider-text"},$f=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",Df,[a.renderSlot(o.$slots,"default",{},()=>[a.createTextVNode(a.toDisplayString(n.text),1)],!0)])):a.createCommentVNode("",!0)],6))}}),nt=se($f,[["__scopeId","data-v-30b00cfd"]]),Rf={class:"datetime-picker-wrapper"},Lf={class:"datetime-picker-leading-icon"},zf={class:"datetime-picker-display"},Pf={key:0,class:"datetime-picker-value"},Vf={key:1,class:"datetime-picker-placeholder"},Ff={key:1,class:"datetime-picker-trailing-icon"},Hf={key:1,class:"datetime-picker-panel"},jf={class:"datetime-picker-header"},Uf={class:"datetime-picker-month-year"},qf=["value"],Wf=["value"],Kf={class:"datetime-picker-weekdays"},Jf={class:"datetime-picker-grid"},Gf={key:2,class:"datetime-picker-panel datetime-picker-time-panel"},Yf={class:"time-selector"},Qf={class:"time-column"},Xf={class:"time-scroll"},Zf={class:"time-column"},_f={class:"time-scroll"},eh={key:0,class:"time-column"},th={class:"time-scroll"},nh={class:"datetime-picker-footer"},rh=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}=qr({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()),b=a.ref(new Date().getMinutes()),C=a.ref("AM"),v=["January","February","March","April","May","June","July","August","September","October","November","December"],k=["Su","Mo","Tu","We","Th","Fr","Sa"],x=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),w=a.computed(()=>{if(!t.modelValue)return null;if(t.modelValue instanceof Date)return t.modelValue;if(t.type==="time"&&typeof t.modelValue=="string"){const R=t.modelValue.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);if(R){const $=new Date;return $.setHours(parseInt(R[1]),parseInt(R[2]),parseInt(R[3]||"0"),0),$}}return new Date(t.modelValue)}),M=a.computed(()=>{if(!w.value||isNaN(w.value.getTime()))return"";const R=w.value;if(t.type==="time"){if(t.is24Hour)return`${String(R.getHours()).padStart(2,"0")}:${String(R.getMinutes()).padStart(2,"0")}`;{const mt=R.getHours()%12||12,ae=R.getHours()>=12?"PM":"AM";return`${mt}:${String(R.getMinutes()).padStart(2,"0")} ${ae}`}}const $=R.getDate(),I=R.getMonth()+1,q=R.getFullYear();let we="";switch(t.format){case"us":we=`${I}/${$}/${q}`;break;case"eu":we=`${$}/${I}/${q}`;break;default:we=`${q}-${String(I).padStart(2,"0")}-${String($).padStart(2,"0")}`;break}if(t.type==="date")return we;let Rt="";if(t.is24Hour)Rt=`${String(R.getHours()).padStart(2,"0")}:${String(R.getMinutes()).padStart(2,"0")}`;else{const mt=R.getHours()%12||12,ae=R.getHours()>=12?"PM":"AM";Rt=`${mt}:${String(R.getMinutes()).padStart(2,"0")} ${ae}`}return`${we} ${Rt}`}),A=a.computed(()=>{const R=[];return t.error&&R.push("datetime-picker-error"),t.disabled&&R.push("datetime-picker-disabled"),t.readonly&&R.push("datetime-picker-readonly"),R.push(`datetime-picker-size-${t.size}`),R}),O=a.computed(()=>t.type==="date"||t.type==="datetime"&&p.value==="date"),H=a.computed(()=>t.type==="time"||t.type==="datetime"&&p.value==="time"),F=a.computed(()=>[{label:"Date",value:"date"},{label:"Time",value:"time"}]),J=a.computed(()=>{const R=[],$=t.is24Hour?23:12,I=t.is24Hour?0:1;for(let q=I;q<=$;q++)R.push(q);return R}),K=a.computed(()=>{const R=[];for(let $=0;$<60;$+=t.minuteStep)R.push($);return R}),E=a.computed(()=>{const R=new Date().getFullYear(),$=x.value?.getFullYear()||R-100,I=S.value?.getFullYear()||R+100,q=[];for(let we=$;we<=I;we++)q.push(we);return q}),D=a.computed(()=>x.value?new Date(g.value,m.value,1)<=x.value:!1),L=a.computed(()=>S.value?new Date(g.value,m.value+1,0)>=S.value:!1),Ee=a.computed(()=>{const R=[],$=g.value,I=m.value,q=new Date($,I,1),we=new Date(q);we.setDate(we.getDate()-q.getDay());const Rt=new Date;Rt.setHours(0,0,0,0);for(let mt=0;mt<42;mt++){const ae=new Date(we);ae.setDate(we.getDate()+mt);const dd=ae.getMonth()!==I,ud=ae.getTime()===Rt.getTime(),fd=w.value&&ae.getFullYear()===w.value.getFullYear()&&ae.getMonth()===w.value.getMonth()&&ae.getDate()===w.value.getDate(),hd=!!(x.value&&ae<x.value||S.value&&ae>S.value);R.push({key:`${ae.getFullYear()}-${ae.getMonth()}-${ae.getDate()}`,date:ae.getDate(),month:ae.getMonth(),year:ae.getFullYear(),otherMonth:dd,isToday:ud,isSelected:fd||!1,isDisabled:hd})}return R}),en=()=>{switch(t.type){case"time":return"Select time";case"datetime":return"Select date and time";default:return"Select date"}},sd=()=>{m.value===0?(m.value=11,g.value--):m.value--},ld=()=>{m.value===11?(m.value=0,g.value++):m.value++},ad=R=>{if(R.isDisabled||R.otherMonth)return;const $=w.value||new Date,I=new Date(R.year,R.month,R.date,$.getHours(),$.getMinutes());r("update:modelValue",I),r("change",I),t.type==="datetime"?p.value="time":t.type==="date"&&f()},Rn=(R,$)=>{let I=w.value?new Date(w.value):new Date;if(!w.value){const q=new Date;I.setFullYear(q.getFullYear(),q.getMonth(),q.getDate())}if(R==="hour"){let q=$;t.is24Hour||(C.value==="PM"&&q!==12&&(q+=12),C.value==="AM"&&q===12&&(q=0)),y.value=$,I.setHours(q)}else if(R==="minute")b.value=$,I.setMinutes($);else if(R==="period"){C.value=$;let q=y.value;$==="PM"&&q!==12&&(q+=12),$==="AM"&&q===12&&(q=0),I.setHours(q)}r("update:modelValue",I),r("change",I)},cd=()=>{const R=new Date;x.value&&R<x.value||S.value&&R>S.value||(r("update:modelValue",R),r("change",R),f())},_o=()=>{r("update:modelValue",null),r("change",null)};return a.watch(()=>t.modelValue,R=>{if(R){const $=R instanceof Date?R:new Date(R);if(!isNaN($.getTime())){if(m.value=$.getMonth(),g.value=$.getFullYear(),t.is24Hour)y.value=$.getHours();else{const I=$.getHours();y.value=I%12||12,C.value=I>=12?"PM":"AM"}b.value=$.getMinutes()}}},{immediate:!0}),a.onUnmounted(()=>{d()}),(R,$)=>(a.openBlock(),a.createElementBlock("div",Rf,[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",Lf,[n.type==="date"?(a.openBlock(),a.createBlock(a.unref(ou),{key:0})):n.type==="time"?(a.openBlock(),a.createBlock(a.unref(au),{key:1})):(a.openBlock(),a.createBlock(a.unref(iu),{key:2}))]),a.createElementVNode("div",zf,[M.value?(a.openBlock(),a.createElementBlock("span",Pf,a.toDisplayString(M.value),1)):(a.openBlock(),a.createElementBlock("span",Vf,a.toDisplayString(n.placeholder||en()),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(po))])):(a.openBlock(),a.createElementBlock("div",Ff,[a.createVNode(a.unref(Ur))]))],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(Wr,{key:0,modelValue:p.value,"onUpdate:modelValue":$[0]||($[0]=I=>p.value=I),tabs:F.value,variant:"default",size:"sm",style:{"margin-bottom":"1rem"}},null,8,["modelValue","tabs"])):a.createCommentVNode("",!0),O.value?(a.openBlock(),a.createElementBlock("div",Hf,[a.createElementVNode("div",jf,[a.createVNode(W,{onClick:sd,disabled:D.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:a.withCtx(()=>[a.createVNode(a.unref(su))]),_:1},8,["disabled"]),a.createElementVNode("div",Uf,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":$[1]||($[1]=I=>m.value=I),class:"datetime-picker-select"},[(a.openBlock(),a.createElementBlock(a.Fragment,null,a.renderList(v,(I,q)=>a.createElementVNode("option",{key:q,value:q},a.toDisplayString(I),9,qf)),64))],512),[[a.vModelSelect,m.value]]),a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":$[2]||($[2]=I=>g.value=I),class:"datetime-picker-select"},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(E.value,I=>(a.openBlock(),a.createElementBlock("option",{key:I,value:I},a.toDisplayString(I),9,Wf))),128))],512),[[a.vModelSelect,g.value]])]),a.createVNode(W,{onClick:ld,disabled:L.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:a.withCtx(()=>[a.createVNode(a.unref(lu))]),_:1},8,["disabled"])]),a.createElementVNode("div",Kf,[(a.openBlock(),a.createElementBlock(a.Fragment,null,a.renderList(k,I=>a.createElementVNode("div",{key:I,class:"datetime-picker-weekday"},a.toDisplayString(I),1)),64))]),a.createElementVNode("div",Jf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Ee.value,I=>(a.openBlock(),a.createBlock(W,{key:I.key,color:I.isSelected||I.isToday?"primary":"secondary",variant:I.isSelected?"primary":I.isToday?"outline":"primary",disabled:I.isDisabled||I.otherMonth,class:a.normalizeClass(["datetime-picker-day",{"datetime-picker-day-other":I.otherMonth,"datetime-picker-day-disabled":I.isDisabled}]),icon:"",squircle:"",onClick:q=>ad(I)},{icon:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(I.date),1)]),_:2},1032,["color","variant","disabled","class","onClick"]))),128))])])):a.createCommentVNode("",!0),H.value?(a.openBlock(),a.createElementBlock("div",Gf,[a.createElementVNode("div",Yf,[a.createElementVNode("div",Qf,[$[6]||($[6]=a.createElementVNode("label",{class:"time-label"},"Hour",-1)),a.createElementVNode("div",Xf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(J.value,I=>(a.openBlock(),a.createBlock(W,{key:I,color:y.value===I?"primary":"secondary",variant:y.value===I?"primary":"ghost",size:"sm",squircle:"",onClick:q=>Rn("hour",I)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(String(I).padStart(2,"0")),1)]),_:2},1032,["color","variant","onClick"]))),128))])]),a.createElementVNode("div",Zf,[$[7]||($[7]=a.createElementVNode("label",{class:"time-label"},"Minute",-1)),a.createElementVNode("div",_f,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(K.value,I=>(a.openBlock(),a.createBlock(W,{key:I,color:b.value===I?"primary":"secondary",variant:b.value===I?"primary":"ghost",size:"sm",squircle:"",onClick:q=>Rn("minute",I)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(String(I).padStart(2,"0")),1)]),_:2},1032,["color","variant","onClick"]))),128))])]),n.is24Hour?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",eh,[$[10]||($[10]=a.createElementVNode("label",{class:"time-label"},"Period",-1)),a.createElementVNode("div",th,[a.createVNode(W,{color:C.value==="AM"?"primary":"secondary",variant:C.value==="AM"?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:$[3]||($[3]=I=>Rn("period","AM"))},{default:a.withCtx(()=>[...$[8]||($[8]=[a.createTextVNode(" AM ",-1)])]),_:1},8,["color","variant"]),a.createVNode(W,{color:C.value==="PM"?"primary":"secondary",variant:C.value==="PM"?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:$[4]||($[4]=I=>Rn("period","PM"))},{default:a.withCtx(()=>[...$[9]||($[9]=[a.createTextVNode(" PM ",-1)])]),_:1},8,["color","variant"])])]))])])):a.createCommentVNode("",!0),a.createVNode(nt),a.createElementVNode("div",nh,[a.createVNode(W,{onClick:cd,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:$[5]||($[5]=I=>{_o(),f()}),color:"danger",variant:"primary",squircle:"",style:{flex:"1"}},{default:a.withCtx(()=>[...$[11]||($[11]=[a.createTextVNode(" Clear ",-1)])]),_:1}),a.createVNode(W,{onClick:f,color:"secondary",variant:"primary",squircle:"",style:{flex:"1"}},{default:a.withCtx(()=>[...$[12]||($[12]=[a.createTextVNode(" Close ",-1)])]),_:1})])],4)):a.createCommentVNode("",!0)]))]))}}),mo=se(rh,[["__scopeId","data-v-f688c330"]]),ih=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(mo,{"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"]))}}),oh=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(mo,{"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"]))}}),sh=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(mo,{"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 fe(n){this.content=n}fe.prototype={constructor:fe,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 fe(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 fe(t)},addToStart:function(n,e){return new fe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new fe(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 fe(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=fe.from(n),n.size?new fe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=fe.from(n),n.size?new fe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=fe.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}};fe.from=function(n){if(n instanceof fe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new fe(e)};function Ol(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=Ol(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function Il(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=Il(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 Ol(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Il(this,e,t,r)}findIndex(e){if(e==0)return Ln(0,e);if(e==this.size)return Ln(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?Ln(t+1,o):Ln(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 ai={index:0,offset:0};function Ln(n,e){return ai.index=n,ai.offset=e,ai}function _n(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(!_n(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!_n(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Q=class Li{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&&_n(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 Li.none;if(e instanceof Li)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Q.none=[];class er 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=$l(this.content,e+this.openStart,t);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,t){return new B(Dl(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 Dl(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(Dl(o.content,e-i-1,t-i-1)))}function $l(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=$l(s.content,e-o-1,t,s);return l&&n.replaceChild(i,s.copy(l))}function lh(n,e,t){if(t.openStart>n.depth)throw new er("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new er("Inconsistent open depths");return Rl(n,e,t,0)}function Rl(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=Rl(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 Ct(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=ah(t,n);return Ct(o,zl(n,s,l,e,r))}else return Ct(o,tr(n,e,r))}function Ll(n,e){if(!e.type.compatibleContent(n.type))throw new er("Cannot join "+e.type.name+" onto "+n.type.name)}function zi(n,e,t){let r=n.node(t);return Ll(r,e.node(t)),r}function wt(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 cn(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&&(wt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)wt(i.child(l),r);e&&e.depth==t&&e.textOffset&&wt(e.nodeBefore,r)}function Ct(n,e){return n.type.checkContent(e),n.copy(e)}function zl(n,e,t,r,i){let o=n.depth>i&&zi(n,e,i+1),s=r.depth>i&&zi(t,r,i+1),l=[];return cn(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(Ll(o,s),wt(Ct(o,zl(n,e,t,r,i+1)),l)):(o&&wt(Ct(o,tr(n,e,i+1)),l),cn(e,t,i,l),s&&wt(Ct(s,tr(t,r,i+1)),l)),cn(r,null,i,l),new T(l)}function tr(n,e,t){let r=[];if(cn(null,n,t,r),n.depth>t){let i=zi(n,e,t+1);wt(Ct(i,tr(n,e,t+1)),r)}return cn(e,null,t,r),new T(r)}function ah(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 vn{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 Q.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 nr(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 vn(t,r,o)}static resolveCached(e,t){let r=rs.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 rs.set(e,r=new ch);let i=r.elts[r.i]=vn.resolve(e,t);return r.i=(r.i+1)%dh,i}}class ch{constructor(){this.elts=[],this.i=0}}const dh=12,rs=new WeakMap;class nr{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 uh=Object.create(null);class Le{constructor(e,t,r,i=Q.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&&_n(this.attrs,t||e.defaultAttrs||uh)&&Q.sameSet(this.marks,r||Q.none)}copy(e=null){return e==this.content?this:new Le(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Le(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 lh(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 vn.resolveCached(this,e)}resolveNoCache(e){return vn.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()+")"),Pl(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=Q.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(!Q.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}}Le.prototype.text=void 0;class rr extends Le{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):Pl(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 rr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new rr(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 Pl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Et{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new fh(e,t);if(r.next==null)return Et.empty;let i=Vl(r);r.next&&r.err("Unexpected trailing text");let o=bh(kh(i));return vh(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
5
|
`)}}Et.empty=new Et(!0);class fh{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 Vl(n){let e=[];do e.push(hh(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function hh(n){let e=[];do e.push(ph(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function ph(n){let e=yh(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=mh(n,e);else break;return e}function is(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function mh(n,e){let t=is(n),r=t;return n.eat(",")&&(n.next!="}"?r=is(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function gh(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 yh(n){if(n.eat("(")){let e=Vl(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=gh(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 kh(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 Fl(n,e){return e-n}function ss(n,e){let t=[];return r(e),t.sort(Fl);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 bh(n){let e=Object.create(null);return t(ss(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]);ss(n,c).forEach(u=>{d||i.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let o=e[r.join(",")]=new Et(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(Fl);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function vh(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 Hl(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 jl(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 Ul(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 ql(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new wh(n,r,e[r]);return t}let ls=class Wl{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=ql(e,r.attrs),this.defaultAttrs=Hl(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==Et.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:jl(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Le(this,this.computeAttrs(e),T.from(t),Q.setFrom(r))}createChecked(e=null,t,r){return t=T.from(t),this.checkContent(t),new Le(this,this.computeAttrs(e),t,Q.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 Le(this,e,t.append(o),Q.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){Ul(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:Q.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Wl(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 xh(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 wh{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?xh(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Kr{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=ql(e,i.attrs),this.excluded=null;let o=Hl(this.attrs);this.instance=o?new Q(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Q(this,jl(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Kr(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){Ul(this.attrs,e,"mark")}excludes(e){return this.excluded.indexOf(e)>-1}}class Kl{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=fe.from(e.nodes),t.marks=fe.from(e.marks||{}),this.nodes=ls.compile(this.spec.nodes,this),this.marks=Kr.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]=Et.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?as(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==""?[]:as(this,s.split(" "))}this.nodeFromJSON=i=>Le.fromJSON(this,i),this.markFromJSON=i=>Q.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 ls){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 rr(r,r.defaultAttrs,e,Q.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 as(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 Ch(n){return n.tag!=null}function Sh(n){return n.style!=null}class at{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(Ch(i))this.tags.push(i);else if(Sh(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 ds(this,t,!1);return r.addAll(e,Q.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ds(this,t,!0);return r.addAll(e,Q.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(Eh(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=us(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=us(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new at(e,at.schemaRules(e)))}}const Jl={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},Mh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Gl={ol:!0,ul:!0},xn=1,Pi=2,dn=4;function cs(n,e,t){return e!=null?(e?xn:0)|(e==="full"?Pi:0):n&&n.whitespace=="pre"?xn|Pi:t&~dn}class zn{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=Q.none,this.match=o||(s&dn?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&xn)){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&&!Jl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ds{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=cs(null,t.preserveWhitespace,0)|(r?dn:0);i?o=new zn(i.type,i.attrs,Q.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new zn(null,null,Q.none,!0,null,s):o=new zn(e.schema.topNodeType,null,Q.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&Pi?"full":this.localPreserveWS||(i.options&xn)>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
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;Gl.hasOwnProperty(s)&&this.parser.normalizeLists&&Th(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(c?c.ignore:Mh.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(Jl.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
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=Q.none;for(let l of i.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):fs(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=cs(e,o,s.options);s.options&dn&&s.content.length==0&&(l|=dn);let c=Q.none;return r=r.filter(d=>(s.type?s.type.allowsMarkType(d.type):fs(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new zn(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|=xn)}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 Th(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Gl.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Eh(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function us(n){let e={};for(let t in n)e[t]=n[t];return e}function fs(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 It{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ci(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}=Gn(ci(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&&Gn(ci(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Gn(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new It(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=hs(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return hs(e.marks)}}function hs(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ci(n){return n.document||window.document}const ps=new WeakMap;function Nh(n){let e=ps.get(n);return e===void 0&&ps.set(n,e=Ah(n)),e}function Ah(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 Gn(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=Nh(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}=Gn(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 Yl=65535,Ql=Math.pow(2,16);function Bh(n,e){return n+e*Ql}function ms(n){return n&Yl}function Oh(n){return(n-(n&Yl))/Ql}const Xl=1,Zl=2,Yn=4,_l=8;class Vi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&_l)>0}get deletedBefore(){return(this.delInfo&(Xl|Yn))>0}get deletedAfter(){return(this.delInfo&(Zl|Yn))>0}get deletedAcross(){return(this.delInfo&Yn)>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=ms(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+Oh(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:Bh(l/3,e-c),g=e==c?Zl:e==f?Xl:Yn;return(t<0?e!=c:e!=f)&&(g|=_l),new Vi(p,g,m)}i+=u-d}return r?e+i:new Vi(e+i,0,null)}touches(e,t){let r=0,i=ms(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 wn{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 wn(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 wn;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 Vi(e,i,null)}}const di=Object.create(null);class ke{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=di[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 di)throw new RangeError("Duplicate use of step JSON ID "+e);return di[e]=t,t.prototype.jsonID=e,t}}class re{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new re(e,null)}static fail(e){return new re(null,e)}static fromReplace(e,t,r,i){try{return re.ok(e.replace(t,r,i))}catch(o){if(o instanceof er)return re.fail(o.message);throw o}}}function go(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(go(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return T.fromArray(r)}class ot extends ke{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(go(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 re.fromReplace(e,this.from,this.to,o)}invert(){return new Re(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 ot(t.pos,r.pos,this.mark)}merge(e){return e instanceof ot&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ot(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 ot(t.from,t.to,e.markFromJSON(t.mark))}}ke.jsonID("addMark",ot);class Re extends ke{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(go(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return re.fromReplace(e,this.from,this.to,r)}invert(){return new ot(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 Re(t.pos,r.pos,this.mark)}merge(e){return e instanceof Re&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Re(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 Re(t.from,t.to,e.markFromJSON(t.mark))}}ke.jsonID("removeMark",Re);class st extends ke{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return re.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return re.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 st(this.pos,t.marks[i]);return new st(this.pos,this.mark)}}return new Nt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new st(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 st(t.pos,e.markFromJSON(t.mark))}}ke.jsonID("addNodeMark",st);class Nt extends ke{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return re.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return re.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 st(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Nt(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 Nt(t.pos,e.markFromJSON(t.mark))}}ke.jsonID("removeNodeMark",Nt);class ce extends ke{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Fi(e,this.from,this.to)?re.fail("Structure replace would overwrite content"):re.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 ce(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 ce(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ce)||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 ce(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 ce(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 ce(t.from,t.to,B.fromJSON(e,t.slice),!!t.structure)}}ke.jsonID("replace",ce);class ue extends ke{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&&(Fi(e,this.from,this.gapFrom)||Fi(e,this.gapTo,this.to)))return re.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return re.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?re.fromReplace(e,this.from,this.to,r):re.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 ue(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 ue(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 ue(t.from,t.to,t.gapFrom,t.gapTo,B.fromJSON(e,t.slice),t.insert,!!t.structure)}}ke.jsonID("replaceAround",ue);function Fi(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 Ih(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 Re(h,p,f[g])));l&&l.to==h?l.to=p:o.push(l=new ot(h,p,r))}}),i.forEach(c=>n.step(c)),o.forEach(c=>n.step(c))}function Dh(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 Kr){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 Re(s.from,s.to,s.style)))}function yo(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 ce(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 Re(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 ce(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 $h(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||!$h(s,l,c))break;l&&(i=1),c<s.childCount&&(o=1)}return null}function Rh(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 ue(c,d,s,l,new B(u.append(h),f,p),u.size-f,!0))}function ko(n,e,t=null,r=n){let i=Lh(n,e),o=i&&zh(r,e);return o?i.map(gs).concat({type:e,attrs:t}).concat(o.map(gs)):null}function gs(n){return{type:n,attrs:null}}function Lh(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 zh(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 Ph(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 ue(i,o,i,o,new B(r,0,0),t.length,!0))}function Vh(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)&&Fh(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&&ta(n,s,l,o),yo(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 ue(f,h,f+1,h-1,new B(T.from(r.create(c,null,s.marks)),0,0),1,!0)),d===!0&&ea(n,s,l,o),!1}})}function ea(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 ta(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 Fh(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Hh(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 ue(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new B(T.from(s),0,0),1,!0))}function Ut(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 jh(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 ce(e,e,new B(o.append(s),t,t),!0))}function pt(n,e){let t=n.resolve(e),r=t.index();return na(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Uh(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 na(n,e){return!!(n&&e&&!n.isLeaf&&Uh(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&&na(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 qh(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);ta(n,u.node(),u.before(),l)}s.inlineContent&&yo(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 ce(d,c.map(e+t,-1),B.empty,!0)),r===!0){let u=n.doc.resolve(d);ea(n,u.node(),u.before(),n.steps.length)}return n}function Wh(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 ra(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 Gr(n,e,t=e,r=B.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return ia(i,o,r)?new ce(e,t,r):new Kh(i,o,r).fit()}function ia(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Kh{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 ue(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new ce(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=ui(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=ui(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=ui(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new B(on(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new B(on(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(oa(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=sn(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 b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?B.empty:new B(on(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new B(on(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||!fi(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=fi(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=fi(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=sn(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=sn(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=sn(this.placed,this.frontier.length,t))}}function on(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(on(n.firstChild.content,e-1,t)))}function sn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(sn(n.lastChild.content,e-1,t)))}function ui(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function oa(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,oa(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 fi(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&&!Jh(t,o.content,s)?l:null}function Jh(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Gh(n){return n.spec.defining||n.spec.definingForContent}function Yh(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(ia(i,o,r))return n.step(new ce(e,t,r));let s=la(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=Gh(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],b=!0;y<0&&(b=!1,y=-y);let w=i.node(y-1),k=i.index(y-1);if(w.canReplaceWith(k,k,m.type,m.marks))return n.replace(i.before(y),b?o.after(y):t,new B(sa(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 sa(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(sa(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 Qh(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Wh(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new B(T.from(r),0,0))}function Xh(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=la(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 la(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 qt extends ke{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 re.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 re.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 qt(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 qt(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 qt(t.pos,t.attr,t.value)}}ke.jsonID("attr",qt);class Cn extends ke{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 re.ok(r)}getMap(){return Me.empty}invert(e){return new Cn(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 Cn(t.attr,t.value)}}ke.jsonID("docAttr",Cn);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 aa{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new wn}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}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((o,s,l,c)=>{e=Math.min(e,l),t=Math.max(t,c)})}return e==1e9?null:{from:e,to:t}}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=Gr(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 Yh(this,e,t,r),this}replaceRangeWith(e,t,r){return Qh(this,e,t,r),this}deleteRange(e,t){return Xh(this,e,t),this}lift(e,t){return Rh(this,e,t),this}join(e,t=1){return qh(this,e,t),this}wrap(e,t){return Ph(this,e,t),this}setBlockType(e,t=e,r,i=null){return Vh(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Hh(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new qt(e,t,r)),this}setDocAttribute(e,t){return this.step(new Cn(e,t)),this}addNodeMark(e,t){return this.step(new st(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 Q)t.isInSet(r.marks)&&this.step(new Nt(e,t));else{let i=r.marks,o,s=[];for(;o=t.isInSet(i);)s.push(new Nt(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 jh(this,e,t,r),this}addMark(e,t,r){return Ih(this,e,t,r),this}removeMark(e,t,r){return Dh(this,e,t,r),this}clearIncompatible(e,t,r){return yo(this,e,t,r),this}}const hi=Object.create(null);class H{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Zh(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&&bs(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),bs(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new V(e):Pt(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?Pt(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):Pt(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 Ie(e.node(0))}static atStart(e){return Pt(e,e,0,0,1)||new Ie(e)}static atEnd(e){return Pt(e,e,e.content.size,e.childCount,-1)||new Ie(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=hi[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 hi)throw new RangeError("Duplicate use of selection JSON ID "+e);return hi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}}H.prototype.visible=!0;class Zh{constructor(e,t){this.$from=e,this.$to=t}}let ys=!1;function ks(n){!ys&&!n.parent.inlineContent&&(ys=!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){ks(e),ks(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 Yr(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 Yr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Yr(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 bo(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 bo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Yr(r,r):new bo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&P.isSelectable(r)?new P(t):H.near(t)}}class Ie 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 Ie(e)}map(e){return new Ie(e)}eq(e){return e instanceof Ie}getBookmark(){return _h}}H.jsonID("all",Ie);const _h={map(){return this},resolve(n){return new Ie(n)}};function Pt(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=Pt(n,l,t+i,i<0?l.childCount:0,i,o);if(c)return c}t+=l.nodeSize*i}return null}function bs(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof ce||i instanceof ue))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 vs=1,Pn=2,xs=4;class ep extends aa{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|vs)&~Pn,this.storedMarks=null,this}get selectionSet(){return(this.updated&vs)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Pn,this}ensureMarks(e){return Q.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&Pn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Pn,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)||Q.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|=xs,this}get scrolledIntoView(){return(this.updated&xs)>0}}function ws(n,e){return!e||!n?n:n.bind(e)}class ln{constructor(e,t,r){this.name=e,this.init=ws(t.init,r),this.apply=ws(t.apply,r)}}const tp=[new ln("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ln("selection",{init(n,e){return n.selection||H.atStart(e.doc)},apply(n){return n.selection}}),new ln("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ln("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class pi{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=tp.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 ln(r.key,r.spec.state,r))})}}class jt{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 jt(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 ep(this)}static create(e){let t=new pi(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new jt(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 pi(this.schema,e.plugins),r=t.fields,i=new jt(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 pi(e.schema,e.plugins),o=new jt(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Le.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 ca(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=ca(i,e,{})),t[r]=i}return t}class _{constructor(e){this.spec=e,this.props={},e.props&&ca(e.props,this,this.props),this.key=e.key?e.key.key:da("plugin")}getState(e){return e[this.key]}}const mi=Object.create(null);function da(n){return n in mi?n+"$"+ ++mi[n]:(mi[n]=0,n+"$")}class le{constructor(e="key"){this.key=da(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const np=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function ua(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const rp=(n,e,t)=>{let r=ua(n,t);if(!r)return!1;let i=vo(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(ma(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=Gr(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},ip=(n,e,t)=>{let r=ua(n,t);if(!r)return!1;let i=vo(r);return i?fa(n,i,e):!1},op=(n,e,t)=>{let r=ha(n,t);if(!r)return!1;let i=xo(r);return i?fa(n,i,e):!1};function fa(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=Gr(n.doc,o,c,B.empty);if(!d||d.from!=o||d instanceof ce&&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 sp=(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=vo(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 vo(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 ha(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const lp=(n,e,t)=>{let r=ha(n,t);if(!r)return!1;let i=xo(r);if(!i)return!1;let o=i.nodeAfter;if(ma(n,i,e,1))return!0;if(r.parent.content.size==0&&(Jt(o,"start")||P.isSelectable(o))){let s=Gr(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},ap=(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=xo(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 xo(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 cp=(n,e)=>{let t=n.selection,r=t instanceof P,i;if(r){if(t.node.isTextblock||!pt(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},dp=(n,e)=>{let t=n.selection,r;if(t instanceof P){if(t.node.isTextblock||!pt(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},up=(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)},fp=(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 pa(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 hp=(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=pa(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},pp=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Ie||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=pa(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},mp=(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(Ut(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)},gp=(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 yp(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||pt(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function ma(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,c=i.type.spec.isolating||o.type.spec.isolating;if(!c&&yp(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 b=s.length-1;b>=0;b--)m=T.from(s[b].create(null,m));m=T.from(i.copy(m));let g=n.tr.step(new ue(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&&pt(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 b=T.empty;for(let k=m.length-1;k>=0;k--)b=T.from(m[k].copy(b));let w=n.tr.step(new ue(e.pos-m.length,e.pos+o.nodeSize,e.pos+y,e.pos+o.nodeSize-y,new B(b,m.length,0),0,!0));t(w.scrollIntoView())}return!0}}return!1}function ga(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 kp=ga(-1),bp=ga(1);function vp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&ko(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Cs(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 xp(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 wp(l,s,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function wp(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 nr(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new nr(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=ko(o,t,r,e);return l?(n&&Cp(n,e,l,i,t),!0):!1}function Cp(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 ue(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&&Ut(n.doc,c,l)&&(n.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return n}function Sp(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?Mp(e,t,n,o):Tp(e,t,o):!0:!1}}function Mp(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ue(o-1,s,o,s,new B(T.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new nr(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 pt(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function Tp(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 ue(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 Ep(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 ue(h-(d?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const he=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 Hi=null;const Je=function(n,e,t){let r=Hi||(Hi=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Np=function(){Hi=null},At=function(n,e,t,r){return t&&(Ss(n,e,t,r,-1)||Ss(n,e,t,r,1))},Ap=/^(img|br|input|textarea|hr)$/i;function Ss(n,e,t,r,i){for(var o;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Oe(n))){let s=n.parentNode;if(!s||s.nodeType!=1||On(n)||Ap.test(n.nodeName)||n.contentEditable=="false")return!1;e=he(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?Oe(n):0}else return!1}}function Oe(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Bp(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=Oe(n)}else if(n.parentNode&&!On(n))e=he(n),n=n.parentNode;else return null}}function Op(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&&!On(n))e=he(n)+1,n=n.parentNode;else return null}}function Ip(n,e,t){for(let r=e==0,i=e==Oe(n);r||i;){if(n==t)return!0;let o=he(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Oe(n)}}function On(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 Qr=function(n){return n.focusNode&&At(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function yt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Dp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function $p(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Oe(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Oe(r.startContainer),r.startOffset)}}}const He=typeof navigator<"u"?navigator:null,Ms=typeof document<"u"?document:null,Dt=He&&He.userAgent||"",ji=/Edge\/(\d+)/.exec(Dt),ya=/MSIE \d/.exec(Dt),Ui=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dt),Se=!!(ya||Ui||ji),ct=ya?document.documentMode:Ui?+Ui[1]:ji?+ji[1]:0,ze=!Se&&/gecko\/(\d+)/i.test(Dt),qi=!Se&&/Chrome\/(\d+)/.exec(Dt),de=!!qi,ka=qi?+qi[1]:0,ge=!Se&&!!He&&/Apple Computer/.test(He.vendor),Yt=ge&&(/Mobile\/\w+/.test(Dt)||!!He&&He.maxTouchPoints>2),Be=Yt||(He?/Mac/.test(He.platform):!1),ba=He?/Win/.test(He.platform):!1,Ge=/Android \d/.test(Dt),In=!!Ms&&"webkitFontSmoothing"in Ms.documentElement.style,Rp=In?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Lp(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 Ue(n,e){return typeof n=="number"?n:n[e]}function zp(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 Ts(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?Lp(o):zp(l),u=0,f=0;if(e.top<d.top+Ue(r,"top")?f=-(d.top-e.top+Ue(i,"top")):e.bottom>d.bottom-Ue(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+Ue(i,"top")-d.top:e.bottom-d.bottom+Ue(i,"bottom")),e.left<d.left+Ue(r,"left")?u=-(d.left-e.left+Ue(i,"left")):e.right>d.right-Ue(r,"right")&&(u=e.right-d.right+Ue(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 Pp(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:va(n.dom)}}function va(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 Vp({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;xa(t,r==0?0:r-e)}function xa(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 Lt=null;function Fp(n){if(n.setActive)return n.setActive();if(Lt)return n.focus(Lt);let e=va(n);n.focus(Lt==null?{get preventScroll(){return Lt={preventScroll:!0},!0}}:void 0),Lt||(Lt=!1,xa(e,0))}function wa(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=Je(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?Hp(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:wa(t,i)}function Hp(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=Ze(r,1);if(s.top!=s.bottom&&wo(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 wo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function jp(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Up(n,e,t){let{node:r,offset:i}=wa(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 qp(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 Ca(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(wo(e,d))return Ca(s,e,d)}}if((o=(o+1)%r)==i)break}return n}function Wp(n,e){let t=n.dom.ownerDocument,r,i=0,o=$p(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(!wo(e,d)||(s=Ca(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=jp(s,e),r){if(ze&&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;In&&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=qp(n,r,i,e))}l==null&&(l=Up(n,s,e));let c=n.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function Es(n){return n.top<n.bottom||n.left<n.right}function Ze(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Es(r))return r}return Array.prototype.find.call(t,Es)||n.getBoundingClientRect()}const Kp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Sa(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=In||ze;if(r.nodeType==3)if(s&&(Kp.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let c=Ze(Je(r,i,i),t);if(ze&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=Ze(Je(r,i-1,i-1),-1);if(d.top==c.top){let u=Ze(Je(r,i,i+1),-1);if(u.top!=c.top)return nn(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++,nn(Ze(Je(r,c,d),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==Oe(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return gi(c.getBoundingClientRect(),!1)}if(o==null&&i<Oe(r)){let c=r.childNodes[i];if(c.nodeType==1)return gi(c.getBoundingClientRect(),!0)}return gi(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==Oe(r))){let c=r.childNodes[i-1],d=c.nodeType==3?Je(c,Oe(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return nn(Ze(d,1),!1)}if(o==null&&i<Oe(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Je(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return nn(Ze(d,-1),!0)}return nn(Ze(r.nodeType==3?Je(r):r,-t),t>=0)}function nn(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 gi(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 Ma(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 Jp(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Ma(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=Sa(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=Je(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 Gp=/[\u0590-\u08ac]/;function Yp(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?!Gp.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:Ma(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 Ns=null,As=null,Bs=!1;function Qp(n,e,t){return Ns==e&&As==t?Bs:(Ns=e,As=t,Bs=t=="up"||t=="down"?Jp(n,e,t):Yp(n,e,t))}const De=0,Os=1,kt=2,je=3;class Dn{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>he(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 Ea){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 Ta&&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?he(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?he(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=he(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=he(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((ze||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:he(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(ze&&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)&&At(l.node,l.offset,u.anchorNode,u.anchorOffset)&&At(c.node,c.offset,u.focusNode,u.focusOffset))return;let h=!1;if((d.extend||e==t)&&!(f&&ze)){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?kt:Os,e==l&&t==c&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=je:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?kt:je}r=s}this.dirty=kt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?kt:Os;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Ta extends Dn{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 Xp extends Dn{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 Bt extends Dn{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=It.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Bt(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&je||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=je&&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=Bt.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=Ki(o,t,s,r)),e>0&&(o=Ki(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 dt extends Dn{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}=It.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=Ba(u,r,t),d?c=new Zp(e,t,r,i,u,f||null,h,d,o,s+1):t.isText?new Xr(e,t,r,i,u,h,o):new dt(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)&&ir(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 em(this,s&&s.node,e);rm(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e,u):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?Q.none:this.node.child(u).marks,r,e,u),c.placeWidget(d,e,i)},(d,u,f,h)=>{c.syncToMarks(d.marks,r,e,h);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,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==kt)&&(s&&this.protectLocalComposition(e,s),Na(this.contentDOM,this.children,e),Yt&&im(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=om(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 Xp(this,o,t,i);e.input.compositionNodes.push(s),this.children=Ki(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==je||!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(ir(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Aa(this.dom,this.nodeDOM,Wi(this.outerDeco,this.node,t),Wi(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 Is(n,e,t,r,i){Ba(r,e,n);let o=new dt(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Xr extends dt{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==je||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 Xr(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=je)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ea extends Dn{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 Zp extends dt{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==je)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 Na(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 Bt){let c=r?r.previousSibling:n.lastChild;Na(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 un=function(n){n&&(this.nodeName=n)};un.prototype=Object.create(null);const bt=[new un];function Wi(n,e,t){if(n.length==0)return bt;let r=t?bt[0]:new un,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new un(s.nodeName));for(let l in s){let c=s[l];c!=null&&(t&&i.length==1&&i.push(r=new un(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 Aa(n,e,t,r){if(t==bt&&r==bt)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=bt[0]),i=c}_p(i,l||bt[0],s)}return i}function _p(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 Ba(n,e,t){return Aa(n,n,bt,Wi(e,t,n.nodeType!=1))}function ir(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 em{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=tm(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,i){let o=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;o<l&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=De,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let c=-1,d=this.top.children.length;i<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=Bt.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}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==je&&s.dom==s.contentDOM&&(s.dirty=kt),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 dt){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!=je&&ir(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=kt,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)||!ir(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=dt.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=dt.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 Ta(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 Bt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Xr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ge||de)&&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 Ea(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 tm(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 Bt)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 nm(n,e){return n.type.side-e.type.side}function rm(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(nm);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 b=0;b<l.length;b++)l[b].to<y&&(y=l[b].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 im(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 om(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 Ki(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 Co(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(Qr(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&&Ip(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=So(n,u,l,f)}return d}function Oa(n){return n.editable?n.hasFocus():Da(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ye(n,e=!1){let t=n.state.selection;if(Ia(n,t),!!Oa(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&de){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&At(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)lm(n);else{let{anchor:r,head:i}=t,o,s;$s&&!(t instanceof V)&&(t.$from.parent.inlineContent||(o=Rs(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Rs(n,t.to))),n.docView.setSelection(r,i,n,e),$s&&(o&&Ls(o),s&&Ls(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&sm(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const $s=ge||de&&ka<63;function Rs(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 yi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return yi(i);if(o)return yi(o)}}function yi(n){return n.contentEditable="true",ge&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Ls(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function sm(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(()=>{(!Oa(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function lm(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,he(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Se&&ct<=11&&(t.disabled=!0,t.disabled=!1)}function Ia(n,e){if(e instanceof P){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(zs(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else zs(n)}function zs(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function So(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||V.between(e,t,r)}function Ps(n){return n.editable&&!n.hasFocus()?!1:Da(n)}function Da(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 am(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return At(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Ji(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 _e(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Vs(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 _e(n,new V(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Ji(n.state,e);return i&&i instanceof P?_e(n,i):!1}else if(!(Be&&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)?_e(n,new P(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):In?_e(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 _e(n,new V(e>0?r.$to:r.$from));{let i=Ji(n.state,e);return i?_e(n,i):!1}}}function or(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function fn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function zt(n,e){return e<0?cm(n):dm(n)}function cm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(ze&&t.nodeType==1&&r<or(t)&&fn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(fn(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if($a(t))break;{let l=t.previousSibling;for(;l&&fn(l,-1);)i=t.parentNode,o=he(l),l=l.previousSibling;if(l)t=l,r=or(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Gi(n,t,r):i&&Gi(n,i,o)}function dm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=or(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(fn(l,1))o=t,s=++r;else break}else{if($a(t))break;{let l=t.nextSibling;for(;l&&fn(l,1);)o=l.parentNode,s=he(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=or(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Gi(n,o,s)}function $a(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function um(n,e){for(;n&&e==n.childNodes.length&&!On(n);)e=he(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 fm(n,e){for(;n&&!e&&!On(n);)e=he(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 Gi(n,e,t){if(e.nodeType!=3){let o,s;(s=um(e,t))?(e=s,t=0):(o=fm(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Qr(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&&Ye(n)},50)}function Fs(n,e){let t=n.state.doc.resolve(e);if(!(de||ba)&&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 Hs(n,e,t){let r=n.state.selection;if(r instanceof V&&!r.empty||t.indexOf("s")>-1||Be&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Ji(n.state,e);if(s&&s instanceof P)return _e(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Ie?H.near(s,e):H.findFrom(s,e);return l?_e(n,l):!1}return!1}function js(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 Us(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function hm(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;Us(n,r,"true"),setTimeout(()=>Us(n,r,"false"),20)}return!1}function pm(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function mm(n,e){let t=e.keyCode,r=pm(e);if(t==8||Be&&t==72&&r=="c")return js(n,-1)||zt(n,-1);if(t==46&&!e.shiftKey||Be&&t==68&&r=="c")return js(n,1)||zt(n,1);if(t==13||t==27)return!0;if(t==37||Be&&t==66&&r=="c"){let i=t==37?Fs(n,n.state.selection.from)=="ltr"?-1:1:-1;return Vs(n,i,r)||zt(n,i)}else if(t==39||Be&&t==70&&r=="c"){let i=t==39?Fs(n,n.state.selection.from)=="ltr"?1:-1:1;return Vs(n,i,r)||zt(n,i)}else{if(t==38||Be&&t==80&&r=="c")return Hs(n,-1,r)||zt(n,-1);if(t==40||Be&&t==78&&r=="c")return hm(n)||Hs(n,1,r)||zt(n,1);if(r==(Be?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Mo(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")||It.fromSchema(n.state.schema),l=Fa(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Va[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,`
|
|
8
|
+
`))}})}function Fh(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Hh(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 ue(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new B(T.from(s),0,0),1,!0))}function Ut(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 jh(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 ce(e,e,new B(o.append(s),t,t),!0))}function pt(n,e){let t=n.resolve(e),r=t.index();return na(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Uh(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 na(n,e){return!!(n&&e&&!n.isLeaf&&Uh(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&&na(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 qh(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);ta(n,u.node(),u.before(),l)}s.inlineContent&&yo(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 ce(d,c.map(e+t,-1),B.empty,!0)),r===!0){let u=n.doc.resolve(d);ea(n,u.node(),u.before(),n.steps.length)}return n}function Wh(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 ra(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 Gr(n,e,t=e,r=B.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return ia(i,o,r)?new ce(e,t,r):new Kh(i,o,r).fit()}function ia(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Kh{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 ue(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new ce(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=ui(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=ui(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=ui(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new B(on(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new B(on(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(oa(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=sn(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 b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?B.empty:new B(on(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new B(on(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||!fi(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=fi(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=fi(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=sn(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=sn(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=sn(this.placed,this.frontier.length,t))}}function on(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(on(n.firstChild.content,e-1,t)))}function sn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(sn(n.lastChild.content,e-1,t)))}function ui(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function oa(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,oa(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 fi(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&&!Jh(t,o.content,s)?l:null}function Jh(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Gh(n){return n.spec.defining||n.spec.definingForContent}function Yh(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(ia(i,o,r))return n.step(new ce(e,t,r));let s=la(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=Gh(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],b=!0;y<0&&(b=!1,y=-y);let C=i.node(y-1),v=i.index(y-1);if(C.canReplaceWith(v,v,m.type,m.marks))return n.replace(i.before(y),b?o.after(y):t,new B(sa(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 sa(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(sa(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 Qh(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Wh(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new B(T.from(r),0,0))}function Xh(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=la(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 la(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 qt extends ke{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 re.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 re.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 qt(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 qt(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 qt(t.pos,t.attr,t.value)}}ke.jsonID("attr",qt);class Cn extends ke{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 re.ok(r)}getMap(){return Me.empty}invert(e){return new Cn(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 Cn(t.attr,t.value)}}ke.jsonID("docAttr",Cn);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 aa{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new wn}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}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((o,s,l,c)=>{e=Math.min(e,l),t=Math.max(t,c)})}return e==1e9?null:{from:e,to:t}}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=Gr(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 Yh(this,e,t,r),this}replaceRangeWith(e,t,r){return Qh(this,e,t,r),this}deleteRange(e,t){return Xh(this,e,t),this}lift(e,t){return Rh(this,e,t),this}join(e,t=1){return qh(this,e,t),this}wrap(e,t){return Ph(this,e,t),this}setBlockType(e,t=e,r,i=null){return Vh(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Hh(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new qt(e,t,r)),this}setDocAttribute(e,t){return this.step(new Cn(e,t)),this}addNodeMark(e,t){return this.step(new st(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 Q)t.isInSet(r.marks)&&this.step(new Nt(e,t));else{let i=r.marks,o,s=[];for(;o=t.isInSet(i);)s.push(new Nt(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 jh(this,e,t,r),this}addMark(e,t,r){return Ih(this,e,t,r),this}removeMark(e,t,r){return Dh(this,e,t,r),this}clearIncompatible(e,t,r){return yo(this,e,t,r),this}}const hi=Object.create(null);class U{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Zh(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&&bs(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),bs(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new V(e):Pt(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?Pt(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):Pt(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 Ie(e.node(0))}static atStart(e){return Pt(e,e,0,0,1)||new Ie(e)}static atEnd(e){return Pt(e,e,e.content.size,e.childCount,-1)||new Ie(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=hi[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 hi)throw new RangeError("Duplicate use of selection JSON ID "+e);return hi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}}U.prototype.visible=!0;class Zh{constructor(e,t){this.$from=e,this.$to=t}}let ys=!1;function ks(n){!ys&&!n.parent.inlineContent&&(ys=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class V extends U{constructor(e,t=e){ks(e),ks(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 U.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 Yr(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=U.findFrom(t,r,!0)||U.findFrom(t,-r,!0);if(o)t=o.$head;else return U.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(U.findFrom(e,-r,!0)||U.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new V(e,t)}}U.jsonID("text",V);class Yr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Yr(e.map(this.anchor),e.map(this.head))}resolve(e){return V.between(e.resolve(this.anchor),e.resolve(this.head))}}class P extends U{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?U.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 bo(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;U.jsonID("node",P);class bo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Yr(r,r):new bo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&P.isSelectable(r)?new P(t):U.near(t)}}class Ie extends U{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=U.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ie(e)}map(e){return new Ie(e)}eq(e){return e instanceof Ie}getBookmark(){return _h}}U.jsonID("all",Ie);const _h={map(){return this},resolve(n){return new Ie(n)}};function Pt(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=Pt(n,l,t+i,i<0?l.childCount:0,i,o);if(c)return c}t+=l.nodeSize*i}return null}function bs(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof ce||i instanceof ue))return;let o=n.mapping.maps[r],s;o.forEach((l,c,d,u)=>{s==null&&(s=u)}),n.setSelection(U.near(n.doc.resolve(s),t))}const vs=1,Pn=2,xs=4;class ep extends aa{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|vs)&~Pn,this.storedMarks=null,this}get selectionSet(){return(this.updated&vs)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Pn,this}ensureMarks(e){return Q.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&Pn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Pn,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)||Q.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(U.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|=xs,this}get scrolledIntoView(){return(this.updated&xs)>0}}function ws(n,e){return!e||!n?n:n.bind(e)}class ln{constructor(e,t,r){this.name=e,this.init=ws(t.init,r),this.apply=ws(t.apply,r)}}const tp=[new ln("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ln("selection",{init(n,e){return n.selection||U.atStart(e.doc)},apply(n){return n.selection}}),new ln("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ln("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class pi{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=tp.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 ln(r.key,r.spec.state,r))})}}class jt{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 jt(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 ep(this)}static create(e){let t=new pi(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new jt(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 pi(this.schema,e.plugins),r=t.fields,i=new jt(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 pi(e.schema,e.plugins),o=new jt(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Le.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=U.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 ca(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=ca(i,e,{})),t[r]=i}return t}class _{constructor(e){this.spec=e,this.props={},e.props&&ca(e.props,this,this.props),this.key=e.key?e.key.key:da("plugin")}getState(e){return e[this.key]}}const mi=Object.create(null);function da(n){return n in mi?n+"$"+ ++mi[n]:(mi[n]=0,n+"$")}class le{constructor(e="key"){this.key=da(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const np=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function ua(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const rp=(n,e,t)=>{let r=ua(n,t);if(!r)return!1;let i=vo(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(ma(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=Gr(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")?U.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},ip=(n,e,t)=>{let r=ua(n,t);if(!r)return!1;let i=vo(r);return i?fa(n,i,e):!1},op=(n,e,t)=>{let r=ha(n,t);if(!r)return!1;let i=xo(r);return i?fa(n,i,e):!1};function fa(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=Gr(n.doc,o,c,B.empty);if(!d||d.from!=o||d instanceof ce&&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 sp=(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=vo(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 vo(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 ha(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const lp=(n,e,t)=>{let r=ha(n,t);if(!r)return!1;let i=xo(r);if(!i)return!1;let o=i.nodeAfter;if(ma(n,i,e,1))return!0;if(r.parent.content.size==0&&(Jt(o,"start")||P.isSelectable(o))){let s=Gr(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")?U.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},ap=(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=xo(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 xo(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 cp=(n,e)=>{let t=n.selection,r=t instanceof P,i;if(r){if(t.node.isTextblock||!pt(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},dp=(n,e)=>{let t=n.selection,r;if(t instanceof P){if(t.node.isTextblock||!pt(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},up=(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)},fp=(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 pa(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 hp=(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=pa(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(U.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},pp=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Ie||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=pa(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},mp=(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(Ut(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)},gp=(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 yp(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||pt(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function ma(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,c=i.type.spec.isolating||o.type.spec.isolating;if(!c&&yp(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 b=s.length-1;b>=0;b--)m=T.from(s[b].create(null,m));m=T.from(i.copy(m));let g=n.tr.step(new ue(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&&pt(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&c?null:U.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 b=T.empty;for(let v=m.length-1;v>=0;v--)b=T.from(m[v].copy(b));let C=n.tr.step(new ue(e.pos-m.length,e.pos+o.nodeSize,e.pos+y,e.pos+o.nodeSize-y,new B(b,m.length,0),0,!0));t(C.scrollIntoView())}return!0}}return!1}function ga(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 kp=ga(-1),bp=ga(1);function vp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&ko(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Cs(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 xp(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 wp(l,s,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function wp(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 nr(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new nr(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=ko(o,t,r,e);return l?(n&&Cp(n,e,l,i,t),!0):!1}function Cp(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 ue(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&&Ut(n.doc,c,l)&&(n.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return n}function Sp(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?Mp(e,t,n,o):Tp(e,t,o):!0:!1}}function Mp(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ue(o-1,s,o,s,new B(T.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new nr(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 pt(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function Tp(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 ue(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 Ep(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 ue(h-(d?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const he=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 Hi=null;const Je=function(n,e,t){let r=Hi||(Hi=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Np=function(){Hi=null},At=function(n,e,t,r){return t&&(Ss(n,e,t,r,-1)||Ss(n,e,t,r,1))},Ap=/^(img|br|input|textarea|hr)$/i;function Ss(n,e,t,r,i){for(var o;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Oe(n))){let s=n.parentNode;if(!s||s.nodeType!=1||On(n)||Ap.test(n.nodeName)||n.contentEditable=="false")return!1;e=he(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?Oe(n):0}else return!1}}function Oe(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Bp(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=Oe(n)}else if(n.parentNode&&!On(n))e=he(n),n=n.parentNode;else return null}}function Op(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&&!On(n))e=he(n)+1,n=n.parentNode;else return null}}function Ip(n,e,t){for(let r=e==0,i=e==Oe(n);r||i;){if(n==t)return!0;let o=he(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Oe(n)}}function On(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 Qr=function(n){return n.focusNode&&At(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function yt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Dp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function $p(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Oe(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Oe(r.startContainer),r.startOffset)}}}const He=typeof navigator<"u"?navigator:null,Ms=typeof document<"u"?document:null,Dt=He&&He.userAgent||"",ji=/Edge\/(\d+)/.exec(Dt),ya=/MSIE \d/.exec(Dt),Ui=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dt),Se=!!(ya||Ui||ji),ct=ya?document.documentMode:Ui?+Ui[1]:ji?+ji[1]:0,ze=!Se&&/gecko\/(\d+)/i.test(Dt),qi=!Se&&/Chrome\/(\d+)/.exec(Dt),de=!!qi,ka=qi?+qi[1]:0,ge=!Se&&!!He&&/Apple Computer/.test(He.vendor),Yt=ge&&(/Mobile\/\w+/.test(Dt)||!!He&&He.maxTouchPoints>2),Be=Yt||(He?/Mac/.test(He.platform):!1),ba=He?/Win/.test(He.platform):!1,Ge=/Android \d/.test(Dt),In=!!Ms&&"webkitFontSmoothing"in Ms.documentElement.style,Rp=In?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Lp(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 Ue(n,e){return typeof n=="number"?n:n[e]}function zp(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 Ts(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?Lp(o):zp(l),u=0,f=0;if(e.top<d.top+Ue(r,"top")?f=-(d.top-e.top+Ue(i,"top")):e.bottom>d.bottom-Ue(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+Ue(i,"top")-d.top:e.bottom-d.bottom+Ue(i,"bottom")),e.left<d.left+Ue(r,"left")?u=-(d.left-e.left+Ue(i,"left")):e.right>d.right-Ue(r,"right")&&(u=e.right-d.right+Ue(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 Pp(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:va(n.dom)}}function va(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 Vp({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;xa(t,r==0?0:r-e)}function xa(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 Lt=null;function Fp(n){if(n.setActive)return n.setActive();if(Lt)return n.focus(Lt);let e=va(n);n.focus(Lt==null?{get preventScroll(){return Lt={preventScroll:!0},!0}}:void 0),Lt||(Lt=!1,xa(e,0))}function wa(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=Je(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?Hp(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:wa(t,i)}function Hp(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=Ze(r,1);if(s.top!=s.bottom&&wo(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 wo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function jp(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Up(n,e,t){let{node:r,offset:i}=wa(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 qp(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 Ca(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(wo(e,d))return Ca(s,e,d)}}if((o=(o+1)%r)==i)break}return n}function Wp(n,e){let t=n.dom.ownerDocument,r,i=0,o=$p(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(!wo(e,d)||(s=Ca(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=jp(s,e),r){if(ze&&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;In&&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=qp(n,r,i,e))}l==null&&(l=Up(n,s,e));let c=n.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function Es(n){return n.top<n.bottom||n.left<n.right}function Ze(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Es(r))return r}return Array.prototype.find.call(t,Es)||n.getBoundingClientRect()}const Kp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Sa(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=In||ze;if(r.nodeType==3)if(s&&(Kp.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let c=Ze(Je(r,i,i),t);if(ze&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=Ze(Je(r,i-1,i-1),-1);if(d.top==c.top){let u=Ze(Je(r,i,i+1),-1);if(u.top!=c.top)return nn(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++,nn(Ze(Je(r,c,d),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==Oe(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return gi(c.getBoundingClientRect(),!1)}if(o==null&&i<Oe(r)){let c=r.childNodes[i];if(c.nodeType==1)return gi(c.getBoundingClientRect(),!0)}return gi(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==Oe(r))){let c=r.childNodes[i-1],d=c.nodeType==3?Je(c,Oe(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return nn(Ze(d,1),!1)}if(o==null&&i<Oe(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Je(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return nn(Ze(d,-1),!0)}return nn(Ze(r.nodeType==3?Je(r):r,-t),t>=0)}function nn(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 gi(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 Ma(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 Jp(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Ma(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=Sa(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=Je(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 Gp=/[\u0590-\u08ac]/;function Yp(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?!Gp.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:Ma(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 Ns=null,As=null,Bs=!1;function Qp(n,e,t){return Ns==e&&As==t?Bs:(Ns=e,As=t,Bs=t=="up"||t=="down"?Jp(n,e,t):Yp(n,e,t))}const De=0,Os=1,kt=2,je=3;class Dn{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>he(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 Ea){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 Ta&&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?he(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?he(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=he(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=he(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((ze||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:he(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(ze&&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)&&At(l.node,l.offset,u.anchorNode,u.anchorOffset)&&At(c.node,c.offset,u.focusNode,u.focusOffset))return;let h=!1;if((d.extend||e==t)&&!(f&&ze)){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?kt:Os,e==l&&t==c&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=je:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?kt:je}r=s}this.dirty=kt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?kt:Os;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Ta extends Dn{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 Xp extends Dn{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 Bt extends Dn{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=It.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Bt(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&je||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=je&&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=Bt.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=Ki(o,t,s,r)),e>0&&(o=Ki(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 dt extends Dn{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}=It.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=Ba(u,r,t),d?c=new Zp(e,t,r,i,u,f||null,h,d,o,s+1):t.isText?new Xr(e,t,r,i,u,h,o):new dt(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)&&ir(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 em(this,s&&s.node,e);rm(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e,u):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?Q.none:this.node.child(u).marks,r,e,u),c.placeWidget(d,e,i)},(d,u,f,h)=>{c.syncToMarks(d.marks,r,e,h);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,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==kt)&&(s&&this.protectLocalComposition(e,s),Na(this.contentDOM,this.children,e),Yt&&im(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=om(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 Xp(this,o,t,i);e.input.compositionNodes.push(s),this.children=Ki(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==je||!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(ir(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Aa(this.dom,this.nodeDOM,Wi(this.outerDeco,this.node,t),Wi(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 Is(n,e,t,r,i){Ba(r,e,n);let o=new dt(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Xr extends dt{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==je||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 Xr(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=je)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ea extends Dn{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 Zp extends dt{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==je)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 Na(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 Bt){let c=r?r.previousSibling:n.lastChild;Na(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 un=function(n){n&&(this.nodeName=n)};un.prototype=Object.create(null);const bt=[new un];function Wi(n,e,t){if(n.length==0)return bt;let r=t?bt[0]:new un,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new un(s.nodeName));for(let l in s){let c=s[l];c!=null&&(t&&i.length==1&&i.push(r=new un(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 Aa(n,e,t,r){if(t==bt&&r==bt)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=bt[0]),i=c}_p(i,l||bt[0],s)}return i}function _p(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 Ba(n,e,t){return Aa(n,n,bt,Wi(e,t,n.nodeType!=1))}function ir(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 em{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=tm(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,i){let o=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;o<l&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=De,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let c=-1,d=this.top.children.length;i<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=Bt.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}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==je&&s.dom==s.contentDOM&&(s.dirty=kt),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 dt){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!=je&&ir(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=kt,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)||!ir(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=dt.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=dt.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 Ta(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 Bt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Xr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ge||de)&&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 Ea(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 tm(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 Bt)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 nm(n,e){return n.type.side-e.type.side}function rm(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(nm);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 b=0;b<l.length;b++)l[b].to<y&&(y=l[b].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 im(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 om(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 Ki(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 Co(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(Qr(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&&Ip(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=So(n,u,l,f)}return d}function Oa(n){return n.editable?n.hasFocus():Da(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ye(n,e=!1){let t=n.state.selection;if(Ia(n,t),!!Oa(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&de){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&At(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)lm(n);else{let{anchor:r,head:i}=t,o,s;$s&&!(t instanceof V)&&(t.$from.parent.inlineContent||(o=Rs(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Rs(n,t.to))),n.docView.setSelection(r,i,n,e),$s&&(o&&Ls(o),s&&Ls(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&sm(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const $s=ge||de&&ka<63;function Rs(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 yi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return yi(i);if(o)return yi(o)}}function yi(n){return n.contentEditable="true",ge&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Ls(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function sm(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(()=>{(!Oa(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function lm(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,he(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Se&&ct<=11&&(t.disabled=!0,t.disabled=!1)}function Ia(n,e){if(e instanceof P){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(zs(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else zs(n)}function zs(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function So(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||V.between(e,t,r)}function Ps(n){return n.editable&&!n.hasFocus()?!1:Da(n)}function Da(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 am(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return At(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Ji(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&&U.findFrom(o,e)}function _e(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Vs(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 _e(n,new V(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Ji(n.state,e);return i&&i instanceof P?_e(n,i):!1}else if(!(Be&&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)?_e(n,new P(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):In?_e(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 _e(n,new V(e>0?r.$to:r.$from));{let i=Ji(n.state,e);return i?_e(n,i):!1}}}function or(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function fn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function zt(n,e){return e<0?cm(n):dm(n)}function cm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(ze&&t.nodeType==1&&r<or(t)&&fn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(fn(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if($a(t))break;{let l=t.previousSibling;for(;l&&fn(l,-1);)i=t.parentNode,o=he(l),l=l.previousSibling;if(l)t=l,r=or(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Gi(n,t,r):i&&Gi(n,i,o)}function dm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=or(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(fn(l,1))o=t,s=++r;else break}else{if($a(t))break;{let l=t.nextSibling;for(;l&&fn(l,1);)o=l.parentNode,s=he(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=or(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Gi(n,o,s)}function $a(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function um(n,e){for(;n&&e==n.childNodes.length&&!On(n);)e=he(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 fm(n,e){for(;n&&!e&&!On(n);)e=he(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 Gi(n,e,t){if(e.nodeType!=3){let o,s;(s=um(e,t))?(e=s,t=0):(o=fm(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Qr(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&&Ye(n)},50)}function Fs(n,e){let t=n.state.doc.resolve(e);if(!(de||ba)&&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 Hs(n,e,t){let r=n.state.selection;if(r instanceof V&&!r.empty||t.indexOf("s")>-1||Be&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Ji(n.state,e);if(s&&s instanceof P)return _e(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Ie?U.near(s,e):U.findFrom(s,e);return l?_e(n,l):!1}return!1}function js(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 Us(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function hm(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;Us(n,r,"true"),setTimeout(()=>Us(n,r,"false"),20)}return!1}function pm(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function mm(n,e){let t=e.keyCode,r=pm(e);if(t==8||Be&&t==72&&r=="c")return js(n,-1)||zt(n,-1);if(t==46&&!e.shiftKey||Be&&t==68&&r=="c")return js(n,1)||zt(n,1);if(t==13||t==27)return!0;if(t==37||Be&&t==66&&r=="c"){let i=t==37?Fs(n,n.state.selection.from)=="ltr"?-1:1:-1;return Vs(n,i,r)||zt(n,i)}else if(t==39||Be&&t==70&&r=="c"){let i=t==39?Fs(n,n.state.selection.from)=="ltr"?1:-1:1;return Vs(n,i,r)||zt(n,i)}else{if(t==38||Be&&t==80&&r=="c")return Hs(n,-1,r)||zt(n,-1);if(t==40||Be&&t==78&&r=="c")return hm(n)||Hs(n,1,r)||zt(n,1);if(r==(Be?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Mo(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")||It.fromSchema(n.state.schema),l=Fa(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Va[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 Ra(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=It.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=bm(t),In&&vm(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")||at.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!gm.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=xm(qs(l,+u[1],+u[2]),u[4]);else if(l=B.maxOpen(ym(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=qs(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,c)}),l}const gm=/^(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 ym(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&&za(c,o,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Pa(s[s.length-1],o.length));let u=La(l,c);s.push(u),i=i.matchType(u.type),o=c}}),s)return T.from(s)}return n}function La(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,T.from(n));return n}function za(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=za(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(La(t,n,i+1))))}}function Pa(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Pa(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(T.empty,!0);return n.copy(t.append(r))}function Yi(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=Yi(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 qs(n,e,t){return e<n.openStart&&(n=new B(Yi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new B(Yi(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Va={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 Ws=null;function Fa(){return Ws||(Ws=document.implementation.createHTMLDocument("title"))}let ki=null;function km(n){let e=window.trustedTypes;return e?(ki||(ki=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ki.createHTML(n)):n}function bm(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Fa().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Va[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=km(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function vm(n){let e=n.querySelectorAll(de?"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 xm(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={},wm={touchstart:!0,touchmove:!0};class Cm{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Sm(n){for(let e in ve){let t=ve[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Tm(n,r)&&!To(n,r)&&(n.editable||!(r.type in xe))&&t(n,r)},wm[e]?{passive:!0}:void 0)}ge&&n.dom.addEventListener("input",()=>null),Qi(n)}function lt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Mm(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 Qi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>To(n,r))})}function To(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Tm(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 Em(n,e){!To(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,!ja(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ge&&de&&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,yt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||mm(n,t)?t.preventDefault():lt(n,"key")};xe.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};xe.keypress=(n,e)=>{let t=e;if(ja(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Be&&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 Zr(n){return{left:n.clientX,top:n.clientY}}function Nm(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Eo(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 Wt(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 Am(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&P.isSelectable(r)?(Wt(n,new P(t)),!0):!1}function Bm(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?(Wt(n,P.create(n.state.doc,i)),!0):!1}function Om(n,e,t,r,i){return Eo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?Bm(n,t):Am(n,t))}function Im(n,e,t,r){return Eo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Dm(n,e,t,r){return Eo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||$m(n,t,r)}function $m(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Wt(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)Wt(n,V.create(r,l+1,l+1+s.content.size));else if(P.isSelectable(s))Wt(n,P.create(r,l));else continue;return!0}}function No(n){return sr(n)}const Ha=Be?"metaKey":"ctrlKey";ve.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=No(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&Nm(t,n.input.lastClick)&&!t[Ha]&&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(Zr(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Rm(n,s,t,!!r)):(o=="doubleClick"?Im:Dm)(n,s.pos,s.inside,t)?t.preventDefault():lt(n,"pointer"))};class Rm{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[Ha],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&&ze&&!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)),lt(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(()=>Ye(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(Zr(e))),this.updateAllowDefault(e),this.allowDefault||!t?lt(this.view,"pointer"):Om(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ge&&this.mightDrag&&!this.mightDrag.node.isAtom||de&&!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)?(Wt(this.view,H.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):lt(this.view,"pointer")}move(e){this.updateAllowDefault(e),lt(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(),No(n),lt(n,"pointer")};ve.touchmove=n=>{n.input.lastTouch=Date.now(),lt(n,"pointer")};ve.contextmenu=n=>No(n);function ja(n,e){return n.composing?!0:ge&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Lm=Ge?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)||de&&ba&&zm(n)))n.markCursor=n.state.storedMarks||t.marks(),sr(n,!0),n.markCursor=null;else if(sr(n,!e.selection.empty),ze&&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}Ua(n,Lm)};function zm(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.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Ua(n,20))};function Ua(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>sr(n),e))}function qa(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Vm());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Pm(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Bp(e.focusNode,e.focusOffset),r=Op(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 Vm(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function sr(n,e=!1){if(!(Ge&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),qa(n),e||n.docView&&n.docView.dirty){let t=Co(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 Fm(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 Sn=Se&&ct<15||Yt&&Rp<604;ve.copy=xe.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Sn?null:t.clipboardData,s=r.content(),{dom:l,text:c}=Mo(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",c)):Fm(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Hm(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function jm(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?Mn(n,r.value,null,i,e):Mn(n,r.textContent,r.innerHTML,i,e)},50)}function Mn(n,e,t,r,i){let o=Ra(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=Hm(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 Wa(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&&!Ge)return;let r=Sn?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Mn(n,Wa(r),r.getData("text/html"),i,t)?t.preventDefault():jm(n,t)};class Ka{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Um=Be?"altKey":"ctrlKey";function Ja(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[Um]}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(Zr(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}=Mo(n,l);(!t.dataTransfer.files.length||!de||ka>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Sn?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Sn||t.dataTransfer.setData("text/plain",d),n.dragging=new Ka(u,Ja(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{qm(n,e,n.dragging)}finally{n.dragging=null}};function qm(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Zr(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=Ra(n,Wa(e.dataTransfer),Sn?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(t&&Ja(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?ra(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,b)=>p=b),c.setSelection(So(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())&&Ye(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(de&&Ge&&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,yt(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 Tn(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 lr{constructor(e,t){this.toDOM=e,this.spec=t||St,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 lr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Tn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ut{constructor(e,t){this.attrs=e,this.spec=t||St}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 ut&&Tn(this.attrs,e.attrs)&&Tn(this.spec,e.spec)}static is(e){return e.type instanceof ut}destroy(){}}class Ao{constructor(e,t){this.attrs=e,this.spec=t||St}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 Ao&&Tn(this.attrs,e.attrs)&&Tn(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 lr(t,r))}static inline(e,t,r,i){return new be(e,t,new ut(r,i))}static node(e,t,r,i){return new be(e,t,new Ao(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ut}get widget(){return this.type instanceof lr}}const Vt=[],St={};class Z{constructor(e,t){this.local=e.length?e:Vt,this.children=t.length?t:Vt}static create(e,t){return t.length?ar(t,e,0,St):ye}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==ye||e.maps.length==0?this:this.mapInner(e,t,0,0,r||St)}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?Wm(this.children,s||[],e,t,r,i,o):s?new Z(s.sort(Mt),Vt):ye}add(e,t){return t.length?this==ye?Z.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=Ya(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,ar(u,l,d+1,St)),o+=3}});let s=Ga(o?Qa(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new Z(s.length?this.local.concat(s).sort(Mt):this.local,i||this.children)}remove(e){return e.length==0||this==ye?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!=ye?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 Z(i,r):ye}forChild(e,t){if(this==ye)return this;if(t.isLeaf)return Z.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 ut){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 Z(i.sort(Mt),Vt);return r?new rt([l,r]):l}return r||ye}eq(e){if(this==e)return!0;if(!(e instanceof Z)||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 Bo(this.localsInner(e))}localsInner(e){if(this==ye)return Vt;if(e.inlineContent||!this.local.some(ut.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ut||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Z.empty=new Z([],[]);Z.removeOverlap=Bo;const ye=Z.empty;class rt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,St));return rt.from(r)}forChild(e,t){if(t.isLeaf)return Z.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=ye&&(o instanceof rt?r=r.concat(o.members):r.push(o))}return rt.from(r)}eq(e){if(!(e instanceof rt)||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?Bo(r?t:t.sort(Mt)):Vt}static from(e){switch(e.length){case 0:return ye;case 1:return e[0];default:return new rt(e.every(t=>t instanceof Z)?e:e.reduce((t,r)=>t.concat(r instanceof Z?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Wm(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 b=0;b<l.length;b+=3){let w=l[b+1];if(w<0||h>w+u-f)continue;let k=l[b]+u-f;p>=k?l[b+1]=h<=k?-2:-1:h>=u&&y&&(l[b]+=y,l[b+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 b=l[d+2].mapInner(t,y,u+1,n[d]+o+1,s);b!=ye?(l[d]=f,l[d+1]=p,l[d+2]=b):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=Km(l,n,e,t,i,o,s),u=ar(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 Z(e.sort(Mt),l)}function Ga(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 Km(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 Ya(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 Qa(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ar(n,e,t,r){let i=[],o=!1;e.forEach((l,c)=>{let d=Ya(n,l,c+t);if(d){o=!0;let u=ar(d,l,t+c+1,r);u!=ye&&i.push(c,c+l.nodeSize,u)}});let s=Ga(o?Qa(n):n,-t).sort(Mt);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 Z(s,i):ye}function Mt(n,e){return n.from-e.from||n.to-e.to}function Bo(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),Ks(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),Ks(e,i,r.copy(o.from,r.to)));break}}}return e}function Ks(n,e,t){for(;e<n.length&&Mt(t,n[e])>0;)e++;n.splice(e,0,t)}function bi(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=ye&&e.push(r)}),n.cursorWrapper&&e.push(Z.create(n.state.doc,[n.cursorWrapper.deco])),rt.from(e)}const Jm={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Gm=Se&&ct<=11;class Ym{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 Qm{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ym,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&&ct<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():ge&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Gm&&(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,Jm)),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(Ps(this.view)){if(this.suppressingSelectionUpdates)return Ye(this.view);if(Se&&ct<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&At(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)&&Ps(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(ze&&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||_m(e,f)!=p)&&h.remove()}}}else if((de||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&&Qr(r)&&(d=Co(e))&&d.eq(H.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ye(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Xm(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,eg(e,c)),this.handleDOMChange(o,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ye(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&&ct<=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?he(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),c=o&&o.parentNode==e.target?he(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 Js=new WeakMap,Gs=!1;function Xm(n){if(!Js.has(n)&&(Js.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=ze,Gs)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."),Gs=!0}}function Ys(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return At(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function Zm(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Ys(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?Ys(n,t):null}function _m(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 eg(n,e){var t;let{focusNode:r,focusOffset:i}=n.domSelectionRange();for(let o of e)if(((t=o.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=o.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(o,l.firstChild),r==o&&n.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}function tg(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}],Qr(c)||d.push({node:c.focusNode,offset:c.focusOffset})),de&&n.input.lastKeyCode===8)for(let y=o;y>i;y--){let b=r.childNodes[y-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){o=y;break}if(!w||w.size)break}let f=n.state.doc,h=n.someProp("domParser")||at.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:ng,context:p});if(d&&d[0].pos!=null){let y=d[0].pos,b=d[1]&&d[1].pos;b==null&&(b=y),m={anchor:y+s,head:b+s}}return{doc:g,sel:m,from:s,to:l}}function ng(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 rg=/^(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 ig(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let C=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,M=Co(n,C);if(M&&!n.state.selection.eq(M)){if(de&&Ge&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",I=>I(n,yt(13,"Enter"))))return;let A=n.state.tr.setSelection(M);C=="pointer"?A.setMeta("pointer",!0):C=="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=tg(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=lg(f.content,d.doc.content,d.from,h,p);if(m&&n.input.domChangeCount++,(Yt&&n.input.lastIOSEnter>Date.now()-225||Ge)&&i.some(C=>C.nodeType==1&&!rg.test(C.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",C=>C(n,yt(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 C=Qs(n,n.state.doc,d.sel);if(C&&!C.eq(n.state.selection)){let M=n.state.tr.setSelection(C);o&&M.setMeta("composition",o),n.dispatch(M)}}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&&ct<=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),b=u.resolve(m.start),w=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Yt&&n.input.lastIOSEnter>Date.now()-225&&(!w||i.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!w&&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",C=>C(n,yt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&sg(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",C=>C(n,yt(8,"Backspace")))){Ge&&de&&n.domObserver.suppressSelectionUpdates();return}de&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Ge&&!w&&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(C){return C(n,yt(13,"Enter"))})},20));let k=m.start,v=m.endA,x=C=>{let M=C||n.state.tr.replace(k,v,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let A=Qs(n,M.doc,d.sel);A&&!(de&&n.composing&&A.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(A.head==k||A.head==M.mapping.map(v)-1)||Se&&A.empty&&A.head==k)&&M.setSelection(A)}return o&&M.setMeta("composition",o),M.scrollIntoView()},S;if(w)if(g.pos==y.pos){Se&&ct<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ye(n),20));let C=x(n.state.tr.delete(k,v)),M=u.resolve(m.start).marksAcross(u.resolve(m.endA));M&&C.ensureMarks(M),n.dispatch(C)}else if(m.endA==m.endB&&(S=og(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let C=x(n.state.tr);S.type=="add"?C.addMark(k,v,S.mark):C.removeMark(k,v,S.mark),n.dispatch(C)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let C=g.parent.textBetween(g.parentOffset,y.parentOffset),M=()=>x(n.state.tr.insertText(C,k,v));n.someProp("handleTextInput",A=>A(n,k,v,C,M))||n.dispatch(M())}else n.dispatch(x());else n.dispatch(x())}function Qs(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:So(n,e.resolve(t.anchor),e.resolve(t.head))}function og(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 sg(n,e,t,r,i){if(t-e<=i.pos-r.pos||vi(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(vi(o,!0,!0));return!s.parent.isTextblock||s.pos>t||vi(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function vi(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 lg(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&&Xs(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&&Xs(n.textBetween(o-1,o+1))&&(o+=c?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function Xs(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 Xa{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 Cm,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(nl),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=el(this),_s(this),this.nodeViews=tl(this),this.docView=Is(this.state.doc,Zs(this),bi(this),this.dom,this),this.domObserver=new Qm(this,(r,i,o,s)=>ig(this,r,i,o,s)),this.domObserver.start(),Sm(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&&Qi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(nl),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&&(qa(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=tl(this);cg(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Qi(this),this.editable=el(this),_s(this);let c=bi(this),d=Zs(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&&Pp(this);if(s){this.domObserver.stop();let p=f&&(Se||de)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ag(i.selection,e.selection);if(f){let m=de?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Pm(this)),(o||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Is(e.doc,d,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&am(this))?Ye(this,p):(Ia(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&&Vp(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&&Ts(this,t.getBoundingClientRect(),e)}else Ts(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 Ka(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&&Fp(this.dom),Ye(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 Wp(this,e)}coordsAtPos(e,t=1){return Sa(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 Qp(this,t||this.state,e)}pasteHTML(e,t){return Mn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Mn(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Mo(this,e)}destroy(){this.docView&&(Mm(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Np())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Em(this,e)}domSelectionRange(){let e=this.domSelection();return e?ge&&this.root.nodeType===11&&Dp(this.dom.ownerDocument)==this.dom&&Zm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Xa.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Zs(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 _s(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 el(n){return!n.someProp("editable",e=>e(n.state)===!1)}function ag(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 tl(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 cg(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 nl(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 ft={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:"'"},cr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},dg=typeof navigator<"u"&&/Mac/.test(navigator.platform),ug=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var pe=0;pe<10;pe++)ft[48+pe]=ft[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)ft[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)ft[pe]=String.fromCharCode(pe+32),cr[pe]=String.fromCharCode(pe);for(var xi in ft)cr.hasOwnProperty(xi)||(cr[xi]=ft[xi]);function fg(n){var e=dg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ug&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?cr:ft)[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 hg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),pg=typeof navigator<"u"&&/Win/.test(navigator.platform);function mg(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))hg?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 gg(n){let e=Object.create(null);for(let t in n)e[mg(t)]=n[t];return e}function wi(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 yg(n){return new _({props:{handleKeyDown:Za(n)}})}function Za(n){let e=gg(n);return function(t,r){let i=fg(r),o,s=e[wi(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[wi(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(pg&&r.ctrlKey&&r.altKey)&&(o=ft[r.keyCode])&&o!=i){let l=e[wi(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var kg=Object.defineProperty,Oo=(n,e)=>{for(var t in e)kg(n,t,{get:e[t],enumerable:!0})};function _r(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 ei=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:_r({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}},_a={};Oo(_a,{blur:()=>bg,clearContent:()=>vg,clearNodes:()=>xg,command:()=>wg,createParagraphNear:()=>Cg,cut:()=>Sg,deleteCurrentNode:()=>Mg,deleteNode:()=>Tg,deleteRange:()=>Eg,deleteSelection:()=>Ng,enter:()=>Ag,exitCode:()=>Bg,extendMarkRange:()=>Og,first:()=>Ig,focus:()=>$g,forEach:()=>Rg,insertContent:()=>Lg,insertContentAt:()=>Vg,joinBackward:()=>jg,joinDown:()=>Hg,joinForward:()=>Ug,joinItemBackward:()=>qg,joinItemForward:()=>Wg,joinTextblockBackward:()=>Kg,joinTextblockForward:()=>Jg,joinUp:()=>Fg,keyboardShortcut:()=>Yg,lift:()=>Qg,liftEmptyBlock:()=>Xg,liftListItem:()=>Zg,newlineInCode:()=>_g,resetAttributes:()=>ey,scrollIntoView:()=>ty,selectAll:()=>ny,selectNodeBackward:()=>ry,selectNodeForward:()=>iy,selectParentNode:()=>oy,selectTextblockEnd:()=>sy,selectTextblockStart:()=>ly,setContent:()=>ay,setMark:()=>Ny,setMeta:()=>Ay,setNode:()=>By,setNodeSelection:()=>Oy,setTextDirection:()=>Iy,setTextSelection:()=>Dy,sinkListItem:()=>$y,splitBlock:()=>Ry,splitListItem:()=>Ly,toggleList:()=>zy,toggleMark:()=>Py,toggleNode:()=>Vy,toggleWrap:()=>Fy,undoInputRule:()=>Hy,unsetAllMarks:()=>jy,unsetMark:()=>Uy,unsetTextDirection:()=>qy,updateAttributes:()=>Wy,wrapIn:()=>Ky,wrapInList:()=>Jy});var bg=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),vg=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),xg=()=>({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},wg=n=>e=>n(e),Cg=()=>({state:n,dispatch:e})=>pp(n,e),Sg=(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 ie(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 Tg=n=>({tr:e,state:t,dispatch:r})=>{const i=ie(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},Eg=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},Ng=()=>({state:n,dispatch:e})=>np(n,e),Ag=()=>({commands:n})=>n.keyboardShortcut("Enter"),Bg=()=>({state:n,dispatch:e})=>hp(n,e);function Io(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function dr(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Io(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function ec(n,e,t={}){return n.find(r=>r.type===e&&dr(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function rl(n,e,t={}){return!!ec(n,e,t)}function Do(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),!ec([...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&&rl([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;c<n.parent.childCount&&rl([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Qe(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 Og=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Qe(n,r.schema),{doc:s,selection:l}=t,{$from:c,from:d,to:u}=l;if(i){const f=Do(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},Ig=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 tc(n){return n instanceof V}function vt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function nc(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,vt(0,i,o),vt(n.content.size,i,o)):V.create(n,vt(e,i,o),vt(e,i,o))}function il(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ur(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Dg(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var $g=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(ur()||il())&&r.dom.focus(),Dg()&&!ur()&&!il()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!tc(t.state.selection))return s(),!0;const l=nc(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},Rg=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),Lg=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),rc=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&&rc(r)}return n};function Vn(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 rc(t)}function En(n,e,t){if(n instanceof Le||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),En("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,l="";const c=new Kl({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?at.fromSchema(c).parseSlice(Vn(n),t.parseOptions):at.fromSchema(c).parse(Vn(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=at.fromSchema(e);return t.slice?o.parseSlice(Vn(n),t.parseOptions).content:o.parse(Vn(n),t.parseOptions)}return En("",e,t)}function zg(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof ce||i instanceof ue))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 Pg=n=>!("type"in n),Vg=(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{En(e,o.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{l=En(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((Pg(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(b=>{b.text&&(y+=b.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),b=y.node(),w=y.parentOffset===0,k=b.isText||b.isTextblock,v=b.content.size>0;w&&k&&v&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g)}t.updateSelection&&zg(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},Fg=()=>({state:n,dispatch:e})=>cp(n,e),Hg=()=>({state:n,dispatch:e})=>dp(n,e),jg=()=>({state:n,dispatch:e})=>rp(n,e),Ug=()=>({state:n,dispatch:e})=>lp(n,e),qg=()=>({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}},Wg=()=>({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}},Kg=()=>({state:n,dispatch:e})=>ip(n,e),Jg=()=>({state:n,dispatch:e})=>op(n,e);function ic(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Gg(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))ur()||ic()?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 Yg=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=Gg(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 ht(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?ie(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=>dr(f.node.attrs,t,{strict:!1}));return o?!!d.length:d.reduce((f,h)=>f+h.to-h.from,0)>=c}var Qg=(n,e={})=>({state:t,dispatch:r})=>{const i=ie(n,t.schema);return ht(t,i,e)?up(t,r):!1},Xg=()=>({state:n,dispatch:e})=>mp(n,e),Zg=n=>({state:e,dispatch:t})=>{const r=ie(n,e.schema);return Sp(r)(e,t)},_g=()=>({state:n,dispatch:e})=>fp(n,e);function ti(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function ol(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 ey=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=ti(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(o=ie(n,r.schema)),l==="mark"&&(s=Qe(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,ol(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(ol(h.attrs,e))))})})}),c},ty=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),ny=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ie(n.doc);n.setSelection(t)}return!0},ry=()=>({state:n,dispatch:e})=>sp(n,e),iy=()=>({state:n,dispatch:e})=>ap(n,e),oy=()=>({state:n,dispatch:e})=>gp(n,e),sy=()=>({state:n,dispatch:e})=>bp(n,e),ly=()=>({state:n,dispatch:e})=>kp(n,e);function Xi(n,e,t={},r={}){return En(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var ay=(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=Xi(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 oc(n,e){const t=Qe(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 sc(n,e){const t=new aa(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function cy(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 dy(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function uy(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 ni(n){return e=>uy(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 $o(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=z(e,"addExtensions",t);return r?[e,...$o(r())]:e}).flat(10)}function Ro(n,e){const t=It.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function lc(n){return typeof n=="function"}function G(n,e=void 0,...t){return lc(n)?e?n.bind(e)(...t):n(...t):n}function fy(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 ac(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 oe(...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 Nn(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)=>oe(t,r),{})}function hy(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function sl(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):hy(t.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function ll(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&fy(t)?!1:t!=null))}function al(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 py(n,e){var t;const r=ac(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(b=>b.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=n.reduce((b,w)=>{const k=z(w,"extendNodeSchema",f);return{...b,...k?k(d):{}}},{}),p=ll({...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(al))}),m=G(z(d,"parseHTML",f));m&&(p.parseDOM=m.map(b=>sl(b,u)));const g=z(d,"renderHTML",f);g&&(p.toDOM=b=>g({node:b,HTMLAttributes:Nn(b,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,b)=>{const w=z(b,"extendMarkSchema",f);return{...y,...w?w(d):{}}},{}),p=ll({...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(al))}),m=G(z(d,"parseHTML",f));m&&(p.parseDOM=m.map(y=>sl(y,u)));const g=z(d,"renderHTML",f);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:Nn(y,u)})),[d.name,p]}));return new Kl({topNode:s,nodes:l,marks:c})}function my(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function fr(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 cc(n){const e=fr($o(n)),t=my(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 dc(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=It.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=bm(t),In&&vm(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")||at.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!gm.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=xm(qs(l,+u[1],+u[2]),u[4]);else if(l=B.maxOpen(ym(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=qs(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,c)}),l}const gm=/^(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 ym(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&&za(c,o,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Pa(s[s.length-1],o.length));let u=La(l,c);s.push(u),i=i.matchType(u.type),o=c}}),s)return T.from(s)}return n}function La(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,T.from(n));return n}function za(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=za(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(La(t,n,i+1))))}}function Pa(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Pa(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(T.empty,!0);return n.copy(t.append(r))}function Yi(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=Yi(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 qs(n,e,t){return e<n.openStart&&(n=new B(Yi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new B(Yi(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Va={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 Ws=null;function Fa(){return Ws||(Ws=document.implementation.createHTMLDocument("title"))}let ki=null;function km(n){let e=window.trustedTypes;return e?(ki||(ki=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ki.createHTML(n)):n}function bm(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Fa().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Va[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=km(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function vm(n){let e=n.querySelectorAll(de?"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 xm(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={},wm={touchstart:!0,touchmove:!0};class Cm{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Sm(n){for(let e in ve){let t=ve[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Tm(n,r)&&!To(n,r)&&(n.editable||!(r.type in xe))&&t(n,r)},wm[e]?{passive:!0}:void 0)}ge&&n.dom.addEventListener("input",()=>null),Qi(n)}function lt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Mm(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 Qi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>To(n,r))})}function To(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Tm(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 Em(n,e){!To(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,!ja(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ge&&de&&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,yt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||mm(n,t)?t.preventDefault():lt(n,"key")};xe.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};xe.keypress=(n,e)=>{let t=e;if(ja(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Be&&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 Zr(n){return{left:n.clientX,top:n.clientY}}function Nm(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Eo(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 Wt(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 Am(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&P.isSelectable(r)?(Wt(n,new P(t)),!0):!1}function Bm(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?(Wt(n,P.create(n.state.doc,i)),!0):!1}function Om(n,e,t,r,i){return Eo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?Bm(n,t):Am(n,t))}function Im(n,e,t,r){return Eo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Dm(n,e,t,r){return Eo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||$m(n,t,r)}function $m(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Wt(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)Wt(n,V.create(r,l+1,l+1+s.content.size));else if(P.isSelectable(s))Wt(n,P.create(r,l));else continue;return!0}}function No(n){return sr(n)}const Ha=Be?"metaKey":"ctrlKey";ve.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=No(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&Nm(t,n.input.lastClick)&&!t[Ha]&&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(Zr(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Rm(n,s,t,!!r)):(o=="doubleClick"?Im:Dm)(n,s.pos,s.inside,t)?t.preventDefault():lt(n,"pointer"))};class Rm{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[Ha],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&&ze&&!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)),lt(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(()=>Ye(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(Zr(e))),this.updateAllowDefault(e),this.allowDefault||!t?lt(this.view,"pointer"):Om(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ge&&this.mightDrag&&!this.mightDrag.node.isAtom||de&&!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)?(Wt(this.view,U.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):lt(this.view,"pointer")}move(e){this.updateAllowDefault(e),lt(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(),No(n),lt(n,"pointer")};ve.touchmove=n=>{n.input.lastTouch=Date.now(),lt(n,"pointer")};ve.contextmenu=n=>No(n);function ja(n,e){return n.composing?!0:ge&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Lm=Ge?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)||de&&ba&&zm(n)))n.markCursor=n.state.storedMarks||t.marks(),sr(n,!0),n.markCursor=null;else if(sr(n,!e.selection.empty),ze&&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}Ua(n,Lm)};function zm(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.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Ua(n,20))};function Ua(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>sr(n),e))}function qa(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Vm());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Pm(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Bp(e.focusNode,e.focusOffset),r=Op(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 Vm(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function sr(n,e=!1){if(!(Ge&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),qa(n),e||n.docView&&n.docView.dirty){let t=Co(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 Fm(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 Sn=Se&&ct<15||Yt&&Rp<604;ve.copy=xe.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Sn?null:t.clipboardData,s=r.content(),{dom:l,text:c}=Mo(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",c)):Fm(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Hm(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function jm(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?Mn(n,r.value,null,i,e):Mn(n,r.textContent,r.innerHTML,i,e)},50)}function Mn(n,e,t,r,i){let o=Ra(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=Hm(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 Wa(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&&!Ge)return;let r=Sn?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Mn(n,Wa(r),r.getData("text/html"),i,t)?t.preventDefault():jm(n,t)};class Ka{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Um=Be?"altKey":"ctrlKey";function Ja(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[Um]}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(Zr(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}=Mo(n,l);(!t.dataTransfer.files.length||!de||ka>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Sn?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Sn||t.dataTransfer.setData("text/plain",d),n.dragging=new Ka(u,Ja(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{qm(n,e,n.dragging)}finally{n.dragging=null}};function qm(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Zr(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=Ra(n,Wa(e.dataTransfer),Sn?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(t&&Ja(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?ra(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,b)=>p=b),c.setSelection(So(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())&&Ye(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(de&&Ge&&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,yt(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 Tn(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 lr{constructor(e,t){this.toDOM=e,this.spec=t||St,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 lr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Tn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ut{constructor(e,t){this.attrs=e,this.spec=t||St}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 ut&&Tn(this.attrs,e.attrs)&&Tn(this.spec,e.spec)}static is(e){return e.type instanceof ut}destroy(){}}class Ao{constructor(e,t){this.attrs=e,this.spec=t||St}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 Ao&&Tn(this.attrs,e.attrs)&&Tn(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 lr(t,r))}static inline(e,t,r,i){return new be(e,t,new ut(r,i))}static node(e,t,r,i){return new be(e,t,new Ao(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ut}get widget(){return this.type instanceof lr}}const Vt=[],St={};class Z{constructor(e,t){this.local=e.length?e:Vt,this.children=t.length?t:Vt}static create(e,t){return t.length?ar(t,e,0,St):ye}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==ye||e.maps.length==0?this:this.mapInner(e,t,0,0,r||St)}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?Wm(this.children,s||[],e,t,r,i,o):s?new Z(s.sort(Mt),Vt):ye}add(e,t){return t.length?this==ye?Z.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=Ya(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,ar(u,l,d+1,St)),o+=3}});let s=Ga(o?Qa(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new Z(s.length?this.local.concat(s).sort(Mt):this.local,i||this.children)}remove(e){return e.length==0||this==ye?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!=ye?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 Z(i,r):ye}forChild(e,t){if(this==ye)return this;if(t.isLeaf)return Z.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 ut){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 Z(i.sort(Mt),Vt);return r?new rt([l,r]):l}return r||ye}eq(e){if(this==e)return!0;if(!(e instanceof Z)||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 Bo(this.localsInner(e))}localsInner(e){if(this==ye)return Vt;if(e.inlineContent||!this.local.some(ut.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ut||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Z.empty=new Z([],[]);Z.removeOverlap=Bo;const ye=Z.empty;class rt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,St));return rt.from(r)}forChild(e,t){if(t.isLeaf)return Z.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=ye&&(o instanceof rt?r=r.concat(o.members):r.push(o))}return rt.from(r)}eq(e){if(!(e instanceof rt)||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?Bo(r?t:t.sort(Mt)):Vt}static from(e){switch(e.length){case 0:return ye;case 1:return e[0];default:return new rt(e.every(t=>t instanceof Z)?e:e.reduce((t,r)=>t.concat(r instanceof Z?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Wm(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 b=0;b<l.length;b+=3){let C=l[b+1];if(C<0||h>C+u-f)continue;let v=l[b]+u-f;p>=v?l[b+1]=h<=v?-2:-1:h>=u&&y&&(l[b]+=y,l[b+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 b=l[d+2].mapInner(t,y,u+1,n[d]+o+1,s);b!=ye?(l[d]=f,l[d+1]=p,l[d+2]=b):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=Km(l,n,e,t,i,o,s),u=ar(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 Z(e.sort(Mt),l)}function Ga(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 Km(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 Ya(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 Qa(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ar(n,e,t,r){let i=[],o=!1;e.forEach((l,c)=>{let d=Ya(n,l,c+t);if(d){o=!0;let u=ar(d,l,t+c+1,r);u!=ye&&i.push(c,c+l.nodeSize,u)}});let s=Ga(o?Qa(n):n,-t).sort(Mt);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 Z(s,i):ye}function Mt(n,e){return n.from-e.from||n.to-e.to}function Bo(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),Ks(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),Ks(e,i,r.copy(o.from,r.to)));break}}}return e}function Ks(n,e,t){for(;e<n.length&&Mt(t,n[e])>0;)e++;n.splice(e,0,t)}function bi(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=ye&&e.push(r)}),n.cursorWrapper&&e.push(Z.create(n.state.doc,[n.cursorWrapper.deco])),rt.from(e)}const Jm={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Gm=Se&&ct<=11;class Ym{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 Qm{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ym,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&&ct<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():ge&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Gm&&(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,Jm)),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(Ps(this.view)){if(this.suppressingSelectionUpdates)return Ye(this.view);if(Se&&ct<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&At(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)&&Ps(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(ze&&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||_m(e,f)!=p)&&h.remove()}}}else if((de||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&&Qr(r)&&(d=Co(e))&&d.eq(U.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ye(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Xm(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,eg(e,c)),this.handleDOMChange(o,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ye(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&&ct<=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?he(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),c=o&&o.parentNode==e.target?he(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 Js=new WeakMap,Gs=!1;function Xm(n){if(!Js.has(n)&&(Js.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=ze,Gs)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."),Gs=!0}}function Ys(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return At(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function Zm(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Ys(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?Ys(n,t):null}function _m(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 eg(n,e){var t;let{focusNode:r,focusOffset:i}=n.domSelectionRange();for(let o of e)if(((t=o.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=o.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(o,l.firstChild),r==o&&n.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}function tg(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}],Qr(c)||d.push({node:c.focusNode,offset:c.focusOffset})),de&&n.input.lastKeyCode===8)for(let y=o;y>i;y--){let b=r.childNodes[y-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){o=y;break}if(!C||C.size)break}let f=n.state.doc,h=n.someProp("domParser")||at.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:ng,context:p});if(d&&d[0].pos!=null){let y=d[0].pos,b=d[1]&&d[1].pos;b==null&&(b=y),m={anchor:y+s,head:b+s}}return{doc:g,sel:m,from:s,to:l}}function ng(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 rg=/^(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 ig(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let w=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,M=Co(n,w);if(M&&!n.state.selection.eq(M)){if(de&&Ge&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",O=>O(n,yt(13,"Enter"))))return;let A=n.state.tr.setSelection(M);w=="pointer"?A.setMeta("pointer",!0):w=="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=tg(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=lg(f.content,d.doc.content,d.from,h,p);if(m&&n.input.domChangeCount++,(Yt&&n.input.lastIOSEnter>Date.now()-225||Ge)&&i.some(w=>w.nodeType==1&&!rg.test(w.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",w=>w(n,yt(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 w=Qs(n,n.state.doc,d.sel);if(w&&!w.eq(n.state.selection)){let M=n.state.tr.setSelection(w);o&&M.setMeta("composition",o),n.dispatch(M)}}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&&ct<=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),b=u.resolve(m.start),C=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Yt&&n.input.lastIOSEnter>Date.now()-225&&(!C||i.some(w=>w.nodeName=="DIV"||w.nodeName=="P"))||!C&&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",w=>w(n,yt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&sg(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",w=>w(n,yt(8,"Backspace")))){Ge&&de&&n.domObserver.suppressSelectionUpdates();return}de&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Ge&&!C&&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(w){return w(n,yt(13,"Enter"))})},20));let v=m.start,k=m.endA,x=w=>{let M=w||n.state.tr.replace(v,k,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let A=Qs(n,M.doc,d.sel);A&&!(de&&n.composing&&A.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(A.head==v||A.head==M.mapping.map(k)-1)||Se&&A.empty&&A.head==v)&&M.setSelection(A)}return o&&M.setMeta("composition",o),M.scrollIntoView()},S;if(C)if(g.pos==y.pos){Se&&ct<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ye(n),20));let w=x(n.state.tr.delete(v,k)),M=u.resolve(m.start).marksAcross(u.resolve(m.endA));M&&w.ensureMarks(M),n.dispatch(w)}else if(m.endA==m.endB&&(S=og(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let w=x(n.state.tr);S.type=="add"?w.addMark(v,k,S.mark):w.removeMark(v,k,S.mark),n.dispatch(w)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let w=g.parent.textBetween(g.parentOffset,y.parentOffset),M=()=>x(n.state.tr.insertText(w,v,k));n.someProp("handleTextInput",A=>A(n,v,k,w,M))||n.dispatch(M())}else n.dispatch(x());else n.dispatch(x())}function Qs(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:So(n,e.resolve(t.anchor),e.resolve(t.head))}function og(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 sg(n,e,t,r,i){if(t-e<=i.pos-r.pos||vi(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(vi(o,!0,!0));return!s.parent.isTextblock||s.pos>t||vi(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function vi(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 lg(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&&Xs(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&&Xs(n.textBetween(o-1,o+1))&&(o+=c?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function Xs(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 Xa{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 Cm,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(nl),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=el(this),_s(this),this.nodeViews=tl(this),this.docView=Is(this.state.doc,Zs(this),bi(this),this.dom,this),this.domObserver=new Qm(this,(r,i,o,s)=>ig(this,r,i,o,s)),this.domObserver.start(),Sm(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&&Qi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(nl),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&&(qa(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=tl(this);cg(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Qi(this),this.editable=el(this),_s(this);let c=bi(this),d=Zs(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&&Pp(this);if(s){this.domObserver.stop();let p=f&&(Se||de)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ag(i.selection,e.selection);if(f){let m=de?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Pm(this)),(o||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Is(e.doc,d,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&am(this))?Ye(this,p):(Ia(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&&Vp(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&&Ts(this,t.getBoundingClientRect(),e)}else Ts(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 Ka(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&&Fp(this.dom),Ye(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 Wp(this,e)}coordsAtPos(e,t=1){return Sa(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 Qp(this,t||this.state,e)}pasteHTML(e,t){return Mn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Mn(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Mo(this,e)}destroy(){this.docView&&(Mm(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Np())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Em(this,e)}domSelectionRange(){let e=this.domSelection();return e?ge&&this.root.nodeType===11&&Dp(this.dom.ownerDocument)==this.dom&&Zm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Xa.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Zs(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 _s(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 el(n){return!n.someProp("editable",e=>e(n.state)===!1)}function ag(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 tl(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 cg(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 nl(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 ft={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:"'"},cr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},dg=typeof navigator<"u"&&/Mac/.test(navigator.platform),ug=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var pe=0;pe<10;pe++)ft[48+pe]=ft[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)ft[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)ft[pe]=String.fromCharCode(pe+32),cr[pe]=String.fromCharCode(pe);for(var xi in ft)cr.hasOwnProperty(xi)||(cr[xi]=ft[xi]);function fg(n){var e=dg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ug&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?cr:ft)[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 hg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),pg=typeof navigator<"u"&&/Win/.test(navigator.platform);function mg(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))hg?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 gg(n){let e=Object.create(null);for(let t in n)e[mg(t)]=n[t];return e}function wi(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 yg(n){return new _({props:{handleKeyDown:Za(n)}})}function Za(n){let e=gg(n);return function(t,r){let i=fg(r),o,s=e[wi(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[wi(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(pg&&r.ctrlKey&&r.altKey)&&(o=ft[r.keyCode])&&o!=i){let l=e[wi(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var kg=Object.defineProperty,Oo=(n,e)=>{for(var t in e)kg(n,t,{get:e[t],enumerable:!0})};function _r(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 ei=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:_r({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}},_a={};Oo(_a,{blur:()=>bg,clearContent:()=>vg,clearNodes:()=>xg,command:()=>wg,createParagraphNear:()=>Cg,cut:()=>Sg,deleteCurrentNode:()=>Mg,deleteNode:()=>Tg,deleteRange:()=>Eg,deleteSelection:()=>Ng,enter:()=>Ag,exitCode:()=>Bg,extendMarkRange:()=>Og,first:()=>Ig,focus:()=>$g,forEach:()=>Rg,insertContent:()=>Lg,insertContentAt:()=>Vg,joinBackward:()=>jg,joinDown:()=>Hg,joinForward:()=>Ug,joinItemBackward:()=>qg,joinItemForward:()=>Wg,joinTextblockBackward:()=>Kg,joinTextblockForward:()=>Jg,joinUp:()=>Fg,keyboardShortcut:()=>Yg,lift:()=>Qg,liftEmptyBlock:()=>Xg,liftListItem:()=>Zg,newlineInCode:()=>_g,resetAttributes:()=>ey,scrollIntoView:()=>ty,selectAll:()=>ny,selectNodeBackward:()=>ry,selectNodeForward:()=>iy,selectParentNode:()=>oy,selectTextblockEnd:()=>sy,selectTextblockStart:()=>ly,setContent:()=>ay,setMark:()=>Ny,setMeta:()=>Ay,setNode:()=>By,setNodeSelection:()=>Oy,setTextDirection:()=>Iy,setTextSelection:()=>Dy,sinkListItem:()=>$y,splitBlock:()=>Ry,splitListItem:()=>Ly,toggleList:()=>zy,toggleMark:()=>Py,toggleNode:()=>Vy,toggleWrap:()=>Fy,undoInputRule:()=>Hy,unsetAllMarks:()=>jy,unsetMark:()=>Uy,unsetTextDirection:()=>qy,updateAttributes:()=>Wy,wrapIn:()=>Ky,wrapInList:()=>Jy});var bg=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),vg=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),xg=()=>({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},wg=n=>e=>n(e),Cg=()=>({state:n,dispatch:e})=>pp(n,e),Sg=(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 ie(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 Tg=n=>({tr:e,state:t,dispatch:r})=>{const i=ie(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},Eg=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},Ng=()=>({state:n,dispatch:e})=>np(n,e),Ag=()=>({commands:n})=>n.keyboardShortcut("Enter"),Bg=()=>({state:n,dispatch:e})=>hp(n,e);function Io(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function dr(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Io(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function ec(n,e,t={}){return n.find(r=>r.type===e&&dr(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function rl(n,e,t={}){return!!ec(n,e,t)}function Do(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),!ec([...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&&rl([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;c<n.parent.childCount&&rl([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Qe(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 Og=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Qe(n,r.schema),{doc:s,selection:l}=t,{$from:c,from:d,to:u}=l;if(i){const f=Do(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},Ig=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 tc(n){return n instanceof V}function vt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function nc(n,e=null){if(!e)return null;const t=U.atStart(n),r=U.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,vt(0,i,o),vt(n.content.size,i,o)):V.create(n,vt(e,i,o),vt(e,i,o))}function il(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ur(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Dg(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var $g=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(ur()||il())&&r.dom.focus(),Dg()&&!ur()&&!il()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!tc(t.state.selection))return s(),!0;const l=nc(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},Rg=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),Lg=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),rc=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&&rc(r)}return n};function Vn(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 rc(t)}function En(n,e,t){if(n instanceof Le||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),En("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,l="";const c=new Kl({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?at.fromSchema(c).parseSlice(Vn(n),t.parseOptions):at.fromSchema(c).parse(Vn(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=at.fromSchema(e);return t.slice?o.parseSlice(Vn(n),t.parseOptions).content:o.parse(Vn(n),t.parseOptions)}return En("",e,t)}function zg(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof ce||i instanceof ue))return;const o=n.mapping.maps[r];let s=0;o.forEach((l,c,d,u)=>{s===0&&(s=u)}),n.setSelection(U.near(n.doc.resolve(s),t))}var Pg=n=>!("type"in n),Vg=(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{En(e,o.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{l=En(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((Pg(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(b=>{b.text&&(y+=b.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),b=y.node(),C=y.parentOffset===0,v=b.isText||b.isTextblock,k=b.content.size>0;C&&v&&k&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g)}t.updateSelection&&zg(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},Fg=()=>({state:n,dispatch:e})=>cp(n,e),Hg=()=>({state:n,dispatch:e})=>dp(n,e),jg=()=>({state:n,dispatch:e})=>rp(n,e),Ug=()=>({state:n,dispatch:e})=>lp(n,e),qg=()=>({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}},Wg=()=>({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}},Kg=()=>({state:n,dispatch:e})=>ip(n,e),Jg=()=>({state:n,dispatch:e})=>op(n,e);function ic(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Gg(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))ur()||ic()?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 Yg=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=Gg(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 ht(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?ie(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=>dr(f.node.attrs,t,{strict:!1}));return o?!!d.length:d.reduce((f,h)=>f+h.to-h.from,0)>=c}var Qg=(n,e={})=>({state:t,dispatch:r})=>{const i=ie(n,t.schema);return ht(t,i,e)?up(t,r):!1},Xg=()=>({state:n,dispatch:e})=>mp(n,e),Zg=n=>({state:e,dispatch:t})=>{const r=ie(n,e.schema);return Sp(r)(e,t)},_g=()=>({state:n,dispatch:e})=>fp(n,e);function ti(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function ol(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 ey=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=ti(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(o=ie(n,r.schema)),l==="mark"&&(s=Qe(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,ol(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(ol(h.attrs,e))))})})}),c},ty=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),ny=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ie(n.doc);n.setSelection(t)}return!0},ry=()=>({state:n,dispatch:e})=>sp(n,e),iy=()=>({state:n,dispatch:e})=>ap(n,e),oy=()=>({state:n,dispatch:e})=>gp(n,e),sy=()=>({state:n,dispatch:e})=>bp(n,e),ly=()=>({state:n,dispatch:e})=>kp(n,e);function Xi(n,e,t={},r={}){return En(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var ay=(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=Xi(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 oc(n,e){const t=Qe(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 sc(n,e){const t=new aa(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function cy(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 dy(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function uy(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 ni(n){return e=>uy(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 $o(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=z(e,"addExtensions",t);return r?[e,...$o(r())]:e}).flat(10)}function Ro(n,e){const t=It.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function lc(n){return typeof n=="function"}function Y(n,e=void 0,...t){return lc(n)?e?n.bind(e)(...t):n(...t):n}function fy(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 ac(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 oe(...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 Nn(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)=>oe(t,r),{})}function hy(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function sl(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):hy(t.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function ll(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&fy(t)?!1:t!=null))}function al(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 py(n,e){var t;const r=ac(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(b=>b.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=n.reduce((b,C)=>{const v=z(C,"extendNodeSchema",f);return{...b,...v?v(d):{}}},{}),p=ll({...h,content:Y(z(d,"content",f)),marks:Y(z(d,"marks",f)),group:Y(z(d,"group",f)),inline:Y(z(d,"inline",f)),atom:Y(z(d,"atom",f)),selectable:Y(z(d,"selectable",f)),draggable:Y(z(d,"draggable",f)),code:Y(z(d,"code",f)),whitespace:Y(z(d,"whitespace",f)),linebreakReplacement:Y(z(d,"linebreakReplacement",f)),defining:Y(z(d,"defining",f)),isolating:Y(z(d,"isolating",f)),attrs:Object.fromEntries(u.map(al))}),m=Y(z(d,"parseHTML",f));m&&(p.parseDOM=m.map(b=>sl(b,u)));const g=z(d,"renderHTML",f);g&&(p.toDOM=b=>g({node:b,HTMLAttributes:Nn(b,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,b)=>{const C=z(b,"extendMarkSchema",f);return{...y,...C?C(d):{}}},{}),p=ll({...h,inclusive:Y(z(d,"inclusive",f)),excludes:Y(z(d,"excludes",f)),group:Y(z(d,"group",f)),spanning:Y(z(d,"spanning",f)),code:Y(z(d,"code",f)),attrs:Object.fromEntries(u.map(al))}),m=Y(z(d,"parseHTML",f));m&&(p.parseDOM=m.map(y=>sl(y,u)));const g=z(d,"renderHTML",f);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:Nn(y,u)})),[d.name,p]}));return new Kl({topNode:s,nodes:l,marks:c})}function my(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function fr(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 cc(n){const e=fr($o(n)),t=my(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 dc(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 gy(n,e){const t={from:0,to:n.content.size};return dc(n,t,e)}function uc(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function yy(n,e){const t=ie(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 fc(n,e){const t=ti(typeof e=="string"?e:e.name,n.schema);return t==="node"?yy(n,e):t==="mark"?oc(n,e):{}}function ky(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 by(n){const e=ky(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 hc(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}})})}),by(r)}function Lo(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=Do(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 vy=(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 Fn(n,e){return e.nodes[n]||e.marks[n]||null}function Qn(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 xy=(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 Zi(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Qe(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>dr(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 b=Math.max(p,y),w=Math.min(m,y+g.nodeSize),k=w-b;s+=k,l.push(...g.marks.map(v=>({mark:v,from:b,to:w})))})}),s===0)return!1;const c=l.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>dr(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 wy(n,e,t={}){if(!e)return ht(n,null,t)||Zi(n,null,t);const r=ti(e,n.schema);return r==="node"?ht(n,e,t):r==="mark"?Zi(n,e,t):!1}var Cy=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const o=ni(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)},Sy=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function cl(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function dl(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 ri(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&&(ri(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function pc(n){return n instanceof P}var mc=class gc{constructor(e){this.position=e}static fromJSON(e){return new gc(e.position)}toJSON(){return{position:this.position}}};function My(n,e){const t=e.mapping.mapResult(n.position);return{position:new mc(t.pos),mapResult:t}}function Ty(n){return new mc(n)}function Ey(n,e,t){var r;const{selection:i}=e;let o=null;if(tc(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 Ny=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:l}=o,c=Qe(n,r.schema);if(i)if(s){const d=oc(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(b=>b.type===c)?h.marks.forEach(b=>{c===b.type&&t.addMark(m,g,c.create({...b.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return Ey(r,t,c)},Ay=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),By=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=ie(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})=>Cs(o,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Cs(o,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Oy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=vt(n,0,r.content.size),o=P.create(r,i);e.setSelection(o)}return!0},Iy=(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},Dy=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=vt(i,s,l),d=vt(o,s,l),u=V.create(r,c,d);e.setSelection(u)}return!0},$y=n=>({state:e,dispatch:t})=>{const r=ie(n,e.schema);return Ep(r)(e,t)};function ul(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 Ry=({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=Qn(d,l.node().type.name,l.node().attrs);if(o instanceof P&&o.node.isBlock)return!l.parentOffset||!Ut(s,l.pos)?!1:(r&&(n&&ul(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:cy(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=Ut(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&Ut(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&&ul(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},Ly=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const l=ie(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 b=T.empty;const w=c.index(-1)?1:c.index(-2)?2:3;for(let M=c.depth-w;M>=c.depth-3;M-=1)b=T.from(c.node(M).copy(b));const k=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,v={...Qn(h,c.node().type.name,c.node().attrs),...e},x=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(v))||void 0;b=b.append(T.from(l.createAndFill(null,x)||void 0));const S=c.before(c.depth-(w-1));t.replace(S,c.after(-k),new B(b,4-w,0));let C=-1;t.doc.nodesBetween(S,t.doc.content.size,(M,A)=>{if(C>-1)return!1;M.isTextblock&&M.content.size===0&&(C=A+1)}),C>-1&&t.setSelection(V.near(t.doc.resolve(C))),t.scrollIntoView()}return!0}const p=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Qn(h,f.type.name,f.attrs),...e},g={...Qn(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(!Ut(t.doc,c.pos,2))return!1;if(i){const{selection:b,storedMarks:w}=r,{splittableMarks:k}=o.extensionManager,v=w||b.$to.parentOffset&&b.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!v||!i)return!0;const x=v.filter(S=>k.includes(S.type.name));t.ensureMarks(x)}return!0},Ci=(n,e)=>{const t=ni(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&&pt(n.doc,t.pos)&&n.join(t.pos),!0},Si=(n,e)=>{const t=ni(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&&pt(n.doc,r)&&n.join(r),!0},zy=(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=ie(n,s.schema),m=ie(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:w}=g,k=b.blockRange(w),v=y||g.$to.parentOffset&&g.$from.marks();if(!k)return!1;const x=ni(S=>dl(S.type.name,f))(g);if(k.depth>=1&&x&&k.depth-x.depth<=1){if(x.node.type===p)return d.liftListItem(m);if(dl(x.node.type.name,f)&&p.validContent(x.node.content)&&l)return c().command(()=>(o.setNodeMarkup(x.pos,p),!0)).command(()=>Ci(o,p)).command(()=>Si(o,p)).run()}return!t||!v||!l?c().command(()=>u().wrapInList(p,r)?!0:d.clearNodes()).wrapInList(p,r).command(()=>Ci(o,p)).command(()=>Si(o,p)).run():c().command(()=>{const S=u().wrapInList(p,r),C=v.filter(M=>h.includes(M.type.name));return o.ensureMarks(C),S?!0:d.clearNodes()}).wrapInList(p,r).command(()=>Ci(o,p)).command(()=>Si(o,p)).run()},Py=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Qe(n,r.schema);return Zi(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},Vy=(n,e,t={})=>({state:r,commands:i})=>{const o=ie(n,r.schema),s=ie(e,r.schema),l=ht(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})},Fy=(n,e={})=>({state:t,commands:r})=>{const i=ie(n,t.schema);return ht(t,i,e)?r.lift(i):r.wrapIn(i,e)},Hy=()=>({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},jy=()=>({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},Uy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,c=Qe(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=Do(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},qy=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},Wy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=ti(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(o=ie(n,r.schema)),l==="mark"&&(s=Qe(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,b)=>{o&&o===y.type&&(c=!0,m=Math.max(b,u),g=Math.min(b+y.nodeSize,f),h=b,p=y)}):r.doc.nodesBetween(u,f,(y,b)=>{b<u&&o&&o===y.type&&(c=!0,m=Math.max(b,u),g=Math.min(b+y.nodeSize,f),h=b,p=y),b>=u&&b<=f&&(o&&o===y.type&&(c=!0,i&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(w=>{if(s===w.type&&(c=!0,i)){const k=Math.max(b,u),v=Math.min(b+y.nodeSize,f);t.addMark(k,v,s.create({...w.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},Ky=(n,e={})=>({state:t,dispatch:r})=>{const i=ie(n,t.schema);return vp(i,e)(t,r)},Jy=(n,e={})=>({state:t,dispatch:r})=>{const i=ie(n,t.schema);return xp(i,e)(t,r)},Gy=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={}}},ii=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},Yy=(n,e)=>{if(Io(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 Hn(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=xy(d)+o;return s.forEach(h=>{if(u)return;const p=Yy(f,h.find);if(!p)return;const m=c.state.tr,g=_r({state:c.state,transaction:m}),y={from:r-(p[0].length-o.length),to:i},{commands:b,chain:w,can:k}=new ei({editor:t,state:g});h.handler({state:g,range:y,match:p,commands:b,chain:w,can:k})===null||!m.steps.length||(h.undoable&&m.setMeta(l,{transform:m,from:r,to:i,text:o}),c.dispatch(m),u=!0)}),u}function Qy(n){const{editor:e,rules:t}=n,r=new _({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=Ro(T.from(u),s.schema);const{from:f}=c,h=f+u.length;Hn({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 Hn({editor:e,from:o,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Hn({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?Hn({editor:e,from:s.pos,to:s.pos,text:`
|
|
16
|
-
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Xy(n){return Object.prototype.toString.call(n).slice(8,-1)}function jn(n){return Xy(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function yc(n,e){const t={...n};return jn(n)&&jn(e)&&Object.keys(e).forEach(r=>{jn(e[r])&&jn(n[r])?t[r]=yc(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:()=>yc(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}},$t=class kc extends zo{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new kc(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 Zy(n){return typeof n=="number"}var _y=class{constructor(n){this.find=n.find,this.handler=n.handler}},e0=(n,e,t)=>{if(Io(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 t0(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=n,{commands:c,chain:d,can:u}=new ei({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,i,(p,m)=>{var g,y,b,w,k;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const v=(k=(w=(b=p.content)==null?void 0:b.size)!=null?w:p.nodeSize)!=null?k:0,x=Math.max(r,m),S=Math.min(i,m+v);if(x>=S)return;const C=p.isText?p.text||"":p.textBetween(x-m,S-m,void 0,"");e0(C,o.find,s).forEach(A=>{if(A.index===void 0)return;const I=x+A.index+1,U=I+A[0].length,j={from:t.tr.mapping.map(I),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 Un=null,n0=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function r0(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=_r({state:u,transaction:g});if(!(!t0({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 _({view(f){const h=m=>{var g;r=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,r&&(Un=e)},p=()=>{Un&&(Un=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=Un;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,b=m.getMeta("applyPasteRules"),w=!!b;if(!g&&!y&&!w)return;if(w){let{text:x}=b;typeof x=="string"?x=x:x=Ro(T.from(x),p.schema);const{from:S}=b,C=S+x.length,M=n0(x);return c({rule:u,state:p,from:S,to:{b:C},pasteEvt:M})}const k=h.doc.content.findDiffStart(p.doc.content),v=h.doc.content.findDiffEnd(p.doc.content);if(!(!Zy(k)||!v||k===v.b))return c({rule:u,state:p,from:k,to:v,pasteEvt:s})}}))}var oi=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=cc(n),this.schema=py(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:Fn(e.name,this.schema)},r=z(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return fr([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Fn(r.name,this.schema)},o=[],s=z(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&z(r,"exitable",i)&&(l.ArrowRight=()=>$t.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=yg(l);o.push(c);const d=z(r,"addInputRules",i);if(cl(r,n.options.enableInputRules)&&d){const h=d();if(h&&h.length){const p=Qy({editor:n,rules:h}),m=Array.isArray(p)?p:[p];o.push(...m)}}const u=z(r,"addPasteRules",i);if(cl(r,n.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const p=r0({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 ac(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:ie(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=Nn(c,r);return s({node:c,view:d,getPos:u,decorations:f,innerDecorations:h,editor:n,extension:t,HTMLAttributes:p})};return[t.name,l]}))}dispatchTransaction(n){const{editor:e}=this;return fr([...this.extensions].reverse()).reduceRight((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Fn(i.name,this.schema)},s=z(i,"dispatchTransaction",o);return s?l=>{s.call(o,{transaction:l,next:r})}:r},n)}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:Qe(t.name,this.schema)},o=z(t,"addMarkView",i);if(!o)return[];const s=(l,c,d)=>{const u=Nn(l,r);return o()({mark:l,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{y0(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:Fn(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)})}};oi.resolve=cc;oi.sort=fr;oi.flatten=$o;var i0={};Oo(i0,{ClipboardTextSerializer:()=>vc,Commands:()=>xc,Delete:()=>wc,Drop:()=>Cc,Editable:()=>Sc,FocusEvents:()=>Tc,Keymap:()=>Ec,Paste:()=>Nc,Tabindex:()=>Ac,TextDirection:()=>Bc,focusEventsPluginKey:()=>Mc});var ne=class bc extends zo{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new bc(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},vc=ne.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new _({key:new le("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=uc(t);return dc(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),xc=ne.create({name:"commands",addCommands(){return{..._a}}}),wc=ne.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=sc(n.before,[n,...e]);hc(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,b=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:!b,editor:this.editor,transaction:n,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((p,m)=>{var g,y;if(p instanceof Re){const b=h.slice(m).map(p.from,-1),w=h.slice(m).map(p.to),k=h.invert().map(b,-1),v=h.invert().map(w),x=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(C=>C.eq(p.mark)),S=(y=u.doc.nodeAt(w))==null?void 0:y.marks.some(C=>C.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:k,to:v},newRange:{from:b,to:w},partial:!!(S||x),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()}}),Cc=ne.create({name:"drop",addProseMirrorPlugins(){return[new _({key:new le("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Sc=ne.create({name:"editable",addProseMirrorPlugins(){return[new _({key:new le("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Mc=new le("focusEvents"),Tc=ne.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new _({key:Mc,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}}}})]}}),Ec=ne.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,b=g&&m.parent.childCount===1?y===f.pos:H.atStart(d).from===h;return!u||!p.type.isTextblock||p.textContent.length||!b||b&&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 ur()||ic()?o:i},addProseMirrorPlugins(){return[new _({key:new le("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)||!ri(t.doc))return;const h=t.tr,p=_r({state:t,transaction:h}),{commands:m}=new ei({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),Nc=ne.create({name:"paste",addProseMirrorPlugins(){return[new _({key:new le("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Ac=ne.create({name:"tabindex",addProseMirrorPlugins(){return[new _({key:new le("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Bc=ne.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 _({key:new le("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),o0=class Ft{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 Ft(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 Ft(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 Ft(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 Ft(l,this.editor,i,i?t:null);i&&(c.actualDepth=this.depth+1),e.push(new Ft(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)}},s0=`.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 gy(n,e){const t={from:0,to:n.content.size};return dc(n,t,e)}function uc(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function yy(n,e){const t=ie(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 fc(n,e){const t=ti(typeof e=="string"?e:e.name,n.schema);return t==="node"?yy(n,e):t==="mark"?oc(n,e):{}}function ky(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 by(n){const e=ky(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 hc(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}})})}),by(r)}function Lo(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=Do(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 vy=(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 Fn(n,e){return e.nodes[n]||e.marks[n]||null}function Qn(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 xy=(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 Zi(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Qe(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>dr(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 b=Math.max(p,y),C=Math.min(m,y+g.nodeSize),v=C-b;s+=v,l.push(...g.marks.map(k=>({mark:k,from:b,to:C})))})}),s===0)return!1;const c=l.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>dr(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 wy(n,e,t={}){if(!e)return ht(n,null,t)||Zi(n,null,t);const r=ti(e,n.schema);return r==="node"?ht(n,e,t):r==="mark"?Zi(n,e,t):!1}var Cy=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const o=ni(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)},Sy=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function cl(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function dl(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=Y(z(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function ri(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&&(ri(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function pc(n){return n instanceof P}var mc=class gc{constructor(e){this.position=e}static fromJSON(e){return new gc(e.position)}toJSON(){return{position:this.position}}};function My(n,e){const t=e.mapping.mapResult(n.position);return{position:new mc(t.pos),mapResult:t}}function Ty(n){return new mc(n)}function Ey(n,e,t){var r;const{selection:i}=e;let o=null;if(tc(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 Ny=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:l}=o,c=Qe(n,r.schema);if(i)if(s){const d=oc(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(b=>b.type===c)?h.marks.forEach(b=>{c===b.type&&t.addMark(m,g,c.create({...b.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return Ey(r,t,c)},Ay=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),By=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=ie(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})=>Cs(o,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Cs(o,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Oy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=vt(n,0,r.content.size),o=P.create(r,i);e.setSelection(o)}return!0},Iy=(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},Dy=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=vt(i,s,l),d=vt(o,s,l),u=V.create(r,c,d);e.setSelection(u)}return!0},$y=n=>({state:e,dispatch:t})=>{const r=ie(n,e.schema);return Ep(r)(e,t)};function ul(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 Ry=({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=Qn(d,l.node().type.name,l.node().attrs);if(o instanceof P&&o.node.isBlock)return!l.parentOffset||!Ut(s,l.pos)?!1:(r&&(n&&ul(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:cy(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=Ut(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&Ut(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&&ul(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},Ly=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const l=ie(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 b=T.empty;const C=c.index(-1)?1:c.index(-2)?2:3;for(let M=c.depth-C;M>=c.depth-3;M-=1)b=T.from(c.node(M).copy(b));const v=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,k={...Qn(h,c.node().type.name,c.node().attrs),...e},x=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(k))||void 0;b=b.append(T.from(l.createAndFill(null,x)||void 0));const S=c.before(c.depth-(C-1));t.replace(S,c.after(-v),new B(b,4-C,0));let w=-1;t.doc.nodesBetween(S,t.doc.content.size,(M,A)=>{if(w>-1)return!1;M.isTextblock&&M.content.size===0&&(w=A+1)}),w>-1&&t.setSelection(V.near(t.doc.resolve(w))),t.scrollIntoView()}return!0}const p=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Qn(h,f.type.name,f.attrs),...e},g={...Qn(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(!Ut(t.doc,c.pos,2))return!1;if(i){const{selection:b,storedMarks:C}=r,{splittableMarks:v}=o.extensionManager,k=C||b.$to.parentOffset&&b.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!k||!i)return!0;const x=k.filter(S=>v.includes(S.type.name));t.ensureMarks(x)}return!0},Ci=(n,e)=>{const t=ni(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&&pt(n.doc,t.pos)&&n.join(t.pos),!0},Si=(n,e)=>{const t=ni(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&&pt(n.doc,r)&&n.join(r),!0},zy=(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=ie(n,s.schema),m=ie(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:C}=g,v=b.blockRange(C),k=y||g.$to.parentOffset&&g.$from.marks();if(!v)return!1;const x=ni(S=>dl(S.type.name,f))(g);if(v.depth>=1&&x&&v.depth-x.depth<=1){if(x.node.type===p)return d.liftListItem(m);if(dl(x.node.type.name,f)&&p.validContent(x.node.content)&&l)return c().command(()=>(o.setNodeMarkup(x.pos,p),!0)).command(()=>Ci(o,p)).command(()=>Si(o,p)).run()}return!t||!k||!l?c().command(()=>u().wrapInList(p,r)?!0:d.clearNodes()).wrapInList(p,r).command(()=>Ci(o,p)).command(()=>Si(o,p)).run():c().command(()=>{const S=u().wrapInList(p,r),w=k.filter(M=>h.includes(M.type.name));return o.ensureMarks(w),S?!0:d.clearNodes()}).wrapInList(p,r).command(()=>Ci(o,p)).command(()=>Si(o,p)).run()},Py=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Qe(n,r.schema);return Zi(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},Vy=(n,e,t={})=>({state:r,commands:i})=>{const o=ie(n,r.schema),s=ie(e,r.schema),l=ht(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})},Fy=(n,e={})=>({state:t,commands:r})=>{const i=ie(n,t.schema);return ht(t,i,e)?r.lift(i):r.wrapIn(i,e)},Hy=()=>({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},jy=()=>({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},Uy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,c=Qe(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=Do(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},qy=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},Wy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=ti(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(o=ie(n,r.schema)),l==="mark"&&(s=Qe(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,b)=>{o&&o===y.type&&(c=!0,m=Math.max(b,u),g=Math.min(b+y.nodeSize,f),h=b,p=y)}):r.doc.nodesBetween(u,f,(y,b)=>{b<u&&o&&o===y.type&&(c=!0,m=Math.max(b,u),g=Math.min(b+y.nodeSize,f),h=b,p=y),b>=u&&b<=f&&(o&&o===y.type&&(c=!0,i&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(C=>{if(s===C.type&&(c=!0,i)){const v=Math.max(b,u),k=Math.min(b+y.nodeSize,f);t.addMark(v,k,s.create({...C.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},Ky=(n,e={})=>({state:t,dispatch:r})=>{const i=ie(n,t.schema);return vp(i,e)(t,r)},Jy=(n,e={})=>({state:t,dispatch:r})=>{const i=ie(n,t.schema);return xp(i,e)(t,r)},Gy=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={}}},ii=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},Yy=(n,e)=>{if(Io(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 Hn(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=xy(d)+o;return s.forEach(h=>{if(u)return;const p=Yy(f,h.find);if(!p)return;const m=c.state.tr,g=_r({state:c.state,transaction:m}),y={from:r-(p[0].length-o.length),to:i},{commands:b,chain:C,can:v}=new ei({editor:t,state:g});h.handler({state:g,range:y,match:p,commands:b,chain:C,can:v})===null||!m.steps.length||(h.undoable&&m.setMeta(l,{transform:m,from:r,to:i,text:o}),c.dispatch(m),u=!0)}),u}function Qy(n){const{editor:e,rules:t}=n,r=new _({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=Ro(T.from(u),s.schema);const{from:f}=c,h=f+u.length;Hn({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 Hn({editor:e,from:o,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Hn({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?Hn({editor:e,from:s.pos,to:s.pos,text:`
|
|
16
|
+
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Xy(n){return Object.prototype.toString.call(n).slice(8,-1)}function jn(n){return Xy(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function yc(n,e){const t={...n};return jn(n)&&jn(e)&&Object.keys(e).forEach(r=>{jn(e[r])&&jn(n[r])?t[r]=yc(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{...Y(z(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Y(z(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>yc(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}},$t=class kc extends zo{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new kc(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 Zy(n){return typeof n=="number"}var _y=class{constructor(n){this.find=n.find,this.handler=n.handler}},e0=(n,e,t)=>{if(Io(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 t0(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=n,{commands:c,chain:d,can:u}=new ei({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,i,(p,m)=>{var g,y,b,C,v;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const k=(v=(C=(b=p.content)==null?void 0:b.size)!=null?C:p.nodeSize)!=null?v:0,x=Math.max(r,m),S=Math.min(i,m+k);if(x>=S)return;const w=p.isText?p.text||"":p.textBetween(x-m,S-m,void 0,"");e0(w,o.find,s).forEach(A=>{if(A.index===void 0)return;const O=x+A.index+1,H=O+A[0].length,F={from:t.tr.mapping.map(O),to:t.tr.mapping.map(H)},J=o.handler({state:t,range:F,match:A,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:l});f.push(J)})}),f.every(p=>p!==null)}var Un=null,n0=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function r0(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=_r({state:u,transaction:g});if(!(!t0({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 _({view(f){const h=m=>{var g;r=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,r&&(Un=e)},p=()=>{Un&&(Un=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=Un;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,b=m.getMeta("applyPasteRules"),C=!!b;if(!g&&!y&&!C)return;if(C){let{text:x}=b;typeof x=="string"?x=x:x=Ro(T.from(x),p.schema);const{from:S}=b,w=S+x.length,M=n0(x);return c({rule:u,state:p,from:S,to:{b:w},pasteEvt:M})}const v=h.doc.content.findDiffStart(p.doc.content),k=h.doc.content.findDiffEnd(p.doc.content);if(!(!Zy(v)||!k||v===k.b))return c({rule:u,state:p,from:v,to:k,pasteEvt:s})}}))}var oi=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=cc(n),this.schema=py(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:Fn(e.name,this.schema)},r=z(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return fr([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Fn(r.name,this.schema)},o=[],s=z(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&z(r,"exitable",i)&&(l.ArrowRight=()=>$t.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=yg(l);o.push(c);const d=z(r,"addInputRules",i);if(cl(r,n.options.enableInputRules)&&d){const h=d();if(h&&h.length){const p=Qy({editor:n,rules:h}),m=Array.isArray(p)?p:[p];o.push(...m)}}const u=z(r,"addPasteRules",i);if(cl(r,n.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const p=r0({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 ac(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:ie(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=Nn(c,r);return s({node:c,view:d,getPos:u,decorations:f,innerDecorations:h,editor:n,extension:t,HTMLAttributes:p})};return[t.name,l]}))}dispatchTransaction(n){const{editor:e}=this;return fr([...this.extensions].reverse()).reduceRight((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Fn(i.name,this.schema)},s=z(i,"dispatchTransaction",o);return s?l=>{s.call(o,{transaction:l,next:r})}:r},n)}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:Qe(t.name,this.schema)},o=z(t,"addMarkView",i);if(!o)return[];const s=(l,c,d)=>{const u=Nn(l,r);return o()({mark:l,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{y0(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:Fn(e.name,this.schema)};e.type==="mark"&&((t=Y(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)})}};oi.resolve=cc;oi.sort=fr;oi.flatten=$o;var i0={};Oo(i0,{ClipboardTextSerializer:()=>vc,Commands:()=>xc,Delete:()=>wc,Drop:()=>Cc,Editable:()=>Sc,FocusEvents:()=>Tc,Keymap:()=>Ec,Paste:()=>Nc,Tabindex:()=>Ac,TextDirection:()=>Bc,focusEventsPluginKey:()=>Mc});var ne=class bc extends zo{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new bc(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},vc=ne.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new _({key:new le("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=uc(t);return dc(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),xc=ne.create({name:"commands",addCommands(){return{..._a}}}),wc=ne.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=sc(n.before,[n,...e]);hc(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,b=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:!b,editor:this.editor,transaction:n,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((p,m)=>{var g,y;if(p instanceof Re){const b=h.slice(m).map(p.from,-1),C=h.slice(m).map(p.to),v=h.invert().map(b,-1),k=h.invert().map(C),x=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(w=>w.eq(p.mark)),S=(y=u.doc.nodeAt(C))==null?void 0:y.marks.some(w=>w.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:v,to:k},newRange:{from:b,to:C},partial:!!(S||x),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()}}),Cc=ne.create({name:"drop",addProseMirrorPlugins(){return[new _({key:new le("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Sc=ne.create({name:"editable",addProseMirrorPlugins(){return[new _({key:new le("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Mc=new le("focusEvents"),Tc=ne.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new _({key:Mc,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}}}})]}}),Ec=ne.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,b=g&&m.parent.childCount===1?y===f.pos:U.atStart(d).from===h;return!u||!p.type.isTextblock||p.textContent.length||!b||b&&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 ur()||ic()?o:i},addProseMirrorPlugins(){return[new _({key:new le("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=U.atStart(e.doc).from,d=U.atEnd(e.doc).to;if(o||!(s===c&&l===d)||!ri(t.doc))return;const h=t.tr,p=_r({state:t,transaction:h}),{commands:m}=new ei({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),Nc=ne.create({name:"paste",addProseMirrorPlugins(){return[new _({key:new le("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Ac=ne.create({name:"tabindex",addProseMirrorPlugins(){return[new _({key:new le("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Bc=ne.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 _({key:new le("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),o0=class Ft{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 Ft(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 Ft(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 Ft(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 Ft(l,this.editor,i,i?t:null);i&&(c.actualDepth=this.depth+1),e.push(new Ft(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)}},s0=`.ProseMirror {
|
|
17
17
|
position: relative;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -85,22 +85,22 @@ img.ProseMirror-separator {
|
|
|
85
85
|
display: block;
|
|
86
86
|
}`;function l0(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 a0=class extends Gy{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,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:My,createMappablePosition:Ty},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=nc(t,this.options.autofocus);this.editorState=jt.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=l0(s0,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=lc(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?[Sc,vc.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),xc,Tc,Ec,Ac,Cc,Nc,wc,Bc.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 oi(i,this)}createCommandManager(){this.commandManager=new ei({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Xi(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=Xi(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:r}=this.options,i=t.dispatchTransaction||this.dispatchTransaction.bind(this),o=r?this.extensionManager.dispatchTransaction(i):i;this.editorView=new Xa(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();const l=this.view.dom;l.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 fc(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return wy(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ro(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
87
87
|
|
|
88
|
-
`,textSerializers:r={}}=e||{};return gy(this.state.doc,{blockSeparator:t,textSerializers:{...uc(this.schema),...r}})}get isEmpty(){return ri(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 o0(t,this)}get $doc(){return this.$pos(0)}};function Xt(n){return new ii({find:n.find,handler:({state:e,range:t,match:r})=>{const i=
|
|
88
|
+
`,textSerializers:r={}}=e||{};return gy(this.state.doc,{blockSeparator:t,textSerializers:{...uc(this.schema),...r}})}get isEmpty(){return ri(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 o0(t,this)}get $doc(){return this.$pos(0)}};function Xt(n){return new ii({find:n.find,handler:({state:e,range:t,match:r})=>{const i=Y(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 c0(n){return new ii({find:n.find,handler:({state:e,range:t,match:r})=>{const i=Y(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 _i(n){return new ii({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=Y(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 ii({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=Y(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),c=s.doc.resolve(t.from).blockRange(),d=c&&ko(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&&pt(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&s.join(t.from-1)},undoable:n.undoable})}function d0(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 u0={};Oo(u0,{createAtomBlockMarkdownSpec:()=>f0,createBlockMarkdownSpec:()=>h0,createInlineMarkdownSpec:()=>g0,parseAttributes:()=>Po,parseIndentedBlocks:()=>eo,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 f0(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(C=>!(C 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 h0(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[b,C=""]=y,v=i(C);let k=1;const x=b.length;let S="";const w=/^:::([\w-]*)(\s.*)?/gm,M=f.slice(x);for(w.lastIndex=0;;){const A=w.exec(M);if(A===null)break;const O=A.index,H=A[1];if(!((m=A[2])!=null&&m.endsWith(":::"))){if(H)k+=1;else if(k-=1,k===0){const F=M.slice(0,O);S=F.trim();const J=f.slice(0,x+O+A[0].length);let K=[];if(S)if(l==="block")for(K=p.blockTokens(F),K.forEach(E=>{E.text&&(!E.tokens||E.tokens.length===0)&&(E.tokens=p.inlineTokens(E.text))});K.length>0;){const E=K[K.length-1];if(E.type==="paragraph"&&(!E.text||E.text.trim()===""))K.pop();else break}else K=p.inlineTokens(S);return{type:e,raw:J,attributes:v,content:S,tokens:K}}}}}},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 p0(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 m0(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function g0(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=p0,serializeAttributes:o=m0,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 b=h[g];if(y!==void 0&&b===y)return;p[g]=b}}),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 b="",
|
|
94
|
+
:::`}}}function p0(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 m0(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function g0(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=p0,serializeAttributes:o=m0,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 b=h[g];if(y!==void 0&&b===y)return;p[g]=b}}),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 b="",C="";if(l){const[,k]=y;C=k}else{const[,k,x]=y;C=k,b=x||""}const v=i(C.trim());return{type:e,raw:y[0],content:b.trim(),attributes:v}}},renderMarkdown:h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=u(h.attrs||{}),g=o(m),y=g?` ${g}`:"";return l?`[${d}${y}]`:`[${d}${y}]${p}[/${d}]`}}}function eo(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
|
-
`;const b=[y];for(u+=1;u<l.length;){const x=l[u];if(x.trim()===""){const
|
|
97
|
+
`;const b=[y];for(u+=1;u<l.length;){const x=l[u];if(x.trim()===""){const w=l.slice(u+1).findIndex(O=>O.trim()!=="");if(w===-1)break;if((((i=(r=l[u+1+w].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>g){b.push(x),d=`${d}${x}
|
|
98
98
|
`,u+=1;continue}else break}if((((s=(o=x.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:s.length)||0)>g)b.push(x),d=`${d}${x}
|
|
99
|
-
`,u+=1;else break}let
|
|
100
|
-
`);x.trim()&&(e.customNestedParser?
|
|
99
|
+
`,u+=1;else break}let C;const v=b.slice(1);if(v.length>0){const x=v.map(S=>S.slice(g+f)).join(`
|
|
100
|
+
`);x.trim()&&(e.customNestedParser?C=e.customNestedParser(x):C=t.blockTokens(x))}const k=e.createToken(m,C);c.push(k)}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 y0(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 Oc extends zo{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Oc(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Ot(n){return new _y({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=
|
|
103
|
+
`)}function y0(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 Oc extends zo{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Oc(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Ot(n){return new _y({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=Y(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 fl(n){return a.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var k0=class extends a0{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=fl(this.view.state),this.reactiveExtensionStorage=fl(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}},b0=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 v0=(n={})=>{const e=a.shallowRef();return a.onMounted(()=>{e.value=new k0(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 hr=(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]},x0=/^\s*>\s$/,w0=Te.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return hr("blockquote",{...oe(this.options.HTMLAttributes,n),children:hr("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}
|
|
@@ -114,22 +114,22 @@ ${t}
|
|
|
114
114
|
`);return c.replaceWith(d,u,r.schema.text(p)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Mi,{state:r}=n,{selection:i}=r,{$from:o,empty:s}=i;return o.parent.type!==this.type?!1:s?n.commands.command(({tr:l})=>{var c;const{pos:d}=o,u=o.start(),f=o.end(),p=r.doc.textBetween(u,f,`
|
|
115
115
|
`,`
|
|
116
116
|
`).split(`
|
|
117
|
-
`);let m=0,g=0;const y=d-u;for(let S=0;S<p.length;S+=1){if(g+p[S].length>=y){m=S;break}g+=p[S].length+1}const
|
|
117
|
+
`);let m=0,g=0;const y=d-u;for(let S=0;S<p.length;S+=1){if(g+p[S].length>=y){m=S;break}g+=p[S].length+1}const C=((c=p[m].match(/^ */))==null?void 0:c[0])||"",v=Math.min(C.length,t);if(v===0)return!0;let k=u;for(let S=0;S<m;S+=1)k+=p[S].length+1;return l.delete(k,k+v),d-k<=v&&l.setSelection(V.create(l.doc,k)),!0}):n.commands.command(({tr:l})=>{const{from:c,to:d}=i,h=r.doc.textBetween(c,d,`
|
|
118
118
|
`,`
|
|
119
119
|
`).split(`
|
|
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(
|
|
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(U.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[_i({find:O0,type:this.type,getAttributes:n=>({language:n[1]})}),_i({find:I0,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new _({key:new le("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
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}}})]}}),$0=Te.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
125
125
|
|
|
126
126
|
`):""}),R0=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",oe(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()}}}),Ic=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]}`,oe(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=>_i({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),L0=Ic,z0=Te.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",oe(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!d0(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return pc(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[c0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),P0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,V0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,F0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,H0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,j0=$t.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",oe(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:P0,type:this.type}),Xt({find:F0,type:this.type})]},addPasteRules(){return[Ot({find:V0,type:this.type}),Ot({find:H0,type:this.type})]}});const U0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",q0="ελ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",to="numeric",no="ascii",ro="alpha",hn="asciinumeric",an="alphanumeric",io="domain",Dc="emoji",W0="scheme",K0="slashscheme",Ti="whitespace";function J0(n,e){return n in e||(e[n]=[]),e[n]}function xt(n,e,t){e[to]&&(e[hn]=!0,e[an]=!0),e[no]&&(e[hn]=!0,e[ro]=!0),e[hn]&&(e[an]=!0),e[ro]&&(e[an]=!0),e[an]&&(e[io]=!0),e[Dc]&&(e[io]=!0);for(const r in e){const i=J0(r,t);i.indexOf(n)<0&&i.push(n)}}function G0(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&&xt(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(G0(s.t,r),t);xt(o,c,r)}else t&&xt(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),ee=(n,e,t,r,i)=>n.tr(e,t,r,i),hl=(n,e,t,r,i)=>n.ts(e,t,r,i),N=(n,e,t,r,i)=>n.tt(e,t,r,i),Ke="WORD",oo="UWORD",$c="ASCIINUMERICAL",Rc="ALPHANUMERICAL",An="LOCALHOST",so="TLD",lo="UTLD",Xn="SCHEME",Ht="SLASH_SCHEME",Ho="NUM",ao="WS",jo="NL",pn="OPENBRACE",mn="CLOSEBRACE",pr="OPENBRACKET",mr="CLOSEBRACKET",gr="OPENPAREN",yr="CLOSEPAREN",kr="OPENANGLEBRACKET",br="CLOSEANGLEBRACKET",vr="FULLWIDTHLEFTPAREN",xr="FULLWIDTHRIGHTPAREN",wr="LEFTCORNERBRACKET",Cr="RIGHTCORNERBRACKET",Sr="LEFTWHITECORNERBRACKET",Mr="RIGHTWHITECORNERBRACKET",Tr="FULLWIDTHLESSTHAN",Er="FULLWIDTHGREATERTHAN",Nr="AMPERSAND",Ar="APOSTROPHE",Br="ASTERISK",et="AT",Or="BACKSLASH",Ir="BACKTICK",Dr="CARET",it="COLON",Uo="COMMA",$r="DOLLAR",Pe="DOT",Rr="EQUALS",qo="EXCLAMATION",Ae="HYPHEN",gn="PERCENT",Lr="PIPE",zr="PLUS",Pr="POUND",yn="QUERY",Wo="QUOTE",Lc="FULLWIDTHMIDDLEDOT",Ko="SEMI",Ve="SLASH",kn="TILDE",Vr="UNDERSCORE",zc="EMOJI",Fr="SYM";var Pc=Object.freeze({__proto__:null,ALPHANUMERICAL:Rc,AMPERSAND:Nr,APOSTROPHE:Ar,ASCIINUMERICAL:$c,ASTERISK:Br,AT:et,BACKSLASH:Or,BACKTICK:Ir,CARET:Dr,CLOSEANGLEBRACKET:br,CLOSEBRACE:mn,CLOSEBRACKET:mr,CLOSEPAREN:yr,COLON:it,COMMA:Uo,DOLLAR:$r,DOT:Pe,EMOJI:zc,EQUALS:Rr,EXCLAMATION:qo,FULLWIDTHGREATERTHAN:Er,FULLWIDTHLEFTPAREN:vr,FULLWIDTHLESSTHAN:Tr,FULLWIDTHMIDDLEDOT:Lc,FULLWIDTHRIGHTPAREN:xr,HYPHEN:Ae,LEFTCORNERBRACKET:wr,LEFTWHITECORNERBRACKET:Sr,LOCALHOST:An,NL:jo,NUM:Ho,OPENANGLEBRACKET:kr,OPENBRACE:pn,OPENBRACKET:pr,OPENPAREN:gr,PERCENT:gn,PIPE:Lr,PLUS:zr,POUND:Pr,QUERY:yn,QUOTE:Wo,RIGHTCORNERBRACKET:Cr,RIGHTWHITECORNERBRACKET:Mr,SCHEME:Xn,SEMI:Ko,SLASH:Ve,SLASH_SCHEME:Ht,SYM:Fr,TILDE:kn,TLD:so,UNDERSCORE:Vr,UTLD:lo,UWORD:oo,WORD:Ke,WS:ao});const qe=/[a-z]/,rn=new RegExp("\\p{L}","u"),Ei=new RegExp("\\p{Emoji}","u"),We=/\d/,Ni=/\s/,pl="\r",Ai=`
|
|
129
|
-
`,Y0="️",Q0="",Bi="";let qn=null,Wn=null;function X0(n=[]){const e={};Ce.groups=e;const t=new Ce;qn==null&&(qn=ml(U0)),Wn==null&&(Wn=ml(q0)),N(t,"'",Ar),N(t,"{",pn),N(t,"}",mn),N(t,"[",pr),N(t,"]",mr),N(t,"(",gr),N(t,")",yr),N(t,"<",kr),N(t,">",br),N(t,"(",vr),N(t,")",xr),N(t,"「",wr),N(t,"」",Cr),N(t,"『",Sr),N(t,"』",Mr),N(t,"<",Tr),N(t,">",Er),N(t,"&",Nr),N(t,"*",Br),N(t,"@",et),N(t,"`",Ir),N(t,"^",Dr),N(t,":",it),N(t,",",Uo),N(t,"$",$r),N(t,".",Pe),N(t,"=",Rr),N(t,"!",qo),N(t,"-",Ae),N(t,"%",gn),N(t,"|",Lr),N(t,"+",zr),N(t,"#",Pr),N(t,"?",yn),N(t,'"',Wo),N(t,"/",Ve),N(t,";",Ko),N(t,"~",kn),N(t,"_",Vr),N(t,"\\",Or),N(t,"・",Lc);const r=ee(t,We,Ho,{[to]:!0});ee(r,We,r);const i=ee(r,qe,$c,{[hn]:!0}),o=ee(r,rn,Rc,{[an]:!0}),s=ee(t,qe,Ke,{[no]:!0});ee(s,We,i),ee(s,qe,s),ee(i,We,i),ee(i,qe,i);const l=ee(t,rn,oo,{[ro]:!0});ee(l,qe),ee(l,We,o),ee(l,rn,l),ee(o,We,o),ee(o,qe),ee(o,rn,o);const c=N(t,Ai,jo,{[Ti]:!0}),d=N(t,pl,ao,{[Ti]:!0}),u=ee(t,Ni,ao,{[Ti]:!0});N(t,Bi,u),N(d,Ai,c),N(d,Bi,u),ee(d,Ni,u),N(u,pl),N(u,Ai),ee(u,Ni,u),N(u,Bi,u);const f=ee(t,Ei,zc,{[Dc]:!0});N(f,"#"),ee(f,Ei,f),N(f,Y0,f);const h=N(f,Q0);N(h,"#"),ee(h,Ei,f);const p=[[qe,s],[We,i]],m=[[qe,null],[rn,l],[We,o]];for(let g=0;g<qn.length;g++)Xe(t,qn[g],so,Ke,p);for(let g=0;g<Wn.length;g++)Xe(t,Wn[g],lo,oo,m);xt(so,{tld:!0,ascii:!0},e),xt(lo,{utld:!0,alpha:!0},e),Xe(t,"file",Xn,Ke,p),Xe(t,"mailto",Xn,Ke,p),Xe(t,"http",Ht,Ke,p),Xe(t,"https",Ht,Ke,p),Xe(t,"ftp",Ht,Ke,p),Xe(t,"ftps",Ht,Ke,p),xt(Xn,{scheme:!0,ascii:!0},e),xt(Ht,{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],
|
|
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()}}}),Ic=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]}`,oe(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=>_i({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),L0=Ic,z0=Te.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",oe(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!d0(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return pc(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[c0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),P0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,V0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,F0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,H0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,j0=$t.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",oe(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:P0,type:this.type}),Xt({find:F0,type:this.type})]},addPasteRules(){return[Ot({find:V0,type:this.type}),Ot({find:H0,type:this.type})]}});const U0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",q0="ελ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",to="numeric",no="ascii",ro="alpha",hn="asciinumeric",an="alphanumeric",io="domain",Dc="emoji",W0="scheme",K0="slashscheme",Ti="whitespace";function J0(n,e){return n in e||(e[n]=[]),e[n]}function xt(n,e,t){e[to]&&(e[hn]=!0,e[an]=!0),e[no]&&(e[hn]=!0,e[ro]=!0),e[hn]&&(e[an]=!0),e[ro]&&(e[an]=!0),e[an]&&(e[io]=!0),e[Dc]&&(e[io]=!0);for(const r in e){const i=J0(r,t);i.indexOf(n)<0&&i.push(n)}}function G0(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&&xt(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(G0(s.t,r),t);xt(o,c,r)}else t&&xt(o,t,r);s.t=o}return i.j[n]=s,s}};const j=(n,e,t,r,i)=>n.ta(e,t,r,i),ee=(n,e,t,r,i)=>n.tr(e,t,r,i),hl=(n,e,t,r,i)=>n.ts(e,t,r,i),N=(n,e,t,r,i)=>n.tt(e,t,r,i),Ke="WORD",oo="UWORD",$c="ASCIINUMERICAL",Rc="ALPHANUMERICAL",An="LOCALHOST",so="TLD",lo="UTLD",Xn="SCHEME",Ht="SLASH_SCHEME",Ho="NUM",ao="WS",jo="NL",pn="OPENBRACE",mn="CLOSEBRACE",pr="OPENBRACKET",mr="CLOSEBRACKET",gr="OPENPAREN",yr="CLOSEPAREN",kr="OPENANGLEBRACKET",br="CLOSEANGLEBRACKET",vr="FULLWIDTHLEFTPAREN",xr="FULLWIDTHRIGHTPAREN",wr="LEFTCORNERBRACKET",Cr="RIGHTCORNERBRACKET",Sr="LEFTWHITECORNERBRACKET",Mr="RIGHTWHITECORNERBRACKET",Tr="FULLWIDTHLESSTHAN",Er="FULLWIDTHGREATERTHAN",Nr="AMPERSAND",Ar="APOSTROPHE",Br="ASTERISK",et="AT",Or="BACKSLASH",Ir="BACKTICK",Dr="CARET",it="COLON",Uo="COMMA",$r="DOLLAR",Pe="DOT",Rr="EQUALS",qo="EXCLAMATION",Ae="HYPHEN",gn="PERCENT",Lr="PIPE",zr="PLUS",Pr="POUND",yn="QUERY",Wo="QUOTE",Lc="FULLWIDTHMIDDLEDOT",Ko="SEMI",Ve="SLASH",kn="TILDE",Vr="UNDERSCORE",zc="EMOJI",Fr="SYM";var Pc=Object.freeze({__proto__:null,ALPHANUMERICAL:Rc,AMPERSAND:Nr,APOSTROPHE:Ar,ASCIINUMERICAL:$c,ASTERISK:Br,AT:et,BACKSLASH:Or,BACKTICK:Ir,CARET:Dr,CLOSEANGLEBRACKET:br,CLOSEBRACE:mn,CLOSEBRACKET:mr,CLOSEPAREN:yr,COLON:it,COMMA:Uo,DOLLAR:$r,DOT:Pe,EMOJI:zc,EQUALS:Rr,EXCLAMATION:qo,FULLWIDTHGREATERTHAN:Er,FULLWIDTHLEFTPAREN:vr,FULLWIDTHLESSTHAN:Tr,FULLWIDTHMIDDLEDOT:Lc,FULLWIDTHRIGHTPAREN:xr,HYPHEN:Ae,LEFTCORNERBRACKET:wr,LEFTWHITECORNERBRACKET:Sr,LOCALHOST:An,NL:jo,NUM:Ho,OPENANGLEBRACKET:kr,OPENBRACE:pn,OPENBRACKET:pr,OPENPAREN:gr,PERCENT:gn,PIPE:Lr,PLUS:zr,POUND:Pr,QUERY:yn,QUOTE:Wo,RIGHTCORNERBRACKET:Cr,RIGHTWHITECORNERBRACKET:Mr,SCHEME:Xn,SEMI:Ko,SLASH:Ve,SLASH_SCHEME:Ht,SYM:Fr,TILDE:kn,TLD:so,UNDERSCORE:Vr,UTLD:lo,UWORD:oo,WORD:Ke,WS:ao});const qe=/[a-z]/,rn=new RegExp("\\p{L}","u"),Ei=new RegExp("\\p{Emoji}","u"),We=/\d/,Ni=/\s/,pl="\r",Ai=`
|
|
129
|
+
`,Y0="️",Q0="",Bi="";let qn=null,Wn=null;function X0(n=[]){const e={};Ce.groups=e;const t=new Ce;qn==null&&(qn=ml(U0)),Wn==null&&(Wn=ml(q0)),N(t,"'",Ar),N(t,"{",pn),N(t,"}",mn),N(t,"[",pr),N(t,"]",mr),N(t,"(",gr),N(t,")",yr),N(t,"<",kr),N(t,">",br),N(t,"(",vr),N(t,")",xr),N(t,"「",wr),N(t,"」",Cr),N(t,"『",Sr),N(t,"』",Mr),N(t,"<",Tr),N(t,">",Er),N(t,"&",Nr),N(t,"*",Br),N(t,"@",et),N(t,"`",Ir),N(t,"^",Dr),N(t,":",it),N(t,",",Uo),N(t,"$",$r),N(t,".",Pe),N(t,"=",Rr),N(t,"!",qo),N(t,"-",Ae),N(t,"%",gn),N(t,"|",Lr),N(t,"+",zr),N(t,"#",Pr),N(t,"?",yn),N(t,'"',Wo),N(t,"/",Ve),N(t,";",Ko),N(t,"~",kn),N(t,"_",Vr),N(t,"\\",Or),N(t,"・",Lc);const r=ee(t,We,Ho,{[to]:!0});ee(r,We,r);const i=ee(r,qe,$c,{[hn]:!0}),o=ee(r,rn,Rc,{[an]:!0}),s=ee(t,qe,Ke,{[no]:!0});ee(s,We,i),ee(s,qe,s),ee(i,We,i),ee(i,qe,i);const l=ee(t,rn,oo,{[ro]:!0});ee(l,qe),ee(l,We,o),ee(l,rn,l),ee(o,We,o),ee(o,qe),ee(o,rn,o);const c=N(t,Ai,jo,{[Ti]:!0}),d=N(t,pl,ao,{[Ti]:!0}),u=ee(t,Ni,ao,{[Ti]:!0});N(t,Bi,u),N(d,Ai,c),N(d,Bi,u),ee(d,Ni,u),N(u,pl),N(u,Ai),ee(u,Ni,u),N(u,Bi,u);const f=ee(t,Ei,zc,{[Dc]:!0});N(f,"#"),ee(f,Ei,f),N(f,Y0,f);const h=N(f,Q0);N(h,"#"),ee(h,Ei,f);const p=[[qe,s],[We,i]],m=[[qe,null],[rn,l],[We,o]];for(let g=0;g<qn.length;g++)Xe(t,qn[g],so,Ke,p);for(let g=0;g<Wn.length;g++)Xe(t,Wn[g],lo,oo,m);xt(so,{tld:!0,ascii:!0},e),xt(lo,{utld:!0,alpha:!0},e),Xe(t,"file",Xn,Ke,p),Xe(t,"mailto",Xn,Ke,p),Xe(t,"http",Ht,Ke,p),Xe(t,"https",Ht,Ke,p),Xe(t,"ftp",Ht,Ke,p),Xe(t,"ftps",Ht,Ke,p),xt(Xn,{scheme:!0,ascii:!0},e),xt(Ht,{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],C=n[g][1]?{[W0]:!0}:{[K0]:!0};y.indexOf("-")>=0?C[io]=!0:qe.test(y)?We.test(y)?C[hn]=!0:C[no]=!0:C[to]=!0,hl(t,y,y,C)}return hl(t,"localhost",An,{ascii:!0}),t.jd=new Ce(Fr),{start:t,tokens:Object.assign({groups:e},Pc)}}function Vc(n,e){const t=Z0(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 Z0(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 Xe(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 ml(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 Bn={defaultProtocol:"http",events:null,format:gl,formatHref:gl,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({},Bn);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:Bn,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]:Bn[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 gl(n){return n}function Fc(n,e){this.t="token",this.v=n,this.tk=e}Fc.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=Bn.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 si(n,e){class t extends Fc{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 yl=si("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),kl=si("text"),_0=si("nl"),Kn=si("url",{isLink:!0,toHref(n=Bn.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==An&&n[1].t===it}}),Ne=n=>new Ce(n);function ek({groups:n}){const e=n.domain.concat([Nr,Br,et,Or,Ir,Dr,$r,Rr,Ae,Ho,gn,Lr,zr,Pr,Ve,Fr,kn,Vr]),t=[Ar,it,Uo,Pe,qo,gn,yn,Wo,Ko,kr,br,pn,mn,mr,pr,gr,yr,vr,xr,wr,Cr,Sr,Mr,Tr,Er],r=[Nr,Ar,Br,Or,Ir,Dr,$r,Rr,Ae,pn,mn,gn,Lr,zr,Pr,yn,Ve,Fr,kn,Vr],i=Ne(),o=N(i,kn);j(o,r,o),j(o,n.domain,o);const s=Ne(),l=Ne(),c=Ne();j(i,n.domain,s),j(i,n.scheme,l),j(i,n.slashscheme,c),j(s,r,o),j(s,n.domain,s);const d=N(s,et);N(o,et,d),N(l,et,d),N(c,et,d);const u=N(o,Pe);j(u,r,o),j(u,n.domain,o);const f=Ne();j(d,n.domain,f),j(f,n.domain,f);const h=N(f,Pe);j(h,n.domain,f);const p=Ne(yl);j(h,n.tld,p),j(h,n.utld,p),N(d,An,p);const m=N(f,Ae);N(m,Ae,m),j(m,n.domain,f),j(p,n.domain,f),N(p,Pe,h),N(p,Ae,m);const g=N(p,it);j(g,n.numeric,yl);const y=N(s,Ae),b=N(s,Pe);N(y,Ae,y),j(y,n.domain,s),j(b,r,o),j(b,n.domain,s);const C=Ne(Kn);j(b,n.tld,C),j(b,n.utld,C),j(C,n.domain,s),j(C,r,o),N(C,Pe,b),N(C,Ae,y),N(C,et,d);const v=N(C,it),k=Ne(Kn);j(v,n.numeric,k);const x=Ne(Kn),S=Ne();j(x,e,x),j(x,t,S),j(S,e,x),j(S,t,S),N(C,Ve,x),N(k,Ve,x);const w=N(l,it),M=N(c,it),A=N(M,Ve),O=N(A,Ve);j(l,n.domain,s),N(l,Pe,b),N(l,Ae,y),j(c,n.domain,s),N(c,Pe,b),N(c,Ae,y),j(w,n.domain,x),N(w,Ve,x),N(w,yn,x),j(O,n.domain,x),j(O,e,x),N(O,Ve,x);const H=[[pn,mn],[pr,mr],[gr,yr],[kr,br],[vr,xr],[wr,Cr],[Sr,Mr],[Tr,Er]];for(let F=0;F<H.length;F++){const[J,K]=H[F],E=N(x,J);N(S,J,E),N(E,K,x);const D=Ne(Kn);j(E,e,D);const L=Ne();j(E,t),j(D,e,D),j(D,t,L),j(L,e,D),j(L,t,L),N(D,K,x),N(L,K,x)}return N(i,An,C),N(i,jo,_0),{start:i,tokens:Pc}}function tk(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(Oi(kl,e,s)),s=[]),i-=h,u-=h;const p=f.t,m=t.slice(i-u,i);o.push(Oi(p,e,m))}}return s.length>0&&o.push(Oi(kl,e,s)),o}function Oi(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 nk=typeof console<"u"&&console&&console.warn||(()=>{}),rk="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",X={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function ik(){return Ce.groups={},X.scanner=null,X.parser=null,X.tokenQueue=[],X.pluginQueue=[],X.customSchemes=[],X.initialized=!1,X}function bl(n,e=!1){if(X.initialized&&nk(`linkifyjs: already initialized - will not register custom scheme "${n}" ${rk}`),!/^[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`);X.customSchemes.push([n,e])}function ok(){X.scanner=X0(X.customSchemes);for(let n=0;n<X.tokenQueue.length;n++)X.tokenQueue[n][1]({scanner:X.scanner});X.parser=ek(X.scanner.tokens);for(let n=0;n<X.pluginQueue.length;n++)X.pluginQueue[n][1]({scanner:X.scanner,parser:X.parser});return X.initialized=!0,X}function Go(n){return X.initialized||ok(),tk(X.parser.start,n,Vc(X.scanner.start,n))}Go.scan=Vc;function Hc(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 ]",sk=new RegExp(Yo),lk=new RegExp(`${Yo}$`),ak=new RegExp(Yo,"g");function ck(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function dk(n){return new _({key:new le("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=sc(t.doc,[...e]);if(hc(l).forEach(({newRange:d})=>{const u=dy(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(!lk.test(p))return;f=u[0],h=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&h){const p=h.split(sk).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(b=>b.toObject(n.defaultProtocol));if(!ck(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{Lo(b.from,b.to,r.doc).some(
|
|
132
|
+
3. "-" cannot repeat`);X.customSchemes.push([n,e])}function ok(){X.scanner=X0(X.customSchemes);for(let n=0;n<X.tokenQueue.length;n++)X.tokenQueue[n][1]({scanner:X.scanner});X.parser=ek(X.scanner.tokens);for(let n=0;n<X.pluginQueue.length;n++)X.pluginQueue[n][1]({scanner:X.scanner,parser:X.parser});return X.initialized=!0,X}function Go(n){return X.initialized||ok(),tk(X.parser.start,n,Vc(X.scanner.start,n))}Go.scan=Vc;function Hc(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 ]",sk=new RegExp(Yo),lk=new RegExp(`${Yo}$`),ak=new RegExp(Yo,"g");function ck(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function dk(n){return new _({key:new le("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=sc(t.doc,[...e]);if(hc(l).forEach(({newRange:d})=>{const u=dy(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(!lk.test(p))return;f=u[0],h=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&h){const p=h.split(sk).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(b=>b.toObject(n.defaultProtocol));if(!ck(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{Lo(b.from,b.to,r.doc).some(C=>C.mark.type===n.type)||s.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function uk(n){return new _({key:new le("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const c=r.target;if(!c)return!1;const d=n.editor.view.dom;s=c.closest("a"),s&&!d.contains(s)&&(s=null)}if(!s)return!1;let l=!1;if(n.enableClickSelection&&(l=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const c=fc(e.state,n.type.name),d=(i=s.href)!=null?i:c.href,u=(o=s.target)!=null?o:c.target;d&&(window.open(d,u),l=!0)}return l}}})}function fk(n){return new _({key:new le("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=Hc(c,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||i!==void 0&&!i(d.value)?!1:n.editor.commands.setMark(n.type,{href:d.href})}}})}function gt(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(ak,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var hk=$t.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"){bl(n);return}bl(n.scheme,n.optionalSlashes)})},onDestroy(){ik()},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)=>!!gt(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const i=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},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=>!!gt(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=>!!gt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",oe(this.options.HTMLAttributes,n),0]:["a",oe(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=>!!gt(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=>!!gt(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[Ot({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=Hc(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!gt(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(dk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!gt(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(uk({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(fk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),pk=Object.defineProperty,mk=(n,e)=>{for(var t in e)pk(n,t,{get:e[t],enumerable:!0})},gk="listItem",vl="textStyle",xl=/^\s*([-+*])\s$/,jc=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",oe(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
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(gk,this.editor.getAttributes(vl)).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:xl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Zt({find:xl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(vl),editor:this.editor})),[n]}}),Uc=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",oe(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)}}}),yk={};mk(yk,{findListItemPos:()=>$n,getNextListDepth:()=>Qo,handleBackspace:()=>co,handleDelete:()=>uo,hasListBefore:()=>qc,hasListItemAfter:()=>kk,hasListItemBefore:()=>Wc,listItemHasSubList:()=>Kc,nextListIsDeeper:()=>Jc,nextListIsHigher:()=>Gc});var $n=(n,e)=>{const{$from:t}=e.selection,r=ie(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=$n(n,e);if(!t)return!1;const[,r]=vy(e,n,t.$pos.pos+4);return r},qc=(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))},Wc=(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)},Kc=(n,e,t)=>{if(!t)return!1;const r=ie(n,e.schema);let i=!1;return t.descendants(o=>{o.type===r&&(i=!0)}),i},co=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!ht(n.state,e)&&qc(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(!ht(n.state,e)||!Sy(n.state))return!1;const r=$n(e,n.state);if(!r)return!1;const o=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=Kc(e,n.state,o);return Wc(e,n.state)&&!s?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Jc=(n,e)=>{const t=Qo(n,e),r=$n(n,e);return!r||!t?!1:t>r.depth},Gc=(n,e)=>{const t=Qo(n,e),r=$n(n,e);return!r||!t?!1:t<r.depth},uo=(n,e)=>{if(!ht(n.state,e)||!Cy(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:Jc(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Gc(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},kk=(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)},Yc=ne.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&&uo(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&&uo(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&&co(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&&co(n,t,r)&&(e=!0)}),e}}}}),wl=/^(\s*)(\d+)\.\s+(.*)$/,bk=/^\s/;function vk(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],o=i.match(wl);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(wl))break;if(p.trim()==="")h.push(p),u+=`
|
|
134
134
|
`,f+=1;else if(p.match(bk))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(`
|
|
@@ -140,4 +140,4 @@ ${p.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),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
141
|
`),[o,s]=vk(i);if(o.length===0)return;const l=Qc(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
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(wk,this.editor.getAttributes(Cl)).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:Sl,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:Sl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Cl)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Ck=/^\s*(\[([( |x])?\])\s$/,Sk=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",oe(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=f=>{var h,p;l.ariaLabel=((p=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:p.call(h,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};d(n),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:h}=f.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=t();if(typeof m!="number")return!1;const g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g?.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,h)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,h])=>{i.setAttribute(f,h)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,s),i.append(o,c),Object.entries(e).forEach(([f,h])=>{i.setAttribute(f,h)});let u=new Set(Object.keys(e));return{dom:i,contentDOM:c,update:f=>{if(f.type!==this.type)return!1;i.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,d(f);const h=r.extensionManager.attributes,p=Nn(f,h),m=new Set(Object.keys(p)),g=this.options.HTMLAttributes;return u.forEach(y=>{m.has(y)||(y in g?i.setAttribute(y,g[y]):i.removeAttribute(y))}),Object.entries(p).forEach(([y,b])=>{b==null?y in g?i.setAttribute(y,g[y]):i.removeAttribute(y):i.setAttribute(y,b)}),u=m,!0}}}},addInputRules(){return[Zt({find:Ck,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",oe(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=eo(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=eo(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()}}});ne.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(jc.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Uc.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Yc.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Xc.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Sk.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Mk.configure(this.options.taskList)),n}});var Tk=Te.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",oe(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()}}}),Ek=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Nk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ak=$t.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",oe(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:Ek,type:this.type})]},addPasteRules(){return[Ot({find:Nk,type:this.type})]}}),Bk=Te.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Zc=$t.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",oe(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()}}}),Ok=Zc;function Ik(n={}){return new _({view(e){return new Dk(e,n)}})}class Dk{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=ra(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 te extends H{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return te.valid(r)?new te(r):H.near(r)}content(){return B.empty}eq(e){return e instanceof te&&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 te(e.resolve(t.pos))}getBookmark(){return new Xo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!$k(e)||!Rk(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&&te.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(te.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(te.valid(l))return l}return null}}}te.prototype.visible=!1;te.findFrom=te.findGapCursorFrom;H.jsonID("gapcursor",te);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 te.valid(t)?new te(t):H.near(t)}}function _c(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function $k(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||_c(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Rk(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||_c(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Lk(){return new _({props:{decorations:Fk,createSelectionBetween(n,e,t){return e.pos==t.pos&&te.valid(t)?new te(t):null},handleClick:Pk,handleKeyDown:zk,handleDOMEvents:{beforeinput:Vk}}})}const zk=Za({ArrowLeft:Jn("horiz",-1),ArrowRight:Jn("horiz",1),ArrowUp:Jn("vert",-1),ArrowDown:Jn("vert",1)});function Jn(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=te.findGapCursorFrom(l,e,c);return d?(i&&i(r.tr.setSelection(new te(d))),!0):!1}}function Pk(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!te.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 te(r))),!0)}function Vk(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof te))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 Fk(n){if(!(n.selection instanceof te))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Z.create(n.doc,[be.widget(n.selection.head,e,{key:"gapcursor"})])}var Hr=200,me=function(){};me.prototype.append=function(e){return e.length?(e=me.from(e),!this.length&&e||e.length<Hr&&this.leafAppend(e)||this.length<Hr&&e.leafPrepend(this)||this.appendInner(e)):this};me.prototype.prepend=function(e){return e.length?me.from(e).append(this):this};me.prototype.appendInner=function(e){return new Hk(this,e)};me.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?me.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};me.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};me.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)};me.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};me.from=function(e){return e instanceof me?e:e&&e.length?new ed(e):me.empty};var ed=(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<=Hr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Hr)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})(me);me.empty=new ed([]);var Hk=(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})(me);const td=me,jk=500;class $e{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 Fe(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 Fe(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 $e(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 Fe(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>qk&&(l=Uk(l,d),s-=d),new $e(l.append(o),s)}remapping(e,t){let r=new wn;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 $e(this.items.append(e.map(t=>new Fe(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 Fe(m,g,y))}else r.push(new Fe(m))},i);let d=[];for(let h=t;h<s;h++)d.push(new Fe(o.maps[h]));let u=this.items.slice(0,i).append(d).append(r),f=new $e(u,l);return f.emptyItemCount()>jk&&(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 Fe(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 $e(td.from(i.reverse()),o)}}$e.empty=new $e(td.empty,0);function Uk(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Fe{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 Fe(t.getMap().invert(),t,this.selection)}}}class tt{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const qk=20;function Wk(n,e,t,r){let i=t.getMeta(Tt),o;if(i)return i.historyState;t.getMeta(Gk)&&(n=new tt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Tt))return s.getMeta(Tt).redo?new tt(n.done.addTransform(t,void 0,r,Zn(e)),n.undone,Ml(t.mapping.maps),n.prevTime,n.prevComposition):new tt(n.done,n.undone.addTransform(t,void 0,r,Zn(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||!Kk(t,n.prevRanges)),d=s?Ii(n.prevRanges,t.mapping):Ml(t.mapping.maps);return new tt(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Zn(e)),$e.empty,d,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new tt(n.done.rebased(t,o),n.undone.rebased(t,o),Ii(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new tt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ii(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Kk(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 Ml(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 Ii(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 Jk(n,e,t){let r=Zn(e),i=Tt.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 tt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(Tt,{redo:t,historyState:c})}let Di=!1,Tl=null;function Zn(n){let e=n.plugins;if(Tl!=e){Di=!1,Tl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Di=!0;break}}return Di}const Tt=new le("history"),Gk=new le("closeHistory");function Yk(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new _({key:Tt,state:{init(){return new tt($e.empty,$e.empty,null,0,-1)},apply(e,t,r){return Wk(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?rd:r=="historyRedo"?id:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function nd(n,e){return(t,r)=>{let i=Tt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=Jk(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const rd=nd(!1,!0),id=nd(!0,!0);ne.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 _({key:new le("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 Qk=ne.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Ik(this.options)]}});ne.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new _({key:new le("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!t||!r)return Z.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}))}),Z.create(n,o)}}})]}});var Xk=ne.create({name:"gapCursor",addProseMirrorPlugins(){return[Lk()]},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}}}),Zk=ne.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new _({key:new le("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&&ri(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}),Z.create(n,i)}}})]}});ne.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new _({key:new le("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||pc(t.selection)||n.view.dragging?null:Z.create(t.doc,[be.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function El({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var _k=ne.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new le(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 _({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!El({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!El({node:s,types:r})}}})]}}),e1=ne.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>rd(n,e),redo:()=>({state:n,dispatch:e})=>id(n,e)}},addProseMirrorPlugins(){return[Yk(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()}}}),t1=ne.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(E0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(w0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(jc.configure(this.options.bulletList)),this.options.code!==!1&&i.push(B0.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(D0.configure(this.options.codeBlock)),this.options.document!==!1&&i.push($0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Qk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Xk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(R0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Ic.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(e1.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(z0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(j0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Uc.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Yc.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(hk.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Xc.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(Tk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Ak.configure(this.options.strike)),this.options.text!==!1&&i.push(Bk.configure(this.options.text)),this.options.underline!==!1&&i.push(Zc.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(_k.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),n1=t1,r1=ne.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")}}}),i1=r1,o1=Zk;const s1={class:"input-richtext-toolbar"},l1={class:"input-richtext-group"},a1={class:"input-richtext-group"},c1={class:"input-richtext-group"},d1={class:"input-richtext-group"},u1={class:"input-richtext-group"},f1={class:"input-richtext-group"},h1={key:0},p1={key:1,class:"input-richtext-dropdown-wrapper"},m1={key:0},g1=["onClick"],y1={class:"input-richtext-dropdown-item-label"},k1={class:"input-richtext-editor-wrapper"},b1=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(x=>({v730eb23c:x.minHeight,cf24df18:x.maxHeight}));const t=n,r=e,i=a.useSlots(),o=a.computed(()=>!!i.default),s=a.ref(null),l=a.ref(typeof t.modelValue=="string"?t.modelValue:"");a.onMounted(()=>{(t.modelValue===void 0||t.modelValue==="")&&o.value&&setTimeout(()=>{if(s.value&&v.value){const x=s.value.innerHTML?.trim()||"";x&&(v.value.commands.setContent(x),l.value=x,r("update:modelValue",x))}},0)});const c=a.ref(null),d=a.ref([]),u=a.ref(),{floatingStyle:f,updatePosition:h,cleanup:p}=qr({trigger:a.computed(()=>c.value!==null?d.value[c.value]:void 0),floating:u,placement:"bottom-start",offset:4,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{g()}}}),m=async x=>{c.value=x,await a.nextTick(),h()},g=()=>{c.value=null},y=x=>{c.value===x?g():m(x)},b=x=>{x.action&&v.value&&x.action(v.value)},w=x=>{v.value&&x.action(v.value),g()},k=(x,S)=>{x&&(d.value[S]=x.$el||x)},v=v0({content:l.value,editable:!t.disabled&&!t.readonly,extensions:[n1.configure({heading:!1}),L0.configure({levels:[1,2,3]}),Ok,i1.configure({types:["heading","paragraph"]}),o1.configure({placeholder:t.placeholder})],onUpdate:({editor:x})=>{const S=x.getHTML();l.value=S,r("update:modelValue",S)},onFocus:x=>{r("focus",x.event)},onBlur:x=>{r("blur",x.event)}});return a.watch(()=>t.modelValue,x=>{typeof x=="string"&&v.value&&v.value.getHTML()!==x&&(v.value.commands.setContent(x),l.value=x)}),a.watch(()=>t.disabled,x=>{v.value&&v.value.setEditable(!x&&!t.readonly)}),a.watch(()=>t.readonly,x=>{v.value&&v.value.setEditable(!t.disabled&&!x)}),a.onBeforeUnmount(()=>{v.value&&v.value.destroy(),p()}),(x,S)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-richtext-container",{"input-error":n.error,"input-disabled":n.disabled}])},[a.createElementVNode("div",s1,[a.createElementVNode("div",l1,[a.createVNode(W,{color:a.unref(v)?.isActive("bold")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[0]||(S[0]=C=>a.unref(v)?.chain().focus().toggleBold().run()),disabled:n.disabled,title:"Bold (Ctrl+B)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(ru),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(v)?.isActive("italic")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[1]||(S[1]=C=>a.unref(v)?.chain().focus().toggleItalic().run()),disabled:n.disabled,title:"Italic (Ctrl+I)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(gu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(v)?.isActive("underline")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[2]||(S[2]=C=>a.unref(v)?.chain().focus().toggleUnderline().run()),disabled:n.disabled,title:"Underline (Ctrl+U)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(Cu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(v)?.isActive("strike")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[3]||(S[3]=C=>a.unref(v)?.chain().focus().toggleStrike().run()),disabled:n.disabled,title:"Strikethrough"},{icon:a.withCtx(()=>[a.createVNode(a.unref(wu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(nt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",a1,[a.createVNode(W,{color:a.unref(v)?.isActive("heading",{level:1})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[4]||(S[4]=C=>a.unref(v)?.chain().focus().toggleHeading({level:1}).run()),disabled:n.disabled,title:"Heading 1"},{icon:a.withCtx(()=>[a.createVNode(a.unref(hu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(v)?.isActive("heading",{level:2})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[5]||(S[5]=C=>a.unref(v)?.chain().focus().toggleHeading({level:2}).run()),disabled:n.disabled,title:"Heading 2"},{icon:a.withCtx(()=>[a.createVNode(a.unref(pu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(v)?.isActive("heading",{level:3})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[6]||(S[6]=C=>a.unref(v)?.chain().focus().toggleHeading({level:3}).run()),disabled:n.disabled,title:"Heading 3"},{icon:a.withCtx(()=>[a.createVNode(a.unref(mu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(nt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",c1,[a.createVNode(W,{color:a.unref(v)?.isActive({textAlign:"left"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[7]||(S[7]=C=>a.unref(v)?.chain().focus().setTextAlign("left").run()),disabled:n.disabled,title:"Align Left"},{icon:a.withCtx(()=>[a.createVNode(a.unref(tu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(v)?.isActive({textAlign:"center"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[8]||(S[8]=C=>a.unref(v)?.chain().focus().setTextAlign("center").run()),disabled:n.disabled,title:"Align Center"},{icon:a.withCtx(()=>[a.createVNode(a.unref(eu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(v)?.isActive({textAlign:"right"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[9]||(S[9]=C=>a.unref(v)?.chain().focus().setTextAlign("right").run()),disabled:n.disabled,title:"Align Right"},{icon:a.withCtx(()=>[a.createVNode(a.unref(nu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(nt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",d1,[a.createVNode(W,{color:a.unref(v)?.isActive("bulletList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[10]||(S[10]=C=>a.unref(v)?.chain().focus().toggleBulletList().run()),disabled:n.disabled,title:"Bullet List"},{icon:a.withCtx(()=>[a.createVNode(a.unref(ku),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(v)?.isActive("orderedList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[11]||(S[11]=C=>a.unref(v)?.chain().focus().toggleOrderedList().run()),disabled:n.disabled,title:"Numbered List"},{icon:a.withCtx(()=>[a.createVNode(a.unref(yu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(v)?.isActive("blockquote")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[12]||(S[12]=C=>a.unref(v)?.chain().focus().toggleBlockquote().run()),disabled:n.disabled,title:"Quote"},{icon:a.withCtx(()=>[a.createVNode(a.unref(bu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(v)?.isActive("codeBlock")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[13]||(S[13]=C=>a.unref(v)?.chain().focus().toggleCodeBlock().run()),disabled:n.disabled,title:"Code Block"},{icon:a.withCtx(()=>[a.createVNode(a.unref(cu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(nt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",u1,[a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",onClick:S[14]||(S[14]=C=>a.unref(v)?.chain().focus().setHorizontalRule().run()),disabled:n.disabled,title:"Horizontal Rule"},{icon:a.withCtx(()=>[a.createVNode(a.unref(Al),{size:16})]),_:1},8,["disabled"]),a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!a.unref(v)?.can().undo()||n.disabled,onClick:S[15]||(S[15]=C=>a.unref(v)?.chain().focus().undo().run()),title:"Undo (Ctrl+Z)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(Su),{size:16})]),_:1},8,["disabled"]),a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!a.unref(v)?.can().redo()||n.disabled,onClick:S[16]||(S[16]=C=>a.unref(v)?.chain().focus().redo().run()),title:"Redo (Ctrl+Y)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(vu),{size:16})]),_:1},8,["disabled"])]),n.customControls&&n.customControls.length>0?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createVNode(nt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",f1,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.customControls,(C,M)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:M},[C.action?(a.openBlock(),a.createBlock(W,{key:0,color:"secondary",size:"sm",icon:!C.label,squircle:"",onClick:A=>b(C),disabled:n.disabled,title:C.tooltip||C.label},a.createSlots({default:a.withCtx(()=>[C.label&&C.icon?(a.openBlock(),a.createElementBlock("span",h1,a.toDisplayString(C.label),1)):C.label?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(C.label),1)],64)):a.createCommentVNode("",!0)]),_:2},[C.icon?{name:"icon",fn:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(C.icon),{size:16}))]),key:"0"}:void 0]),1032,["icon","onClick","disabled","title"])):C.list?(a.openBlock(),a.createElementBlock("div",p1,[a.createVNode(W,{ref_for:!0,ref:A=>k(A,M),color:"secondary",size:"sm",squircle:"",onClick:A=>y(M),disabled:n.disabled,title:C.tooltip||C.label,class:a.normalizeClass({"input-richtext-dropdown-open":c.value===M})},a.createSlots({"trailing-icon":a.withCtx(()=>[a.createVNode(a.unref(Ur),{size:14,class:"input-richtext-dropdown-arrow"})]),default:a.withCtx(()=>[C.label?(a.openBlock(),a.createElementBlock("span",m1,a.toDisplayString(C.label),1)):a.createCommentVNode("",!0)]),_:2},[C.icon?{name:"leading-icon",fn:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(C.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"},[c.value!==null&&n.customControls?.[c.value]?.list?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"input-richtext-dropdown",style:a.normalizeStyle(a.unref(f))},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.customControls[c.value].list,(C,M)=>(a.openBlock(),a.createElementBlock("button",{key:M,class:"input-richtext-dropdown-item",onClick:A=>w(C),type:"button"},[C.icon?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(C.icon),{key:0,size:16,class:"input-richtext-dropdown-item-icon"})):a.createCommentVNode("",!0),a.createElementVNode("span",y1,a.toDisplayString(C.label),1)],8,g1))),128))],4)):a.createCommentVNode("",!0)])),a.createElementVNode("div",k1,[a.createVNode(a.unref(b0),{editor:a.unref(v),class:"input-richtext-editor",id:n.inputId},null,8,["editor","id"])]),o.value?(a.openBlock(),a.createElementBlock("span",{key:0,ref_key:"slotContentRef",ref:s,class:"sr-only","aria-hidden":"true"},[a.renderSlot(x.$slots,"default",{},void 0,!0)],512)):a.createCommentVNode("",!0)],2))}}),v1=se(b1,[["__scopeId","data-v-2a24e764"]]),x1={class:"pincode-inputs"},w1={key:0,class:"pincode-icon pincode-icon-leading"},C1=["value","disabled","readonly","tabindex","data-index","onInput","onKeydown","onFocus"],S1={key:1,class:"pincode-divider"},M1={key:1,class:"pincode-icon pincode-icon-trailing"},T1=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 k=(t.modelValue||"").split("");for(;k.length<t.maxLength;)k.push("");return k.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=w=>!l.value||w===t.maxLength?!1:w%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=(w,k)=>{const v=w.target,S=v.value.slice(-1);if(!h().test(S)&&S!==""){v.value=s.value[k];return}const M=[...s.value];M[k]=S;const A=M.join("");r("update:modelValue",A),S&&k<t.maxLength-1&&a.nextTick(()=>{const I=i.value[k+1];I&&(I.focus(),I.select())}),A.length===t.maxLength&&r("complete",A)},m=(w,k)=>{const v=w.key;if(v==="Backspace"){w.preventDefault();const x=[...s.value];s.value[k]?(x[k]="",r("update:modelValue",x.join(""))):k>0&&(x[k-1]="",r("update:modelValue",x.join("")),a.nextTick(()=>{const S=i.value[k-1];S&&S.focus()}))}else if(v==="ArrowLeft"&&k>0){w.preventDefault();const x=i.value[k-1];x&&x.focus()}else if(v==="ArrowRight"&&k<t.maxLength-1){w.preventDefault();const x=i.value[k+1];x&&x.focus()}else if(v==="Delete"){w.preventDefault();const x=[...s.value];x[k]="",r("update:modelValue",x.join(""))}},g=w=>{w.preventDefault();const k=w.clipboardData?.getData("text")||"",v=h(),x=k.split("").filter(S=>v.test(S)).slice(0,t.maxLength).join("");if(x){r("update:modelValue",x);const S=x.length<t.maxLength?x.length:t.maxLength-1;a.nextTick(()=>{const C=i.value[S];C&&C.focus()}),x.length===t.maxLength&&r("complete",x)}},y=w=>{o.value=w;const k=i.value[w];k&&k.select()},b=w=>{o.value=-1,r("blur",w)};return a.watch(()=>t.modelValue,w=>{w||a.nextTick(()=>{const k=i.value[0];k&&!t.disabled&&!t.readonly&&k.focus()})}),(w,k)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["pincode-wrapper",[`pincode-size-${n.size}`,{"pincode-error":n.error}]])},[a.createElementVNode("div",x1,[a.renderSlot(w.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",w1,[a.renderSlot(w.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.maxLength,v=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:v},[a.createElementVNode("input",{ref_for:!0,ref_key:"pincodeRefs",ref:i,type:"text",class:a.normalizeClass(["pincode-input",{"pincode-input-filled":s.value[v-1],"pincode-input-focused":o.value===v-1}]),value:s.value[v-1],disabled:n.disabled,readonly:n.readonly,tabindex:n.disabled?-1:void 0,"data-index":v-1,maxlength:"1",onInput:x=>p(x,v-1),onKeydown:x=>m(x,v-1),onFocus:x=>y(v-1),onBlur:b,onPaste:g},null,42,C1),f(v)&&d.value?(a.openBlock(),a.createBlock(nt,a.mergeProps({key:0,ref_for:!0},u.value,{class:"pincode-custom-divider"}),null,16)):f(v)?(a.openBlock(),a.createElementBlock("span",S1,a.toDisplayString(c.value),1)):a.createCommentVNode("",!0)],64))),128)),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",M1,[a.renderSlot(w.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(w.$slots,"trailing",{},void 0,!0)])],2))}}),E1=se(T1,[["__scopeId","data-v-12f41567"]]);function N1(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 A1={key:0,class:"input-required"},B1={key:1,class:"input-hint"},O1={key:2,class:"input-error-text"},I1={key:3,class:"input-help-text"},D1=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:{},virtual:{type:Boolean},virtualItemHeight:{},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(t.value!==void 0?t.value:t.modelValue!==void 0?t.modelValue:""),s=a.computed(()=>o.value);a.watch(()=>t.modelValue,k=>{k!==void 0&&k!==o.value&&(o.value=k)},{immediate:!0});const l=`input-${a.useId()}`,c=k=>N1(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=>{o.value=k,r("input",k)},h=k=>{r("change",k)},p=k=>{r("blur",k)},m=k=>{r("focus",k)},g=k=>{r("keydown",k)},y=k=>{r("file-error",k)},b=()=>{r("clear-preview")},w=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,tabindex:"-1",class:"input-label"},[a.createTextVNode(a.toDisplayString(t.label)+" ",1),t.required?(a.openBlock(),a.createElementBlock("span",A1,"*")):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",null,[d.value?(a.openBlock(),a.createBlock(Ou,{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,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,onInput:f,onChange:h,onBlur:p,onFocus:m,onKeydown:g},{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","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="textarea"?(a.openBlock(),a.createBlock(Lu,{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,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:p,onFocus:m,onKeydown:g},a.createSlots({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)]),_:2},[c("default")?{name:"default",fn:a.withCtx(()=>[a.renderSlot(k.$slots,"default",{},void 0,!0)]),key:"0"}:void 0]),1032,["model-value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck","resizable","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="select"?(a.openBlock(),a.createBlock(sf,{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,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:p,onFocus:m},{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","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="file"?(a.openBlock(),a.createBlock(Tf,{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,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:y,onClearPreview:b,onBlur:p,onFocus:m},{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","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="date"?(a.openBlock(),a.createBlock(ih,{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,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:p,onFocus:m},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","tabindex"])):n.type==="time"?(a.openBlock(),a.createBlock(oh,{key:5,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,"input-id":l,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:p,onFocus:m},null,8,["model-value","placeholder","disabled","readonly","required","error","size","tabindex"])):n.type==="datetime"?(a.openBlock(),a.createBlock(sh,{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,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:p,onFocus:m},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","tabindex"])):n.type==="richtext"?(a.openBlock(),a.createBlock(v1,{key:7,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,"input-id":l,error:t.error,"min-height":t.minHeight,"max-height":t.maxHeight,"custom-controls":t.customControls,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:p,onFocus:m},a.createSlots({_:2},[c("default")?{name:"default",fn:a.withCtx(()=>[a.renderSlot(k.$slots,"default",{},void 0,!0)]),key:"0"}:void 0]),1032,["model-value","placeholder","disabled","readonly","error","min-height","max-height","custom-controls","tabindex"])):n.type==="pincode"?(a.openBlock(),a.createBlock(E1,{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,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:p,onFocus:m,onComplete:w},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","error","size","tabindex"])):a.createCommentVNode("",!0)]),k.$slots.hint?(a.openBlock(),a.createElementBlock("div",B1,[a.renderSlot(k.$slots,"hint",{},void 0,!0)])):a.createCommentVNode("",!0),t.error&&t.error!==!0?(a.openBlock(),a.createElementBlock("p",O1,a.toDisplayString(typeof t.error=="string"?t.error:t.error?.message||String(t.error)),1)):t.helpText?(a.openBlock(),a.createElementBlock("p",I1,a.toDisplayString(t.helpText),1)):a.createCommentVNode("",!0)],2))}}),li=se(D1,[["__scopeId","data-v-2eecc135"]]),$1=["disabled","aria-disabled"],R1=["href","target","rel","aria-disabled"],L1=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,$1)):(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,R1))}}),Zo=se(L1,[["__scopeId","data-v-3bf99110"]]),z1={StrandsUiAlert:fo,StrandsUiButton:W,StrandsUiCard:ho,StrandsUiInput:li,StrandsUiLink:Zo,StrandsUiTabs:Wr,StrandsUiLoader:jr},od={install(n,e={}){const{prefix:t=""}=e;Object.entries(z1).forEach(([r,i])=>{const o=t?`${t}${r}`:r;n.component(o,i)})}},P1=Object.freeze(Object.defineProperty({__proto__:null,StrandsUiAlert:fo,StrandsUiButton:W,StrandsUiCard:ho,StrandsUiInput:li,StrandsUiLink:Zo,StrandsUiLoader:jr,StrandsUiTabs:Wr,default:od},Symbol.toStringTag,{value:"Module"}));exports.ChevronDown=Ur;exports.Minus=Al;exports.StrandsUIPlugin=od;exports.StrandsUIPlugin$1=P1;exports.StrandsUiAlert=fo;exports.StrandsUiButton=W;exports.StrandsUiCard=ho;exports.StrandsUiInput=li;exports.StrandsUiLink=Zo;exports.StrandsUiLoader=jr;exports.StrandsUiTabs=Wr;exports.UiButtonContent=bn;exports.UiDivider=nt;exports.UiTooltip=Nl;exports.VirtualList=Bl;exports._export_sfc=se;exports._sfc_main=$i;exports._sfc_main$1=Ri;exports.createLucideIcon=J;exports.useFloatingPosition=qr;
|
|
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=eo(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=eo(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()}}});ne.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(jc.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Uc.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Yc.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Xc.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Sk.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Mk.configure(this.options.taskList)),n}});var Tk=Te.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",oe(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()}}}),Ek=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Nk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ak=$t.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",oe(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:Ek,type:this.type})]},addPasteRules(){return[Ot({find:Nk,type:this.type})]}}),Bk=Te.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Zc=$t.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",oe(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()}}}),Ok=Zc;function Ik(n={}){return new _({view(e){return new Dk(e,n)}})}class Dk{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=ra(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 te extends U{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return te.valid(r)?new te(r):U.near(r)}content(){return B.empty}eq(e){return e instanceof te&&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 te(e.resolve(t.pos))}getBookmark(){return new Xo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!$k(e)||!Rk(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&&te.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(te.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(te.valid(l))return l}return null}}}te.prototype.visible=!1;te.findFrom=te.findGapCursorFrom;U.jsonID("gapcursor",te);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 te.valid(t)?new te(t):U.near(t)}}function _c(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function $k(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||_c(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Rk(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||_c(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Lk(){return new _({props:{decorations:Fk,createSelectionBetween(n,e,t){return e.pos==t.pos&&te.valid(t)?new te(t):null},handleClick:Pk,handleKeyDown:zk,handleDOMEvents:{beforeinput:Vk}}})}const zk=Za({ArrowLeft:Jn("horiz",-1),ArrowRight:Jn("horiz",1),ArrowUp:Jn("vert",-1),ArrowDown:Jn("vert",1)});function Jn(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=te.findGapCursorFrom(l,e,c);return d?(i&&i(r.tr.setSelection(new te(d))),!0):!1}}function Pk(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!te.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 te(r))),!0)}function Vk(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof te))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 Fk(n){if(!(n.selection instanceof te))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Z.create(n.doc,[be.widget(n.selection.head,e,{key:"gapcursor"})])}var Hr=200,me=function(){};me.prototype.append=function(e){return e.length?(e=me.from(e),!this.length&&e||e.length<Hr&&this.leafAppend(e)||this.length<Hr&&e.leafPrepend(this)||this.appendInner(e)):this};me.prototype.prepend=function(e){return e.length?me.from(e).append(this):this};me.prototype.appendInner=function(e){return new Hk(this,e)};me.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?me.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};me.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};me.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)};me.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};me.from=function(e){return e instanceof me?e:e&&e.length?new ed(e):me.empty};var ed=(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<=Hr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Hr)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})(me);me.empty=new ed([]);var Hk=(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})(me);const td=me,jk=500;class $e{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 Fe(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 Fe(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 $e(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 Fe(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>qk&&(l=Uk(l,d),s-=d),new $e(l.append(o),s)}remapping(e,t){let r=new wn;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 $e(this.items.append(e.map(t=>new Fe(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 Fe(m,g,y))}else r.push(new Fe(m))},i);let d=[];for(let h=t;h<s;h++)d.push(new Fe(o.maps[h]));let u=this.items.slice(0,i).append(d).append(r),f=new $e(u,l);return f.emptyItemCount()>jk&&(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 Fe(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 $e(td.from(i.reverse()),o)}}$e.empty=new $e(td.empty,0);function Uk(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Fe{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 Fe(t.getMap().invert(),t,this.selection)}}}class tt{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const qk=20;function Wk(n,e,t,r){let i=t.getMeta(Tt),o;if(i)return i.historyState;t.getMeta(Gk)&&(n=new tt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Tt))return s.getMeta(Tt).redo?new tt(n.done.addTransform(t,void 0,r,Zn(e)),n.undone,Ml(t.mapping.maps),n.prevTime,n.prevComposition):new tt(n.done,n.undone.addTransform(t,void 0,r,Zn(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||!Kk(t,n.prevRanges)),d=s?Ii(n.prevRanges,t.mapping):Ml(t.mapping.maps);return new tt(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Zn(e)),$e.empty,d,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new tt(n.done.rebased(t,o),n.undone.rebased(t,o),Ii(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new tt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ii(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Kk(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 Ml(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 Ii(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 Jk(n,e,t){let r=Zn(e),i=Tt.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 tt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(Tt,{redo:t,historyState:c})}let Di=!1,Tl=null;function Zn(n){let e=n.plugins;if(Tl!=e){Di=!1,Tl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Di=!0;break}}return Di}const Tt=new le("history"),Gk=new le("closeHistory");function Yk(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new _({key:Tt,state:{init(){return new tt($e.empty,$e.empty,null,0,-1)},apply(e,t,r){return Wk(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?rd:r=="historyRedo"?id:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function nd(n,e){return(t,r)=>{let i=Tt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=Jk(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const rd=nd(!1,!0),id=nd(!0,!0);ne.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 _({key:new le("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 Qk=ne.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Ik(this.options)]}});ne.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new _({key:new le("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!t||!r)return Z.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}))}),Z.create(n,o)}}})]}});var Xk=ne.create({name:"gapCursor",addProseMirrorPlugins(){return[Lk()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=Y(z(n,"allowGapCursor",t)))!=null?e:null}}}),Zk=ne.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new _({key:new le("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&&ri(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}),Z.create(n,i)}}})]}});ne.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new _({key:new le("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||pc(t.selection)||n.view.dragging?null:Z.create(t.doc,[be.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function El({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var _k=ne.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new le(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 _({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!El({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!El({node:s,types:r})}}})]}}),e1=ne.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>rd(n,e),redo:()=>({state:n,dispatch:e})=>id(n,e)}},addProseMirrorPlugins(){return[Yk(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()}}}),t1=ne.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(E0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(w0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(jc.configure(this.options.bulletList)),this.options.code!==!1&&i.push(B0.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(D0.configure(this.options.codeBlock)),this.options.document!==!1&&i.push($0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Qk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Xk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(R0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Ic.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(e1.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(z0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(j0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Uc.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Yc.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(hk.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Xc.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(Tk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Ak.configure(this.options.strike)),this.options.text!==!1&&i.push(Bk.configure(this.options.text)),this.options.underline!==!1&&i.push(Zc.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(_k.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),n1=t1,r1=ne.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")}}}),i1=r1,o1=Zk;const s1={class:"input-richtext-toolbar"},l1={class:"input-richtext-group"},a1={class:"input-richtext-group"},c1={class:"input-richtext-group"},d1={class:"input-richtext-group"},u1={class:"input-richtext-group"},f1={class:"input-richtext-group"},h1={key:0},p1={key:1,class:"input-richtext-dropdown-wrapper"},m1={key:0},g1=["onClick"],y1={class:"input-richtext-dropdown-item-label"},k1={class:"input-richtext-editor-wrapper"},b1=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(x=>({v730eb23c:x.minHeight,cf24df18:x.maxHeight}));const t=n,r=e,i=a.useSlots(),o=a.computed(()=>!!i.default),s=a.ref(null),l=a.ref(typeof t.modelValue=="string"?t.modelValue:"");a.onMounted(()=>{(t.modelValue===void 0||t.modelValue==="")&&o.value&&setTimeout(()=>{if(s.value&&k.value){const x=s.value.innerHTML?.trim()||"";x&&(k.value.commands.setContent(x),l.value=x,r("update:modelValue",x))}},0)});const c=a.ref(null),d=a.ref([]),u=a.ref(),{floatingStyle:f,updatePosition:h,cleanup:p}=qr({trigger:a.computed(()=>c.value!==null?d.value[c.value]:void 0),floating:u,placement:"bottom-start",offset:4,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{g()}}}),m=async x=>{c.value=x,await a.nextTick(),h()},g=()=>{c.value=null},y=x=>{c.value===x?g():m(x)},b=x=>{x.action&&k.value&&x.action(k.value)},C=x=>{k.value&&x.action(k.value),g()},v=(x,S)=>{x&&(d.value[S]=x.$el||x)},k=v0({content:l.value,editable:!t.disabled&&!t.readonly,extensions:[n1.configure({heading:!1}),L0.configure({levels:[1,2,3]}),Ok,i1.configure({types:["heading","paragraph"]}),o1.configure({placeholder:t.placeholder})],onUpdate:({editor:x})=>{const S=x.getHTML();l.value=S,r("update:modelValue",S)},onFocus:x=>{r("focus",x.event)},onBlur:x=>{r("blur",x.event)}});return a.watch(()=>t.modelValue,x=>{typeof x=="string"&&k.value&&k.value.getHTML()!==x&&(k.value.commands.setContent(x),l.value=x)}),a.watch(()=>t.disabled,x=>{k.value&&k.value.setEditable(!x&&!t.readonly)}),a.watch(()=>t.readonly,x=>{k.value&&k.value.setEditable(!t.disabled&&!x)}),a.onBeforeUnmount(()=>{k.value&&k.value.destroy(),p()}),(x,S)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["input-richtext-container",{"input-error":n.error,"input-disabled":n.disabled}])},[a.createElementVNode("div",s1,[a.createElementVNode("div",l1,[a.createVNode(W,{color:a.unref(k)?.isActive("bold")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[0]||(S[0]=w=>a.unref(k)?.chain().focus().toggleBold().run()),disabled:n.disabled,title:"Bold (Ctrl+B)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(ru),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("italic")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[1]||(S[1]=w=>a.unref(k)?.chain().focus().toggleItalic().run()),disabled:n.disabled,title:"Italic (Ctrl+I)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(gu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("underline")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[2]||(S[2]=w=>a.unref(k)?.chain().focus().toggleUnderline().run()),disabled:n.disabled,title:"Underline (Ctrl+U)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(Cu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("strike")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[3]||(S[3]=w=>a.unref(k)?.chain().focus().toggleStrike().run()),disabled:n.disabled,title:"Strikethrough"},{icon:a.withCtx(()=>[a.createVNode(a.unref(wu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(nt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",a1,[a.createVNode(W,{color:a.unref(k)?.isActive("heading",{level:1})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[4]||(S[4]=w=>a.unref(k)?.chain().focus().toggleHeading({level:1}).run()),disabled:n.disabled,title:"Heading 1"},{icon:a.withCtx(()=>[a.createVNode(a.unref(hu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("heading",{level:2})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[5]||(S[5]=w=>a.unref(k)?.chain().focus().toggleHeading({level:2}).run()),disabled:n.disabled,title:"Heading 2"},{icon:a.withCtx(()=>[a.createVNode(a.unref(pu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("heading",{level:3})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[6]||(S[6]=w=>a.unref(k)?.chain().focus().toggleHeading({level:3}).run()),disabled:n.disabled,title:"Heading 3"},{icon:a.withCtx(()=>[a.createVNode(a.unref(mu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(nt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",c1,[a.createVNode(W,{color:a.unref(k)?.isActive({textAlign:"left"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[7]||(S[7]=w=>a.unref(k)?.chain().focus().setTextAlign("left").run()),disabled:n.disabled,title:"Align Left"},{icon:a.withCtx(()=>[a.createVNode(a.unref(tu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive({textAlign:"center"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[8]||(S[8]=w=>a.unref(k)?.chain().focus().setTextAlign("center").run()),disabled:n.disabled,title:"Align Center"},{icon:a.withCtx(()=>[a.createVNode(a.unref(eu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive({textAlign:"right"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[9]||(S[9]=w=>a.unref(k)?.chain().focus().setTextAlign("right").run()),disabled:n.disabled,title:"Align Right"},{icon:a.withCtx(()=>[a.createVNode(a.unref(nu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(nt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",d1,[a.createVNode(W,{color:a.unref(k)?.isActive("bulletList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[10]||(S[10]=w=>a.unref(k)?.chain().focus().toggleBulletList().run()),disabled:n.disabled,title:"Bullet List"},{icon:a.withCtx(()=>[a.createVNode(a.unref(ku),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("orderedList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[11]||(S[11]=w=>a.unref(k)?.chain().focus().toggleOrderedList().run()),disabled:n.disabled,title:"Numbered List"},{icon:a.withCtx(()=>[a.createVNode(a.unref(yu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("blockquote")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[12]||(S[12]=w=>a.unref(k)?.chain().focus().toggleBlockquote().run()),disabled:n.disabled,title:"Quote"},{icon:a.withCtx(()=>[a.createVNode(a.unref(bu),{size:16})]),_:1},8,["color","disabled"]),a.createVNode(W,{color:a.unref(k)?.isActive("codeBlock")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[13]||(S[13]=w=>a.unref(k)?.chain().focus().toggleCodeBlock().run()),disabled:n.disabled,title:"Code Block"},{icon:a.withCtx(()=>[a.createVNode(a.unref(cu),{size:16})]),_:1},8,["color","disabled"])]),a.createVNode(nt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",u1,[a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",onClick:S[14]||(S[14]=w=>a.unref(k)?.chain().focus().setHorizontalRule().run()),disabled:n.disabled,title:"Horizontal Rule"},{icon:a.withCtx(()=>[a.createVNode(a.unref(Al),{size:16})]),_:1},8,["disabled"]),a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!a.unref(k)?.can().undo()||n.disabled,onClick:S[15]||(S[15]=w=>a.unref(k)?.chain().focus().undo().run()),title:"Undo (Ctrl+Z)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(Su),{size:16})]),_:1},8,["disabled"]),a.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!a.unref(k)?.can().redo()||n.disabled,onClick:S[16]||(S[16]=w=>a.unref(k)?.chain().focus().redo().run()),title:"Redo (Ctrl+Y)"},{icon:a.withCtx(()=>[a.createVNode(a.unref(vu),{size:16})]),_:1},8,["disabled"])]),n.customControls&&n.customControls.length>0?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createVNode(nt,{orientation:"vertical",spacing:"28px",margin:"4px"}),a.createElementVNode("div",f1,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.customControls,(w,M)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:M},[w.action?(a.openBlock(),a.createBlock(W,{key:0,color:"secondary",size:"sm",icon:!w.label,squircle:"",onClick:A=>b(w),disabled:n.disabled,title:w.tooltip||w.label},a.createSlots({default:a.withCtx(()=>[w.label&&w.icon?(a.openBlock(),a.createElementBlock("span",h1,a.toDisplayString(w.label),1)):w.label?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(w.label),1)],64)):a.createCommentVNode("",!0)]),_:2},[w.icon?{name:"icon",fn:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(w.icon),{size:16}))]),key:"0"}:void 0]),1032,["icon","onClick","disabled","title"])):w.list?(a.openBlock(),a.createElementBlock("div",p1,[a.createVNode(W,{ref_for:!0,ref:A=>v(A,M),color:"secondary",size:"sm",squircle:"",onClick:A=>y(M),disabled:n.disabled,title:w.tooltip||w.label,class:a.normalizeClass({"input-richtext-dropdown-open":c.value===M})},a.createSlots({"trailing-icon":a.withCtx(()=>[a.createVNode(a.unref(Ur),{size:14,class:"input-richtext-dropdown-arrow"})]),default:a.withCtx(()=>[w.label?(a.openBlock(),a.createElementBlock("span",m1,a.toDisplayString(w.label),1)):a.createCommentVNode("",!0)]),_:2},[w.icon?{name:"leading-icon",fn:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(w.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"},[c.value!==null&&n.customControls?.[c.value]?.list?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"input-richtext-dropdown",style:a.normalizeStyle(a.unref(f))},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.customControls[c.value].list,(w,M)=>(a.openBlock(),a.createElementBlock("button",{key:M,class:"input-richtext-dropdown-item",onClick:A=>C(w),type:"button"},[w.icon?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(w.icon),{key:0,size:16,class:"input-richtext-dropdown-item-icon"})):a.createCommentVNode("",!0),a.createElementVNode("span",y1,a.toDisplayString(w.label),1)],8,g1))),128))],4)):a.createCommentVNode("",!0)])),a.createElementVNode("div",k1,[a.createVNode(a.unref(b0),{editor:a.unref(k),class:"input-richtext-editor",id:n.inputId},null,8,["editor","id"])]),o.value?(a.openBlock(),a.createElementBlock("span",{key:0,ref_key:"slotContentRef",ref:s,class:"sr-only","aria-hidden":"true"},[a.renderSlot(x.$slots,"default",{},void 0,!0)],512)):a.createCommentVNode("",!0)],2))}}),v1=se(b1,[["__scopeId","data-v-2a24e764"]]),x1={class:"pincode-inputs"},w1={key:0,class:"pincode-icon pincode-icon-leading"},C1=["value","disabled","readonly","tabindex","data-index","onInput","onKeydown","onFocus"],S1={key:1,class:"pincode-divider"},M1={key:1,class:"pincode-icon pincode-icon-trailing"},T1=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 v=(t.modelValue||"").split("");for(;v.length<t.maxLength;)v.push("");return v.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=C=>!l.value||C===t.maxLength?!1:C%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=(C,v)=>{const k=C.target,S=k.value.slice(-1);if(!h().test(S)&&S!==""){k.value=s.value[v];return}const M=[...s.value];M[v]=S;const A=M.join("");r("update:modelValue",A),S&&v<t.maxLength-1&&a.nextTick(()=>{const O=i.value[v+1];O&&(O.focus(),O.select())}),A.length===t.maxLength&&r("complete",A)},m=(C,v)=>{const k=C.key;if(k==="Backspace"){C.preventDefault();const x=[...s.value];s.value[v]?(x[v]="",r("update:modelValue",x.join(""))):v>0&&(x[v-1]="",r("update:modelValue",x.join("")),a.nextTick(()=>{const S=i.value[v-1];S&&S.focus()}))}else if(k==="ArrowLeft"&&v>0){C.preventDefault();const x=i.value[v-1];x&&x.focus()}else if(k==="ArrowRight"&&v<t.maxLength-1){C.preventDefault();const x=i.value[v+1];x&&x.focus()}else if(k==="Delete"){C.preventDefault();const x=[...s.value];x[v]="",r("update:modelValue",x.join(""))}},g=C=>{C.preventDefault();const v=C.clipboardData?.getData("text")||"",k=h(),x=v.split("").filter(S=>k.test(S)).slice(0,t.maxLength).join("");if(x){r("update:modelValue",x);const S=x.length<t.maxLength?x.length:t.maxLength-1;a.nextTick(()=>{const w=i.value[S];w&&w.focus()}),x.length===t.maxLength&&r("complete",x)}},y=C=>{o.value=C;const v=i.value[C];v&&v.select()},b=C=>{o.value=-1,r("blur",C)};return a.watch(()=>t.modelValue,C=>{C||a.nextTick(()=>{const v=i.value[0];v&&!t.disabled&&!t.readonly&&v.focus()})}),(C,v)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["pincode-wrapper",[`pincode-size-${n.size}`,{"pincode-error":n.error}]])},[a.createElementVNode("div",x1,[a.renderSlot(C.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(a.openBlock(),a.createElementBlock("div",w1,[a.renderSlot(C.$slots,"leading-icon",{},void 0,!0)])):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.maxLength,k=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:k},[a.createElementVNode("input",{ref_for:!0,ref_key:"pincodeRefs",ref:i,type:"text",class:a.normalizeClass(["pincode-input",{"pincode-input-filled":s.value[k-1],"pincode-input-focused":o.value===k-1}]),value:s.value[k-1],disabled:n.disabled,readonly:n.readonly,tabindex:n.disabled?-1:void 0,"data-index":k-1,maxlength:"1",onInput:x=>p(x,k-1),onKeydown:x=>m(x,k-1),onFocus:x=>y(k-1),onBlur:b,onPaste:g},null,42,C1),f(k)&&d.value?(a.openBlock(),a.createBlock(nt,a.mergeProps({key:0,ref_for:!0},u.value,{class:"pincode-custom-divider"}),null,16)):f(k)?(a.openBlock(),a.createElementBlock("span",S1,a.toDisplayString(c.value),1)):a.createCommentVNode("",!0)],64))),128)),t.hasTrailingIcon?(a.openBlock(),a.createElementBlock("div",M1,[a.renderSlot(C.$slots,"trailing-icon",{},void 0,!0)])):a.createCommentVNode("",!0),a.renderSlot(C.$slots,"trailing",{},void 0,!0)])],2))}}),E1=se(T1,[["__scopeId","data-v-12f41567"]]);function N1(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 A1={key:0,class:"input-required"},B1={key:1,class:"input-hint"},O1={key:2,class:"input-error-text"},I1={key:3,class:"input-help-text"},D1=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:{},virtual:{type:Boolean},virtualItemHeight:{},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(t.value!==void 0?t.value:t.modelValue!==void 0?t.modelValue:""),s=a.computed(()=>o.value);a.watch(()=>t.modelValue,v=>{v!==void 0&&v!==o.value&&(o.value=v)},{immediate:!0});const l=`input-${a.useId()}`,c=v=>N1(i,v),d=a.computed(()=>{const v=["text","email","password","number","tel","url","search"],k=t.type||"text";return v.includes(k)}),u=v=>{o.value=v,r("update:modelValue",v),r("input",v),r("change",v)},f=v=>{o.value=v,r("input",v)},h=v=>{r("change",v)},p=v=>{r("blur",v)},m=v=>{r("focus",v)},g=v=>{r("keydown",v)},y=v=>{r("file-error",v)},b=()=>{r("clear-preview")},C=v=>{r("complete",v)};return(v,k)=>(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,tabindex:"-1",class:"input-label"},[a.createTextVNode(a.toDisplayString(t.label)+" ",1),t.required?(a.openBlock(),a.createElementBlock("span",A1,"*")):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",null,[d.value?(a.openBlock(),a.createBlock(Ou,{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,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,onInput:f,onChange:h,onBlur:p,onFocus:m,onKeydown:g},{leading:a.withCtx(()=>[a.renderSlot(v.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(v.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(v.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(v.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","type","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="textarea"?(a.openBlock(),a.createBlock(Lu,{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,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:p,onFocus:m,onKeydown:g},a.createSlots({leading:a.withCtx(()=>[a.renderSlot(v.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(v.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(v.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(v.$slots,"trailing",{},void 0,!0)]),_:2},[c("default")?{name:"default",fn:a.withCtx(()=>[a.renderSlot(v.$slots,"default",{},void 0,!0)]),key:"0"}:void 0]),1032,["model-value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck","resizable","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="select"?(a.openBlock(),a.createBlock(sf,{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,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:p,onFocus:m},{leading:a.withCtx(()=>[a.renderSlot(v.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(v.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(v.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(v.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","options","placeholder","disabled","multiple","searchable","allow-insert","max-dropdown-height","no-options-text","search-placeholder","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="file"?(a.openBlock(),a.createBlock(Tf,{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,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:y,onClearPreview:b,onBlur:p,onFocus:m},{leading:a.withCtx(()=>[a.renderSlot(v.$slots,"leading",{},void 0,!0)]),"leading-icon":a.withCtx(()=>[a.renderSlot(v.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":a.withCtx(()=>[a.renderSlot(v.$slots,"trailing-icon",{},void 0,!0)]),trailing:a.withCtx(()=>[a.renderSlot(v.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","accept","multiple","max-file-size","drag-drop-text","selected-text","preview","disabled","required","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="date"?(a.openBlock(),a.createBlock(ih,{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,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:p,onFocus:m},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","tabindex"])):n.type==="time"?(a.openBlock(),a.createBlock(oh,{key:5,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,"input-id":l,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:p,onFocus:m},null,8,["model-value","placeholder","disabled","readonly","required","error","size","tabindex"])):n.type==="datetime"?(a.openBlock(),a.createBlock(sh,{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,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:p,onFocus:m},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","tabindex"])):n.type==="richtext"?(a.openBlock(),a.createBlock(v1,{key:7,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,"input-id":l,error:t.error,"min-height":t.minHeight,"max-height":t.maxHeight,"custom-controls":t.customControls,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:p,onFocus:m},a.createSlots({_:2},[c("default")?{name:"default",fn:a.withCtx(()=>[a.renderSlot(v.$slots,"default",{},void 0,!0)]),key:"0"}:void 0]),1032,["model-value","placeholder","disabled","readonly","error","min-height","max-height","custom-controls","tabindex"])):n.type==="pincode"?(a.openBlock(),a.createBlock(E1,{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,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:p,onFocus:m,onComplete:C},a.createSlots({_:2},[c("leading")?{name:"leading",fn:a.withCtx(()=>[a.renderSlot(v.$slots,"leading",{},void 0,!0)]),key:"0"}:void 0,c("leading-icon")?{name:"leading-icon",fn:a.withCtx(()=>[a.renderSlot(v.$slots,"leading-icon",{},void 0,!0)]),key:"1"}:void 0,c("trailing-icon")?{name:"trailing-icon",fn:a.withCtx(()=>[a.renderSlot(v.$slots,"trailing-icon",{},void 0,!0)]),key:"2"}:void 0,c("trailing")?{name:"trailing",fn:a.withCtx(()=>[a.renderSlot(v.$slots,"trailing",{},void 0,!0)]),key:"3"}:void 0]),1032,["model-value","max-length","variant","divider","disabled","readonly","error","size","tabindex"])):a.createCommentVNode("",!0)]),v.$slots.hint?(a.openBlock(),a.createElementBlock("div",B1,[a.renderSlot(v.$slots,"hint",{},void 0,!0)])):a.createCommentVNode("",!0),t.error&&t.error!==!0?(a.openBlock(),a.createElementBlock("p",O1,a.toDisplayString(typeof t.error=="string"?t.error:t.error?.message||String(t.error)),1)):t.helpText?(a.openBlock(),a.createElementBlock("p",I1,a.toDisplayString(t.helpText),1)):a.createCommentVNode("",!0)],2))}}),li=se(D1,[["__scopeId","data-v-2de0564c"]]),$1=["disabled","aria-disabled"],R1=["href","target","rel","aria-disabled"],L1=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,$1)):(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,R1))}}),Zo=se(L1,[["__scopeId","data-v-3bf99110"]]),z1={StrandsUiAlert:fo,StrandsUiButton:W,StrandsUiCard:ho,StrandsUiInput:li,StrandsUiLink:Zo,StrandsUiTabs:Wr,StrandsUiLoader:jr},od={install(n,e={}){const{prefix:t=""}=e;Object.entries(z1).forEach(([r,i])=>{const o=t?`${t}${r}`:r;n.component(o,i)})}},P1=Object.freeze(Object.defineProperty({__proto__:null,StrandsUiAlert:fo,StrandsUiButton:W,StrandsUiCard:ho,StrandsUiInput:li,StrandsUiLink:Zo,StrandsUiLoader:jr,StrandsUiTabs:Wr,default:od},Symbol.toStringTag,{value:"Module"}));exports.ChevronDown=Ur;exports.Minus=Al;exports.StrandsUIPlugin=od;exports.StrandsUIPlugin$1=P1;exports.StrandsUiAlert=fo;exports.StrandsUiButton=W;exports.StrandsUiCard=ho;exports.StrandsUiInput=li;exports.StrandsUiLink=Zo;exports.StrandsUiLoader=jr;exports.StrandsUiTabs=Wr;exports.UiButtonContent=bn;exports.UiDivider=nt;exports.UiTooltip=Nl;exports.VirtualList=Bl;exports._export_sfc=se;exports._sfc_main=$i;exports._sfc_main$1=Ri;exports.createLucideIcon=G;exports.useFloatingPosition=qr;
|