@strands.gg/lumen 3.0.14 → 3.0.16
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/LumenUIPlugin-B9wblUv-.cjs.js +145 -0
- package/dist/LumenUIPlugin-CKJOVQM7.es.js +30985 -0
- package/dist/LumenUIPlugin-CuDB79Q7.es.js +30984 -0
- package/dist/LumenUIPlugin-D0TZ8ypf.es.js +30984 -0
- package/dist/LumenUIPlugin-D4x9nL4O.cjs.js +145 -0
- package/dist/LumenUIPlugin-Duwhmnm7.cjs.js +145 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +78 -62
- package/dist/lumen.css +1 -1
- package/dist/nuxt/runtime/plugin.client.d.ts +1 -1
- package/dist/nuxt/runtime/plugin.server.d.ts +1 -1
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.es.js +1 -1
- package/dist/vue/ui/LumenButtonGroup.vue.d.ts +22 -0
- package/dist/vue/ui/LumenCheckboxGroup.vue.d.ts +1 -1
- package/dist/vue/ui/LumenHero.vue.d.ts +1 -1
- package/dist/vue/ui/LumenTabs.vue.d.ts +1 -1
- package/dist/vue/ui/index.d.ts +1 -0
- package/dist/webcomponents/entries/lumen-button-group.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";const r=require("vue"),sh={class:"app-content"},lh={key:0,class:"lumen-app-loading-overlay"},ah={class:"lumen-app-loading-content"},ch={key:0,class:"lumen-app-loading-message"},uh=r.defineComponent({__name:"LumenApp",props:{theme:{default:"auto"},loading:{type:Boolean,default:!1},loadingMessage:{default:""}},setup(n){const e=n,t=r.computed(()=>e.loading),o=r.computed(()=>({"lumen-app--light":e.theme==="light","lumen-app--dark":e.theme==="dark","lumen-app--auto":e.theme==="auto","lumen-app--loading":t.value})),i=l=>{},s=r.computed(()=>e.theme);return r.provide("uiApp",{theme:s,isLoading:t}),r.provide("themeProvider",{theme:s,isForced:r.computed(()=>e.theme!=="auto")}),r.onMounted(()=>{document.addEventListener("keydown",i),document.body.classList.add("lumen-app-body"),e.theme!=="auto"&&document.body.classList.add(`lumen-app-theme--${e.theme}`)}),r.onUnmounted(()=>{document.removeEventListener("keydown",i),document.body.classList.remove("lumen-app-body"),document.body.classList.remove("lumen-app-theme--light","lumen-app-theme--dark")}),(l,a)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["lumen-app",o.value])},[r.createElementVNode("div",sh,[r.renderSlot(l.$slots,"default",{},void 0,!0)]),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[a[0]||(a[0]=r.createElementVNode("div",{class:"lumen-app-notifications"},null,-1))])),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[t.value?(r.openBlock(),r.createElementBlock("div",lh,[r.createElementVNode("div",ah,[a[1]||(a[1]=r.createElementVNode("div",{class:"lumen-app-loading-spinner"},null,-1)),n.loadingMessage?(r.openBlock(),r.createElementBlock("p",ch,r.toDisplayString(n.loadingMessage),1)):r.createCommentVNode("",!0)])])):r.createCommentVNode("",!0)]))],2))}}),_e=(n,e)=>{const t=n.__vccOpts||n;for(const[o,i]of e)t[o]=i;return t},yl=_e(uh,[["__scopeId","data-v-ad0f6a47"]]),dh={class:"lumen-scope"},fh={class:"alert-content"},hh={class:"alert-icon-container"},ph={class:"alert-main-icon",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true"},mh=["d"],gh={class:"alert-text-container"},vh={key:0,class:"alert-dismiss-container"},yh=r.defineComponent({__name:"LumenAlert",props:{variant:{default:"info"},title:{},message:{},dismissible:{type:Boolean,default:!1}},emits:["dismiss"],setup(n){const e=n,t=r.computed(()=>({primary:"alert alert-primary",secondary:"alert alert-secondary",success:"alert alert-success",warning:"alert alert-warning",danger:"alert alert-danger",info:"alert alert-info",neutral:"alert alert-neutral"})[e.variant]),o=r.computed(()=>"alert-title"),i=r.computed(()=>"alert-message"),s=r.computed(()=>({primary:"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",secondary:"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",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",danger:"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",neutral:"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(l,a)=>(r.openBlock(),r.createElementBlock("div",dh,[r.createElementVNode("div",{class:r.normalizeClass(t.value),role:"alert"},[r.createElementVNode("div",fh,[r.createElementVNode("div",hh,[(r.openBlock(),r.createElementBlock("svg",ph,[r.createElementVNode("path",{"fill-rule":"evenodd",d:s.value,"clip-rule":"evenodd"},null,8,mh)]))]),r.createElementVNode("div",gh,[n.title?(r.openBlock(),r.createElementBlock("h3",{key:0,class:r.normalizeClass(o.value)},r.toDisplayString(n.title),3)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass(i.value)},[r.renderSlot(l.$slots,"default",{},()=>[r.createTextVNode(r.toDisplayString(n.message),1)],!0)],2)]),n.dismissible?(r.openBlock(),r.createElementBlock("div",vh,[r.createElementVNode("button",{type:"button",class:"alert-dismiss-button",onClick:a[0]||(a[0]=c=>l.$emit("dismiss"))},[...a[1]||(a[1]=[r.createElementVNode("span",{class:"sr-only"},"Dismiss",-1),r.createElementVNode("svg",{class:"alert-dismiss-icon",fill:"currentColor",viewBox:"0 0 20 20"},[r.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)])])])):r.createCommentVNode("",!0)])],2)]))}}),kl=_e(yh,[["__scopeId","data-v-27a18614"]]),kh=`<svg width="302" height="438" viewBox="0 0 302 438" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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
|
+
</svg>
|
|
4
|
+
`,bh={key:0,class:"loader-icon"},xh=["width","height"],wh=["d"],Ch=["stroke-width"],Eh=["stroke-width"],Sh=["width","height"],Mh={key:3,class:"loader-text"},Th=r.defineComponent({__name:"LumenLoader",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=kh.replace(/<svg[^>]*>/,"").replace(/<\/svg>/,"").trim().match(/d="([^"]*)"/)?.[1]||"",o=n,i={sm:32,md:48,lg:64,xl:80},s=r.computed(()=>typeof o.size=="number"?o.size:i[o.size]||i.md);return(l,a)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["loader-container",[{"loader-centered":n.centered},`loader-color-${n.color}`]])},[n.variant==="spinner"?(r.openBlock(),r.createElementBlock("div",bh,[(r.openBlock(),r.createElementBlock("svg",{width:s.value,height:s.value,viewBox:"0 0 500 500"},[r.createElementVNode("defs",null,[r.createElementVNode("path",{id:"logo-path",d:r.unref(t),transform:"translate(81, 13) scale(1.0)"},null,8,wh)]),r.createElementVNode("use",{href:"#logo-path",fill:"none",stroke:"var(--loader-semi-color)","stroke-width":n.weight,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,Ch),r.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,Eh)],8,xh))])):n.variant==="circle"?(r.openBlock(),r.createElementBlock("div",{key:1,class:"loader-circle",style:r.normalizeStyle({width:`${s.value}px`,height:`${s.value}px`})},[(r.openBlock(),r.createElementBlock("svg",{width:s.value,height:s.value,viewBox:"0 0 50 50"},[...a[0]||(a[0]=[r.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,Sh))],4)):n.variant==="bar"?(r.openBlock(),r.createElementBlock("div",{key:2,class:"loader-bar",style:r.normalizeStyle({width:n.fullWidth?"100%":`${s.value*1.5}px`,height:`${Math.max(s.value*.1,4)}px`})},[...a[1]||(a[1]=[r.createElementVNode("div",{class:"loader-bar-track"},[r.createElementVNode("div",{class:"loader-bar-fill"})],-1)])],4)):r.createCommentVNode("",!0),n.text?(r.openBlock(),r.createElementBlock("p",Mh,r.toDisplayString(n.text),1)):r.createCommentVNode("",!0)],2))}}),Fi=_e(Th,[["__scopeId","data-v-2faa9cc5"]]),Nh={key:0,class:"button-loading-content"},Bh={key:0},Ah={key:0,class:"leading-icon"},$h={class:"button-text-content"},Oh={key:1,class:"trailing-icon"},Ih=r.defineComponent({__name:"LumenButton.Content",props:{loading:{type:Boolean,default:!1},loadingText:{},icon:{type:Boolean,default:!1},size:{},textAlign:{default:"center"}},setup(n){const e=r.useSlots(),t=r.computed(()=>!!e["leading-icon"]),o=r.computed(()=>!!e["trailing-icon"]),i=n,s=r.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}}),l=r.computed(()=>i.size?`button-content-${i.size}`:"button-content-md");return(a,c)=>n.loading?(r.openBlock(),r.createElementBlock("span",Nh,[r.createVNode(Fi,{variant:"circle",size:s.value,centered:!1,color:"white"},null,8,["size"]),n.icon?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",Bh,r.toDisplayString(n.loadingText||"Loading..."),1))])):(r.openBlock(),r.createElementBlock("span",{key:1,class:r.normalizeClass(["button-content",l.value,`button-content-align-${n.textAlign}`])},[n.icon?r.renderSlot(a.$slots,"icon",{key:0},void 0,!0):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[t.value?(r.openBlock(),r.createElementBlock("span",Ah,[r.renderSlot(a.$slots,"leading-icon",{},void 0,!0)])):r.createCommentVNode("",!0),r.renderSlot(a.$slots,"icon",{},void 0,!0),r.createElementVNode("span",$h,[r.renderSlot(a.$slots,"default",{},void 0,!0)]),o.value?(r.openBlock(),r.createElementBlock("span",Oh,[r.renderSlot(a.$slots,"trailing-icon",{},void 0,!0)])):r.createCommentVNode("",!0)],64))],2))}}),pr=_e(Ih,[["__scopeId","data-v-74d36d1c"]]),Lh=["href","target","rel"],zs=r.defineComponent({__name:"LumenButton.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,o=e,i=r.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"#"}),s=l=>{if(t.disabled||t.loading){l.preventDefault();return}o("click",l)};return(l,a)=>(r.openBlock(),r.createElementBlock("a",{href:i.value,target:n.external?"_blank":void 0,rel:n.external?"noopener noreferrer":void 0,class:r.normalizeClass(n.buttonClasses),style:r.normalizeStyle(n.buttonStyles),onClick:s},[r.createVNode(pr,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"text-align":n.textAlign},{"leading-icon":r.withCtx(()=>[r.renderSlot(l.$slots,"leading-icon")]),icon:r.withCtx(()=>[r.renderSlot(l.$slots,"icon")]),default:r.withCtx(()=>[r.renderSlot(l.$slots,"default")]),"trailing-icon":r.withCtx(()=>[r.renderSlot(l.$slots,"trailing-icon")]),_:3},8,["loading","loading-text","icon","text-align"])],14,Lh))}}),Ps=r.defineComponent({__name:"LumenButton.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=r.getCurrentInstance();let o=!1;const i=r.computed(()=>{o=!1;const d=t?.appContext?.components||{};return d.NuxtLink?(o=!0,d.NuxtLink):d.RouterLink?(o=!0,d.RouterLink):"a"}),s=r.computed(()=>o),l=n,a=e,c=u=>{if(l.disabled||l.loading){u.preventDefault();return}a("click",u)};return(u,d)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(i.value),{to:s.value?n.to:void 0,href:s.value?void 0:typeof n.to=="string"?n.to:"/",class:r.normalizeClass(n.buttonClasses),style:r.normalizeStyle(n.buttonStyles),onClick:c},{default:r.withCtx(()=>[r.createVNode(pr,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"text-align":n.textAlign},{"leading-icon":r.withCtx(()=>[r.renderSlot(u.$slots,"leading-icon")]),icon:r.withCtx(()=>[r.renderSlot(u.$slots,"icon")]),default:r.withCtx(()=>[r.renderSlot(u.$slots,"default")]),"trailing-icon":r.withCtx(()=>[r.renderSlot(u.$slots,"trailing-icon")]),_:3},8,["loading","loading-text","icon","text-align"])]),_:3},8,["to","href","class","style"]))}}),Dh={class:"lumen-tooltip-content"},Vh=r.defineComponent({inheritAttrs:!1,__name:"LumenTooltip",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=r.ref(),o=r.ref(),i=r.ref(!1),s=r.ref(!1);let l=null,a=null;const c=r.ref({}),u=r.ref(e.position),d={top:"bottom",bottom:"top",left:"right",right:"left"};function f(v,y,b,C,k){let x=0,S=0;switch(v){case"top":x=y.top-C-k,S=y.left+y.width/2-b/2;break;case"bottom":x=y.bottom+k,S=y.left+y.width/2-b/2;break;case"left":x=y.top+y.height/2-C/2,S=y.left-b-k;break;case"right":x=y.top+y.height/2-C/2,S=y.right+k;break}return{top:x,left:S}}function h(v,y,b,C,k,x){const S=window.innerWidth,M=window.innerHeight;return v==="top"?y>=x:v==="bottom"?y+k<=M-x:v==="left"?b>=x:v==="right"?b+C<=S-x:!0}const p=async()=>{if(!t.value||!o.value||!s.value)return;await r.nextTick();const v=t.value.getBoundingClientRect();o.value.style.visibility="hidden",o.value.style.opacity="1";const y=o.value.getBoundingClientRect(),b=y.width,C=y.height;o.value.style.visibility="",o.value.style.opacity="";const k=8,x=e.position;let{top:S,left:M}=f(x,v,b,C,e.offset),L=x;if(!h(x,S,M,b,C,k)){const ve=d[x],fe=f(ve,v,b,C,e.offset);h(ve,fe.top,fe.left,b,C,k)&&(S=fe.top,M=fe.left,L=ve)}u.value=L;const R=window.innerWidth,X=window.innerHeight;M<k?M=k:M+b>R-k&&(M=R-b-k),S<k?S=k:S+C>X-k&&(S=X-C-k),c.value={position:"fixed",top:`${S}px`,left:`${M}px`,zIndex:"9999"}},m=()=>{e.disabled||(a&&(clearTimeout(a),a=null),s.value=!0,r.nextTick(()=>{p()}),l=setTimeout(()=>{i.value=!0},e.delay))},g=()=>{l&&(clearTimeout(l),l=null),a=setTimeout(()=>{i.value=!1,setTimeout(()=>{s.value=!1},200)},100)};return r.onUnmounted(()=>{l&&clearTimeout(l),a&&clearTimeout(a)}),(v,y)=>(r.openBlock(),r.createElementBlock("div",r.mergeProps({ref_key:"tooltipContainer",ref:t,class:"lumen-tooltip-container"},v.$attrs,{onMouseenter:m,onMouseleave:g}),[r.renderSlot(v.$slots,"default",{},void 0,!0),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[s.value?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"tooltipRef",ref:o,class:r.normalizeClass(["lumen-tooltip",[`lumen-tooltip--${u.value}`,{"lumen-tooltip--visible":i.value}]]),style:r.normalizeStyle(c.value),role:"tooltip"},[r.createElementVNode("div",Dh,[r.renderSlot(v.$slots,"tooltip",{},()=>[r.createTextVNode(r.toDisplayString(n.content),1)],!0)]),r.createElementVNode("div",{class:r.normalizeClass(["lumen-tooltip-arrow",`lumen-tooltip-arrow--${u.value}`])},null,2)],6)):r.createCommentVNode("",!0)]))],16))}}),vn=_e(Vh,[["__scopeId","data-v-f45f02f5"]]),Rh=["type","disabled","tabindex"],zh=["type","disabled","tabindex"],Ph=r.defineComponent({inheritAttrs:!1,__name:"LumenButton",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,o=r.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=r.computed(()=>["lumen-button",`lumen-button-${t.variant}`,`lumen-button-${t.size}`,`lumen-button-color-${t.color}`,t.loading?"lumen-button-loading":"",t.disabled?"lumen-button-disabled":"",t.fullWidth?"lumen-button-full-width":"",t.icon?"lumen-button-icon":"",t.squircle?"lumen-button-squircle":""].filter(Boolean)),s=r.computed(()=>i.value.join(" ")),l=r.computed(()=>({fontWeight:t.fontWeight})),a=r.computed(()=>t.disabled||t.loading?-1:t.tabindex??void 0);return(c,u)=>n.title?(r.openBlock(),r.createBlock(vn,r.normalizeProps(r.mergeProps({key:0},o.value)),{default:r.withCtx(()=>[n.to?n.to?(r.openBlock(),r.createBlock(Ps,{key:1,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":i.value,"button-styles":l.value,tabindex:a.value,"text-align":n.textAlign,onClick:u[1]||(u[1]=d=>c.$emit("click",d))},r.createSlots({icon:r.withCtx(()=>[r.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:r.withCtx(()=>[r.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:r.withCtx(()=>[r.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:r.withCtx(()=>[r.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?(r.openBlock(),r.createBlock(zs,{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":l.value,tabindex:a.value,"text-align":n.textAlign,onClick:u[2]||(u[2]=d=>c.$emit("click",d))},r.createSlots({icon:r.withCtx(()=>[r.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:r.withCtx(()=>[r.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:r.withCtx(()=>[r.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:r.withCtx(()=>[r.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"])):r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("button",r.mergeProps({key:0},c.$attrs,{type:n.type,disabled:n.disabled||n.loading,class:s.value,style:l.value,tabindex:a.value,onClick:u[0]||(u[0]=d=>c.$emit("click",d))}),[r.createVNode(pr,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,size:n.size,"text-align":n.textAlign},r.createSlots({icon:r.withCtx(()=>[r.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:r.withCtx(()=>[r.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:r.withCtx(()=>[r.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:r.withCtx(()=>[r.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","text-align"])],16,Rh))]),_:3},16)):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[n.to?n.to?(r.openBlock(),r.createBlock(Ps,{key:1,to:n.to,disabled:n.disabled,loading:n.loading,"loading-text":n.loadingText,icon:n.icon,"button-classes":i.value,"button-styles":l.value,tabindex:a.value,"text-align":n.textAlign,onClick:u[4]||(u[4]=d=>c.$emit("click",d))},r.createSlots({icon:r.withCtx(()=>[r.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:r.withCtx(()=>[r.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:r.withCtx(()=>[r.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:r.withCtx(()=>[r.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?(r.openBlock(),r.createBlock(zs,{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":l.value,tabindex:a.value,"text-align":n.textAlign,onClick:u[5]||(u[5]=d=>c.$emit("click",d))},r.createSlots({icon:r.withCtx(()=>[r.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:r.withCtx(()=>[r.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:r.withCtx(()=>[r.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:r.withCtx(()=>[r.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"])):r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("button",r.mergeProps({key:0},c.$attrs,{type:n.type,disabled:n.disabled||n.loading,class:s.value,style:l.value,tabindex:a.value,onClick:u[3]||(u[3]=d=>c.$emit("click",d))}),[r.createVNode(pr,{loading:n.loading,"loading-text":n.loadingText,icon:n.icon,size:n.size,"text-align":n.textAlign},r.createSlots({icon:r.withCtx(()=>[r.renderSlot(c.$slots,"icon",{},void 0,!0)]),default:r.withCtx(()=>[r.renderSlot(c.$slots,"default",{},void 0,!0)]),_:2},[c.$slots["leading-icon"]?{name:"leading-icon",fn:r.withCtx(()=>[r.renderSlot(c.$slots,"leading-icon",{},void 0,!0)]),key:"0"}:void 0,c.$slots["trailing-icon"]?{name:"trailing-icon",fn:r.withCtx(()=>[r.renderSlot(c.$slots,"trailing-icon",{},void 0,!0)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","text-align"])],16,zh))],64))}}),De=_e(Ph,[["__scopeId","data-v-c0c2aa63"]]),gn=De;gn.Content=pr;gn.Anchor=zs;gn.Nuxt=Ps;const Hh={key:0,class:"lumen-card-header"},_h={key:0,class:"lumen-card-title-wrapper"},Fh={key:0,class:"lumen-card-title"},Uh={key:0,class:"lumen-card-subtitle"},qh={key:1,class:"lumen-card-content"},jh={key:2,class:"lumen-card-footer"},Wh=r.defineComponent({inheritAttrs:!1,__name:"LumenCard",props:{variant:{default:"default"},padding:{default:"md"},shadow:{default:"sm"},color:{default:"default"},title:{},subtitle:{},to:{}},setup(n){const e=n,t=r.useAttrs(),o=r.computed(()=>{if(!e.to)return null;try{const u=r.resolveComponent("NuxtLink");if(typeof u!="string")return u}catch{}try{const u=r.resolveComponent("RouterLink");if(typeof u!="string")return u}catch{}return"a"}),i=r.computed(()=>!e.to||typeof e.to!="string"?!1:/^(https?:\/\/|mailto:|tel:)/.test(e.to)),s=r.computed(()=>e.to?i.value?"a":o.value||"a":"div"),l=r.computed(()=>typeof s.value!="string"),a=r.computed(()=>s.value==="a"&&!!e.to),c=r.computed(()=>[`lumen-card-${e.variant}`,`lumen-card-padding-${e.padding}`,`lumen-card-shadow-${e.shadow}`,`lumen-card-color-${e.color}`,t.class]);return(u,d)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(s.value),{to:l.value?n.to:void 0,href:a.value?typeof n.to=="string"?n.to:"":void 0,class:r.normalizeClass(["lumen-card",[c.value,{"lumen-card-linkable":!!n.to}]])},{default:r.withCtx(()=>[u.$slots.header||n.title||n.subtitle||u.$slots["leading-icon"]||u.$slots["trailing-icon"]?(r.openBlock(),r.createElementBlock("div",Hh,[r.renderSlot(u.$slots,"header",{},()=>[r.renderSlot(u.$slots,"leading-icon",{},void 0,!0),n.title||u.$slots.title||n.subtitle||u.$slots.subtitle?(r.openBlock(),r.createElementBlock("div",_h,[n.title||u.$slots.title?r.renderSlot(u.$slots,"title",{key:0},()=>[n.title?(r.openBlock(),r.createElementBlock("h2",Fh,r.toDisplayString(n.title),1)):r.createCommentVNode("",!0)],!0):r.createCommentVNode("",!0),n.subtitle||u.$slots.subtitle?r.renderSlot(u.$slots,"subtitle",{key:1},()=>[n.subtitle?(r.openBlock(),r.createElementBlock("p",Uh,r.toDisplayString(n.subtitle),1)):r.createCommentVNode("",!0)],!0):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.renderSlot(u.$slots,"trailing-icon",{},void 0,!0),r.renderSlot(u.$slots,"actions",{},void 0,!0)],!0)])):r.createCommentVNode("",!0),u.$slots.default?(r.openBlock(),r.createElementBlock("div",qh,[r.renderSlot(u.$slots,"default",{},void 0,!0)])):r.createCommentVNode("",!0),u.$slots.footer?(r.openBlock(),r.createElementBlock("div",jh,[r.renderSlot(u.$slots,"footer",{},void 0,!0)])):r.createCommentVNode("",!0)]),_:3},8,["to","href","class"]))}}),Ui=_e(Wh,[["__scopeId","data-v-c05ef913"]]);const Ea=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Kh=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,o)=>o?o.toUpperCase():t.toLowerCase()),Gh=n=>{const e=Kh(n);return e.charAt(0).toUpperCase()+e.slice(1)},Jh=(...n)=>n.filter((e,t,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===t).join(" ").trim(),Sa=n=>n==="";var Wo={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 Yh=({name:n,iconNode:e,absoluteStrokeWidth:t,"absolute-stroke-width":o,strokeWidth:i,"stroke-width":s,size:l=Wo.width,color:a=Wo.stroke,...c},{slots:u})=>r.h("svg",{...Wo,...c,width:l,height:l,stroke:a,"stroke-width":Sa(t)||Sa(o)||t===!0||o===!0?Number(i||s||Wo["stroke-width"])*24/Number(l):i||s||Wo["stroke-width"],class:Jh("lucide",c.class,...n?[`lucide-${Ea(Gh(n))}-icon`,`lucide-${Ea(n)}`]:["lucide-icon"])},[...e.map(d=>r.h(...d)),...u.default?[u.default()]:[]]);const Pe=(n,e)=>(t,{slots:o,attrs:i})=>r.h(Yh,{...i,...t,iconNode:e,name:n},o);const Xh=Pe("align-center",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const Zh=Pe("align-left",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const Qh=Pe("align-right",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const ep=Pe("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 tp=Pe("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 np=Pe("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 Ma=Pe("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Ro=Pe("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const op=Pe("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const rp=Pe("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const iu=Pe("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Xo=Pe("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);const ip=Pe("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const sp=Pe("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const lp=Pe("contrast",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]]);const ap=Pe("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 cp=Pe("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 up=Pe("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 dp=Pe("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);const fp=Pe("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);const hp=Pe("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 pp=Pe("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 mp=Pe("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 gp=Pe("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 vp=Pe("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 yp=Pe("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 su=Pe("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const Ta=Pe("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);const kp=Pe("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);const bp=Pe("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const xp=Pe("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 wp=Pe("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 Cp=Pe("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const Ep=Pe("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 Sp=Pe("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const Mp=Pe("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 Tp=Pe("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 Na=Pe("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);const bl=Pe("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Np={key:0,class:"input-leading-icon"},Bp=["id","type","value","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","tabindex"],Ap=["tabindex","aria-label"],$p=["tabindex"],Op={key:3,class:"input-trailing-icon"},Ip=r.defineComponent({__name:"LumenInput.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"},color:{},tabindex:{}},emits:["update:modelValue","input","change","blur","focus","keydown"],setup(n,{emit:e}){const t=n,o=e,i=r.ref(t.modelValue??""),s=r.computed(()=>i.value);r.watch(()=>t.modelValue,b=>{b!==void 0&&b!==i.value&&(i.value=b)},{immediate:!0});const l=r.ref(!1),a=r.computed(()=>t.type==="password"?l.value?"text":"password":t.type),c=r.computed(()=>t.hasTrailingIcon||t.type==="password"||t.type==="search"&&s.value),u=r.computed(()=>{if(t.tabindex!==void 0)return t.tabindex+1}),d=r.computed(()=>{const b=[];return t.error&&b.push("input-error"),t.disabled&&b.push("input-disabled"),t.readonly&&b.push("input-readonly"),b.push(`input-size-${t.size}`),b}),f=r.computed(()=>{const b=[];return t.hasLeadingIcon?b.push("input-padding-left-icon"):b.push("input-padding-left"),c.value?b.push("input-padding-right-icon"):b.push("input-padding-right"),b}),h=b=>{let k=b.target.value;t.type==="number"&&k!==""&&(k=parseFloat(k)||0),i.value=k,o("update:modelValue",k),o("input",k),o("change",k)},p=b=>{o("blur",b)},m=b=>{o("focus",b)},g=b=>{o("keydown",b)},v=()=>{l.value=!l.value},y=()=>{i.value="",o("update:modelValue","")};return(b,C)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["input-field-wrapper",d.value])},[r.renderSlot(b.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(r.openBlock(),r.createElementBlock("div",Np,[r.renderSlot(b.$slots,"leading-icon",{},void 0,!0)])):r.createCommentVNode("",!0),r.createElementVNode("input",{id:n.inputId,type:a.value,value:s.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:r.normalizeClass(["input-base",f.value]),onInput:h,onBlur:p,onFocus:m,onKeydown:g},null,42,Bp),n.type==="password"?(r.openBlock(),r.createElementBlock("button",{key:1,class:r.normalizeClass(["input-trailing-action",{"input-trailing-action--active":l.value}]),tabindex:u.value,"aria-label":l.value?"Hide password":"Show password",type:"button",onClick:v},[l.value?(r.openBlock(),r.createBlock(r.unref(ap),{key:0})):(r.openBlock(),r.createBlock(r.unref(cp),{key:1}))],10,Ap)):n.type==="search"&&s.value&&!n.disabled&&!n.readonly?(r.openBlock(),r.createElementBlock("button",{key:2,class:"input-trailing-action input-trailing-action--danger",tabindex:u.value,"aria-label":"Clear search",type:"button",onClick:y},[r.createVNode(r.unref(bl))],8,$p)):t.hasTrailingIcon?(r.openBlock(),r.createElementBlock("div",Op,[r.renderSlot(b.$slots,"trailing-icon",{},void 0,!0)])):r.createCommentVNode("",!0),r.renderSlot(b.$slots,"trailing",{},void 0,!0)],2))}}),Lp=_e(Ip,[["__scopeId","data-v-d708530d"]]),Dp={key:0,class:"input-leading-icon"},Vp=["id","value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck"],Rp={key:1,class:"input-trailing-icon"},zp=r.defineComponent({__name:"LumenInput.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"},color:{},tabindex:{}},emits:["update:modelValue","blur","focus","keydown"],setup(n,{emit:e}){const t=n,o=e,i=r.useSlots(),s=r.computed(()=>!!i.default),l=r.ref(null),a=r.ref(null),c=()=>{const g=a.value;g&&(g.style.height="auto",g.style.height=g.scrollHeight+"px")};r.onMounted(()=>{(t.modelValue===void 0||t.modelValue==="")&&s.value&&setTimeout(()=>{if(l.value){const g=l.value.textContent?.trim()||"";g&&o("update:modelValue",g)}},0)});const u=r.computed(()=>{const g=[];return t.error&&g.push("input-error"),t.disabled&&g.push("input-disabled"),t.readonly&&g.push("input-readonly"),g.push(`input-size-${t.size}`),g}),d=r.computed(()=>{const g=[];return t.hasLeadingIcon?g.push("input-padding-left-icon"):g.push("input-padding-left"),t.hasTrailingIcon?g.push("input-padding-right-icon"):g.push("input-padding-right"),g});r.onMounted(()=>{r.nextTick(()=>c())}),r.watch(()=>t.modelValue,()=>{r.nextTick(()=>c())});const f=g=>{const v=g.target;o("update:modelValue",v.value),c()},h=g=>{o("blur",g)},p=g=>{o("focus",g)},m=g=>{o("keydown",g)};return(g,v)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["input-field-wrapper input-textarea",u.value])},[r.renderSlot(g.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(r.openBlock(),r.createElementBlock("div",Dp,[r.renderSlot(g.$slots,"leading-icon",{},void 0,!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass(["textarea-wrapper",{"textarea-resizable":n.resizable}])},[r.createElementVNode("textarea",{ref_key:"textareaRef",ref:a,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:r.normalizeClass(["input-base",[{"input-textarea-resize":n.resizable},d.value]]),onInput:f,onBlur:h,onFocus:p,onKeydown:m},null,42,Vp)],2),t.hasTrailingIcon?(r.openBlock(),r.createElementBlock("div",Rp,[r.renderSlot(g.$slots,"trailing-icon",{},void 0,!0)])):r.createCommentVNode("",!0),r.renderSlot(g.$slots,"trailing",{},void 0,!0),s.value?(r.openBlock(),r.createElementBlock("span",{key:2,ref_key:"slotContentRef",ref:l,class:"sr-only","aria-hidden":"true"},[r.renderSlot(g.$slots,"default",{},void 0,!0)],512)):r.createCommentVNode("",!0)],2))}}),Pp=_e(zp,[["__scopeId","data-v-1e763c4c"]]);function Mr(n){const{trigger:e,floating:t,placement:o="bottom-start",offset:i=8,flip:s=!0,shift:l=!0,sameWidth:a=!1,autoUpdate:c=!1,clickOutside:u}=n,d=r.ref({position:"fixed",top:"0px",left:"0px",zIndex:"9999"}),f=async()=>{if(await r.nextTick(),!e.value||!t.value||typeof e.value.getBoundingClientRect!="function"||typeof t.value.getBoundingClientRect!="function")return;const C=e.value.getBoundingClientRect(),k=t.value.getBoundingClientRect(),[x,S="start"]=o.split("-");let M=0,L=0;switch(x){case"bottom":M=C.left,L=C.bottom+i;break;case"top":M=C.left,L=C.top-k.height-i;break;case"right":M=C.right+i,L=C.top;break;case"left":M=C.left-k.width-i,L=C.top;break}if(x==="top"||x==="bottom")switch(S){case"center":M=C.left+(C.width-k.width)/2;break;case"end":M=C.right-k.width;break}else if(x==="left"||x==="right")switch(S){case"center":L=C.top+(C.height-k.height)/2;break;case"end":L=C.bottom-k.height;break}let R=a?C.width:void 0;const X=window.innerWidth,ve=window.innerHeight,fe=8;let Se=!1,xe=!1;if(s){if(x==="bottom"&&L+k.height>ve-fe){const ee=C.top-k.height-i;ee>=fe&&(L=ee,Se=!0)}else if(x==="top"&&L<fe){const ee=C.bottom+i;ee+k.height<=ve-fe&&(L=ee,Se=!1)}if(x==="right"&&M+k.width>X-fe){const ee=C.left-k.width-i;ee>=fe&&(M=ee,xe=!0)}else if(x==="left"&&M<fe){const ee=C.right+i;ee+k.width<=X-fe&&(M=ee,xe=!1)}}l&&(M<fe?M=fe:M+k.width>X-fe&&(M=X-k.width-fe),L<fe?L=fe:L+k.height>ve-fe&&(L=ve-k.height-fe));const U={position:"fixed",zIndex:"9999",...R?{width:`${R}px`}:{}};Se?U.bottom=`${ve-L-k.height}px`:U.top=`${L}px`,xe?U.right=`${X-M-k.width}px`:U.left=`${M}px`,d.value=U},h=()=>{f()};let p=null;const m=()=>{h()},g=()=>{if(h(),u?.enabled&&u.handler&&e.value){if(typeof e.value.getBoundingClientRect!="function")return;const C=e.value.getBoundingClientRect(),k=window.innerHeight,x=window.innerWidth;(C.bottom<0||C.top>k||C.right<0||C.left>x)&&u.handler()}},v=C=>{if(!u?.enabled||!u.handler)return;const k=C.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&&u.handler()},y=()=>{c&&(window.addEventListener("resize",m),window.addEventListener("scroll",g,!0),typeof ResizeObserver<"u"&&(p=new ResizeObserver(()=>{h()}),r.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)}))),u?.enabled&&document.addEventListener("click",v,!0)},b=()=>{c&&(window.removeEventListener("resize",m),window.removeEventListener("scroll",g,!0)),u?.enabled&&document.removeEventListener("click",v,!0),p&&(p.disconnect(),p=null)};return r.onMounted(()=>{y()}),r.onUnmounted(()=>{b()}),{floatingStyle:d,updatePosition:h,cleanup:b}}const Hp={class:"lumen-p-2 lumen-border-b"},_p=r.defineComponent({__name:"VirtualList",props:{items:{},itemHeight:{},containerHeight:{},itemKey:{type:[String,Function],default:"id"},overscan:{default:5}},setup(n,{expose:e}){const t=n,o=r.ref(),i=r.ref(0),s=r.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)}}),l=r.computed(()=>{const{start:h,end:p}=s.value,m=[];for(let g=h;g<=p;g++)m.push({index:g,data:t.items[g],top:g*t.itemHeight});return m}),a=r.computed(()=>t.items.length*t.itemHeight),c=h=>typeof t.itemKey=="function"?t.itemKey(h):h[t.itemKey]||h.id||Math.random();let u=null;const d=h=>{u&&clearTimeout(u),u=setTimeout(()=>{const p=h.target;i.value=p.scrollTop},16)};return r.onUnmounted(()=>{u&&clearTimeout(u)}),e({scrollToItem:(h,p="start")=>{if(!o.value)return;let m=h*t.itemHeight;p==="center"?m-=t.containerHeight/2-t.itemHeight/2:p==="end"&&(m-=t.containerHeight-t.itemHeight),o.value.scrollTop=Math.max(0,m)}}),(h,p)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"scrollContainer",ref:o,style:r.normalizeStyle({height:n.containerHeight+"px",overflowY:"auto"}),onScroll:d,class:"lumen-virtual-list"},[r.createElementVNode("div",{style:r.normalizeStyle({height:a.value+"px",position:"relative"})},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(l.value,m=>(r.openBlock(),r.createElementBlock("div",{key:c(m.data),style:r.normalizeStyle({position:"absolute",top:m.top+"px",left:0,right:0,height:n.itemHeight+"px"})},[r.renderSlot(h.$slots,"default",{item:m.data,index:m.index},()=>[r.createElementVNode("div",Hp,r.toDisplayString(JSON.stringify(m.data)),1)],!0)],4))),128))],4)],36))}}),Fp=_e(_p,[["__scopeId","data-v-eee21333"]]),Up={key:0,class:"input-leading-icon"},qp=["id","tabindex","aria-expanded","aria-controls","aria-disabled"],jp={class:"input-select-value"},Wp={key:0,class:"input-select-text"},Kp={key:1,class:"input-select-placeholder"},Gp={key:1,class:"input-trailing-icon"},Jp=["id","aria-multiselectable"],Yp={key:0,class:"input-dropdown-search"},Xp={key:0,class:"input-dropdown-no-options"},Zp=["onClick","onMouseenter","aria-selected"],Qp={class:"input-dropdown-option-content"},em={class:"input-dropdown-option-text"},tm={key:0,class:"input-dropdown-option-description"},nm={key:0,class:"input-dropdown-option-check"},om=["onClick","onMouseenter","aria-selected"],rm={class:"input-dropdown-option-content"},im={class:"input-dropdown-option-text"},sm={key:0,class:"input-dropdown-option-description"},lm={key:0,class:"input-dropdown-option-check"},am=r.defineComponent({__name:"LumenInput.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"},color:{},tabindex:{}},emits:["update:modelValue","blur","focus","search"],setup(n,{emit:e}){const t=n,o=e,i=r.ref(),s=r.ref(),l=r.ref(),a=r.ref(),c=r.computed(()=>`dropdown-${t.inputId||Math.random().toString(36).substr(2,9)}`),u=r.computed(()=>{if(i.value){const U=i.value.closest('[role="dialog"][aria-modal="true"]');if(U)return U}return"body"}),d=r.ref({isOpen:!1,searchQuery:"",highlightedIndex:-1});r.watch(()=>d.value.searchQuery,U=>{o("search",U)});const{floatingStyle:f,updatePosition:h,cleanup:p}=Mr({trigger:i,floating:s,placement:"bottom-start",offset:10,shift:!0,flip:!0,sameWidth:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{M()}}}),m=r.computed(()=>t.multiple?Array.isArray(t.modelValue)?t.modelValue:[]:t.modelValue!==void 0?[t.modelValue]:[]),g=r.computed(()=>{if(t.multiple){const U=t.options.filter(ee=>m.value.includes(ee.value));return U.length>0?`${U.length} selected`:null}else return t.options.find(ee=>ee.value===t.modelValue)?.label||null}),v=r.computed(()=>{let U=t.options;if(t.searchable&&d.value.searchQuery){const ee=d.value.searchQuery.toLowerCase();U=t.options.filter(ce=>ce.label.toLowerCase().includes(ee)||ce.description?.toLowerCase().includes(ee)),t.allowInsert&&t.multiple&&d.value.searchQuery.trim()&&(t.options.some(be=>be.label.toLowerCase()===d.value.searchQuery.toLowerCase())||(U=[{value:`__insert__${d.value.searchQuery}`,label:`Add "${d.value.searchQuery}"`,description:"Add as new item",disabled:!1},...U]))}return U}),y=r.computed(()=>t.searchPlaceholder&&t.searchPlaceholder.trim()!==""?t.searchPlaceholder:t.allowInsert&&t.multiple?"Search or create...":"Search..."),b=r.computed(()=>t.disabled?-1:t.tabindex??0),C=r.computed(()=>{if(t.tabindex!==void 0)return t.tabindex+1}),k=r.computed(()=>{const U=[];return t.error&&U.push("input-error"),t.disabled&&U.push("input-disabled"),U.push(`input-size-${t.size}`),U}),x=r.computed(()=>{const U=[];return t.hasLeadingIcon?U.push("input-padding-left-icon"):U.push("input-padding-left"),t.hasTrailingIcon?U.push("input-padding-right-icon"):U.push("input-padding-right"),U}),S=async()=>{if(!t.disabled){if(d.value.isOpen=!0,d.value.searchQuery="",await r.nextTick(),h(),d.value.highlightedIndex===-1){const U=v.value.findIndex(ee=>!ee.disabled);d.value.highlightedIndex=U>=0?U:0}if(t.searchable&&l.value){const U=l.value.$el?.querySelector("input");U&&U.focus()}document.addEventListener("keydown",Se),o("focus",new FocusEvent("focus"))}},M=()=>{d.value.isOpen&&(d.value.isOpen=!1,d.value.highlightedIndex=-1,d.value.searchQuery="",document.removeEventListener("keydown",Se),o("blur",new FocusEvent("blur")))},L=()=>{d.value.isOpen?M():S()},R=U=>U.value&&typeof U.value=="string"&&U.value.startsWith("__insert__")?!1:m.value.includes(U.value),X=U=>{if(!U.disabled)if(t.multiple){const ee=[...m.value];if(U.value&&typeof U.value=="string"&&U.value.startsWith("__insert__")){const ce=U.value.replace("__insert__","");ee.includes(ce)||ee.push(ce),d.value.searchQuery=""}else{const ce=ee.indexOf(U.value);ce>-1?ee.splice(ce,1):ee.push(U.value)}o("update:modelValue",ee)}else o("update:modelValue",U.value),M()},ve=U=>{if(["Enter"," ","ArrowDown","ArrowUp","Escape"].includes(U.key)&&(U.preventDefault(),!(d.value.isOpen&&(U.key==="ArrowDown"||U.key==="ArrowUp"))))switch(U.key){case"Enter":case" ":L();break;case"ArrowDown":case"ArrowUp":S();break;case"Escape":M();break}},fe=U=>{switch(U.key){case"ArrowDown":U.preventDefault(),xe(1);break;case"ArrowUp":U.preventDefault(),xe(-1);break;case"Enter":if(U.preventDefault(),d.value.highlightedIndex>=0){const ee=v.value[d.value.highlightedIndex];ee&&!ee.disabled&&X(ee)}break;case"Escape":M();break}},Se=U=>{if(d.value.isOpen)switch(U.key){case"Escape":M();break;case"ArrowDown":U.preventDefault(),xe(1);break;case"ArrowUp":U.preventDefault(),xe(-1);break;case"Enter":if(U.preventDefault(),d.value.highlightedIndex>=0){const ee=v.value[d.value.highlightedIndex];ee&&!ee.disabled&&X(ee)}break}},xe=U=>{const ee=v.value;if(ee.length===0)return;let ce=d.value.highlightedIndex+U;ce<0?ce=ee.length-1:ce>=ee.length&&(ce=0);let be=0;for(;ee[ce]?.disabled&&be<ee.length;)ce+=U,ce<0&&(ce=ee.length-1),ce>=ee.length&&(ce=0),be++;d.value.highlightedIndex=ce};return r.onUnmounted(()=>{d.value.isOpen&&M(),document.removeEventListener("keydown",Se),p()}),(U,ee)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",{class:r.normalizeClass(["input-field-wrapper",[k.value,x.value]])},[r.renderSlot(U.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(r.openBlock(),r.createElementBlock("div",Up,[r.renderSlot(U.$slots,"leading-icon",{},void 0,!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",{ref_key:"selectTriggerRef",ref:i,id:n.inputId,class:r.normalizeClass(["input-select-trigger",{"input-select-open":d.value.isOpen}]),onClick:L,onKeydown:ve,tabindex:b.value,role:"combobox","aria-expanded":d.value.isOpen,"aria-haspopup":!0,"aria-controls":c.value,"aria-disabled":n.disabled},[r.createElementVNode("div",jp,[g.value?(r.openBlock(),r.createElementBlock("span",Wp,r.toDisplayString(g.value),1)):(r.openBlock(),r.createElementBlock("span",Kp,r.toDisplayString(n.placeholder||"Select an option..."),1))]),r.createElementVNode("div",{class:r.normalizeClass(["input-select-arrow",{"input-select-arrow-open":d.value.isOpen}])},[r.createVNode(r.unref(Ro))],2)],42,qp),t.hasTrailingIcon?(r.openBlock(),r.createElementBlock("div",Gp,[r.renderSlot(U.$slots,"trailing-icon",{},void 0,!0)])):r.createCommentVNode("",!0),r.renderSlot(U.$slots,"trailing",{},void 0,!0)],2),(r.openBlock(),r.createBlock(r.Teleport,{to:u.value},[d.value.isOpen?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:s,id:c.value,class:r.normalizeClass(["input-dropdown",{"input-dropdown--multiple":n.multiple}]),style:r.normalizeStyle(r.unref(f)),role:"listbox","aria-multiselectable":n.multiple,onMousedown:ee[1]||(ee[1]=r.withModifiers(()=>{},["prevent"]))},[n.searchable?(r.openBlock(),r.createElementBlock("div",Yp,[r.createVNode(uo,{ref_key:"searchInputRef",ref:l,modelValue:d.value.searchQuery,"onUpdate:modelValue":ee[0]||(ee[0]=ce=>d.value.searchQuery=ce),type:"search",placeholder:y.value,size:"sm",tabindex:C.value,onKeydown:fe},{"leading-icon":r.withCtx(()=>[r.createVNode(r.unref(Cp))]),_:1},8,["modelValue","placeholder","tabindex"])])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"input-dropdown-options",style:r.normalizeStyle({maxHeight:`${n.maxDropdownHeight}px`})},[v.value.length===0?(r.openBlock(),r.createElementBlock("div",Xp,[r.renderSlot(U.$slots,"zero-state",{},()=>[r.createTextVNode(r.toDisplayString(n.noOptionsText),1)],!0)])):n.virtual?(r.openBlock(),r.createBlock(Fp,{key:1,ref_key:"virtualListRef",ref:a,items:v.value,"item-height":n.virtualItemHeight,"container-height":Math.min(n.maxDropdownHeight,v.value.length*n.virtualItemHeight),"item-key":"value",overscan:5},{default:r.withCtx(({item:ce,index:be})=>[r.createElementVNode("div",{class:r.normalizeClass(["input-dropdown-option",{"input-dropdown-option--selected":R(ce),"input-dropdown-option--highlighted":be===d.value.highlightedIndex,"input-dropdown-option--disabled":ce.disabled,"input-dropdown-option--insert":ce.value&&typeof ce.value=="string"&&ce.value.startsWith("__insert__")}]),onClick:K=>X(ce),onMouseenter:K=>d.value.highlightedIndex=be,role:"option","aria-selected":R(ce)},[r.createElementVNode("div",Qp,[r.createElementVNode("div",em,r.toDisplayString(ce.label),1),ce.description?(r.openBlock(),r.createElementBlock("div",tm,r.toDisplayString(ce.description),1)):r.createCommentVNode("",!0)]),n.multiple&&R(ce)?(r.openBlock(),r.createElementBlock("div",nm,[r.createVNode(r.unref(Ma))])):r.createCommentVNode("",!0)],42,Zp)]),_:1},8,["items","item-height","container-height"])):(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:2},r.renderList(v.value,(ce,be)=>(r.openBlock(),r.createElementBlock("div",{key:ce.value,class:r.normalizeClass(["input-dropdown-option",{"input-dropdown-option--selected":R(ce),"input-dropdown-option--highlighted":be===d.value.highlightedIndex,"input-dropdown-option--disabled":ce.disabled,"input-dropdown-option--insert":ce.value&&typeof ce.value=="string"&&ce.value.startsWith("__insert__")}]),onClick:K=>X(ce),onMouseenter:K=>d.value.highlightedIndex=be,role:"option","aria-selected":R(ce)},[r.createElementVNode("div",rm,[r.createElementVNode("div",im,r.toDisplayString(ce.label),1),ce.description?(r.openBlock(),r.createElementBlock("div",sm,r.toDisplayString(ce.description),1)):r.createCommentVNode("",!0)]),n.multiple&&R(ce)?(r.openBlock(),r.createElementBlock("div",lm,[r.createVNode(r.unref(Ma))])):r.createCommentVNode("",!0)],42,om))),128))],4)],46,Jp)):r.createCommentVNode("",!0)],8,["to"]))],64))}}),cm=_e(am,[["__scopeId","data-v-8389c65d"]]),um={class:"input-leading-icon"},dm=["src"],fm=["id","accept","multiple","disabled","required"],hm={class:"input-file-content"},pm={key:0,class:"input-file-selected"},mm={class:"input-file-list"},gm={class:"input-file-item"},vm={class:"input-file-name"},ym={key:1,class:"input-file-prompt"},km={class:"input-file-prompt-text"},bm={key:0,class:"input-file-accept-text"},xm={key:2,class:"input-file-selected"},wm={class:"input-file-selected-text"},Cm={class:"input-file-list"},Em={class:"input-file-name"},Sm={class:"input-file-size"},Mm={key:0,class:"input-trailing-icon"},Tm={key:1,class:"input-trailing-icon"},Nm=r.defineComponent({__name:"LumenInput.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"},color:{},tabindex:{}},emits:["update:modelValue","file-error","clear-preview","blur","focus"],setup(n,{emit:e}){const t=n,o=e,i=r.ref(),s=r.ref(!1),l=r.ref(null),a=r.ref([]),c=r.computed(()=>t.preview?t.preview:l.value);r.computed(()=>!!t.preview);const u=r.computed(()=>t.preview?t.preview:null),d=r.computed(()=>{const L=[];return t.error&&L.push("input-error"),t.disabled&&L.push("input-disabled"),L.push(`input-size-${t.size}`),L}),f=r.computed(()=>{const L=[];return L.push("input-padding-left-icon"),a.value.length>0||u.value||t.disabled?L.push("input-padding-right-icon"):L.push("input-padding-right"),L}),h=L=>{if(t.maxFileSize&&L.size>t.maxFileSize)return`File "${L.name}" is too large. Maximum size is ${v(t.maxFileSize)}.`;if(t.accept){const R=t.accept.split(",").map(Se=>Se.trim().toLowerCase()),X=L.type.toLowerCase(),ve="."+L.name.split(".").pop()?.toLowerCase();if(!R.some(Se=>{if(Se.startsWith("."))return ve===Se;if(Se.includes("*")){const xe=Se.split("/")[0];return X.startsWith(xe)}return X===Se}))return`File "${L.name}" is not an accepted file type.`}return null},p=L=>{for(const R of L){const X=h(R);if(X){o("file-error",X);return}}t.multiple?a.value=[...a.value,...L]:a.value=L.slice(0,1),t.multiple?o("update:modelValue",a.value):o("update:modelValue",a.value[0]||null),!t.multiple&&a.value.length>0&&a.value[0].type.startsWith("image/")&&m(a.value[0])},m=L=>{l.value&&URL.revokeObjectURL(l.value);const R=new FileReader;R.onload=X=>{l.value=X.target?.result},R.readAsDataURL(L)},g=()=>{a.value=[],o("update:modelValue",t.multiple?[]:null),l.value&&(URL.revokeObjectURL(l.value),l.value=null),i.value&&(i.value.value=""),t.preview&&o("clear-preview")},v=L=>{if(L===0)return"0 Bytes";const R=1024,X=["Bytes","KB","MB","GB"],ve=Math.floor(Math.log(L)/Math.log(R));return parseFloat((L/Math.pow(R,ve)).toFixed(2))+" "+X[ve]},y=()=>{!t.disabled&&i.value&&i.value.click()},b=L=>{const R=L.target,X=Array.from(R.files||[]);X.length>0&&p(X)},C=L=>{t.disabled||(s.value=!0)},k=L=>{s.value=!1},x=L=>{if(t.disabled)return;s.value=!1;const R=Array.from(L.dataTransfer?.files||[]);R.length>0&&p(R)},S=L=>{o("blur",L)},M=L=>{o("focus",L)};return r.watch(()=>t.modelValue,L=>{L?Array.isArray(L)?a.value=L:(a.value=[L],L.type.startsWith("image/")&&m(L)):(a.value=[],l.value&&(URL.revokeObjectURL(l.value),l.value=null))},{immediate:!0}),r.onUnmounted(()=>{l.value&&URL.revokeObjectURL(l.value)}),(L,R)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["input-field-wrapper",[d.value,f.value]])},[r.renderSlot(L.$slots,"leading",{},void 0,!0),r.createElementVNode("div",um,[c.value?(r.openBlock(),r.createElementBlock("img",{key:0,src:c.value,alt:"Preview",class:"input-file-preview"},null,8,dm)):t.hasLeadingIcon?r.renderSlot(L.$slots,"leading-icon",{key:1},void 0,!0):(r.openBlock(),r.createBlock(r.unref(up),{key:2}))]),r.createElementVNode("div",{class:r.normalizeClass(["input-file-area",{"input-file-dragover":s.value,"input-file-disabled":n.disabled}]),onClick:y,onDragover:r.withModifiers(C,["prevent"]),onDragleave:r.withModifiers(k,["prevent"]),onDrop:r.withModifiers(x,["prevent"])},[r.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:b,onBlur:S,onFocus:M},null,40,fm),r.createElementVNode("div",hm,[u.value&&a.value.length===0?(r.openBlock(),r.createElementBlock("div",pm,[R[0]||(R[0]=r.createElementVNode("div",{class:"input-file-selected-text"}," File loaded ",-1)),r.createElementVNode("div",mm,[r.createElementVNode("div",gm,[r.createElementVNode("span",vm,r.toDisplayString(u.value),1)])])])):a.value.length===0?(r.openBlock(),r.createElementBlock("div",ym,[r.createElementVNode("div",km,r.toDisplayString(n.dragDropText||"Click to select or drag and drop"),1),n.accept?(r.openBlock(),r.createElementBlock("div",bm,r.toDisplayString(n.accept),1)):r.createCommentVNode("",!0)])):(r.openBlock(),r.createElementBlock("div",xm,[r.createElementVNode("div",wm,r.toDisplayString(n.selectedText||`${a.value.length} file(s) selected`),1),r.createElementVNode("div",Cm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.value,(X,ve)=>(r.openBlock(),r.createElementBlock("div",{key:ve,class:"input-file-item"},[r.createElementVNode("span",Em,r.toDisplayString(X.name),1),r.createElementVNode("span",Sm,"("+r.toDisplayString(v(X.size))+")",1)]))),128))])]))])],34),(a.value.length>0||u.value)&&!n.disabled?(r.openBlock(),r.createElementBlock("div",Mm,[r.createElementVNode("button",{type:"button",class:"input-file-clear",onClick:r.withModifiers(g,["stop"]),"aria-label":"Clear selected files"},[r.createVNode(r.unref(bl))])])):t.hasTrailingIcon?(r.openBlock(),r.createElementBlock("div",Tm,[r.renderSlot(L.$slots,"trailing-icon",{},void 0,!0)])):r.createCommentVNode("",!0),r.renderSlot(L.$slots,"trailing",{},void 0,!0)],2))}}),Bm=_e(Nm,[["__scopeId","data-v-b030f7a0"]]),Am={class:"tabs-wrapper"},$m={key:0,class:"tabs-before"},Om=["aria-selected","id","onClick"],Im={key:1,class:"tabs-after"},Lm=["aria-labelledby"],Dm=r.defineComponent({__name:"LumenTabs",props:{modelValue:{default:""},tabs:{default:()=>[]},underlineWidth:{default:"5rem"},orientation:{default:"horizontal"},size:{default:"md"},variant:{default:"default"},tabWidth:{default:"fill"},sticky:{default:null},color:{default:"primary"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,i=r.useSlots(),s=r.computed(()=>!!i.content),l=r.computed(()=>t.tabs.find(k=>k.value===t.modelValue)),a=r.ref([]),c=r.ref(!1),u=r.ref({width:"0px",height:"0px",left:"0px",top:"0px",opacity:"0"}),d=r.ref({width:"0px",height:"0px",left:"0px",top:"0px",opacity:"0"});let f=-1,h=!1;const p=(k,x)=>{const S=k.getBoundingClientRect(),M=x.getBoundingClientRect(),L=getComputedStyle(x),R=parseFloat(L.getPropertyValue("--underline-thickness")||"5");let X=5;t.size==="sm"?X=4:t.size==="lg"&&(X=6);const ve=M.height;if(t.orientation==="vertical"){const fe=S.top-M.top;return{height:S.height-X*4,top:fe+X*2,width:R,left:X-R/2}}else{const fe=S.left-M.left,Se=S.width;if(t.underlineWidth==="full")return{width:Se-30,left:fe+15,height:R,top:ve-X-R/2};let xe;if(t.underlineWidth.endsWith("%")){const ee=parseFloat(t.underlineWidth)/100;xe=Se*ee}else if(t.underlineWidth.endsWith("px"))xe=parseFloat(t.underlineWidth);else if(t.underlineWidth.endsWith("rem")){const ee=parseFloat(t.underlineWidth),ce=parseFloat(getComputedStyle(document.documentElement).fontSize);xe=ee*ce}else xe=parseFloat(t.underlineWidth)||Se;const U=(Se-xe)/2;return{width:xe,left:fe+U,height:R,top:ve-X-R/2}}},m=async(k,x)=>{h||(o("update:modelValue",k),await r.nextTick(),g(x))},g=async k=>{if(!a.value[k]||k===f)return;h=!0;const x=a.value[k],S=x.parentElement;if(!S)return;const M=p(x,S),L=x.getBoundingClientRect(),R=S.getBoundingClientRect();let X,ve;if(t.orientation==="vertical"?(X=L.top-R.top,ve=L.height):(X=L.left-R.left,ve=L.width),f===-1){t.orientation==="vertical"?(u.value={height:`${M.height}px`,top:`${M.top}px`,width:`${M.width}px`,left:`${M.left}px`,opacity:"1"},d.value={height:`${ve}px`,top:`${X}px`,width:`${L.width}px`,left:"0",opacity:"1"}):(u.value={width:`${M.width}px`,left:`${M.left}px`,height:`${M.height}px`,top:`${M.top}px`,opacity:"1"},d.value={width:`${ve}px`,left:`${X}px`,height:"100%",top:"0",opacity:"1"}),f=k,h=!1;return}const fe=a.value[f];if(p(fe,S),fe.getBoundingClientRect(),window.matchMedia("(prefers-reduced-motion: reduce)").matches){u.value={width:`${M.width||0}px`,left:`${M.left||0}px`,height:`${M.height||7}px`,top:`${M.top}px`,opacity:"1"},t.orientation==="vertical"?d.value={height:`${ve}px`,top:`${X}px`,width:"100%",left:"0",opacity:"1"}:d.value={width:`${ve}px`,left:`${X}px`,height:"100%",top:"0",opacity:"1"},f=k,h=!1;return}requestAnimationFrame(()=>{t.orientation==="vertical"?(u.value={height:`${M.height}px`,top:`${M.top}px`,width:`${M.width||7}px`,left:`${M.left}px`,opacity:"1"},d.value={height:`${ve}px`,top:`${X}px`,width:"100%",left:"0",opacity:"1"}):(u.value={width:`${M.width}px`,left:`${M.left}px`,height:`${M.height||7}px`,top:`${M.top}px`,opacity:"1"},d.value={width:`${ve}px`,left:`${X}px`,height:"100%",top:"0",opacity:"1"}),f=k,setTimeout(()=>{h=!1},200)})};let v=null;const y=()=>{const k=t.tabs.findIndex(x=>x.value===t.modelValue);if(k!==-1&&a.value&&a.value[k]){const x=c.value;c.value=!1;const S=a.value[k],M=S.parentElement;if(M){const L=p(S,M),R=S.getBoundingClientRect(),X=M.getBoundingClientRect();let ve,fe;t.orientation==="vertical"?(ve=R.top-X.top,fe=R.height,u.value={height:`${L.height}px`,top:`${L.top}px`,width:`${L.width}px`,left:`${L.left}px`,opacity:"1"},d.value={height:`${fe}px`,top:`${ve}px`,width:`${R.width}px`,left:"0",opacity:"1"}):(ve=R.left-X.left,fe=R.width,u.value={width:`${L.width}px`,left:`${L.left}px`,height:`${L.height}px`,top:`${L.top}px`,opacity:"1"},d.value={width:`${fe}px`,left:`${ve}px`,height:"100%",top:"0",opacity:"1"})}f=k,h=!1,setTimeout(()=>{c.value=x},10)}v&&clearTimeout(v),v=setTimeout(()=>{v=null},50)};r.onMounted(async()=>{await r.nextTick(),b(),setTimeout(()=>{c.value=!0},50),window.addEventListener("resize",y)}),r.onUnmounted(()=>{window.removeEventListener("resize",y),v&&(clearTimeout(v),v=null)});const b=()=>{if(!t.tabs.length||!t.modelValue)return;const k=t.tabs.findIndex(x=>x.value===t.modelValue);k!==-1&&g(k)};r.watch(()=>t.tabs,async k=>{k?.length&&(await r.nextTick(),b())},{deep:!0});const{modelValue:C}=r.toRefs(t);return r.watch(C,async()=>{if(await r.nextTick(),!t.tabs.length)return;const k=t.tabs.findIndex(x=>x.value===t.modelValue);k!==-1&&g(k)}),(k,x)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["tabs-container",[`tabs-container--${n.orientation}`,`tabs-container--${n.size}`,`tabs-container--${n.variant}`,`tabs-color-${n.color}`,{"tabs-container--with-content":s.value}]])},[r.createElementVNode("div",Am,[r.createElementVNode("div",{class:r.normalizeClass(["tabs-list",[`tabs-list--${n.orientation}`,`tabs-list--${n.size}`,`tabs-list--${n.variant}`]]),style:r.normalizeStyle(n.sticky?{position:"sticky",[n.sticky.side]:`${n.sticky.offset}px`,zIndex:10}:{})},[k.$slots.before?(r.openBlock(),r.createElementBlock("div",$m,[r.renderSlot(k.$slots,"before",{},void 0,!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass(["tabs-buttons-wrapper",`tabs-buttons-wrapper--${n.tabWidth}`]),role:"tablist"},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(n.tabs,(S,M)=>(r.openBlock(),r.createElementBlock("button",{key:S.value,ref_for:!0,ref_key:"tabButtons",ref:a,class:r.normalizeClass(["tab-button",[`tab-button--${n.size}`,`tab-button--${n.variant}`,`tab-button--${n.tabWidth}`,{"tab-button-active":r.unref(C)===S.value}]]),"aria-selected":r.unref(C)===S.value,"aria-controls":"tabpanel",id:`tab-${S.value}`,role:"tab",onClick:L=>m(S.value,M)},r.toDisplayString(S.label),11,Om))),128)),r.createElementVNode("div",{class:r.normalizeClass(["tab-background",{"no-transition":!c.value}]),style:r.normalizeStyle(d.value)},null,6),r.createElementVNode("div",{class:r.normalizeClass(["tab-underline",{"no-transition":!c.value}]),style:r.normalizeStyle(u.value)},null,6)],2),k.$slots.after?(r.openBlock(),r.createElementBlock("div",Im,[r.renderSlot(k.$slots,"after",{},void 0,!0)])):r.createCommentVNode("",!0)],6)]),s.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["tabs-content",`tabs-content--${n.orientation}`]),role:"tabpanel","aria-labelledby":`tab-${r.unref(C)}`,id:"tabpanel"},[r.renderSlot(k.$slots,"content",{activeTab:l.value},void 0,!0)],10,Lm)):r.createCommentVNode("",!0)],2))}}),Tr=_e(Dm,[["__scopeId","data-v-c4228d19"]]),Vm={key:0,class:"lumen-divider-text"},Rm=r.defineComponent({__name:"LumenDivider",props:{orientation:{default:"horizontal"},variant:{default:"solid"},text:{},textPosition:{default:"center"},color:{default:"var(--lumen-divider-color)"},thickness:{default:"1px"},margin:{default:"1rem"},spacing:{default:"auto"}},setup(n){const e=n,t=r.useSlots(),o=r.computed(()=>!!(e.text||t.default)),i=r.computed(()=>{const s={};return e.orientation==="horizontal"?(s.width=e.spacing==="auto"?"100%":typeof e.spacing=="number"?`${e.spacing}px`:e.spacing,s.marginTop=typeof e.margin=="number"?`${e.margin}px`:e.margin,s.marginBottom=typeof e.margin=="number"?`${e.margin}px`:e.margin,o.value||(s.height=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness),s["--divider-color"]=e.color==="#e5e7eb"?"var(--lumen-divider-color)":e.color,s["--divider-thickness"]=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness):(s.height=e.spacing==="auto"?"100%":typeof e.spacing=="number"?`${e.spacing}px`:e.spacing,s.marginLeft=typeof e.margin=="number"?`${e.margin}px`:e.margin,s.marginRight=typeof e.margin=="number"?`${e.margin}px`:e.margin,o.value||(s.width=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness),s["--divider-color"]=e.color==="#e5e7eb"?"var(--lumen-divider-color)":e.color,s["--divider-thickness"]=typeof e.thickness=="number"?`${e.thickness}px`:e.thickness),s});return(s,l)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["lumen-divider",`lumen-divider--${n.orientation}`,`lumen-divider--${n.variant}`,{"lumen-divider--with-text":o.value,[`lumen-divider--text-${n.textPosition}`]:o.value}]),style:r.normalizeStyle(i.value)},[o.value?(r.openBlock(),r.createElementBlock("span",Vm,[r.renderSlot(s.$slots,"default",{},()=>[r.createTextVNode(r.toDisplayString(n.text),1)],!0)])):r.createCommentVNode("",!0)],6))}}),Dt=_e(Rm,[["__scopeId","data-v-ea2c0d97"]]),zm={class:"datetime-picker-wrapper"},Pm={class:"datetime-picker-leading-icon"},Hm={class:"datetime-picker-display"},_m={key:0,class:"datetime-picker-value"},Fm={key:1,class:"datetime-picker-placeholder"},Um={key:1,class:"datetime-picker-trailing-icon"},qm={key:1,class:"datetime-picker-panel"},jm={class:"datetime-picker-header"},Wm={class:"datetime-picker-month-year"},Km=["value"],Gm=["value"],Jm={class:"datetime-picker-weekdays"},Ym={class:"datetime-picker-grid"},Xm={key:2,class:"datetime-picker-panel datetime-picker-time-panel"},Zm={class:"time-selector"},Qm={class:"time-column"},eg={class:"time-scroll"},tg={class:"time-column"},ng={class:"time-scroll"},og={key:0,class:"time-column"},rg={class:"time-scroll"},ig={class:"datetime-picker-footer"},sg=r.defineComponent({__name:"LumenDateTimePicker",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,o=e,i=r.ref(),s=r.ref(),l=r.ref(!1),{floatingStyle:a,updatePosition:c,cleanup:u}=Mr({trigger:i,floating:s,placement:"bottom-start",offset:8,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{f()}}}),d=async()=>{t.disabled||t.readonly||(l.value=!0,await r.nextTick(),c())},f=()=>{l.value=!1},h=()=>{l.value?f():d()},p=r.ref(t.type==="time"?"time":"date"),m=r.ref(new Date().getMonth()),g=r.ref(new Date().getFullYear()),v=r.ref(new Date().getHours()),y=r.ref(new Date().getMinutes()),b=r.ref("AM"),C=["January","February","March","April","May","June","July","August","September","October","November","December"],k=["Su","Mo","Tu","We","Th","Fr","Sa"],x=r.computed(()=>t.min?t.min instanceof Date?t.min:new Date(t.min):null),S=r.computed(()=>t.max?t.max instanceof Date?t.max:new Date(t.max):null),M=r.computed(()=>{if(!t.modelValue)return null;if(t.modelValue instanceof Date)return t.modelValue;if(t.type==="time"&&typeof t.modelValue=="string"){const re=t.modelValue.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);if(re){const ie=new Date;return ie.setHours(parseInt(re[1]),parseInt(re[2]),parseInt(re[3]||"0"),0),ie}}return new Date(t.modelValue)}),L=r.computed(()=>{if(!M.value||isNaN(M.value.getTime()))return"";const re=M.value;if(t.type==="time"){if(t.is24Hour)return`${String(re.getHours()).padStart(2,"0")}:${String(re.getMinutes()).padStart(2,"0")}`;{const de=re.getHours()%12||12,Me=re.getHours()>=12?"PM":"AM";return`${de}:${String(re.getMinutes()).padStart(2,"0")} ${Me}`}}const ie=re.getDate(),A=re.getMonth()+1,I=re.getFullYear();let P="";switch(t.format){case"us":P=`${A}/${ie}/${I}`;break;case"eu":P=`${ie}/${A}/${I}`;break;default:P=`${I}-${String(A).padStart(2,"0")}-${String(ie).padStart(2,"0")}`;break}if(t.type==="date")return P;let Q="";if(t.is24Hour)Q=`${String(re.getHours()).padStart(2,"0")}:${String(re.getMinutes()).padStart(2,"0")}`;else{const de=re.getHours()%12||12,Me=re.getHours()>=12?"PM":"AM";Q=`${de}:${String(re.getMinutes()).padStart(2,"0")} ${Me}`}return`${P} ${Q}`}),R=r.computed(()=>{const re=[];return t.error&&re.push("datetime-picker-error"),t.disabled&&re.push("datetime-picker-disabled"),t.readonly&&re.push("datetime-picker-readonly"),re.push(`datetime-picker-size-${t.size}`),re}),X=r.computed(()=>t.type==="date"||t.type==="datetime"&&p.value==="date"),ve=r.computed(()=>t.type==="time"||t.type==="datetime"&&p.value==="time"),fe=r.computed(()=>[{label:"Date",value:"date"},{label:"Time",value:"time"}]),Se=r.computed(()=>{const re=[],ie=t.is24Hour?23:12,A=t.is24Hour?0:1;for(let I=A;I<=ie;I++)re.push(I);return re}),xe=r.computed(()=>{const re=[];for(let ie=0;ie<60;ie+=t.minuteStep)re.push(ie);return re}),U=r.computed(()=>{const re=new Date().getFullYear(),ie=x.value?.getFullYear()||re-100,A=S.value?.getFullYear()||re+100,I=[];for(let P=ie;P<=A;P++)I.push(P);return I}),ee=r.computed(()=>x.value?new Date(g.value,m.value,1)<=x.value:!1),ce=r.computed(()=>S.value?new Date(g.value,m.value+1,0)>=S.value:!1),be=r.computed(()=>{const re=[],ie=g.value,A=m.value,I=new Date(ie,A,1),P=new Date(I);P.setDate(P.getDate()-I.getDay());const Q=new Date;Q.setHours(0,0,0,0);for(let de=0;de<42;de++){const Me=new Date(P);Me.setDate(P.getDate()+de);const Ne=Me.getMonth()!==A,Le=Me.getTime()===Q.getTime(),Ge=M.value&&Me.getFullYear()===M.value.getFullYear()&&Me.getMonth()===M.value.getMonth()&&Me.getDate()===M.value.getDate(),wt=!!(x.value&&Me<x.value||S.value&&Me>S.value);re.push({key:`${Me.getFullYear()}-${Me.getMonth()}-${Me.getDate()}`,date:Me.getDate(),month:Me.getMonth(),year:Me.getFullYear(),otherMonth:Ne,isToday:Le,isSelected:Ge||!1,isDisabled:wt})}return re}),K=()=>{switch(t.type){case"time":return"Select time";case"datetime":return"Select date and time";default:return"Select date"}},J=()=>{m.value===0?(m.value=11,g.value--):m.value--},Y=()=>{m.value===11?(m.value=0,g.value++):m.value++},me=re=>{if(re.isDisabled||re.otherMonth)return;const ie=M.value||new Date,A=new Date(re.year,re.month,re.date,ie.getHours(),ie.getMinutes());o("update:modelValue",A),o("change",A),t.type==="datetime"?p.value="time":t.type==="date"&&f()},ke=(re,ie)=>{let A=M.value?new Date(M.value):new Date;if(!M.value){const I=new Date;A.setFullYear(I.getFullYear(),I.getMonth(),I.getDate())}if(re==="hour"){let I=ie;t.is24Hour||(b.value==="PM"&&I!==12&&(I+=12),b.value==="AM"&&I===12&&(I=0)),v.value=ie,A.setHours(I)}else if(re==="minute")y.value=ie,A.setMinutes(ie);else if(re==="period"){b.value=ie;let I=v.value;ie==="PM"&&I!==12&&(I+=12),ie==="AM"&&I===12&&(I=0),A.setHours(I)}o("update:modelValue",A),o("change",A)},Fe=()=>{const re=new Date;x.value&&re<x.value||S.value&&re>S.value||(o("update:modelValue",re),o("change",re),f())},$e=()=>{o("update:modelValue",null),o("change",null)};return r.watch(()=>t.modelValue,re=>{if(re){const ie=re instanceof Date?re:new Date(re);if(!isNaN(ie.getTime())){if(m.value=ie.getMonth(),g.value=ie.getFullYear(),t.is24Hour)v.value=ie.getHours();else{const A=ie.getHours();v.value=A%12||12,b.value=A>=12?"PM":"AM"}y.value=ie.getMinutes()}}},{immediate:!0}),r.onUnmounted(()=>{u()}),(re,ie)=>(r.openBlock(),r.createElementBlock("div",zm,[r.createElementVNode("div",{ref_key:"triggerElement",ref:i,class:r.normalizeClass(["datetime-picker-trigger",[R.value,{"datetime-picker-open":l.value}]]),onClick:h},[r.createElementVNode("div",Pm,[n.type==="date"?(r.openBlock(),r.createBlock(r.unref(np),{key:0})):n.type==="time"?(r.openBlock(),r.createBlock(r.unref(ip),{key:1})):(r.openBlock(),r.createBlock(r.unref(tp),{key:2}))]),r.createElementVNode("div",Hm,[L.value?(r.openBlock(),r.createElementBlock("span",_m,r.toDisplayString(L.value),1)):(r.openBlock(),r.createElementBlock("span",Fm,r.toDisplayString(n.placeholder||K()),1))]),n.modelValue&&!n.disabled&&!n.readonly?(r.openBlock(),r.createElementBlock("div",{key:0,class:"datetime-picker-trailing-icon",onClick:r.withModifiers($e,["stop"])},[r.createVNode(r.unref(bl))])):(r.openBlock(),r.createElementBlock("div",Um,[r.createVNode(r.unref(Ro))]))],2),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[l.value?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"floatingElement",ref:s,class:"datetime-picker-dropdown",style:r.normalizeStyle(r.unref(a))},[n.type==="datetime"?(r.openBlock(),r.createBlock(Tr,{key:0,modelValue:p.value,"onUpdate:modelValue":ie[0]||(ie[0]=A=>p.value=A),tabs:fe.value,variant:"default",size:"sm",style:{"margin-bottom":"1rem"}},null,8,["modelValue","tabs"])):r.createCommentVNode("",!0),X.value?(r.openBlock(),r.createElementBlock("div",qm,[r.createElementVNode("div",jm,[r.createVNode(De,{onClick:J,disabled:ee.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:r.withCtx(()=>[r.createVNode(r.unref(op))]),_:1},8,["disabled"]),r.createElementVNode("div",Wm,[r.withDirectives(r.createElementVNode("select",{"onUpdate:modelValue":ie[1]||(ie[1]=A=>m.value=A),class:"datetime-picker-select"},[(r.openBlock(),r.createElementBlock(r.Fragment,null,r.renderList(C,(A,I)=>r.createElementVNode("option",{key:I,value:I},r.toDisplayString(A),9,Km)),64))],512),[[r.vModelSelect,m.value]]),r.withDirectives(r.createElementVNode("select",{"onUpdate:modelValue":ie[2]||(ie[2]=A=>g.value=A),class:"datetime-picker-select"},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(U.value,A=>(r.openBlock(),r.createElementBlock("option",{key:A,value:A},r.toDisplayString(A),9,Gm))),128))],512),[[r.vModelSelect,g.value]])]),r.createVNode(De,{onClick:Y,disabled:ce.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:r.withCtx(()=>[r.createVNode(r.unref(rp))]),_:1},8,["disabled"])]),r.createElementVNode("div",Jm,[(r.openBlock(),r.createElementBlock(r.Fragment,null,r.renderList(k,A=>r.createElementVNode("div",{key:A,class:"datetime-picker-weekday"},r.toDisplayString(A),1)),64))]),r.createElementVNode("div",Ym,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(be.value,A=>(r.openBlock(),r.createBlock(De,{key:A.key,color:A.isSelected||A.isToday?"primary":"secondary",variant:A.isSelected?"primary":A.isToday?"outline":"primary",disabled:A.isDisabled||A.otherMonth,class:r.normalizeClass(["datetime-picker-day",{"datetime-picker-day-other":A.otherMonth,"datetime-picker-day-disabled":A.isDisabled}]),icon:"",squircle:"",onClick:I=>me(A)},{icon:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(A.date),1)]),_:2},1032,["color","variant","disabled","class","onClick"]))),128))])])):r.createCommentVNode("",!0),ve.value?(r.openBlock(),r.createElementBlock("div",Xm,[r.createElementVNode("div",Zm,[r.createElementVNode("div",Qm,[ie[6]||(ie[6]=r.createElementVNode("label",{class:"time-label"},"Hour",-1)),r.createElementVNode("div",eg,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Se.value,A=>(r.openBlock(),r.createBlock(De,{key:A,color:v.value===A?"primary":"secondary",variant:v.value===A?"primary":"ghost",size:"sm",squircle:"",onClick:I=>ke("hour",A)},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(String(A).padStart(2,"0")),1)]),_:2},1032,["color","variant","onClick"]))),128))])]),r.createElementVNode("div",tg,[ie[7]||(ie[7]=r.createElementVNode("label",{class:"time-label"},"Minute",-1)),r.createElementVNode("div",ng,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(xe.value,A=>(r.openBlock(),r.createBlock(De,{key:A,color:y.value===A?"primary":"secondary",variant:y.value===A?"primary":"ghost",size:"sm",squircle:"",onClick:I=>ke("minute",A)},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(String(A).padStart(2,"0")),1)]),_:2},1032,["color","variant","onClick"]))),128))])]),n.is24Hour?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",og,[ie[10]||(ie[10]=r.createElementVNode("label",{class:"time-label"},"Period",-1)),r.createElementVNode("div",rg,[r.createVNode(De,{color:b.value==="AM"?"primary":"secondary",variant:b.value==="AM"?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:ie[3]||(ie[3]=A=>ke("period","AM"))},{default:r.withCtx(()=>[...ie[8]||(ie[8]=[r.createTextVNode(" AM ",-1)])]),_:1},8,["color","variant"]),r.createVNode(De,{color:b.value==="PM"?"primary":"secondary",variant:b.value==="PM"?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:ie[4]||(ie[4]=A=>ke("period","PM"))},{default:r.withCtx(()=>[...ie[9]||(ie[9]=[r.createTextVNode(" PM ",-1)])]),_:1},8,["color","variant"])])]))])])):r.createCommentVNode("",!0),r.createVNode(Dt),r.createElementVNode("div",ig,[r.createVNode(De,{onClick:Fe,color:"primary",variant:"primary",squircle:"",style:{flex:"1"}},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(n.type==="time"?"Now":"Today"),1)]),_:1}),r.createVNode(De,{onClick:ie[5]||(ie[5]=A=>{$e(),f()}),color:"danger",variant:"primary",squircle:"",style:{flex:"1"}},{default:r.withCtx(()=>[...ie[11]||(ie[11]=[r.createTextVNode(" Clear ",-1)])]),_:1}),r.createVNode(De,{onClick:f,color:"secondary",variant:"primary",squircle:"",style:{flex:"1"}},{default:r.withCtx(()=>[...ie[12]||(ie[12]=[r.createTextVNode(" Close ",-1)])]),_:1})])],4)):r.createCommentVNode("",!0)]))]))}}),zo=_e(sg,[["__scopeId","data-v-8e583d19"]]),lg=r.defineComponent({__name:"LumenInput.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"},color:{},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(n,{emit:e}){const t=e,o=s=>{t("update:modelValue",s)},i=s=>{t("change",s)};return(s,l)=>(r.openBlock(),r.createBlock(zo,{"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":o,onChange:i},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","format"]))}}),ag=r.defineComponent({__name:"LumenInput.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"},color:{},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(n,{emit:e}){const t=e,o=s=>{t("update:modelValue",s)},i=s=>{t("change",s)};return(s,l)=>(r.openBlock(),r.createBlock(zo,{"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":o,onChange:i},null,8,["model-value","placeholder","disabled","readonly","required","error","size","is24Hour","minuteStep"]))}}),cg=r.defineComponent({__name:"LumenInput.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"},color:{},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(n,{emit:e}){const t=e,o=s=>{t("update:modelValue",s)},i=s=>{t("change",s)};return(s,l)=>(r.openBlock(),r.createBlock(zo,{"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":o,onChange:i},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","format","is24Hour","minuteStep"]))}});function vt(n){this.content=n}vt.prototype={constructor:vt,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 o=t&&t!=n?this.remove(t):this,i=o.find(n),s=o.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new vt(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new vt(t)},addToStart:function(n,e){return new vt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new vt(t)},addBefore:function(n,e,t){var o=this.remove(e),i=o.content.slice(),s=o.find(n);return i.splice(s==-1?i.length:s,0,e,t),new vt(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=vt.from(n),n.size?new vt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=vt.from(n),n.size?new vt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=vt.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}};vt.from=function(n){if(n instanceof vt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new vt(e)};function lu(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(o),s=e.child(o);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let l=0;i.text[l]==s.text[l];l++)t++;return t}if(i.content.size||s.content.size){let l=lu(i.content,s.content,t+1);if(l!=null)return l}t+=i.nodeSize}}function au(n,e,t,o){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:o};let l=n.child(--i),a=e.child(--s),c=l.nodeSize;if(l==a){t-=c,o-=c;continue}if(!l.sameMarkup(a))return{a:t,b:o};if(l.isText&&l.text!=a.text){let u=0,d=Math.min(l.text.length,a.text.length);for(;u<d&&l.text[l.text.length-u-1]==a.text[a.text.length-u-1];)u++,t--,o--;return{a:t,b:o}}if(l.content.size||a.content.size){let u=au(l.content,a.content,t-1,o-1);if(u)return u}t-=c,o-=c}}class G{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,i=0,s){for(let l=0,a=0;a<t;l++){let c=this.content[l],u=a+c.nodeSize;if(u>e&&o(c,i+a,s||null,l)!==!1&&c.content.size){let d=a+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,t-d),o,i+d)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,i){let s="",l=!0;return this.nodesBetween(e,t,(a,c)=>{let u=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&o&&(l?l=!1:s+=o),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(o)&&(i[i.length-1]=t.withText(t.text+o.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new G(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],i=0;if(t>e)for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;c>e&&((l<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-l),Math.min(a.text.length,t-l)):a=a.cut(Math.max(0,e-l-1),Math.min(a.content.size,t-l-1))),o.push(a),i+=a.nodeSize),l=c}return new G(o,i)}cutByIndex(e,t){return e==t?G.empty:e==0&&t==this.content.length?this:new G(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-o.nodeSize;return i[e]=t,new G(i,s)}addToStart(e){return new G([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new G(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,o=0;t<this.content.length;t++){let i=this.content[t];e(i,o,t),o+=i.nodeSize}}findDiffStart(e,t=0){return lu(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return au(this,e,t,o)}findIndex(e){if(e==0)return Vr(0,e);if(e==this.size)return Vr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let i=this.child(t),s=o+i.nodeSize;if(s>=e)return s==e?Vr(t+1,s):Vr(t,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return G.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new G(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return G.empty;let t,o=0;for(let i=0;i<e.length;i++){let s=e[i];o+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new G(t||e,o)}static from(e){if(!e)return G.empty;if(e instanceof G)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new G([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}G.empty=new G([],0);const us={index:0,offset:0};function Vr(n,e){return us.index=n,us.offset=e,us}function Qr(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 o=0;o<n.length;o++)if(!Qr(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Qr(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let Ke=class Hs{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!o&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),o=!0),t&&t.push(s)}}return t||(t=e.slice()),o||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&&Qr(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 o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=o.create(t.attrs);return o.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Hs.none;if(e instanceof Hs)return[e];let t=e.slice();return t.sort((o,i)=>o.type.rank-i.type.rank),t}};Ke.none=[];class ei extends Error{}class pe{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=uu(this.content,e+this.openStart,t);return o&&new pe(o,this.openStart,this.openEnd)}removeBetween(e,t){return new pe(cu(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 pe.empty;let o=t.openStart||0,i=t.openEnd||0;if(typeof o!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new pe(G.fromJSON(e,t.content),o,i)}static maxOpen(e,t=!0){let o=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)o++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new pe(e,o,i)}}pe.empty=new pe(G.empty,0,0);function cu(n,e,t){let{index:o,offset:i}=n.findIndex(e),s=n.maybeChild(o),{index:l,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(l).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=l)throw new RangeError("Removing non-flat range");return n.replaceChild(o,s.copy(cu(s.content,e-i-1,t-i-1)))}function uu(n,e,t,o){let{index:i,offset:s}=n.findIndex(e),l=n.maybeChild(i);if(s==e||l.isText)return o&&!o.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=uu(l.content,e-s-1,t,l);return a&&n.replaceChild(i,l.copy(a))}function ug(n,e,t){if(t.openStart>n.depth)throw new ei("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ei("Inconsistent open depths");return du(n,e,t,0)}function du(n,e,t,o){let i=n.index(o),s=n.node(o);if(i==e.index(o)&&o<n.depth-t.openStart){let l=du(n,e,t,o+1);return s.copy(s.content.replaceChild(i,l))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let l=n.parent,a=l.content;return to(l,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:l,end:a}=dg(t,n);return to(s,hu(n,l,a,e,o))}else return to(s,ti(n,e,o))}function fu(n,e){if(!e.type.compatibleContent(n.type))throw new ei("Cannot join "+e.type.name+" onto "+n.type.name)}function _s(n,e,t){let o=n.node(t);return fu(o,e.node(t)),o}function eo(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 or(n,e,t,o){let i=(e||n).node(t),s=0,l=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(eo(n.nodeAfter,o),s++));for(let a=s;a<l;a++)eo(i.child(a),o);e&&e.depth==t&&e.textOffset&&eo(e.nodeBefore,o)}function to(n,e){return n.type.checkContent(e),n.copy(e)}function hu(n,e,t,o,i){let s=n.depth>i&&_s(n,e,i+1),l=o.depth>i&&_s(t,o,i+1),a=[];return or(null,n,i,a),s&&l&&e.index(i)==t.index(i)?(fu(s,l),eo(to(s,hu(n,e,t,o,i+1)),a)):(s&&eo(to(s,ti(n,e,i+1)),a),or(e,t,i,a),l&&eo(to(l,ti(t,o,i+1)),a)),or(o,null,i,a),new G(a)}function ti(n,e,t){let o=[];if(or(null,n,t,o),n.depth>t){let i=_s(n,e,t+1);eo(to(i,ti(n,e,t+1)),o)}return or(e,null,t,o),new G(o)}function dg(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(G.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class mr{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,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 o=this.pos-this.path[this.path.length-1],i=e.child(t);return o?e.child(t).cut(o):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 o=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=o.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ke.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),i=e.maybeChild(t);if(!o){let a=o;o=i,i=a}let s=o.marks;for(var l=0;l<s.length;l++)s[l].type.spec.inclusive===!1&&(!i||!s[l].isInSet(i.marks))&&(s=s[l--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,i=e.parent.maybeChild(e.index());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}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 o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new ni(this,e,o);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 o=[],i=0,s=t;for(let l=e;;){let{index:a,offset:c}=l.content.findIndex(s),u=s-c;if(o.push(l,a,i+c),!u||(l=l.child(a),l.isText))break;s=u-1,i+=c+1}return new mr(t,o,s)}static resolveCached(e,t){let o=Ba.get(e);if(o)for(let s=0;s<o.elts.length;s++){let l=o.elts[s];if(l.pos==t)return l}else Ba.set(e,o=new fg);let i=o.elts[o.i]=mr.resolve(e,t);return o.i=(o.i+1)%hg,i}}class fg{constructor(){this.elts=[],this.i=0}}const hg=12,Ba=new WeakMap;class ni{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}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 pg=Object.create(null);class Jt{constructor(e,t,o,i=Ke.none){this.type=e,this.attrs=t,this.marks=i,this.content=o||G.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,o,i=0){this.content.nodesBetween(e,t,o,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,o,i){return this.content.textBetween(e,t,o,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,o){return this.type==e&&Qr(this.attrs,t||e.defaultAttrs||pg)&&Ke.sameSet(this.marks,o||Ke.none)}copy(e=null){return e==this.content?this:new Jt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Jt(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,o=!1){if(e==t)return pe.empty;let i=this.resolve(e),s=this.resolve(t),l=o?0:i.sharedDepth(t),a=i.start(l),u=i.node(l).content.cut(i.pos-a,s.pos-a);return new pe(u,i.depth-l,s.depth-l)}replace(e,t,o){return ug(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let i=this.content.child(t-1);return{node:i,index:t-1,offset:o-i.nodeSize}}resolve(e){return mr.resolveCached(this,e)}resolveNoCache(e){return mr.resolve(this,e)}rangeHasMark(e,t,o){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(o.isInSet(s.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()+")"),pu(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,o=G.empty,i=0,s=o.childCount){let l=this.contentMatchAt(e).matchFragment(o,i,s),a=l&&l.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=i;c<s;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,t,o,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(o),l=s&&s.matchFragment(this.content,t);return l?l.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=Ke.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!Ke.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 o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=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,o)}let i=G.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,o);return s.type.checkAttrs(s.attrs),s}}Jt.prototype.text=void 0;class oi extends Jt{constructor(e,t,o,i){if(super(e,t,null,i),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):pu(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 oi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new oi(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 pu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class io{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new mg(e,t);if(o.next==null)return io.empty;let i=mu(o);o.next&&o.err("Unexpected trailing text");let s=wg(xg(i));return Cg(s,o),s}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,o=e.childCount){let i=this;for(let s=t;i&&s<o;s++)i=i.matchType(e.child(s).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 o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let i=[this];function s(l,a){let c=l.matchFragment(e,o);if(c&&(!t||c.validEnd))return G.from(a.map(u=>u.createAndFill()));for(let u=0;u<l.next.length;u++){let{type:d,next:f}=l.next[u];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=s(f,a.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let i=o.shift(),s=i.match;if(s.matchType(e)){let l=[];for(let a=i;a.type;a=a.via)l.push(a.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||c.validEnd)&&(o.push({match:a.contentMatch,type:a,via:i}),t[a.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(o){e.push(o);for(let i=0;i<o.next.length;i++)e.indexOf(o.next[i].next)==-1&&t(o.next[i].next)}return t(this),e.map((o,i)=>{let s=i+(o.validEnd?"*":" ")+" ";for(let l=0;l<o.next.length;l++)s+=(l?", ":"")+o.next[l].type.name+"->"+e.indexOf(o.next[l].next);return s}).join(`
|
|
5
|
+
`)}}io.empty=new io(!0);class mg{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 mu(n){let e=[];do e.push(gg(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function gg(n){let e=[];do e.push(vg(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function vg(n){let e=bg(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=yg(n,e);else break;return e}function Aa(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function yg(n,e){let t=Aa(n),o=t;return n.eat(",")&&(n.next!="}"?o=Aa(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function kg(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let i=[];for(let s in t){let l=t[s];l.isInGroup(e)&&i.push(l)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function bg(n){if(n.eat("(")){let e=mu(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=kg(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 xg(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function o(l,a,c){let u={term:c,to:a};return e[l].push(u),u}function i(l,a){l.forEach(c=>c.to=a)}function s(l,a){if(l.type=="choice")return l.exprs.reduce((c,u)=>c.concat(s(u,a)),[]);if(l.type=="seq")for(let c=0;;c++){let u=s(l.exprs[c],a);if(c==l.exprs.length-1)return u;i(u,a=t())}else if(l.type=="star"){let c=t();return o(a,c),i(s(l.expr,c),c),[o(c)]}else if(l.type=="plus"){let c=t();return i(s(l.expr,a),c),i(s(l.expr,c),c),[o(c)]}else{if(l.type=="opt")return[o(a)].concat(s(l.expr,a));if(l.type=="range"){let c=a;for(let u=0;u<l.min;u++){let d=t();i(s(l.expr,c),d),c=d}if(l.max==-1)i(s(l.expr,c),c);else for(let u=l.min;u<l.max;u++){let d=t();o(c,d),i(s(l.expr,c),d),c=d}return[o(c)]}else{if(l.type=="name")return[o(a,void 0,l.value)];throw new Error("Unknown expr type")}}}}function gu(n,e){return e-n}function $a(n,e){let t=[];return o(e),t.sort(gu);function o(i){let s=n[i];if(s.length==1&&!s[0].term)return o(s[0].to);t.push(i);for(let l=0;l<s.length;l++){let{term:a,to:c}=s[l];!a&&t.indexOf(c)==-1&&o(c)}}}function wg(n){let e=Object.create(null);return t($a(n,0));function t(o){let i=[];o.forEach(l=>{n[l].forEach(({term:a,to:c})=>{if(!a)return;let u;for(let d=0;d<i.length;d++)i[d][0]==a&&(u=i[d][1]);$a(n,c).forEach(d=>{u||i.push([a,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let s=e[o.join(",")]=new io(o.indexOf(n.length-1)>-1);for(let l=0;l<i.length;l++){let a=i[l][1].sort(gu);s.next.push({type:i[l][0],next:e[a.join(",")]||t(a)})}return s}}function Cg(n,e){for(let t=0,o=[n];t<o.length;t++){let i=o[t],s=!i.validEnd,l=[];for(let a=0;a<i.next.length;a++){let{type:c,next:u}=i.next[a];l.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),o.indexOf(u)==-1&&o.push(u)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function vu(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function yu(n,e){let t=Object.create(null);for(let o in n){let i=e&&e[o];if(i===void 0){let s=n[o];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=i}return t}function ku(n,e,t,o){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 s=n[i];s.validate&&s.validate(e[i])}}function bu(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new Sg(n,o,e[o]);return t}let Oa=class xu{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=bu(e,o.attrs),this.defaultAttrs=vu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==io.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:yu(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Jt(this,this.computeAttrs(e),G.from(t),Ke.setFrom(o))}createChecked(e=null,t,o){return t=G.from(t),this.checkContent(t),new Jt(this,this.computeAttrs(e),t,Ke.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=G.from(t),t.size){let l=this.contentMatch.fillBefore(t);if(!l)return null;t=l.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(G.empty,!0);return s?new Jt(this,e,t.append(s),Ke.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).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){ku(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 o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:Ke.none:e}static compile(e,t){let o=Object.create(null);e.forEach((s,l)=>o[s]=new xu(s,t,l));let i=t.spec.topNode||"doc";if(!o[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let s in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function Eg(n,e,t){let o=t.split("|");return i=>{let s=i===null?"null":typeof i;if(o.indexOf(s)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${s}`)}}class Sg{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?Eg(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class qi{constructor(e,t,o,i){this.name=e,this.rank=t,this.schema=o,this.spec=i,this.attrs=bu(e,i.attrs),this.excluded=null;let s=vu(this.attrs);this.instance=s?new Ke(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Ke(this,yu(this.attrs,e))}static compile(e,t){let o=Object.create(null),i=0;return e.forEach((s,l)=>o[s]=new qi(s,i++,t,l)),o}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){ku(this.attrs,e,"mark")}excludes(e){return this.excluded.indexOf(e)>-1}}class wu{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=vt.from(e.nodes),t.marks=vt.from(e.marks||{}),this.nodes=Oa.compile(this.spec.nodes,this),this.marks=qi.compile(this.spec.marks,this);let o=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 s=this.nodes[i],l=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=o[l]||(o[l]=io.parse(l,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Ia(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],l=s.spec.excludes;s.excluded=l==null?[s]:l==""?[]:Ia(this,l.split(" "))}this.nodeFromJSON=i=>Jt.fromJSON(this,i),this.markFromJSON=i=>Ke.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,o,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Oa){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,o,i)}text(e,t){let o=this.nodes.text;return new oi(o,o.defaultAttrs,e,Ke.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 Ia(n,e){let t=[];for(let o=0;o<e.length;o++){let i=e[o],s=n.marks[i],l=s;if(s)t.push(s);else for(let a in n.marks){let c=n.marks[a];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&t.push(l=c)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function Mg(n){return n.tag!=null}function Tg(n){return n.style!=null}class Vn{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(i=>{if(Mg(i))this.tags.push(i);else if(Tg(i)){let s=/[^=]*/.exec(i.style)[0];o.indexOf(s)<0&&o.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let o=new Da(this,t,!1);return o.addAll(e,Ke.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new Da(this,t,!0);return o.addAll(e,Ke.none,t.from,t.to),pe.maxOpen(o.finish())}matchTag(e,t,o){for(let i=o?this.tags.indexOf(o)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Ag(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(e,t,o,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let l=this.styles[s],a=l.style;if(!(a.indexOf(e)!=0||l.context&&!o.matchesContext(l.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(l.getAttrs){let c=l.getAttrs(t);if(c===!1)continue;l.attrs=c||void 0}return l}}}static schemaRules(e){let t=[];function o(i){let s=i.priority==null?50:i.priority,l=0;for(;l<t.length;l++){let a=t[l];if((a.priority==null?50:a.priority)<s)break}t.splice(l,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(l=>{o(l=Va(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(l=>{o(l=Va(l)),l.node||l.ignore||l.mark||(l.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Vn(e,Vn.schemaRules(e)))}}const Cu={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},Ng={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Eu={ol:!0,ul:!0},gr=1,Fs=2,rr=4;function La(n,e,t){return e!=null?(e?gr:0)|(e==="full"?Fs:0):n&&n.whitespace=="pre"?gr|Fs:t&~rr}class Rr{constructor(e,t,o,i,s,l){this.type=e,this.attrs=t,this.marks=o,this.solid=i,this.options=l,this.content=[],this.activeMarks=Ke.none,this.match=s||(l&rr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(G.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,i;return(i=o.findWrapping(e.type))?(this.match=o,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&gr)){let o=this.content[this.content.length-1],i;if(o&&o.isText&&(i=/[ \t\r\n\u000c]+$/.exec(o.text))){let s=o;o.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=G.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(G.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&&!Cu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Da{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,l=La(null,t.preserveWhitespace,0)|(o?rr:0);i?s=new Rr(i.type,i.attrs,Ke.none,!0,t.topMatch||i.type.contentMatch,l):o?s=new Rr(null,null,Ke.none,!0,null,l):s=new Rr(e.schema.topNodeType,null,Ke.none,!0,null,l),this.nodes=[s],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 o=e.nodeValue,i=this.top,s=i.options&Fs?"full":this.localPreserveWS||(i.options&gr)>0,{schema:l}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(s)if(s==="full")o=o.replace(/\r\n?/g,`
|
|
6
|
+
`);else if(l.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(l.linebreakReplacement.create())){let a=o.split(/\r?\n|\r/);for(let c=0;c<a.length;c++)c&&this.insertNode(l.linebreakReplacement.create(),t,!0),a[c]&&this.insertNode(l.text(a[c]),t,!/\S/.test(a[c]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],c=e.previousSibling;(!a||c&&c.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(o=o.slice(1))}o&&this.insertNode(l.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),a;Eu.hasOwnProperty(l)&&this.parser.normalizeLists&&Bg(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,o));e:if(c?c.ignore:Ng.hasOwnProperty(l))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 u,d=this.needsBlock;if(Cu.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.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),u&&this.sync(s),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,c,u,c.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
7
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],l=o.getPropertyValue(s);if(l)for(let a=void 0;;){let c=this.parser.matchStyle(s,l,this,a);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(u=>!c.clearMark(u)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)a=c;else break}}return t}addElementByRule(e,t,o,i){let s,l;if(t.node)if(l=this.parser.schema.nodes[t.node],l.isLeaf)this.insertNode(l.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let c=this.enter(l,t.attrs||null,o,t.preserveWhitespace);c&&(s=!0,o=c)}else{let c=this.parser.schema.marks[t.mark];o=o.concat(c.create(t.attrs))}let a=this.top;if(l&&l.isLeaf)this.findInside(e);else if(i)this.addElement(e,o,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o,!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,o),this.findAround(e,c,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,o,i){let s=o||0;for(let l=o?e.childNodes[o]:e.firstChild,a=i==null?null:e.childNodes[i];l!=a;l=l.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(l,t);this.findAtPoint(e,s)}findPlace(e,t,o){let i,s;for(let l=this.open,a=0;l>=0;l--){let c=this.nodes[l],u=c.findWrapping(e);if(u&&(!i||i.length>u.length+a)&&(i=u,s=c,!u.length))break;if(c.solid){if(o)break;a+=2}}if(!i)return null;this.sync(s);for(let l=0;l<i.length;l++)t=this.enterInner(i[l],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,o);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let l=Ke.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Ra(a.type,e.type))&&(l=a.addToSet(l));return s.content.push(e.mark(l)),!0}return!1}enter(e,t,o,i){let s=this.findPlace(e.create(t),o,!1);return s&&(s=this.enterInner(e,t,o,!0,i)),s}enterInner(e,t,o,i=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let a=La(e,s,l.options);l.options&rr&&l.content.length==0&&(a|=rr);let c=Ke.none;return o=o.filter(u=>(l.type?l.type.allowsMarkType(u.type):Ra(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new Rr(e,t,c,i,null,a)),this.open++,o}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|=gr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let i=o.length-1;i>=0;i--)e+=o[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].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,o){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)&(o?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("/"),o=this.options.context,i=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),s=-(o?o.depth+1:0)+(i?0:1),l=(a,c)=>{for(;a>=0;a--){let u=t[a];if(u==""){if(a==t.length-1||a==0)continue;for(;c>=s;c--)if(l(a-1,c))return!0;return!1}else{let d=c>0||c==0&&i?this.nodes[c].type:o&&c>=s?o.node(c-s).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;c--}}return!0};return l(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function Bg(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&Eu.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function Ag(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Va(n){let e={};for(let t in n)e[t]=n[t];return e}function Ra(n,e){let t=e.schema.nodes;for(let o in t){let i=t[o];if(!i.allowsMarkType(n))continue;let s=[],l=a=>{s.push(a);for(let c=0;c<a.edgeCount;c++){let{type:u,next:d}=a.edge(c);if(u==e||s.indexOf(d)<0&&l(d))return!0}};if(l(i.contentMatch))return!0}}class fo{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=ds(t).createDocumentFragment());let i=o,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let a=0,c=0;for(;a<s.length&&c<l.marks.length;){let u=l.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(s[a][0])||u.type.spec.spanning===!1)break;a++,c++}for(;a<s.length;)i=s.pop()[1];for(;c<l.marks.length;){let u=l.marks[c++],d=this.serializeMark(u,l.isInline,t);d&&(s.push([u,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(l,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:i}=Gr(ds(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 o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(o),o=s.dom)}return o}serializeMark(e,t,o={}){let i=this.marks[e.type.name];return i&&Gr(ds(o),i(e,t),null,e.attrs)}static renderSpec(e,t,o=null,i){return Gr(e,t,o,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new fo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=za(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return za(e.marks)}}function za(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function ds(n){return n.document||window.document}const Pa=new WeakMap;function $g(n){let e=Pa.get(n);return e===void 0&&Pa.set(n,e=Og(n)),e}function Og(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let i=0;i<o.length;i++)t(o[i]);else for(let i in o)t(o[i])}return t(n),e}function Gr(n,e,t,o){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],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(s=$g(o))&&s.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 l=i.indexOf(" ");l>0&&(t=i.slice(0,l),i=i.slice(l+1));let a,c=t?n.createElementNS(t,i):n.createElement(i),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let h=f.indexOf(" ");h>0?c.setAttributeNS(f.slice(0,h),f.slice(h+1),u[f]):f=="style"&&c.style?c.style.cssText=u[f]:c.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>d)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}=Gr(n,h,t,o);if(c.appendChild(p),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:c,contentDOM:a}}const Su=65535,Mu=Math.pow(2,16);function Ig(n,e){return n+e*Mu}function Ha(n){return n&Su}function Lg(n){return(n-(n&Su))/Mu}const Tu=1,Nu=2,Jr=4,Bu=8;class Us{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&Bu)>0}get deletedBefore(){return(this.delInfo&(Tu|Jr))>0}get deletedAfter(){return(this.delInfo&(Nu|Jr))>0}get deletedAcross(){return(this.delInfo&Jr)>0}}class Vt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Vt.empty)return Vt.empty}recover(e){let t=0,o=Ha(e);if(!this.inverted)for(let i=0;i<o;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[o*3]+t+Lg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let i=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?i:0);if(c>e)break;let u=this.ranges[a+s],d=this.ranges[a+l],f=c+u;if(e<=f){let h=u?e==c?-1:e==f?1:t:t,p=c+i+(h<0?0:d);if(o)return p;let m=e==(t<0?c:f)?null:Ig(a/3,e-c),g=e==c?Nu:e==f?Tu:Jr;return(t<0?e!=c:e!=f)&&(g|=Bu),new Us(p,g,m)}i+=d-u}return o?e+i:new Us(e+i,0,null)}touches(e,t){let o=0,i=Ha(t),s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?o:0);if(c>e)break;let u=this.ranges[a+s],d=c+u;if(e<=d&&a==i*3)return!0;o+=this.ranges[a+l]-u}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let l=this.ranges[i],a=l-(this.inverted?s:0),c=l+(this.inverted?0:s),u=this.ranges[i+t],d=this.ranges[i+o];e(a,a+u,c,c+d),s+=d-u}}invert(){return new Vt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Vt.empty:new Vt(e<0?[0,-e,0]:[0,0,e])}}Vt.empty=new Vt([]);class vr{constructor(e,t,o=0,i=e?e.length:0){this.mirror=t,this.from=o,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new vr(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,o=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?o+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,o=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?o-i-1:void 0)}}invert(){let e=new vr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let i=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],a=l.mapResult(e,t);if(a.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return o?e:new Us(e,i,null)}}const fs=Object.create(null);class Tt{getMap(){return Vt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=fs[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in fs)throw new RangeError("Duplicate use of step JSON ID "+e);return fs[e]=t,t.prototype.jsonID=e,t}}class ct{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ct(e,null)}static fail(e){return new ct(null,e)}static fromReplace(e,t,o,i){try{return ct.ok(e.replace(t,o,i))}catch(s){if(s instanceof ei)return ct.fail(s.message);throw s}}}function xl(n,e,t){let o=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(xl(s.content,e,s))),s.isInline&&(s=e(s,t,i)),o.push(s)}return G.fromArray(o)}class In extends Tt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),i=o.node(o.sharedDepth(this.to)),s=new pe(xl(t.content,(l,a)=>!l.isAtom||!a.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),t.openStart,t.openEnd);return ct.fromReplace(e,this.from,this.to,s)}invert(){return new Gt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new In(t.pos,o.pos,this.mark)}merge(e){return e instanceof In&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new In(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 In(t.from,t.to,e.markFromJSON(t.mark))}}Tt.jsonID("addMark",In);class Gt extends Tt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new pe(xl(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ct.fromReplace(e,this.from,this.to,o)}invert(){return new In(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Gt(t.pos,o.pos,this.mark)}merge(e){return e instanceof Gt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 Gt(t.from,t.to,e.markFromJSON(t.mark))}}Tt.jsonID("removeMark",Gt);class Ln extends Tt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ct.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ct.fromReplace(e,this.pos,this.pos+1,new pe(G.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(o))return new Ln(this.pos,t.marks[i]);return new Ln(this.pos,this.mark)}}return new so(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ln(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 Ln(t.pos,e.markFromJSON(t.mark))}}Tt.jsonID("addNodeMark",Ln);class so extends Tt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ct.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ct.fromReplace(e,this.pos,this.pos+1,new pe(G.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ln(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new so(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 so(t.pos,e.markFromJSON(t.mark))}}Tt.jsonID("removeNodeMark",so);class pt extends Tt{constructor(e,t,o,i=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=i}apply(e){return this.structure&&qs(e,this.from,this.to)?ct.fail("Structure replace would overwrite content"):ct.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Vt([this.from,this.to-this.from,this.slice.size])}invert(e){return new pt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new pt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pt)||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?pe.empty:new pe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pt(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?pe.empty:new pe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pt(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 pt(t.from,t.to,pe.fromJSON(e,t.slice),!!t.structure)}}Tt.jsonID("replace",pt);class mt extends Tt{constructor(e,t,o,i,s,l,a=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=i,this.slice=s,this.insert=l,this.structure=a}apply(e){if(this.structure&&(qs(e,this.from,this.gapFrom)||qs(e,this.gapTo,this.to)))return ct.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ct.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?ct.fromReplace(e,this.from,this.to,o):ct.fail("Content does not fit in gap")}getMap(){return new Vt([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 mt(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),o=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||i<t.pos||s>o.pos?null:new mt(t.pos,o.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new mt(t.from,t.to,t.gapFrom,t.gapTo,pe.fromJSON(e,t.slice),t.insert,!!t.structure)}}Tt.jsonID("replaceAround",mt);function qs(n,e,t){let o=n.resolve(e),i=t-e,s=o.depth;for(;i>0&&s>0&&o.indexAfter(s)==o.node(s).childCount;)s--,i--;if(i>0){let l=o.node(s).maybeChild(o.indexAfter(s));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function Dg(n,e,t,o){let i=[],s=[],l,a;n.doc.nodesBetween(e,t,(c,u,d)=>{if(!c.isInline)return;let f=c.marks;if(!o.isInSet(f)&&d.type.allowsMarkType(o.type)){let h=Math.max(u,e),p=Math.min(u+c.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(l&&l.to==h&&l.mark.eq(f[g])?l.to=p:i.push(l=new Gt(h,p,f[g])));a&&a.to==h?a.to=p:s.push(a=new In(h,p,o))}}),i.forEach(c=>n.step(c)),s.forEach(c=>n.step(c))}function Vg(n,e,t,o){let i=[],s=0;n.doc.nodesBetween(e,t,(l,a)=>{if(!l.isInline)return;s++;let c=null;if(o instanceof qi){let u=l.marks,d;for(;d=o.isInSet(u);)(c||(c=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(l.marks)&&(c=[o]):c=l.marks;if(c&&c.length){let u=Math.min(a+l.nodeSize,t);for(let d=0;d<c.length;d++){let f=c[d],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==s-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=u,h.step=s):i.push({style:f,from:Math.max(a,e),to:u,step:s})}}}),i.forEach(l=>n.step(new Gt(l.from,l.to,l.style)))}function wl(n,e,t,o=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),l=[],a=e+1;for(let c=0;c<s.childCount;c++){let u=s.child(c),d=a+u.nodeSize,f=o.matchType(u.type);if(!f)l.push(new pt(a,d,pe.empty));else{o=f;for(let h=0;h<u.marks.length;h++)t.allowsMarkType(u.marks[h].type)||n.step(new Gt(a,d,u.marks[h]));if(i&&u.isText&&t.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(u.text);)m||(m=new pe(G.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),l.push(new pt(a+h.index,a+h.index+h[0].length,m))}}a=d}if(!o.validEnd){let c=o.fillBefore(G.empty,!0);n.replace(a,a,new pe(c,0,0))}for(let c=l.length-1;c>=0;c--)n.step(l[c])}function Rg(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Po(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let o=n.depth,i=0,s=0;;--o){let l=n.$from.node(o),a=n.$from.index(o)+i,c=n.$to.indexAfter(o)-s;if(o<n.depth&&l.canReplace(a,c,t))return o;if(o==0||l.type.spec.isolating||!Rg(l,a,c))break;a&&(i=1),c<l.childCount&&(s=1)}return null}function zg(n,e,t){let{$from:o,$to:i,depth:s}=e,l=o.before(s+1),a=i.after(s+1),c=l,u=a,d=G.empty,f=0;for(let m=s,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,d=G.from(o.node(m).copy(d)),f++):c--;let h=G.empty,p=0;for(let m=s,g=!1;m>t;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=G.from(i.node(m).copy(h)),p++):u++;n.step(new mt(c,u,l,a,new pe(d.append(h),f,p),d.size-f,!0))}function Cl(n,e,t=null,o=n){let i=Pg(n,e),s=i&&Hg(o,e);return s?i.map(_a).concat({type:e,attrs:t}).concat(s.map(_a)):null}function _a(n){return{type:n,attrs:null}}function Pg(n,e){let{parent:t,startIndex:o,endIndex:i}=n,s=t.contentMatchAt(o).findWrapping(e);if(!s)return null;let l=s.length?s[0]:e;return t.canReplaceWith(o,i,l)?s:null}function Hg(n,e){let{parent:t,startIndex:o,endIndex:i}=n,s=t.child(o),l=e.contentMatch.findWrapping(s.type);if(!l)return null;let c=(l.length?l[l.length-1]:e).contentMatch;for(let u=o;c&&u<i;u++)c=c.matchType(t.child(u).type);return!c||!c.validEnd?null:l}function _g(n,e,t){let o=G.empty;for(let l=t.length-1;l>=0;l--){if(o.size){let a=t[l].type.contentMatch.matchFragment(o);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=G.from(t[l].type.create(t[l].attrs,o))}let i=e.start,s=e.end;n.step(new mt(i,s,i,s,new pe(o,0,0),t.length,!0))}function Fg(n,e,t,o,i){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(l,a)=>{let c=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(o,c)&&Ug(n.doc,n.mapping.slice(s).map(a),o)){let u=null;if(o.schema.linebreakReplacement){let p=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);p&&!m?u=!1:!p&&m&&(u=!0)}u===!1&&$u(n,l,a,s),wl(n,n.mapping.slice(s).map(a,1),o,void 0,u===null);let d=n.mapping.slice(s),f=d.map(a,1),h=d.map(a+l.nodeSize,1);return n.step(new mt(f,h,f+1,h-1,new pe(G.from(o.create(c,null,l.marks)),0,0),1,!0)),u===!0&&Au(n,l,a,s),!1}})}function Au(n,e,t,o){e.forEach((i,s)=>{if(i.isText){let l,a=/\r?\n|\r/g;for(;l=a.exec(i.text);){let c=n.mapping.slice(o).map(t+1+s+l.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function $u(n,e,t,o){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let l=n.mapping.slice(o).map(t+1+s);n.replaceWith(l,l+1,e.type.schema.text(`
|
|
8
|
+
`))}})}function Ug(n,e,t){let o=n.resolve(e),i=o.index();return o.parent.canReplaceWith(i,i+1,t)}function qg(n,e,t,o,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let l=t.create(o,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,l);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new mt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new pe(G.from(l),0,0),1,!0))}function Mo(n,e,t=1,o){let i=n.resolve(e),s=i.depth-t,l=o&&o[o.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,d=t-2;u>s;u--,d--){let f=i.node(u),h=i.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=o&&o[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[d]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let a=i.indexAfter(s),c=o&&o[0];return i.node(s).canReplaceWith(a,a,c?c.type:i.node(s+1).type)}function jg(n,e,t=1,o){let i=n.doc.resolve(e),s=G.empty,l=G.empty;for(let a=i.depth,c=i.depth-t,u=t-1;a>c;a--,u--){s=G.from(i.node(a).copy(s));let d=o&&o[u];l=G.from(d?d.type.create(d.attrs,l):i.node(a).copy(l))}n.step(new pt(e,e,new pe(s.append(l),t,t),!0))}function Fn(n,e){let t=n.resolve(e),o=t.index();return Ou(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function Wg(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),l=s.type==o?n.type.schema.nodes.text:s.type;if(t=t.matchType(l),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function Ou(n,e){return!!(n&&e&&!n.isLeaf&&Wg(n,e))}function ji(n,e,t=-1){let o=n.resolve(e);for(let i=o.depth;;i--){let s,l,a=o.index(i);if(i==o.depth?(s=o.nodeBefore,l=o.nodeAfter):t>0?(s=o.node(i+1),a++,l=o.node(i).maybeChild(a)):(s=o.node(i).maybeChild(a-1),l=o.node(i+1)),s&&!s.isTextblock&&Ou(s,l)&&o.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?o.before(i):o.after(i)}}function Kg(n,e,t){let o=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),l=s.node().type;if(i&&l.inlineContent){let d=l.whitespace=="pre",f=!!l.contentMatch.matchType(i);d&&!f?o=!1:!d&&f&&(o=!0)}let a=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);$u(n,d.node(),d.before(),a)}l.inlineContent&&wl(n,e+t-1,l,s.node().contentMatchAt(s.index()),o==null);let c=n.mapping.slice(a),u=c.map(e-t);if(n.step(new pt(u,c.map(e+t,-1),pe.empty,!0)),o===!0){let d=n.doc.resolve(u);Au(n,d.node(),d.before(),n.steps.length)}return n}function Gg(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let i=o.depth-1;i>=0;i--){let s=o.index(i);if(o.node(i).canReplaceWith(s,s,t))return o.before(i+1);if(s>0)return null}if(o.parentOffset==o.parent.content.size)for(let i=o.depth-1;i>=0;i--){let s=o.indexAfter(i);if(o.node(i).canReplaceWith(s,s,t))return o.after(i+1);if(s<o.node(i).childCount)return null}return null}function Iu(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let l=o.depth;l>=0;l--){let a=l==o.depth?0:o.pos<=(o.start(l+1)+o.end(l+1))/2?-1:1,c=o.index(l)+(a>0?1:0),u=o.node(l),d=!1;if(s==1)d=u.canReplace(c,c,i);else{let f=u.contentMatchAt(c).findWrapping(i.firstChild.type);d=f&&u.canReplaceWith(c,c,f[0])}if(d)return a==0?o.pos:a<0?o.before(l+1):o.after(l+1)}return null}function Wi(n,e,t=e,o=pe.empty){if(e==t&&!o.size)return null;let i=n.resolve(e),s=n.resolve(t);return Lu(i,s,o)?new pt(e,t,o):new Jg(i,s,o).fit()}function Lu(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Jg{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=G.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=G.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,i=this.close(e<0?this.$to:o.doc.resolve(e));if(!i)return null;let s=this.placed,l=o.depth,a=i.depth;for(;l&&a&&s.childCount==1;)s=s.firstChild.content,l--,a--;let c=new pe(s,l,a);return e>-1?new mt(o.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||o.pos!=this.$to.pos?new pt(o.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,i=this.unplaced.openEnd;o<e;o++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=o){e=o;break}t=s.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let i,s=null;o?(s=hs(this.unplaced.content,o-1).firstChild,i=s.content):i=this.unplaced.content;let l=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:u}=this.frontier[a],d,f=null;if(t==1&&(l?u.matchType(l.type)||(f=u.fillBefore(G.from(l),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:o,frontierDepth:a,parent:s,inject:f};if(t==2&&l&&(d=u.findWrapping(l.type)))return{sliceDepth:o,frontierDepth:a,parent:s,wrap:d};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,i=hs(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new pe(e,t+1,Math.max(o,i.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,i=hs(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new pe(Zo(e,t-1,1),t-1,s?t-1:o)}else this.unplaced=new pe(Zo(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let l=this.unplaced,a=o?o.content:l.content,c=l.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)d.push(i.child(g));f=f.matchFragment(i)}let p=a.size+e-(l.content.size-l.openEnd);for(;u<a.childCount;){let g=a.child(u),v=f.matchType(g.type);if(!v)break;u++,(u>1||c==0||g.content.size)&&(f=v,d.push(Du(g.mark(h.allowedMarks(g.marks)),u==1?c:0,u==a.childCount?p:-1)))}let m=u==a.childCount;m||(p=-1),this.placed=Qo(this.placed,t,G.from(d)),this.frontier[t].match=f,m&&p<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=a;g<p;g++){let y=v.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),v=y.content}this.unplaced=m?e==0?pe.empty:new pe(Zo(l.content,e-1,1),e-1,p<0?l.openEnd:e-1):new pe(Zo(l.content,e,u),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ps(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:o}=this.$to,i=this.$to.after(o);for(;o>1&&i==this.$to.end(--o);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),l=ps(e,t,i,o,s);if(l){for(let a=t-1;a>=0;a--){let{match:c,type:u}=this.frontier[a],d=ps(e,a,u,c,!0);if(!d||d.childCount)continue e}return{depth:t,fit:l,move:s?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=Qo(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let i=e.node(o),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(o));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,o){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Qo(this.placed,this.depth,G.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(G.empty,!0);t.childCount&&(this.placed=Qo(this.placed,this.frontier.length,t))}}function Zo(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Zo(n.firstChild.content,e-1,t)))}function Qo(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Qo(n.lastChild.content,e-1,t)))}function hs(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Du(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,Du(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(G.empty,!0)))),n.copy(o)}function ps(n,e,t,o,i){let s=n.node(e),l=i?n.indexAfter(e):n.index(e);if(l==s.childCount&&!t.compatibleContent(s.type))return null;let a=o.fillBefore(s.content,!0,l);return a&&!Yg(t,s.content,l)?a:null}function Yg(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function Xg(n){return n.spec.defining||n.spec.definingForContent}function Zg(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(Lu(i,s,o))return n.step(new pt(e,t,o));let l=Ru(i,s);l[l.length-1]==0&&l.pop();let a=-(i.depth+1);l.unshift(a);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;l.indexOf(h)>-1?a=h:i.before(h)==p&&l.splice(1,0,-h)}let c=l.indexOf(a),u=[],d=o.openStart;for(let h=o.content,p=0;;p++){let m=h.firstChild;if(u.push(m),p==o.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=u[h],m=Xg(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(a)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=o.openStart;h>=0;h--){let p=(h+d+1)%(o.openStart+1),m=u[p];if(m)for(let g=0;g<l.length;g++){let v=l[(g+c)%l.length],y=!0;v<0&&(y=!1,v=-v);let b=i.node(v-1),C=i.index(v-1);if(b.canReplaceWith(C,C,m.type,m.marks))return n.replace(i.before(v),y?s.after(v):t,new pe(Vu(o.content,0,o.openStart,p),p,o.openEnd))}}let f=n.steps.length;for(let h=l.length-1;h>=0&&(n.replace(e,t,o),!(n.steps.length>f));h--){let p=l[h];p<0||(e=i.before(p),t=s.after(p))}}function Vu(n,e,t,o,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(Vu(s.content,e+1,t,o,s)))}if(e>o){let s=i.contentMatchAt(0),l=s.fillBefore(n).append(n);n=l.append(s.matchFragment(l).fillBefore(G.empty,!0))}return n}function Qg(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Gg(n.doc,e,o.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new pe(G.from(o),0,0))}function ev(n,e,t){let o=n.doc.resolve(e),i=n.doc.resolve(t),s=Ru(o,i);for(let l=0;l<s.length;l++){let a=s[l],c=l==s.length-1;if(c&&a==0||o.node(a).type.contentMatch.validEnd)return n.delete(o.start(a),i.end(a));if(a>0&&(c||o.node(a-1).canReplace(o.index(a-1),i.indexAfter(a-1))))return n.delete(o.before(a),i.after(a))}for(let l=1;l<=o.depth&&l<=i.depth;l++)if(e-o.start(l)==o.depth-l&&t>o.end(l)&&i.end(l)-t!=i.depth-l&&o.start(l-1)==i.start(l-1)&&o.node(l-1).canReplace(o.index(l-1),i.index(l-1)))return n.delete(o.before(l),t);n.delete(e,t)}function Ru(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let i=o;i>=0;i--){let s=n.start(i);if(s<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;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class To extends Tt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return ct.fail("No node at attribute step's position");let o=Object.create(null);for(let s in t.attrs)o[s]=t.attrs[s];o[this.attr]=this.value;let i=t.type.create(o,null,t.marks);return ct.fromReplace(e,this.pos,this.pos+1,new pe(G.from(i),0,t.isLeaf?0:1))}getMap(){return Vt.empty}invert(e){return new To(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 To(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 To(t.pos,t.attr,t.value)}}Tt.jsonID("attr",To);class yr extends Tt{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 o=e.type.create(t,e.content,e.marks);return ct.ok(o)}getMap(){return Vt.empty}invert(e){return new yr(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 yr(t.attr,t.value)}}Tt.jsonID("docAttr",yr);let Ao=class extends Error{};Ao=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ao.prototype=Object.create(Error.prototype);Ao.prototype.constructor=Ao;Ao.prototype.name="TransformError";class zu{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new vr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ao(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 o=0;o<this.mapping.maps.length;o++){let i=this.mapping.maps[o];o&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((s,l,a,c)=>{e=Math.min(e,a),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,o=pe.empty){let i=Wi(this.doc,e,t,o);return i&&this.step(i),this}replaceWith(e,t,o){return this.replace(e,t,new pe(G.from(o),0,0))}delete(e,t){return this.replace(e,t,pe.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return Zg(this,e,t,o),this}replaceRangeWith(e,t,o){return Qg(this,e,t,o),this}deleteRange(e,t){return ev(this,e,t),this}lift(e,t){return zg(this,e,t),this}join(e,t=1){return Kg(this,e,t),this}wrap(e,t){return _g(this,e,t),this}setBlockType(e,t=e,o,i=null){return Fg(this,e,t,o,i),this}setNodeMarkup(e,t,o=null,i){return qg(this,e,t,o,i),this}setNodeAttribute(e,t,o){return this.step(new To(e,t,o)),this}setDocAttribute(e,t){return this.step(new yr(e,t)),this}addNodeMark(e,t){return this.step(new Ln(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof Ke)t.isInSet(o.marks)&&this.step(new so(e,t));else{let i=o.marks,s,l=[];for(;s=t.isInSet(i);)l.push(new so(e,s)),i=s.removeFromSet(i);for(let a=l.length-1;a>=0;a--)this.step(l[a])}return this}split(e,t=1,o){return jg(this,e,t,o),this}addMark(e,t,o){return Dg(this,e,t,o),this}removeMark(e,t,o){return Vg(this,e,t,o),this}clearIncompatible(e,t,o){return wl(this,e,t,o),this}}const ms=Object.create(null);class Re{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new tv(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=pe.empty){let o=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=o,o=o.lastChild;let s=e.steps.length,l=this.ranges;for(let a=0;a<l.length;a++){let{$from:c,$to:u}=l[a],d=e.mapping.slice(s);e.replaceRange(d.map(c.pos),d.map(u.pos),a?pe.empty:t),a==0&&qa(e,s,(o?o.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:a}=i[s],c=e.mapping.slice(o),u=c.map(l.pos),d=c.map(a.pos);s?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),qa(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let i=e.parent.inlineContent?new Oe(e):wo(e.node(0),e.parent,e.pos,e.index(),t,o);if(i)return i;for(let s=e.depth-1;s>=0;s--){let l=t<0?wo(e.node(0),e.node(s),e.before(s+1),e.index(s),t,o):wo(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,o);if(l)return l}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new jt(e.node(0))}static atStart(e){return wo(e,e,0,0,1)||new jt(e)}static atEnd(e){return wo(e,e,e.content.size,e.childCount,-1)||new jt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=ms[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in ms)throw new RangeError("Duplicate use of selection JSON ID "+e);return ms[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Re.prototype.visible=!0;class tv{constructor(e,t){this.$from=e,this.$to=t}}let Fa=!1;function Ua(n){!Fa&&!n.parent.inlineContent&&(Fa=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Oe extends Re{constructor(e,t=e){Ua(e),Ua(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return Re.near(o);let i=e.resolve(t.map(this.anchor));return new Oe(i.parent.inlineContent?i:o,o)}replace(e,t=pe.empty){if(super.replace(e,t),t==pe.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ki(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 Oe(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let i=e.resolve(t);return new this(i,o==t?i:e.resolve(o))}static between(e,t,o){let i=e.pos-t.pos;if((!o||i)&&(o=i>=0?1:-1),!t.parent.inlineContent){let s=Re.findFrom(t,o,!0)||Re.findFrom(t,-o,!0);if(s)t=s.$head;else return Re.near(t,o)}return e.parent.inlineContent||(i==0?e=t:(e=(Re.findFrom(e,-o,!0)||Re.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new Oe(e,t)}}Re.jsonID("text",Oe);class Ki{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ki(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Te extends Re{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return o?Re.near(s):new Te(s)}content(){return new pe(G.from(this.node),0,0)}eq(e){return e instanceof Te&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new El(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Te(e.resolve(t.anchor))}static create(e,t){return new Te(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Te.prototype.visible=!1;Re.jsonID("node",Te);class El{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new Ki(o,o):new El(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Te.isSelectable(o)?new Te(t):Re.near(t)}}class jt extends Re{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=pe.empty){if(t==pe.empty){e.delete(0,e.doc.content.size);let o=Re.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new jt(e)}map(e){return new jt(e)}eq(e){return e instanceof jt}getBookmark(){return nv}}Re.jsonID("all",jt);const nv={map(){return this},resolve(n){return new jt(n)}};function wo(n,e,t,o,i,s=!1){if(e.inlineContent)return Oe.create(n,t);for(let l=o-(i>0?0:1);i>0?l<e.childCount:l>=0;l+=i){let a=e.child(l);if(a.isAtom){if(!s&&Te.isSelectable(a))return Te.create(n,t-(i<0?a.nodeSize:0))}else{let c=wo(n,a,t+i,i<0?a.childCount:0,i,s);if(c)return c}t+=a.nodeSize*i}return null}function qa(n,e,t){let o=n.steps.length-1;if(o<e)return;let i=n.steps[o];if(!(i instanceof pt||i instanceof mt))return;let s=n.mapping.maps[o],l;s.forEach((a,c,u,d)=>{l==null&&(l=d)}),n.setSelection(Re.near(n.doc.resolve(l),t))}const ja=1,zr=2,Wa=4;class ov extends zu{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|ja)&~zr,this.storedMarks=null,this}get selectionSet(){return(this.updated&ja)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=zr,this}ensureMarks(e){return Ke.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&zr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~zr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let o=this.selection;return t&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||Ke.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,o){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(o==null&&(o=t),!e)return this.deleteRange(t,o);let s=this.storedMarks;if(!s){let l=this.doc.resolve(t);s=o==t?l.marks():l.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(t,o,i.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(Re.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|=Wa,this}get scrolledIntoView(){return(this.updated&Wa)>0}}function Ka(n,e){return!e||!n?n:n.bind(e)}class er{constructor(e,t,o){this.name=e,this.init=Ka(t.init,o),this.apply=Ka(t.apply,o)}}const rv=[new er("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new er("selection",{init(n,e){return n.selection||Re.atStart(e.doc)},apply(n){return n.selection}}),new er("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new er("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class gs{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=rv.slice(),t&&t.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new er(o.key,o.spec.state,o))})}}class So{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 o=0;o<this.config.plugins.length;o++)if(o!=t){let i=this.config.plugins[o];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],o=this.applyInner(e),i=null;for(;;){let s=!1;for(let l=0;l<this.config.plugins.length;l++){let a=this.config.plugins[l];if(a.spec.appendTransaction){let c=i?i[l].n:0,u=i?i[l].state:this,d=c<t.length&&a.spec.appendTransaction.call(a,c?t.slice(c):t,u,o);if(d&&o.filterTransaction(d,l)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<l?{state:o,n:t.length}:{state:this,n:0})}t.push(d),o=o.applyInner(d),s=!0}i&&(i[l]={state:o,n:t.length})}}if(!s)return{state:o,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new So(this.config),o=this.config.fields;for(let i=0;i<o.length;i++){let s=o[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new ov(this)}static create(e){let t=new gs(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new So(t);for(let i=0;i<t.fields.length;i++)o[t.fields[i].name]=t.fields[i].init(e,o);return o}reconfigure(e){let t=new gs(this.schema,e.plugins),o=t.fields,i=new So(t);for(let s=0;s<o.length;s++){let l=o[s].name;i[l]=this.hasOwnProperty(l)?this[l]:o[s].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(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[o],s=i.spec.state;s&&s.toJSON&&(t[o]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,o){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new gs(e.schema,e.plugins),s=new So(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=Jt.fromJSON(e.schema,t.doc);else if(l.name=="selection")s.selection=Re.fromJSON(s.doc,t.selection);else if(l.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let a in o){let c=o[a],u=c.spec.state;if(c.key==l.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[l.name]=u.fromJSON.call(c,e,t[a],s);return}}s[l.name]=l.init(e,s)}}),s}}function Pu(n,e,t){for(let o in n){let i=n[o];i instanceof Function?i=i.bind(e):o=="handleDOMEvents"&&(i=Pu(i,e,{})),t[o]=i}return t}class ot{constructor(e){this.spec=e,this.props={},e.props&&Pu(e.props,this,this.props),this.key=e.key?e.key.key:Hu("plugin")}getState(e){return e[this.key]}}const vs=Object.create(null);function Hu(n){return n in vs?n+"$"+ ++vs[n]:(vs[n]=0,n+"$")}class ht{constructor(e="key"){this.key=Hu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const iv=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function _u(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const sv=(n,e,t)=>{let o=_u(n,t);if(!o)return!1;let i=Sl(o);if(!i){let l=o.blockRange(),a=l&&Po(l);return a==null?!1:(e&&e(n.tr.lift(l,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(ju(n,i,e,-1))return!0;if(o.parent.content.size==0&&($o(s,"end")||Te.isSelectable(s)))for(let l=o.depth;;l--){let a=Wi(n.doc,o.before(l),o.after(l),pe.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection($o(s,"end")?Re.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):Te.create(c.doc,i.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(l==1||o.node(l-1).childCount>1)break}return s.isAtom&&i.depth==o.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},lv=(n,e,t)=>{let o=_u(n,t);if(!o)return!1;let i=Sl(o);return i?Fu(n,i,e):!1},av=(n,e,t)=>{let o=Uu(n,t);if(!o)return!1;let i=Ml(o);return i?Fu(n,i,e):!1};function Fu(n,e,t){let o=e.nodeBefore,i=o,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let l=e.nodeAfter,a=l,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let u=Wi(n.doc,s,c,pe.empty);if(!u||u.from!=s||u instanceof pt&&u.slice.size>=c-s)return!1;if(t){let d=n.tr.step(u);d.setSelection(Oe.create(d.doc,s)),t(d.scrollIntoView())}return!0}function $o(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const cv=(n,e,t)=>{let{$head:o,empty:i}=n.selection,s=o;if(!i)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;s=Sl(o)}let l=s&&s.nodeBefore;return!l||!Te.isSelectable(l)?!1:(e&&e(n.tr.setSelection(Te.create(n.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function Sl(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 Uu(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const uv=(n,e,t)=>{let o=Uu(n,t);if(!o)return!1;let i=Ml(o);if(!i)return!1;let s=i.nodeAfter;if(ju(n,i,e,1))return!0;if(o.parent.content.size==0&&($o(s,"start")||Te.isSelectable(s))){let l=Wi(n.doc,o.before(),o.after(),pe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection($o(s,"start")?Re.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):Te.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==o.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},dv=(n,e,t)=>{let{$head:o,empty:i}=n.selection,s=o;if(!i)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;s=Ml(o)}let l=s&&s.nodeAfter;return!l||!Te.isSelectable(l)?!1:(e&&e(n.tr.setSelection(Te.create(n.doc,s.pos)).scrollIntoView()),!0)};function Ml(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 fv=(n,e)=>{let t=n.selection,o=t instanceof Te,i;if(o){if(t.node.isTextblock||!Fn(n.doc,t.from))return!1;i=t.from}else if(i=ji(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);o&&s.setSelection(Te.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},hv=(n,e)=>{let t=n.selection,o;if(t instanceof Te){if(t.node.isTextblock||!Fn(n.doc,t.to))return!1;o=t.to}else if(o=ji(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},pv=(n,e)=>{let{$from:t,$to:o}=n.selection,i=t.blockRange(o),s=i&&Po(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},mv=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
|
|
9
|
+
`).scrollIntoView()),!0)};function qu(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 gv=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let i=t.node(-1),s=t.indexAfter(-1),l=qu(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(e){let a=t.after(),c=n.tr.replaceWith(a,a,l.createAndFill());c.setSelection(Re.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},vv=(n,e)=>{let t=n.selection,{$from:o,$to:i}=t;if(t instanceof jt||o.parent.inlineContent||i.parent.inlineContent)return!1;let s=qu(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let l=(!o.parentOffset&&i.index()<i.parent.childCount?o:i).pos,a=n.tr.insert(l,s.createAndFill());a.setSelection(Oe.create(a.doc,l+1)),e(a.scrollIntoView())}return!0},yv=(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 s=t.before();if(Mo(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let o=t.blockRange(),i=o&&Po(o);return i==null?!1:(e&&e(n.tr.lift(o,i).scrollIntoView()),!0)},kv=(n,e)=>{let{$from:t,to:o}=n.selection,i,s=t.sharedDepth(o);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(Te.create(n.doc,i))),!0)};function bv(n,e,t){let o=e.nodeBefore,i=e.nodeAfter,s=e.index();return!o||!i||!o.type.compatibleContent(i.type)?!1:!o.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Fn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function ju(n,e,t,o){let i=e.nodeBefore,s=e.nodeAfter,l,a,c=i.type.spec.isolating||s.type.spec.isolating;if(!c&&bv(n,e,t))return!0;let u=!c&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(l=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(l[0]||s.type).validEnd){if(t){let p=e.pos+s.nodeSize,m=G.empty;for(let y=l.length-1;y>=0;y--)m=G.from(l[y].create(null,m));m=G.from(i.copy(m));let g=n.tr.step(new mt(e.pos-1,p,e.pos,p,new pe(m,1,0),l.length,!0)),v=g.doc.resolve(p+2*l.length);v.nodeAfter&&v.nodeAfter.type==i.type&&Fn(g.doc,v.pos)&&g.join(v.pos),t(g.scrollIntoView())}return!0}let d=s.type.spec.isolating||o>0&&c?null:Re.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&Po(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(u&&$o(s,"start",!0)&&$o(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=s,v=1;for(;!g.isTextblock;g=g.firstChild)v++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(t){let y=G.empty;for(let C=m.length-1;C>=0;C--)y=G.from(m[C].copy(y));let b=n.tr.step(new mt(e.pos-m.length,e.pos+s.nodeSize,e.pos+v,e.pos+s.nodeSize-v,new pe(y,m.length,0),0,!0));t(b.scrollIntoView())}return!0}}return!1}function Wu(n){return function(e,t){let o=e.selection,i=n<0?o.$from:o.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(Oe.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const xv=Wu(-1),wv=Wu(1);function Cv(n,e=null){return function(t,o){let{$from:i,$to:s}=t.selection,l=i.blockRange(s),a=l&&Cl(l,n,e);return a?(o&&o(t.tr.wrap(l,a).scrollIntoView()),!0):!1}}function Ga(n,e=null){return function(t,o){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(l,a,(c,u)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)i=!0;else{let d=t.doc.resolve(u),f=d.index();i=d.parent.canReplaceWith(f,f+1,n)}})}if(!i)return!1;if(o){let s=t.tr;for(let l=0;l<t.selection.ranges.length;l++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[l];s.setBlockType(a,c,n,e)}o(s.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Ev(n,e=null){return function(t,o){let{$from:i,$to:s}=t.selection,l=i.blockRange(s);if(!l)return!1;let a=o?t.tr:null;return Sv(a,l,n,e)?(o&&o(a.scrollIntoView()),!0):!1}}function Sv(n,e,t,o=null){let i=!1,s=e,l=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=l.resolve(e.start-2);s=new ni(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new ni(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Cl(s,t,o,e);return a?(n&&Mv(n,e,a,i,t),!0):!1}function Mv(n,e,t,o,i){let s=G.empty;for(let d=t.length-1;d>=0;d--)s=G.from(t[d].type.create(t[d].attrs,s));n.step(new mt(e.start-(o?2:0),e.end,e.start,e.end,new pe(s,0,0),t.length,!0));let l=0;for(let d=0;d<t.length;d++)t[d].type==i&&(l=d+1);let a=t.length-l,c=e.start+t.length-(o?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,h=!0;d<f;d++,h=!1)!h&&Mo(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=u.child(d).nodeSize;return n}function Tv(n){return function(e,t){let{$from:o,$to:i}=e.selection,s=o.blockRange(i,l=>l.childCount>0&&l.firstChild.type==n);return s?t?o.node(s.depth-1).type==n?Nv(e,t,n,s):Bv(e,t,s):!0:!1}}function Nv(n,e,t,o){let i=n.tr,s=o.end,l=o.$to.end(o.depth);s<l&&(i.step(new mt(s-1,l,s,l,new pe(G.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new ni(i.doc.resolve(o.$from.pos),i.doc.resolve(l),o.depth));const a=Po(o);if(a==null)return!1;i.lift(o,a);let c=i.doc.resolve(i.mapping.map(s,-1)-1);return Fn(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function Bv(n,e,t){let o=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,o.delete(p-1,p+1);let s=o.doc.resolve(t.start),l=s.nodeAfter;if(o.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,c=t.endIndex==i.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(a?0:1),d+1,l.content.append(c?G.empty:G.from(i))))return!1;let f=s.pos,h=f+l.nodeSize;return o.step(new mt(f-(a?1:0),h+(c?1:0),f+1,h-1,new pe((a?G.empty:G.from(i.copy(G.empty))).append(c?G.empty:G.from(i.copy(G.empty))),a?0:1,c?0:1),a?0:1)),e(o.scrollIntoView()),!0}function Av(n){return function(e,t){let{$from:o,$to:i}=e.selection,s=o.blockRange(i,u=>u.childCount>0&&u.firstChild.type==n);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let a=s.parent,c=a.child(l-1);if(c.type!=n)return!1;if(t){let u=c.lastChild&&c.lastChild.type==a.type,d=G.from(u?n.create():null),f=new pe(G.from(n.create(null,G.from(a.type.create(null,d)))),u?3:1,0),h=s.start,p=s.end;t(e.tr.step(new mt(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const yt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Oo=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let js=null;const mn=function(n,e,t){let o=js||(js=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},$v=function(){js=null},lo=function(n,e,t,o){return t&&(Ja(n,e,t,o,-1)||Ja(n,e,t,o,1))},Ov=/^(img|br|input|textarea|hr)$/i;function Ja(n,e,t,o,i){for(var s;;){if(n==t&&e==o)return!0;if(e==(i<0?0:qt(n))){let l=n.parentNode;if(!l||l.nodeType!=1||Nr(n)||Ov.test(n.nodeName)||n.contentEditable=="false")return!1;e=yt(n)+(i<0?0:1),n=l}else if(n.nodeType==1){let l=n.childNodes[e+(i<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((s=l.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=l,e=i<0?qt(n):0}else return!1}}function qt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Iv(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=qt(n)}else if(n.parentNode&&!Nr(n))e=yt(n),n=n.parentNode;else return null}}function Lv(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&&!Nr(n))e=yt(n)+1,n=n.parentNode;else return null}}function Dv(n,e,t){for(let o=e==0,i=e==qt(n);o||i;){if(n==t)return!0;let s=yt(n);if(n=n.parentNode,!n)return!1;o=o&&s==0,i=i&&s==qt(n)}}function Nr(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 Gi=function(n){return n.focusNode&&lo(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Jn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Vv(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Rv(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(qt(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(qt(o.startContainer),o.startOffset)}}}const on=typeof navigator<"u"?navigator:null,Ya=typeof document<"u"?document:null,ho=on&&on.userAgent||"",Ws=/Edge\/(\d+)/.exec(ho),Ku=/MSIE \d/.exec(ho),Ks=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ho),Lt=!!(Ku||Ks||Ws),Rn=Ku?document.documentMode:Ks?+Ks[1]:Ws?+Ws[1]:0,Yt=!Lt&&/gecko\/(\d+)/i.test(ho),Gs=!Lt&&/Chrome\/(\d+)/.exec(ho),bt=!!Gs,Gu=Gs?+Gs[1]:0,Mt=!Lt&&!!on&&/Apple Computer/.test(on.vendor),Io=Mt&&(/Mobile\/\w+/.test(ho)||!!on&&on.maxTouchPoints>2),Ut=Io||(on?/Mac/.test(on.platform):!1),Ju=on?/Win/.test(on.platform):!1,yn=/Android \d/.test(ho),Br=!!Ya&&"webkitFontSmoothing"in Ya.documentElement.style,zv=Br?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Pv(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 un(n,e){return typeof n=="number"?n:n[e]}function Hv(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,o=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*o}}function Xa(n,e,t){let o=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let l=t||n.dom;l;){if(l.nodeType!=1){l=Oo(l);continue}let a=l,c=a==s.body,u=c?Pv(s):Hv(a),d=0,f=0;if(e.top<u.top+un(o,"top")?f=-(u.top-e.top+un(i,"top")):e.bottom>u.bottom-un(o,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+un(i,"top")-u.top:e.bottom-u.bottom+un(i,"bottom")),e.left<u.left+un(o,"left")?d=-(u.left-e.left+un(i,"left")):e.right>u.right-un(o,"right")&&(d=e.right-u.right+un(i,"right")),d||f)if(c)s.defaultView.scrollBy(d,f);else{let p=a.scrollLeft,m=a.scrollTop;f&&(a.scrollTop+=f),d&&(a.scrollLeft+=d);let g=a.scrollLeft-p,v=a.scrollTop-m;e={left:e.left-g,top:e.top-v,right:e.right-g,bottom:e.bottom-v}}let h=c?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(h))break;l=h=="absolute"?l.offsetParent:Oo(l)}}function _v(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),o,i;for(let s=(e.left+e.right)/2,l=t+1;l<Math.min(innerHeight,e.bottom);l+=5){let a=n.root.elementFromPoint(s,l);if(!a||a==n.dom||!n.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=t-20){o=a,i=c.top;break}}return{refDOM:o,refTop:i,stack:Yu(n.dom)}}function Yu(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=Oo(o));return e}function Fv({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;Xu(t,o==0?0:o-e)}function Xu(n,e){for(let t=0;t<n.length;t++){let{dom:o,top:i,left:s}=n[t];o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=s&&(o.scrollLeft=s)}}let bo=null;function Uv(n){if(n.setActive)return n.setActive();if(bo)return n.focus(bo);let e=Yu(n);n.focus(bo==null?{get preventScroll(){return bo={preventScroll:!0},!0}}:void 0),bo||(bo=!1,Xu(e,0))}function Zu(n,e){let t,o=2e8,i,s=0,l=e.top,a=e.top,c,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=mn(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=l&&m.bottom>=a){l=Math.max(m.bottom,l),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<o){t=d,o=g,i=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(s=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=d,u={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)&&(s=f+1)}}return!t&&c&&(t=c,i=u,o=0),t&&t.nodeType==3?qv(t,i):!t||o&&t.nodeType==1?{node:n,offset:s}:Zu(t,i)}function qv(n,e){let t=n.nodeValue.length,o=document.createRange(),i;for(let s=0;s<t;s++){o.setEnd(n,s+1),o.setStart(n,s);let l=Mn(o,1);if(l.top!=l.bottom&&Tl(e,l)){i={node:n,offset:s+(e.left>=(l.left+l.right)/2?1:0)};break}}return o.detach(),i||{node:n,offset:0}}function Tl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function jv(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Wv(n,e,t){let{node:o,offset:i}=Zu(e,t),s=-1;if(o.nodeType==1&&!o.firstChild){let l=o.getBoundingClientRect();s=l.left!=l.right&&t.left>(l.left+l.right)/2?1:-1}return n.docView.posFromDOM(o,i,s)}function Kv(n,e,t,o){let i=-1;for(let s=e,l=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),c;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!l&&c.left>o.left||c.top>o.top?i=a.posBefore:(!l&&c.right<o.left||c.bottom<o.top)&&(i=a.posAfter),l=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Qu(n,e,t){let o=n.childNodes.length;if(o&&t.top<t.bottom)for(let i=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let l=n.childNodes[s];if(l.nodeType==1){let a=l.getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(Tl(e,u))return Qu(l,e,u)}}if((s=(s+1)%o)==i)break}return n}function Gv(n,e){let t=n.dom.ownerDocument,o,i=0,s=Rv(t,e.left,e.top);s&&({node:o,offset:i}=s);let l=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!l||!n.dom.contains(l.nodeType!=1?l.parentNode:l)){let u=n.dom.getBoundingClientRect();if(!Tl(e,u)||(l=Qu(n.dom,e,u),!l))return null}if(Mt)for(let u=l;o&&u;u=Oo(u))u.draggable&&(o=void 0);if(l=jv(l,e),o){if(Yt&&o.nodeType==1&&(i=Math.min(i,o.childNodes.length),i<o.childNodes.length)){let d=o.childNodes[i],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let u;Br&&i&&o.nodeType==1&&(u=o.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,o==n.dom&&i==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||o.nodeType!=1||o.childNodes[i-1].nodeName!="BR")&&(a=Kv(n,o,i,e))}a==null&&(a=Wv(n,l,e));let c=n.docView.nearestDesc(l,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Za(n){return n.top<n.bottom||n.left<n.right}function Mn(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(Za(o))return o}return Array.prototype.find.call(t,Za)||n.getBoundingClientRect()}const Jv=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ed(n,e,t){let{node:o,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),l=Br||Yt;if(o.nodeType==3)if(l&&(Jv.test(o.nodeValue)||(t<0?!i:i==o.nodeValue.length))){let c=Mn(mn(o,i,i),t);if(Yt&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){let u=Mn(mn(o,i-1,i-1),-1);if(u.top==c.top){let d=Mn(mn(o,i,i+1),-1);if(d.top!=c.top)return Ko(d,d.left<u.left)}}return c}else{let c=i,u=i,d=t<0?1:-1;return t<0&&!i?(u++,d=-1):t>=0&&i==o.nodeValue.length?(c--,d=1):t<0?c--:u++,Ko(Mn(mn(o,c,u),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==qt(o))){let c=o.childNodes[i-1];if(c.nodeType==1)return ys(c.getBoundingClientRect(),!1)}if(s==null&&i<qt(o)){let c=o.childNodes[i];if(c.nodeType==1)return ys(c.getBoundingClientRect(),!0)}return ys(o.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==qt(o))){let c=o.childNodes[i-1],u=c.nodeType==3?mn(c,qt(c)-(l?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return Ko(Mn(u,1),!1)}if(s==null&&i<qt(o)){let c=o.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?c.nodeType==3?mn(c,0,l?0:1):c.nodeType==1?c:null:null;if(u)return Ko(Mn(u,-1),!0)}return Ko(Mn(o.nodeType==3?mn(o):o,-t),t>=0)}function Ko(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 ys(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 td(n,e,t){let o=n.state,i=n.root.activeElement;o!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{o!=e&&n.updateState(o),i!=n.dom&&i&&i.focus()}}function Yv(n,e,t){let o=e.selection,i=t=="up"?o.$from:o.$to;return td(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let l=ed(n,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=mn(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let d=c[u];if(d.bottom>d.top+1&&(t=="up"?l.top-d.top>(d.bottom-l.top)*2:d.bottom-l.bottom>(l.bottom-d.top)*2))return!1}}return!0})}const Xv=/[\u0590-\u08ac]/;function Zv(n,e,t){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let i=o.parentOffset,s=!i,l=i==o.parent.content.size,a=n.domSelection();return a?!Xv.test(o.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:l:td(n,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:d,anchorOffset:f}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let p=o.depth?n.docView.domAfterPos(o.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),v=m&&!p.contains(m.nodeType==1?m:m.parentNode)||c==m&&u==g;try{a.collapse(d,f),c&&(c!=d||u!=f)&&a.extend&&a.extend(c,u)}catch{}return h!=null&&(a.caretBidiLevel=h),v}):o.pos==o.start()||o.pos==o.end()}let Qa=null,ec=null,tc=!1;function Qv(n,e,t){return Qa==e&&ec==t?tc:(Qa=e,ec=t,tc=t=="up"||t=="down"?Yv(n,e,t):Zv(n,e,t))}const Wt=0,nc=1,Yn=2,rn=3;class Ar{constructor(e,t,o,i){this.parent=e,this.children=t,this.dom=o,this.contentDOM=i,this.dirty=Wt,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,o){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,o=this.posAtStart;;t++){let i=this.children[t];if(i==e)return o;o+=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,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let s,l;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(l)+l.size:this.posAtStart}else{let s,l;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(l):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>yt(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 s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let o=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),l;if(s&&(!t||s.node))if(o&&(l=s.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==e))o=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let o=t;o;o=o.parent)if(o==this)return t}posFromDOM(e,t,o){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,o)}return-1}descAt(e){for(let t=0,o=0;t<this.children.length;t++){let i=this.children[t],s=o+i.size;if(o==e&&s!=o){for(;!i.border&&i.children.length;)for(let l=0;l<i.children.length;l++){let a=i.children[l];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-o-i.border);o=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,i=0;for(let s=0;o<this.children.length;o++){let l=this.children[o],a=s+l.size;if(a>e||l instanceof od){i=e-s;break}s=a}if(i)return this.children[o].domFromPos(i-this.children[o].border,t);for(let s;o&&!(s=this.children[o-1]).size&&s instanceof nd&&s.side>=0;o--);if(t<=0){let s,l=!0;for(;s=o?this.children[o-1]:null,!(!s||s.dom.parentNode==this.contentDOM);o--,l=!1);return s&&t&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?yt(s.dom)+1:0}}else{let s,l=!0;for(;s=o<this.children.length?this.children[o]:null,!(!s||s.dom.parentNode==this.contentDOM);o++,l=!1);return s&&l&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?yt(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let l=o,a=0;;a++){let c=this.children[a],u=l+c.size;if(i==-1&&e<=u){let d=l+c.border;if(e>=d&&t<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,d);e=l;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=yt(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(u>t||a==this.children.length-1)){t=u;for(let d=a+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=yt(f.dom);break}t+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=u}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}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:o}=this.domFromPos(e,0);if(t.nodeType!=1||o==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[o]}setSelection(e,t,o,i=!1){let s=Math.min(e,t),l=Math.max(e,t);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],v=m+g.size;if(s>m&&l<v)return g.setSelection(e-m-g.border,t-m-g.border,o,i);m=v}let a=this.domFromPos(e,e?-1:1),c=t==e?a:this.domFromPos(t,t?-1:1),u=o.root.getSelection(),d=o.domSelectionRange(),f=!1;if((Yt||Mt)&&e==t){let{node:p,offset:m}=a;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==`
|
|
10
|
+
`),f&&m==p.nodeValue.length)for(let g=p,v;g;g=g.parentNode){if(v=g.nextSibling){v.nodeName=="BR"&&(a=c={node:v.parentNode,offset:yt(v)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Yt&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&Mt)&&lo(a.node,a.offset,d.anchorNode,d.anchorOffset)&&lo(c.node,c.offset,d.focusNode,d.focusOffset))return;let h=!1;if((u.extend||e==t)&&!(f&&Yt)){u.collapse(a.node,a.offset);try{e!=t&&u.extend(c.node,c.offset),h=!0}catch{}}if(!h){if(e>t){let m=a;a=c,c=m}let p=document.createRange();p.setEnd(c.node,c.offset),p.setStart(a.node,a.offset),u.removeAllRanges(),u.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 o=0,i=0;i<this.children.length;i++){let s=this.children[i],l=o+s.size;if(o==l?e<=l&&t>=o:e<l&&t>o){let a=o+s.border,c=l-s.border;if(e>=a&&t<=c){this.dirty=e==o||t==l?Yn:nc,e==a&&t==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=rn:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Yn:rn}o=l}this.dirty=Yn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?Yn:nc;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class nd extends Ar{constructor(e,t,o,i){let s,l=t.type.toDOM;if(typeof l=="function"&&(l=l(o,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(l.nodeType!=1){let a=document.createElement("span");a.appendChild(l),l=a}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Wt&&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 ey extends Ar{constructor(e,t,o,i){super(e,[],t,null),this.textDOM=o,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 ao extends Ar{constructor(e,t,o,i,s){super(e,[],o,i),this.mark=t,this.spec=s}static create(e,t,o,i){let s=i.nodeViews[t.type.name],l=s&&s(t,i,o);return(!l||!l.dom)&&(l=fo.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new ao(e,t,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&rn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=rn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Wt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=Wt}}slice(e,t,o){let i=ao.create(this.parent,this.mark,!0,o),s=this.children,l=this.size;t<l&&(s=Ys(s,t,l,o)),e>0&&(s=Ys(s,0,e,o));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class zn extends Ar{constructor(e,t,o,i,s,l,a,c,u){super(e,[],s,l),this.node=t,this.outerDeco=o,this.innerDeco=i,this.nodeDOM=a}static create(e,t,o,i,s,l){let a=s.nodeViews[t.type.name],c,u=a&&a(t,s,()=>{if(!c)return l;if(c.parent)return c.parent.posBeforeChild(c)},o,i),d=u&&u.dom,f=u&&u.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=fo.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=sd(d,o,t),u?c=new ty(e,t,o,i,d,f||null,h,u,s,l+1):t.isText?new Ji(e,t,o,i,d,h,s):new zn(e,t,o,i,d,f||null,h,s,l+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 o=this.children[t];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>G.empty)}return e}matchesNode(e,t,o){return this.dirty==Wt&&e.eq(this.node)&&ri(t,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let o=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,l=s&&s.pos>-1?s:null,a=s&&s.pos<0,c=new oy(this,l&&l.node,e);sy(this.node,this.innerDeco,(u,d,f)=>{u.spec.marks?c.syncToMarks(u.spec.marks,o,e,d):u.type.side>=0&&!f&&c.syncToMarks(d==this.node.childCount?Ke.none:this.node.child(d).marks,o,e,d),c.placeWidget(u,e,i)},(u,d,f,h)=>{c.syncToMarks(u.marks,o,e,h);let p;c.findNodeMatch(u,d,f,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(p=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(u,d,f,p,e)||c.updateNextNode(u,d,f,e,h,i)||c.addNode(u,d,f,e,i),i+=u.nodeSize}),c.syncToMarks([],o,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Yn)&&(l&&this.protectLocalComposition(e,l),rd(this.contentDOM,this.children,e),Io&&ly(this.dom))}localCompositionInfo(e,t){let{from:o,to:i}=e.state.selection;if(!(e.state.selection instanceof Oe)||o<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let l=s.nodeValue,a=ay(this.node.content,l,o-t,i-t);return a<0?null:{node:s,pos:a,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:o,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let l=new ey(this,s,t,i);e.input.compositionNodes.push(l),this.children=Ys(this.children,o,o+i.length,e,l)}update(e,t,o,i){return this.dirty==rn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,o,i),!0)}updateInner(e,t,o,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Wt}updateOuterDeco(e){if(ri(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=id(this.dom,this.nodeDOM,Js(this.outerDeco,this.node,t),Js(e,this.node,t)),this.dom!=o&&(o.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 oc(n,e,t,o,i){sd(o,e,n);let s=new zn(void 0,n,e,t,o,o,o,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Ji extends zn{constructor(e,t,o,i,s,l,a){super(e,t,o,i,s,null,l,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,o,i){return this.dirty==rn||this.dirty!=Wt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Wt||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=Wt,!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,o){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,o){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new Ji(this.parent,i,this.outerDeco,this.innerDeco,s,s,o)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=rn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class od extends Ar{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Wt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class ty extends zn{constructor(e,t,o,i,s,l,a,c,u,d){super(e,t,o,i,s,l,a,u,d),this.spec=c}update(e,t,o,i){if(this.dirty==rn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,o);return s&&this.updateInner(e,t,o,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,o,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,o,i){this.spec.setSelection?this.spec.setSelection(e,t,o.root):super.setSelection(e,t,o,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 rd(n,e,t){let o=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let l=e[s],a=l.dom;if(a.parentNode==n){for(;a!=o;)o=rc(o),i=!0;o=o.nextSibling}else i=!0,n.insertBefore(a,o);if(l instanceof ao){let c=o?o.previousSibling:n.lastChild;rd(l.contentDOM,l.children,t),o=c?c.nextSibling:n.firstChild}}for(;o;)o=rc(o),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const ir=function(n){n&&(this.nodeName=n)};ir.prototype=Object.create(null);const Xn=[new ir];function Js(n,e,t){if(n.length==0)return Xn;let o=t?Xn[0]:new ir,i=[o];for(let s=0;s<n.length;s++){let l=n[s].type.attrs;if(l){l.nodeName&&i.push(o=new ir(l.nodeName));for(let a in l){let c=l[a];c!=null&&(t&&i.length==1&&i.push(o=new ir(e.isInline?"span":"div")),a=="class"?o.class=(o.class?o.class+" ":"")+c:a=="style"?o.style=(o.style?o.style+";":"")+c:a!="nodeName"&&(o[a]=c))}}}return i}function id(n,e,t,o){if(t==Xn&&o==Xn)return e;let i=e;for(let s=0;s<o.length;s++){let l=o[s],a=t[s];if(s){let c;a&&a.nodeName==l.nodeName&&i!=n&&(c=i.parentNode)&&c.nodeName.toLowerCase()==l.nodeName||(c=document.createElement(l.nodeName),c.pmIsDeco=!0,c.appendChild(i),a=Xn[0]),i=c}ny(i,a||Xn[0],l)}return i}function ny(n,e,t){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in t)&&n.removeAttribute(o);for(let o in t)o!="class"&&o!="style"&&o!="nodeName"&&t[o]!=e[o]&&n.setAttribute(o,t[o]);if(e.class!=t.class){let o=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<o.length;s++)i.indexOf(o[s])==-1&&n.classList.remove(o[s]);for(let s=0;s<i.length;s++)o.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=o.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function sd(n,e,t){return id(n,n,Xn,Js(e,t,n.nodeType!=1))}function ri(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 rc(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class oy{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ry(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let o=e;o<t;o++)this.top.children[o].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,o,i){let s=0,l=this.stack.length>>1,a=Math.min(l,e.length);for(;s<a&&(s==l-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<l;)this.destroyRest(),this.top.dirty=Wt,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let c=-1,u=this.top.children.length;i<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let f=this.top.children[d];if(f.matchesMark(e[l])&&!this.isLocked(f.dom)){c=d;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let d=ao.create(this.top,e[l],t,o);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,l++}}findNodeMatch(e,t,o,i){let s=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(e,t,o))s=this.top.children.indexOf(l,this.index);else for(let a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let u=this.top.children[a];if(u.matchesNode(e,t,o)&&!this.preMatch.matched.has(u)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,o,i,s){let l=this.top.children[i];return l.dirty==rn&&l.dom==l.contentDOM&&(l.dirty=Yn),l.update(e,t,o,s)?(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 o=e.pmViewDesc;if(o){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==o)return i}return-1}e=t}}updateNextNode(e,t,o,i,s,l){for(let a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof zn){let u=this.preMatch.matched.get(c);if(u!=null&&u!=s)return!1;let d=c.dom,f,h=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=rn&&ri(t,c.outerDeco));if(!h&&c.update(e,t,o,i))return this.destroyBetween(this.index,a),c.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(c,e,t,o,i,l)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Yn,f.updateChildren(i,l+1),f.dirty=Wt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,o,i,s,l){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ri(o,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=zn.create(this.top,t,o,i,s,l);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,t,o,i,s){let l=zn.create(this.top,e,t,o,i,s);l.contentDOM&&l.updateChildren(i,s+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,t,o){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 s=new nd(this.top,e,t,o);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof ao;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ji)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Mt||bt)&&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 o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let i=new od(this.top,[],o,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 ry(n,e){let t=e,o=t.children.length,i=n.childCount,s=new Map,l=[];e:for(;i>0;){let a;for(;;)if(o){let u=t.children[o-1];if(u instanceof ao)t=u,o=u.children.length;else{a=u,o--;break}}else{if(t==e)break e;o=t.parent.children.indexOf(t),t=t.parent}let c=a.node;if(c){if(c!=n.child(i-1))break;--i,s.set(a,i),l.push(a)}}return{index:i,matched:s,matches:l.reverse()}}function iy(n,e){return n.type.side-e.type.side}function sy(n,e,t,o){let i=e.locals(n),s=0;if(i.length==0){for(let u=0;u<n.childCount;u++){let d=n.child(u);o(d,i,e.forChild(s,d),u),s+=d.nodeSize}return}let l=0,a=[],c=null;for(let u=0;;){let d,f;for(;l<i.length&&i[l].to==s;){let v=i[l++];v.widget&&(d?(f||(f=[d])).push(v):d=v)}if(d)if(f){f.sort(iy);for(let v=0;v<f.length;v++)t(f[v],u,!!c)}else t(d,u,!!c);let h,p;if(c)p=-1,h=c,c=null;else if(u<n.childCount)p=u,h=n.child(u++);else break;for(let v=0;v<a.length;v++)a[v].to<=s&&a.splice(v--,1);for(;l<i.length&&i[l].from<=s&&i[l].to>s;)a.push(i[l++]);let m=s+h.nodeSize;if(h.isText){let v=m;l<i.length&&i[l].from<v&&(v=i[l].from);for(let y=0;y<a.length;y++)a[y].to<v&&(v=a[y].to);v<m&&(c=h.cut(v-s),h=h.cut(0,v-s),m=v,p=-1)}else for(;l<i.length&&i[l].to<m;)l++;let g=h.isInline&&!h.isLeaf?a.filter(v=>!v.inline):a.slice();o(h,g,e.forChild(s,h),p),s=m}}function ly(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 ay(n,e,t,o){for(let i=0,s=0;i<n.childCount&&s<=o;){let l=n.child(i++),a=s;if(s+=l.nodeSize,!l.isText)continue;let c=l.text;for(;i<n.childCount;){let u=n.child(i++);if(s+=u.nodeSize,!u.isText)break;c+=u.text}if(s>=t){if(s>=o&&c.slice(o-e.length-a,o-a)==e)return o-e.length;let u=a<o?c.lastIndexOf(e,o-a-1):-1;if(u>=0&&u+e.length+a>=t)return a+u;if(t==o&&c.length>=o+e.length-a&&c.slice(o-a,o-a+e.length)==e)return o}}return-1}function Ys(n,e,t,o,i){let s=[];for(let l=0,a=0;l<n.length;l++){let c=n[l],u=a,d=a+=c.size;u>=t||d<=e?s.push(c):(u<e&&s.push(c.slice(0,e-u,o)),i&&(s.push(i),i=void 0),d>t&&s.push(c.slice(t-u,c.size,o)))}return s}function Nl(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,l=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(l<0)return null;let a=o.resolve(l),c,u;if(Gi(t)){for(c=l;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&Te.isSelectable(f)&&i.parent&&!(f.isInline&&Dv(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;u=new Te(l==h?a:o.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=l,h=l;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,l]=h==n.state.selection.anchor?[h,f]:[f,h],a=o.resolve(l)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let d=o.resolve(c);if(!u){let f=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;u=Bl(n,d,a,f)}return u}function ld(n){return n.editable?n.hasFocus():cd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function kn(n,e=!1){let t=n.state.selection;if(ad(n,t),!!ld(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&bt){let o=n.domSelectionRange(),i=n.domObserver.currentSelection;if(o.anchorNode&&i.anchorNode&&lo(o.anchorNode,o.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)uy(n);else{let{anchor:o,head:i}=t,s,l;ic&&!(t instanceof Oe)&&(t.$from.parent.inlineContent||(s=sc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(l=sc(n,t.to))),n.docView.setSelection(o,i,n,e),ic&&(s&&lc(s),l&&lc(l)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&cy(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ic=Mt||bt&&Gu<63;function sc(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),i=o<t.childNodes.length?t.childNodes[o]:null,s=o?t.childNodes[o-1]:null;if(Mt&&i&&i.contentEditable=="false")return ks(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return ks(i);if(s)return ks(s)}}function ks(n){return n.contentEditable="true",Mt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function lc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function cy(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!ld(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function uy(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,yt(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&Lt&&Rn<=11&&(t.disabled=!0,t.disabled=!1)}function ad(n,e){if(e instanceof Te){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ac(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ac(n)}function ac(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Bl(n,e,t,o){return n.someProp("createSelectionBetween",i=>i(n,e,t))||Oe.between(e,t,o)}function cc(n){return n.editable&&!n.hasFocus()?!1:cd(n)}function cd(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 dy(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return lo(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Xs(n,e){let{$anchor:t,$head:o}=n.selection,i=e>0?t.max(o):t.min(o),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Re.findFrom(s,e)}function Nn(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function uc(n,e,t){let o=n.state.selection;if(o instanceof Oe)if(t.indexOf("s")>-1){let{$head:i}=o,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let l=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Nn(n,new Oe(o.$anchor,l))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Xs(n.state,e);return i&&i instanceof Te?Nn(n,i):!1}else if(!(Ut&&t.indexOf("m")>-1)){let i=o.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,l;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(l=n.docView.descAt(a))&&!l.contentDOM?Te.isSelectable(s)?Nn(n,new Te(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Br?Nn(n,new Oe(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Te&&o.node.isInline)return Nn(n,new Oe(e>0?o.$to:o.$from));{let i=Xs(n.state,e);return i?Nn(n,i):!1}}}function ii(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function sr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function xo(n,e){return e<0?fy(n):hy(n)}function fy(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let i,s,l=!1;for(Yt&&t.nodeType==1&&o<ii(t)&&sr(t.childNodes[o],-1)&&(l=!0);;)if(o>0){if(t.nodeType!=1)break;{let a=t.childNodes[o-1];if(sr(a,-1))i=t,s=--o;else if(a.nodeType==3)t=a,o=t.nodeValue.length;else break}}else{if(ud(t))break;{let a=t.previousSibling;for(;a&&sr(a,-1);)i=t.parentNode,s=yt(a),a=a.previousSibling;if(a)t=a,o=ii(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}l?Zs(n,t,o):i&&Zs(n,i,s)}function hy(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let i=ii(t),s,l;for(;;)if(o<i){if(t.nodeType!=1)break;let a=t.childNodes[o];if(sr(a,1))s=t,l=++o;else break}else{if(ud(t))break;{let a=t.nextSibling;for(;a&&sr(a,1);)s=a.parentNode,l=yt(a)+1,a=a.nextSibling;if(a)t=a,o=0,i=ii(t);else{if(t=t.parentNode,t==n.dom)break;o=i=0}}}s&&Zs(n,s,l)}function ud(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function py(n,e){for(;n&&e==n.childNodes.length&&!Nr(n);)e=yt(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 my(n,e){for(;n&&!e&&!Nr(n);)e=yt(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 Zs(n,e,t){if(e.nodeType!=3){let s,l;(l=py(e,t))?(e=l,t=0):(s=my(e,t))&&(e=s,t=s.nodeValue.length)}let o=n.domSelection();if(!o)return;if(Gi(o)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),o.removeAllRanges(),o.addRange(s)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&kn(n)},50)}function dc(n,e){let t=n.state.doc.resolve(e);if(!(bt||Ju)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function fc(n,e,t){let o=n.state.selection;if(o instanceof Oe&&!o.empty||t.indexOf("s")>-1||Ut&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=o;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let l=Xs(n.state,e);if(l&&l instanceof Te)return Nn(n,l)}if(!i.parent.inlineContent){let l=e<0?i:s,a=o instanceof jt?Re.near(l,e):Re.findFrom(l,e);return a?Nn(n,a):!1}return!1}function hc(n,e){if(!(n.state.selection instanceof Oe))return!0;let{$head:t,$anchor:o,empty:i}=n.state.selection;if(!t.sameParent(o))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let l=n.state.tr;return e<0?l.delete(t.pos-s.nodeSize,t.pos):l.delete(t.pos,t.pos+s.nodeSize),n.dispatch(l),!0}return!1}function pc(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function gy(n){if(!Mt||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 o=e.firstChild;pc(n,o,"true"),setTimeout(()=>pc(n,o,"false"),20)}return!1}function vy(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function yy(n,e){let t=e.keyCode,o=vy(e);if(t==8||Ut&&t==72&&o=="c")return hc(n,-1)||xo(n,-1);if(t==46&&!e.shiftKey||Ut&&t==68&&o=="c")return hc(n,1)||xo(n,1);if(t==13||t==27)return!0;if(t==37||Ut&&t==66&&o=="c"){let i=t==37?dc(n,n.state.selection.from)=="ltr"?-1:1:-1;return uc(n,i,o)||xo(n,i)}else if(t==39||Ut&&t==70&&o=="c"){let i=t==39?dc(n,n.state.selection.from)=="ltr"?1:-1:1;return uc(n,i,o)||xo(n,i)}else{if(t==38||Ut&&t==80&&o=="c")return fc(n,-1,o)||xo(n,-1);if(t==40||Ut&&t==78&&o=="c")return gy(n)||fc(n,1,o)||xo(n,1);if(o==(Ut?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Al(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:o,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&o.childCount==1&&o.firstChild.childCount==1;){i--,s--;let p=o.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),o=p.content}let l=n.someProp("clipboardSerializer")||fo.fromSchema(n.state.schema),a=gd(),c=a.createElement("div");c.appendChild(l.serializeFragment(o,{document:a}));let u=c.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=md[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=a.createElement(d[p]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}u=c.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
|
|
11
|
+
|
|
12
|
+
`);return{dom:c,text:h,slice:e}}function dd(n,e,t,o,i){let s=i.parent.type.spec.code,l,a;if(!t&&!e)return null;let c=!!e&&(o||s||!t);if(c){if(n.someProp("transformPastedText",h=>{e=h(e,s||o,n)}),s)return a=new pe(G.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
13
|
+
`))),0,0),n.someProp("transformPasted",h=>{a=h(a,n,!0)}),a;let f=n.someProp("clipboardTextParser",h=>h(e,i,o,n));if(f)a=f;else{let h=i.marks(),{schema:p}=n.state,m=fo.fromSchema(p);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let v=l.appendChild(document.createElement("p"));g&&v.appendChild(m.serializeNode(p.text(g,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),l=wy(t),Br&&Cy(l);let u=l&&l.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let h=l.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;l=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||Vn.fromSchema(n.state.schema)).parseSlice(l,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!ky.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=Ey(mc(a,+d[1],+d[2]),d[4]);else if(a=pe.maxOpen(by(a.content,i),!0),a.openStart||a.openEnd){let f=0,h=0;for(let p=a.content.firstChild;f<a.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=mc(a,f,h)}return n.someProp("transformPasted",f=>{a=f(a,n,c)}),a}const ky=/^(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 by(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)),s,l=[];if(n.forEach(a=>{if(!l)return;let c=i.findWrapping(a.type),u;if(!c)return l=null;if(u=l.length&&s.length&&hd(c,s,a,l[l.length-1],0))l[l.length-1]=u;else{l.length&&(l[l.length-1]=pd(l[l.length-1],s.length));let d=fd(a,c);l.push(d),i=i.matchType(d.type),s=c}}),l)return G.from(l)}return n}function fd(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,G.from(n));return n}function hd(n,e,t,o,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=hd(n,e,t,o.lastChild,i+1);if(s)return o.copy(o.content.replaceChild(o.childCount-1,s));if(o.contentMatchAt(o.childCount).matchType(i==n.length-1?t.type:n[i+1]))return o.copy(o.content.append(G.from(fd(t,n,i+1))))}}function pd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,pd(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(G.empty,!0);return n.copy(t.append(o))}function Qs(n,e,t,o,i,s){let l=e<0?n.firstChild:n.lastChild,a=l.content;return n.childCount>1&&(s=0),i<o-1&&(a=Qs(a,e,t,o,i+1,s)),i>=t&&(a=e<0?l.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(G.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,l.copy(a))}function mc(n,e,t){return e<n.openStart&&(n=new pe(Qs(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new pe(Qs(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const md={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 gc=null;function gd(){return gc||(gc=document.implementation.createHTMLDocument("title"))}let bs=null;function xy(n){let e=window.trustedTypes;return e?(bs||(bs=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),bs.createHTML(n)):n}function wy(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=gd().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),i;if((i=o&&md[o[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=xy(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Cy(n){let e=n.querySelectorAll(bt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function Ey(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:i,openStart:s,openEnd:l}=n;for(let a=o.length-2;a>=0;a-=2){let c=t.nodes[o[a]];if(!c||c.hasRequiredAttrs())break;i=G.from(c.create(o[a+1],i)),s++,l++}return new pe(i,s,l)}const At={},$t={},Sy={touchstart:!0,touchmove:!0};class My{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 Ty(n){for(let e in At){let t=At[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{By(n,o)&&!$l(n,o)&&(n.editable||!(o.type in $t))&&t(n,o)},Sy[e]?{passive:!0}:void 0)}Mt&&n.dom.addEventListener("input",()=>null),el(n)}function Dn(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Ny(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 el(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>$l(n,o))})}function $l(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function By(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 Ay(n,e){!$l(n,e)&&At[e.type]&&(n.editable||!(e.type in $t))&&At[e.type](n,e)}$t.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!yd(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(yn&&bt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Io&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",i=>i(n,Jn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||yy(n,t)?t.preventDefault():Dn(n,"key")};$t.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};$t.keypress=(n,e)=>{let t=e;if(yd(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ut&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof Oe)||!o.$from.sameParent(o.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",l=>l(n,o.$from.pos,o.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function Yi(n){return{left:n.clientX,top:n.clientY}}function $y(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function Ol(n,e,t,o,i){if(o==-1)return!1;let s=n.state.doc.resolve(o);for(let l=s.depth+1;l>0;l--)if(n.someProp(e,a=>l>s.depth?a(n,t,s.nodeAfter,s.before(l),i,!0):a(n,t,s.node(l),s.before(l),i,!1)))return!0;return!1}function No(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function Oy(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Te.isSelectable(o)?(No(n,new Te(t)),!0):!1}function Iy(n,e){if(e==-1)return!1;let t=n.state.selection,o,i;t instanceof Te&&(o=t.node);let s=n.state.doc.resolve(e);for(let l=s.depth+1;l>0;l--){let a=l>s.depth?s.nodeAfter:s.node(l);if(Te.isSelectable(a)){o&&t.$from.depth>0&&l>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(l);break}}return i!=null?(No(n,Te.create(n.state.doc,i)),!0):!1}function Ly(n,e,t,o,i){return Ol(n,"handleClickOn",e,t,o)||n.someProp("handleClick",s=>s(n,e,o))||(i?Iy(n,t):Oy(n,t))}function Dy(n,e,t,o){return Ol(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",i=>i(n,e,o))}function Vy(n,e,t,o){return Ol(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",i=>i(n,e,o))||Ry(n,t,o)}function Ry(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(No(n,Oe.create(o,0,o.content.size)),!0):!1;let i=o.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(l.inlineContent)No(n,Oe.create(o,a+1,a+1+l.content.size));else if(Te.isSelectable(l))No(n,Te.create(o,a));else continue;return!0}}function Il(n){return si(n)}const vd=Ut?"metaKey":"ctrlKey";At.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=Il(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&$y(t,n.input.lastClick)&&!t[vd]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let l=n.posAtCoords(Yi(t));l&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new zy(n,l,t,!!o)):(s=="doubleClick"?Dy:Vy)(n,l.pos,l.inside,t)?t.preventDefault():Dn(n,"pointer"))};class zy{constructor(e,t,o,i){this.view=e,this.pos=t,this.event=o,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[vd],this.allowDefault=o.shiftKey;let s,l;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),l=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,l=d.depth?d.before():0}const a=i?null:o.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:u}=e.state;(o.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof Te&&u.from<=l&&u.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Yt&&!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)),Dn(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(()=>kn(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(Yi(e))),this.updateAllowDefault(e),this.allowDefault||!t?Dn(this.view,"pointer"):Ly(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Mt&&this.mightDrag&&!this.mightDrag.node.isAtom||bt&&!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)?(No(this.view,Re.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Dn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Dn(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)}}At.touchstart=n=>{n.input.lastTouch=Date.now(),Il(n),Dn(n,"pointer")};At.touchmove=n=>{n.input.lastTouch=Date.now(),Dn(n,"pointer")};At.contextmenu=n=>Il(n);function yd(n,e){return n.composing?!0:Mt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Py=yn?5e3:-1;$t.compositionstart=$t.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||bt&&Ju&&Hy(n)))n.markCursor=n.state.storedMarks||t.marks(),si(n,!0),n.markCursor=null;else if(si(n,!e.selection.empty),Yt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let i=o.focusNode,s=o.focusOffset;i&&i.nodeType==1&&s!=0;){let l=s<0?i.lastChild:i.childNodes[s-1];if(!l)break;if(l.nodeType==3){let a=n.domSelection();a&&a.collapse(l,l.nodeValue.length);break}else i=l,s=-1}}n.input.composing=!0}kd(n,Py)};function Hy(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let o=e.childNodes[t];return o.nodeType==1&&o.contentEditable=="false"}$t.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++,kd(n,20))};function kd(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>si(n),e))}function bd(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Fy());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function _y(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Iv(e.focusNode,e.focusOffset),o=Lv(e.focusNode,e.focusOffset);if(t&&o&&t!=o){let i=o.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||o==s)return s;if(!i||!i.isText(o.nodeValue))return o;if(n.input.compositionNode==o){let l=t.pmViewDesc;if(!(!l||!l.isText(t.nodeValue)))return o}}return t||o}function Fy(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function si(n,e=!1){if(!(yn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),bd(n),e||n.docView&&n.docView.dirty){let t=Nl(n),o=n.state.selection;return t&&!t.eq(o)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Uy(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 o=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const kr=Lt&&Rn<15||Io&&zv<604;At.copy=$t.cut=(n,e)=>{let t=e,o=n.state.selection,i=t.type=="cut";if(o.empty)return;let s=kr?null:t.clipboardData,l=o.content(),{dom:a,text:c}=Al(n,l);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",c)):Uy(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function qy(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function jy(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?br(n,o.value,null,i,e):br(n,o.textContent,o.innerHTML,i,e)},50)}function br(n,e,t,o,i){let s=dd(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,i,s||pe.empty)))return!0;if(!s)return!1;let l=qy(s),a=l?n.state.tr.replaceSelectionWith(l,o):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function xd(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," "):""}$t.paste=(n,e)=>{let t=e;if(n.composing&&!yn)return;let o=kr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&br(n,xd(o),o.getData("text/html"),i,t)?t.preventDefault():jy(n,t)};class wd{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const Wy=Ut?"altKey":"ctrlKey";function Cd(n,e){let t=n.someProp("dragCopies",o=>!o(e));return t??!e[Wy]}At.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Yi(t)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Te?i.to-1:i.to))){if(o&&o.mightDrag)l=Te.create(n.state.doc,o.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&&(l=Te.create(n.state.doc,f.posBefore))}}let a=(l||n.state.selection).content(),{dom:c,text:u,slice:d}=Al(n,a);(!t.dataTransfer.files.length||!bt||Gu>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(kr?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",kr||t.dataTransfer.setData("text/plain",u),n.dragging=new wd(d,Cd(n,t),l)};At.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};$t.dragover=$t.dragenter=(n,e)=>e.preventDefault();$t.drop=(n,e)=>{try{Ky(n,e,n.dragging)}finally{n.dragging=null}};function Ky(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(Yi(e));if(!o)return;let i=n.state.doc.resolve(o.pos),s=t&&t.slice;s?n.someProp("transformPasted",p=>{s=p(s,n,!1)}):s=dd(n,xd(e.dataTransfer),kr?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(t&&Cd(n,e));if(n.someProp("handleDrop",p=>p(n,e,s||pe.empty,l))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?Iu(n.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=n.state.tr;if(l){let{node:p}=t;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&Te.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Te(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,v,y)=>p=y),c.setSelection(Bl(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}At.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())&&kn(n)},20))};At.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)};At.beforeinput=(n,e)=>{if(bt&&yn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:o}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=o||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Jn(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 $t)At[n]=$t[n];function xr(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 li{constructor(e,t){this.toDOM=e,this.spec=t||no,this.side=this.spec.side||0}map(e,t,o,i){let{pos:s,deleted:l}=e.mapResult(t.from+i,this.side<0?-1:1);return l?null:new Bt(s-o,s-o,this)}valid(){return!0}eq(e){return this==e||e instanceof li&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&xr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Pn{constructor(e,t){this.attrs=e,this.spec=t||no}map(e,t,o,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-o,l=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-o;return s>=l?null:new Bt(s,l,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Pn&&xr(this.attrs,e.attrs)&&xr(this.spec,e.spec)}static is(e){return e.type instanceof Pn}destroy(){}}class Ll{constructor(e,t){this.attrs=e,this.spec=t||no}map(e,t,o,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let l=e.mapResult(t.to+i,-1);return l.deleted||l.pos<=s.pos?null:new Bt(s.pos-o,l.pos-o,this)}valid(e,t){let{index:o,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(o)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Ll&&xr(this.attrs,e.attrs)&&xr(this.spec,e.spec)}destroy(){}}class Bt{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new Bt(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,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new Bt(e,e,new li(t,o))}static inline(e,t,o,i){return new Bt(e,t,new Pn(o,i))}static node(e,t,o,i){return new Bt(e,t,new Ll(o,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Pn}get widget(){return this.type instanceof li}}const Co=[],no={};class nt{constructor(e,t){this.local=e.length?e:Co,this.children=t.length?t:Co}static create(e,t){return t.length?ai(t,e,0,no):St}find(e,t,o){let i=[];return this.findInner(e??0,t??1e9,i,0,o),i}findInner(e,t,o,i,s){for(let l=0;l<this.local.length;l++){let a=this.local[l];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&o.push(a.copy(a.from+i,a.to+i))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<t&&this.children[l+1]>e){let a=this.children[l]+1;this.children[l+2].findInner(e-a,t-a,o,i+a,s)}}map(e,t,o){return this==St||e.maps.length==0?this:this.mapInner(e,t,0,0,o||no)}mapInner(e,t,o,i,s){let l;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,o,i);c&&c.type.valid(t,c)?(l||(l=[])).push(c):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?Gy(this.children,l||[],e,t,o,i,s):l?new nt(l.sort(oo),Co):St}add(e,t){return t.length?this==St?nt.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let i,s=0;e.forEach((a,c)=>{let u=c+o,d;if(d=Sd(t,a,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(a,d,u+1):i.splice(s,0,c,c+a.nodeSize,ai(d,a,u+1,no)),s+=3}});let l=Ed(s?Md(t):t,-o);for(let a=0;a<l.length;a++)l[a].type.valid(e,l[a])||l.splice(a--,1);return new nt(l.length?this.local.concat(l).sort(oo):this.local,i||this.children)}remove(e){return e.length==0||this==St?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,i=this.local;for(let s=0;s<o.length;s+=3){let l,a=o[s]+t,c=o[s+1]+t;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>a&&f.to<c&&(e[d]=null,(l||(l=[])).push(f));if(!l)continue;o==this.children&&(o=this.children.slice());let u=o[s+2].removeInner(l,a+1);u!=St?o[s+2]=u:(o.splice(s,3),s-=3)}if(i.length){for(let s=0,l;s<e.length;s++)if(l=e[s])for(let a=0;a<i.length;a++)i[a].eq(l,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return o==this.children&&i==this.local?this:i.length||o.length?new nt(i,o):St}forChild(e,t){if(this==St)return this;if(t.isLeaf)return nt.empty;let o,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(o=this.children[a+2]);break}let s=e+1,l=s+t.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<l&&c.to>s&&c.type instanceof Pn){let u=Math.max(s,c.from)-s,d=Math.min(l,c.to)-s;u<d&&(i||(i=[])).push(c.copy(u,d))}}if(i){let a=new nt(i.sort(oo),Co);return o?new $n([a,o]):a}return o||St}eq(e){if(this==e)return!0;if(!(e instanceof nt)||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 Dl(this.localsInner(e))}localsInner(e){if(this==St)return Co;if(e.inlineContent||!this.local.some(Pn.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Pn||t.push(this.local[o]);return t}forEachSet(e){e(this)}}nt.empty=new nt([],[]);nt.removeOverlap=Dl;const St=nt.empty;class $n{constructor(e){this.members=e}map(e,t){const o=this.members.map(i=>i.map(e,t,no));return $n.from(o)}forChild(e,t){if(t.isLeaf)return nt.empty;let o=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=St&&(s instanceof $n?o=o.concat(s.members):o.push(s))}return $n.from(o)}eq(e){if(!(e instanceof $n)||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,o=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{o&&(t=t.slice(),o=!1);for(let l=0;l<s.length;l++)t.push(s[l])}}return t?Dl(o?t:t.sort(oo)):Co}static from(e){switch(e.length){case 0:return St;case 1:return e[0];default:return new $n(e.every(t=>t instanceof nt)?e:e.reduce((t,o)=>t.concat(o instanceof nt?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Gy(n,e,t,o,i,s,l){let a=n.slice();for(let u=0,d=s;u<t.maps.length;u++){let f=0;t.maps[u].forEach((h,p,m,g)=>{let v=g-m-(p-h);for(let y=0;y<a.length;y+=3){let b=a[y+1];if(b<0||h>b+d-f)continue;let C=a[y]+d-f;p>=C?a[y+1]=h<=C?-2:-1:h>=d&&v&&(a[y]+=v,a[y+1]+=v)}f+=v}),d=t.maps[u].map(d,-1)}let c=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){c=!0,a[u+1]=-1;continue}let d=t.map(n[u]+s),f=d-i;if(f<0||f>=o.content.size){c=!0;continue}let h=t.map(n[u+1]+s,-1),p=h-i,{index:m,offset:g}=o.content.findIndex(f),v=o.maybeChild(m);if(v&&g==f&&g+v.nodeSize==p){let y=a[u+2].mapInner(t,v,d+1,n[u]+s+1,l);y!=St?(a[u]=f,a[u+1]=p,a[u+2]=y):(a[u+1]=-2,c=!0)}else c=!0}if(c){let u=Jy(a,n,e,t,i,s,l),d=ai(u,o,0,l);e=d.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,h=0;f<d.children.length;f+=3){let p=d.children[f];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,d.children[f],d.children[f+1],d.children[f+2])}}return new nt(e.sort(oo),a)}function Ed(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let i=n[o];t.push(new Bt(i.from+e,i.to+e,i.type))}return t}function Jy(n,e,t,o,i,s,l){function a(c,u){for(let d=0;d<c.local.length;d++){let f=c.local[d].map(o,i,u);f?t.push(f):l.onRemove&&l.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)a(c.children[d+2],c.children[d]+u+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&a(n[c+2],e[c]+s+1);return t}function Sd(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,i=null;for(let s=0,l;s<n.length;s++)(l=n[s])&&l.from>t&&l.to<o&&((i||(i=[])).push(l),n[s]=null);return i}function Md(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ai(n,e,t,o){let i=[],s=!1;e.forEach((a,c)=>{let u=Sd(n,a,c+t);if(u){s=!0;let d=ai(u,a,t+c+1,o);d!=St&&i.push(c,c+a.nodeSize,d)}});let l=Ed(s?Md(n):n,-t).sort(oo);for(let a=0;a<l.length;a++)l[a].type.valid(e,l[a])||(o.onRemove&&o.onRemove(l[a].spec),l.splice(a--,1));return l.length||i.length?new nt(l,i):St}function oo(n,e){return n.from-e.from||n.to-e.to}function Dl(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==o.from){s.to!=o.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,o.to),vc(e,i+1,s.copy(o.to,s.to)));continue}else{s.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,s.from),vc(e,i,o.copy(s.from,o.to)));break}}}return e}function vc(n,e,t){for(;e<n.length&&oo(t,n[e])>0;)e++;n.splice(e,0,t)}function xs(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=St&&e.push(o)}),n.cursorWrapper&&e.push(nt.create(n.state.doc,[n.cursorWrapper.deco])),$n.from(e)}const Yy={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Xy=Lt&&Rn<=11;class Zy{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 Qy{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Zy,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let i=0;i<o.length;i++)this.queue.push(o[i]);Lt&&Rn<=11&&o.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Mt&&e.composing&&o.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Xy&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.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,Yy)),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(cc(this.view)){if(this.suppressingSelectionUpdates)return kn(this.view);if(Lt&&Rn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&lo(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,o;for(let s=e.focusNode;s;s=Oo(s))t.add(s);for(let s=e.anchorNode;s;s=Oo(s))if(t.has(s)){o=s;break}let i=o&&this.view.docView.nearestDesc(o);if(i&&i.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))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 o=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&cc(e)&&!this.ignoreSelectionChange(o),s=-1,l=-1,a=!1,c=[];if(e.editable)for(let d=0;d<t.length;d++){let f=this.registerMutation(t[d],c);f&&(s=s<0?f.from:Math.min(f.from,s),l=l<0?f.to:Math.max(f.to,l),f.typeOver&&(a=!0))}if(c.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of c)if(d.nodeName=="BR"&&d.parentNode){let f=d.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&d.parentNode.removeChild(d)}}else if(Yt&&c.length){let d=c.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,h]=d;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of d){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||n0(e,f)!=p)&&h.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Gi(o)&&(u=Nl(e))&&u.eq(Re.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,kn(e),this.currentSelection.set(o),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,l),e0(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,o0(e,c)),this.handleDOMChange(s,l,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||kn(e),this.currentSelection.set(o))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Lt&&Rn<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:h}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let l=i&&i.parentNode==e.target?yt(i)+1:0,a=o.localPosFromDOM(e.target,l,-1),c=s&&s.parentNode==e.target?yt(s):e.target.childNodes.length,u=o.localPosFromDOM(e.target,c,1);return{from:a,to:u}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let yc=new WeakMap,kc=!1;function e0(n){if(!yc.has(n)&&(yc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Yt,kc)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."),kc=!0}}function bc(n,e){let t=e.startContainer,o=e.startOffset,i=e.endContainer,s=e.endOffset,l=n.domAtPos(n.state.selection.anchor);return lo(l.node,l.offset,i,s)&&([t,o,i,s]=[i,s,t,o]),{anchorNode:t,anchorOffset:o,focusNode:i,focusOffset:s}}function t0(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return bc(n,i)}let t;function o(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",o,!0),t?bc(n,t):null}function n0(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let o=n.docView.nearestDesc(t,!0);if(o&&o.node.isBlock)return t}return null}function o0(n,e){var t;let{focusNode:o,focusOffset:i}=n.domSelectionRange();for(let s of e)if(((t=s.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let l=s.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let a=l;for(;;){let c=a.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;a=c}a.insertBefore(s,a.firstChild),o==s&&n.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function r0(n,e,t){let{node:o,fromOffset:i,toOffset:s,from:l,to:a}=n.docView.parseRange(e,t),c=n.domSelectionRange(),u,d=c.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],Gi(c)||u.push({node:c.focusNode,offset:c.focusOffset})),bt&&n.input.lastKeyCode===8)for(let v=s;v>i;v--){let y=o.childNodes[v-1],b=y.pmViewDesc;if(y.nodeName=="BR"&&!b){s=v;break}if(!b||b.size)break}let f=n.state.doc,h=n.someProp("domParser")||Vn.fromSchema(n.state.schema),p=f.resolve(l),m=null,g=h.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:i0,context:p});if(u&&u[0].pos!=null){let v=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=v),m={anchor:v+l,head:y+l}}return{doc:g,sel:m,from:l,to:a}}function i0(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Mt&&/^(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||Mt&&/^(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 s0=/^(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 l0(n,e,t,o,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,L=Nl(n,M);if(L&&!n.state.selection.eq(L)){if(bt&&yn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",X=>X(n,Jn(13,"Enter"))))return;let R=n.state.tr.setSelection(L);M=="pointer"?R.setMeta("pointer",!0):M=="key"&&R.scrollIntoView(),s&&R.setMeta("composition",s),n.dispatch(R)}return}let l=n.state.doc.resolve(e),a=l.sharedDepth(t);e=l.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,u=r0(n,e,t),d=n.state.doc,f=d.slice(u.from,u.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=u0(f.content,u.doc.content,u.from,h,p);if(m&&n.input.domChangeCount++,(Io&&n.input.lastIOSEnter>Date.now()-225||yn)&&i.some(M=>M.nodeType==1&&!s0.test(M.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",M=>M(n,Jn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof Oe&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let M=xc(n,n.state.doc,u.sel);if(M&&!M.eq(n.state.selection)){let L=n.state.tr.setSelection(M);s&&L.setMeta("composition",s),n.dispatch(L)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof Oe&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),Lt&&Rn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),v=u.doc.resolveNoCache(m.endB-u.from),y=d.resolve(m.start),b=g.sameParent(v)&&g.parent.inlineContent&&y.end()>=m.endA;if((Io&&n.input.lastIOSEnter>Date.now()-225&&(!b||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!b&&g.pos<u.doc.content.size&&(!g.sameParent(v)||!g.parent.inlineContent)&&g.pos<v.pos&&!/\S/.test(u.doc.textBetween(g.pos,v.pos,"","")))&&n.someProp("handleKeyDown",M=>M(n,Jn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&c0(d,m.start,m.endA,g,v)&&n.someProp("handleKeyDown",M=>M(n,Jn(8,"Backspace")))){yn&&bt&&n.domObserver.suppressSelectionUpdates();return}bt&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),yn&&!b&&g.start()!=v.start()&&v.parentOffset==0&&g.depth==v.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,v=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,Jn(13,"Enter"))})},20));let C=m.start,k=m.endA,x=M=>{let L=M||n.state.tr.replace(C,k,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let R=xc(n,L.doc,u.sel);R&&!(bt&&n.composing&&R.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(R.head==C||R.head==L.mapping.map(k)-1)||Lt&&R.empty&&R.head==C)&&L.setSelection(R)}return s&&L.setMeta("composition",s),L.scrollIntoView()},S;if(b)if(g.pos==v.pos){Lt&&Rn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>kn(n),20));let M=x(n.state.tr.delete(C,k)),L=d.resolve(m.start).marksAcross(d.resolve(m.endA));L&&M.ensureMarks(L),n.dispatch(M)}else if(m.endA==m.endB&&(S=a0(g.parent.content.cut(g.parentOffset,v.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start())))){let M=x(n.state.tr);S.type=="add"?M.addMark(C,k,S.mark):M.removeMark(C,k,S.mark),n.dispatch(M)}else if(g.parent.child(g.index()).isText&&g.index()==v.index()-(v.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,v.parentOffset),L=()=>x(n.state.tr.insertText(M,C,k));n.someProp("handleTextInput",R=>R(n,C,k,M,L))||n.dispatch(L())}else n.dispatch(x());else n.dispatch(x())}function xc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Bl(n,e.resolve(t.anchor),e.resolve(t.head))}function a0(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,i=t,s=o,l,a,c;for(let d=0;d<o.length;d++)i=o[d].removeFromSet(i);for(let d=0;d<t.length;d++)s=t[d].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],l="add",c=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&s.length==1)a=s[0],l="remove",c=d=>d.mark(a.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(c(e.child(d)));if(G.from(u).eq(n))return{mark:a,type:l}}function c0(n,e,t,o,i){if(t-e<=i.pos-o.pos||ws(o,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!o.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=n.resolve(ws(s,!0,!0));return!l.parent.isTextblock||l.pos>t||ws(l,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(l.parent.content)}function ws(n,e,t){let o=n.depth,i=e?n.end():n.pos;for(;o>0&&(e||n.indexAfter(o)==n.node(o).childCount);)o--,i++,e=!1;if(t){let s=n.node(o).maybeChild(n.indexAfter(o));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function u0(n,e,t,o,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:l,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let c=Math.max(0,s-Math.min(l,a));o-=l+c-s}if(l<s&&n.size<e.size){let c=o<=s&&o>=l?s-o:0;s-=c,s&&s<e.size&&wc(e.textBetween(s-1,s+1))&&(s+=c?1:-1),a=s+(a-l),l=s}else if(a<s){let c=o<=s&&o>=a?s-o:0;s-=c,s&&s<n.size&&wc(n.textBetween(s-1,s+1))&&(s+=c?1:-1),l=s+(l-a),a=s}return{start:s,endA:l,endB:a}}function wc(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 Td{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 My,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Tc),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=Sc(this),Ec(this),this.nodeViews=Mc(this),this.docView=oc(this.state.doc,Cc(this),xs(this),this.dom,this),this.domObserver=new Qy(this,(o,i,s,l)=>l0(this,o,i,s,l)),this.domObserver.start(),Ty(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&&el(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Tc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let o in this._props)t[o]=this._props[o];t.state=this.state;for(let o in e)t[o]=e[o];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var o;let i=this.state,s=!1,l=!1;e.storedMarks&&this.composing&&(bd(this),l=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=Mc(this);f0(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&el(this),this.editable=Sc(this),Ec(this);let c=xs(this),u=Cc(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,u,c);(f||!e.selection.eq(i.selection))&&(l=!0);let h=d=="preserve"&&l&&this.dom.style.overflowAnchor==null&&_v(this);if(l){this.domObserver.stop();let p=f&&(Lt||bt)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&d0(i.selection,e.selection);if(f){let m=bt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_y(this)),(s||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=oc(e.doc,u,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&dy(this))?kn(this,p):(ad(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((o=this.dragging)===null||o===void 0)&&o.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&Fv(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 Te){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Xa(this,t.getBoundingClientRect(),e)}else Xa(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 o=this.directPlugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let o=this.state.plugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let o=this.pluginViews[t];o.update&&o.update(this,e)}}updateDraggedNode(e,t){let o=e.node,i=-1;if(this.state.doc.nodeAt(o.from)==o.node)i=o.from;else{let s=o.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==o.node&&(i=s)}this.dragging=new wd(e.slice,e.move,i<0?void 0:Te.create(this.state.doc,i))}someProp(e,t){let o=this._props&&this._props[e],i;if(o!=null&&(i=t?t(o):o))return i;for(let l=0;l<this.directPlugins.length;l++){let a=this.directPlugins[l].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let l=0;l<s.length;l++){let a=s[l].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(Lt){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&&Uv(this.dom),kn(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 Gv(this,e)}coordsAtPos(e,t=1){return ed(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,o=-1){let i=this.docView.posFromDOM(e,t,o);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Qv(this,t||this.state,e)}pasteHTML(e,t){return br(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return br(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Al(this,e)}destroy(){this.docView&&(Ny(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],xs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,$v())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Ay(this,e)}domSelectionRange(){let e=this.domSelection();return e?Mt&&this.root.nodeType===11&&Vv(this.dom.ownerDocument)==this.dom&&t0(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Td.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Cc(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 o in t)o=="class"?e.class+=" "+t[o]:o=="style"?e.style=(e.style?e.style+";":"")+t[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(t[o]))}),e.translate||(e.translate="no"),[Bt.node(0,n.state.doc.content.size,e)]}function Ec(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:Bt.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Sc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function d0(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 Mc(n){let e=Object.create(null);function t(o){for(let i in o)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=o[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function f0(n,e){let t=0,o=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)o++;return t!=o}function Tc(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 Hn={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:"'"},ci={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},h0=typeof navigator<"u"&&/Mac/.test(navigator.platform),p0=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var kt=0;kt<10;kt++)Hn[48+kt]=Hn[96+kt]=String(kt);for(var kt=1;kt<=24;kt++)Hn[kt+111]="F"+kt;for(var kt=65;kt<=90;kt++)Hn[kt]=String.fromCharCode(kt+32),ci[kt]=String.fromCharCode(kt);for(var Cs in Hn)ci.hasOwnProperty(Cs)||(ci[Cs]=Hn[Cs]);function m0(n){var e=h0&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||p0&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ci:Hn)[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 g0=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),v0=typeof navigator<"u"&&/Win/.test(navigator.platform);function y0(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,i,s,l;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))g0?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(t="Alt-"+t),i&&(t="Ctrl-"+t),l&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function k0(n){let e=Object.create(null);for(let t in n)e[y0(t)]=n[t];return e}function Es(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 b0(n){return new ot({props:{handleKeyDown:Nd(n)}})}function Nd(n){let e=k0(n);return function(t,o){let i=m0(o),s,l=e[Es(i,o)];if(l&&l(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(o.shiftKey){let a=e[Es(i,o,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(v0&&o.ctrlKey&&o.altKey)&&(s=Hn[o.keyCode])&&s!=i){let a=e[Es(s,o)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var x0=Object.defineProperty,Vl=(n,e)=>{for(var t in e)x0(n,t,{get:e[t],enumerable:!0})};function Xi(n){const{state:e,transaction:t}=n;let{selection:o}=t,{doc:i}=t,{storedMarks:s}=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 s},get selection(){return o},get doc(){return i},get tr(){return o=t.selection,i=t.doc,s=t.storedMarks,t}}}var Zi=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:o}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...u)=>{const d=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:o,state:i}=this,{view:s}=o,l=[],a=!!n,c=n||i.tr,u=()=>(!a&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(t).map(([f,h])=>[f,(...m)=>{const g=this.buildProps(c,e),v=h(...m)(g);return l.push(v),d}])),run:u};return d}createCan(n){const{rawCommands:e,state:t}=this,o=!1,i=n||t.tr,s=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(e).map(([a,c])=>[a,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}buildProps(n,e=!0){const{rawCommands:t,editor:o,state:i}=this,{view:s}=o,l={tr:n,editor:o,view:s,state:Xi({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(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}},Bd={};Vl(Bd,{blur:()=>w0,clearContent:()=>C0,clearNodes:()=>E0,command:()=>S0,createParagraphNear:()=>M0,cut:()=>T0,deleteCurrentNode:()=>N0,deleteNode:()=>B0,deleteRange:()=>A0,deleteSelection:()=>$0,enter:()=>O0,exitCode:()=>I0,extendMarkRange:()=>L0,first:()=>D0,focus:()=>R0,forEach:()=>z0,insertContent:()=>P0,insertContentAt:()=>F0,joinBackward:()=>j0,joinDown:()=>q0,joinForward:()=>W0,joinItemBackward:()=>K0,joinItemForward:()=>G0,joinTextblockBackward:()=>J0,joinTextblockForward:()=>Y0,joinUp:()=>U0,keyboardShortcut:()=>Z0,lift:()=>Q0,liftEmptyBlock:()=>ek,liftListItem:()=>tk,newlineInCode:()=>nk,resetAttributes:()=>ok,scrollIntoView:()=>rk,selectAll:()=>ik,selectNodeBackward:()=>sk,selectNodeForward:()=>lk,selectParentNode:()=>ak,selectTextblockEnd:()=>ck,selectTextblockStart:()=>uk,setContent:()=>dk,setMark:()=>$k,setMeta:()=>Ok,setNode:()=>Ik,setNodeSelection:()=>Lk,setTextDirection:()=>Dk,setTextSelection:()=>Vk,sinkListItem:()=>Rk,splitBlock:()=>zk,splitListItem:()=>Pk,toggleList:()=>Hk,toggleMark:()=>_k,toggleNode:()=>Fk,toggleWrap:()=>Uk,undoInputRule:()=>qk,unsetAllMarks:()=>jk,unsetMark:()=>Wk,unsetTextDirection:()=>Kk,updateAttributes:()=>Gk,wrapIn:()=>Jk,wrapInList:()=>Yk});var w0=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),C0=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),E0=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:i}=o;return t&&i.forEach(({$from:s,$to:l})=>{n.doc.nodesBetween(s.pos,l.pos,(a,c)=>{if(a.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(c)),h=u.resolve(d.map(c+a.nodeSize)),p=f.blockRange(h);if(!p)return;const m=Po(p);if(a.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},S0=n=>e=>n(e),M0=()=>({state:n,dispatch:e})=>vv(n,e),T0=(n,e)=>({editor:t,tr:o})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);o.deleteRange(n.from,n.to);const l=o.mapping.map(e);return o.insert(l,s.content),o.setSelection(new Oe(o.doc.resolve(Math.max(l-1,0)))),!0},N0=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,o=t.$anchor.node();if(o.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o.type){if(e){const a=i.before(s),c=i.after(s);n.delete(a,c).scrollIntoView()}return!0}return!1};function ut(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 B0=n=>({tr:e,state:t,dispatch:o})=>{const i=ut(n,t.schema),s=e.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===i){if(o){const c=s.before(l),u=s.after(l);e.delete(c,u).scrollIntoView()}return!0}return!1},A0=n=>({tr:e,dispatch:t})=>{const{from:o,to:i}=n;return t&&e.delete(o,i),!0},$0=()=>({state:n,dispatch:e})=>iv(n,e),O0=()=>({commands:n})=>n.keyboardShortcut("Enter"),I0=()=>({state:n,dispatch:e})=>gv(n,e);function Rl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function ui(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(i=>t.strict?e[i]===n[i]:Rl(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function Ad(n,e,t={}){return n.find(o=>o.type===e&&ui(Object.fromEntries(Object.keys(t).map(i=>[i,o.attrs[i]])),t))}function Nc(n,e,t={}){return!!Ad(n,e,t)}function zl(n,e,t){var o;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(t=t||((o=i.node.marks[0])==null?void 0:o.attrs),!Ad([...i.node.marks],e,t)))return;let l=i.index,a=n.start()+i.offset,c=l+1,u=a+i.node.nodeSize;for(;l>0&&Nc([...n.parent.child(l-1).marks],e,t);)l-=1,a-=n.parent.child(l).nodeSize;for(;c<n.parent.childCount&&Nc([...n.parent.child(c).marks],e,t);)u+=n.parent.child(c).nodeSize,c+=1;return{from:a,to:u}}function bn(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 L0=(n,e={})=>({tr:t,state:o,dispatch:i})=>{const s=bn(n,o.schema),{doc:l,selection:a}=t,{$from:c,from:u,to:d}=a;if(i){const f=zl(c,s,e);if(f&&f.from<=u&&f.to>=d){const h=Oe.create(l,f.from,f.to);t.setSelection(h)}}return!0},D0=n=>e=>{const t=typeof n=="function"?n(e):n;for(let o=0;o<t.length;o+=1)if(t[o](e))return!0;return!1};function $d(n){return n instanceof Oe}function Zn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Od(n,e=null){if(!e)return null;const t=Re.atStart(n),o=Re.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return o;const i=t.from,s=o.to;return e==="all"?Oe.create(n,Zn(0,i,s),Zn(n.content.size,i,s)):Oe.create(n,Zn(e,i,s),Zn(e,i,s))}function Bc(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function di(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function V0(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var R0=(n=null,e={})=>({editor:t,view:o,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(di()||Bc())&&o.dom.focus(),V0()&&!di()&&!Bc()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(o.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};try{if(o.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(s&&n===null&&!$d(t.state.selection))return l(),!0;const a=Od(i.doc,n)||t.state.selection,c=t.state.selection.eq(a);return s&&(c||i.setSelection(a),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},z0=(n,e)=>t=>n.every((o,i)=>e(o,{...t,index:i})),P0=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Id=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const o=e[t];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?n.removeChild(o):o.nodeType===1&&Id(o)}return n};function Pr(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 Id(t)}function wr(n,e,t){if(n instanceof Jt||n instanceof G)return n;t={slice:!0,parseOptions:{},...t};const o=typeof n=="object"&&n!==null,i=typeof n=="string";if(o)try{if(Array.isArray(n)&&n.length>0)return G.fromArray(n.map(a=>e.nodeFromJSON(a)));const l=e.nodeFromJSON(n);return t.errorOnInvalidContent&&l.check(),l}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),wr("",e,t)}if(i){if(t.errorOnInvalidContent){let l=!1,a="";const c=new wu({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:u=>(l=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?Vn.fromSchema(c).parseSlice(Pr(n),t.parseOptions):Vn.fromSchema(c).parse(Pr(n),t.parseOptions),t.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=Vn.fromSchema(e);return t.slice?s.parseSlice(Pr(n),t.parseOptions).content:s.parse(Pr(n),t.parseOptions)}return wr("",e,t)}function H0(n,e,t){const o=n.steps.length-1;if(o<e)return;const i=n.steps[o];if(!(i instanceof pt||i instanceof mt))return;const s=n.mapping.maps[o];let l=0;s.forEach((a,c,u,d)=>{l===0&&(l=d)}),n.setSelection(Re.near(n.doc.resolve(l),t))}var _0=n=>!("type"in n),F0=(n,e,t)=>({tr:o,dispatch:i,editor:s})=>{var l;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const c=v=>{s.emit("contentError",{editor:s,error:v,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{wr(e,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(v){c(v)}try{a=wr(e,s.schema,{parseOptions:u,errorOnInvalidContent:(l=t.errorOnInvalidContent)!=null?l:s.options.enableContentCheck})}catch(v){return c(v),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,p=!0;if((_0(a)?a:[a]).forEach(v=>{v.check(),h=h?v.isText&&v.marks.length===0:!1,p=p?v.isBlock:!1}),d===f&&p){const{parent:v}=o.doc.resolve(d);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(d-=1,f+=1)}let g;if(h){if(Array.isArray(e))g=e.map(v=>v.text||"").join("");else if(e instanceof G){let v="";e.forEach(y=>{y.text&&(v+=y.text)}),g=v}else typeof e=="object"&&e&&e.text?g=e.text:g=e;o.insertText(g,d,f)}else{g=a;const v=o.doc.resolve(d),y=v.node(),b=v.parentOffset===0,C=y.isText||y.isTextblock,k=y.content.size>0;b&&C&&k&&(d=Math.max(0,d-1)),o.replaceWith(d,f,g)}t.updateSelection&&H0(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:d,text:g}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:d,text:g})}return!0},U0=()=>({state:n,dispatch:e})=>fv(n,e),q0=()=>({state:n,dispatch:e})=>hv(n,e),j0=()=>({state:n,dispatch:e})=>sv(n,e),W0=()=>({state:n,dispatch:e})=>uv(n,e),K0=()=>({state:n,dispatch:e,tr:t})=>{try{const o=ji(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},G0=()=>({state:n,dispatch:e,tr:t})=>{try{const o=ji(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},J0=()=>({state:n,dispatch:e})=>lv(n,e),Y0=()=>({state:n,dispatch:e})=>av(n,e);function Ld(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function X0(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,i,s,l;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))di()||Ld()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),l&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var Z0=n=>({editor:e,view:t,tr:o,dispatch:i})=>{const s=X0(n).split(/-(?!$)/),l=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,a))});return c?.steps.forEach(u=>{const d=u.map(o.mapping);d&&i&&o.maybeStep(d)}),!0};function _n(n,e,t={}){const{from:o,to:i,empty:s}=n.selection,l=e?ut(e,n.schema):null,a=[];n.doc.nodesBetween(o,i,(f,h)=>{if(f.isText)return;const p=Math.max(o,h),m=Math.min(i,h+f.nodeSize);a.push({node:f,from:p,to:m})});const c=i-o,u=a.filter(f=>l?l.name===f.node.type.name:!0).filter(f=>ui(f.node.attrs,t,{strict:!1}));return s?!!u.length:u.reduce((f,h)=>f+h.to-h.from,0)>=c}var Q0=(n,e={})=>({state:t,dispatch:o})=>{const i=ut(n,t.schema);return _n(t,i,e)?pv(t,o):!1},ek=()=>({state:n,dispatch:e})=>yv(n,e),tk=n=>({state:e,dispatch:t})=>{const o=ut(n,e.schema);return Tv(o)(e,t)},nk=()=>({state:n,dispatch:e})=>mv(n,e);function Qi(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Ac(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((o,i)=>(t.includes(i)||(o[i]=n[i]),o),{})}var ok=(n,e)=>({tr:t,state:o,dispatch:i})=>{let s=null,l=null;const a=Qi(typeof n=="string"?n:n.name,o.schema);if(!a)return!1;a==="node"&&(s=ut(n,o.schema)),a==="mark"&&(l=bn(n,o.schema));let c=!1;return t.selection.ranges.forEach(u=>{o.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{s&&s===d.type&&(c=!0,i&&t.setNodeMarkup(f,void 0,Ac(d.attrs,e))),l&&d.marks.length&&d.marks.forEach(h=>{l===h.type&&(c=!0,i&&t.addMark(f,f+d.nodeSize,l.create(Ac(h.attrs,e))))})})}),c},rk=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),ik=()=>({tr:n,dispatch:e})=>{if(e){const t=new jt(n.doc);n.setSelection(t)}return!0},sk=()=>({state:n,dispatch:e})=>cv(n,e),lk=()=>({state:n,dispatch:e})=>dv(n,e),ak=()=>({state:n,dispatch:e})=>kv(n,e),ck=()=>({state:n,dispatch:e})=>wv(n,e),uk=()=>({state:n,dispatch:e})=>xv(n,e);function tl(n,e,t={},o={}){return wr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var dk=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:i,tr:s,dispatch:l,commands:a})=>{const{doc:c}=s;if(o.preserveWhitespace!=="full"){const u=tl(n,i.schema,o,{errorOnInvalidContent:e??i.options.enableContentCheck});return l&&s.replaceWith(0,c.content.size,u).setMeta("preventUpdate",!t),!0}return l&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:c.content.size},n,{parseOptions:o,errorOnInvalidContent:e??i.options.enableContentCheck})};function Dd(n,e){const t=bn(e,n.schema),{from:o,to:i,empty:s}=n.selection,l=[];s?(n.storedMarks&&l.push(...n.storedMarks),l.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,i,c=>{l.push(...c.marks)});const a=l.find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function Vd(n,e){const t=new zu(n);return e.forEach(o=>{o.steps.forEach(i=>{t.step(i)})}),t}function fk(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 hk(n,e,t){const o=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&o.push({node:i,pos:s})}),o}function pk(n,e){for(let t=n.depth;t>0;t-=1){const o=n.node(t);if(e(o))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:o}}}function es(n){return e=>pk(e.$from,n)}function Ee(n,e,t){return n.config[e]===void 0&&n.parent?Ee(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?Ee(n.parent,e,t):null}):n.config[e]}function Pl(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},o=Ee(e,"addExtensions",t);return o?[e,...Pl(o())]:e}).flat(10)}function Hl(n,e){const t=fo.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function Rd(n){return typeof n=="function"}function We(n,e=void 0,...t){return Rd(n)?e?n.bind(e)(...t):n(...t):n}function mk(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Lo(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),o=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:o}}function zd(n){const e=[],{nodeExtensions:t,markExtensions:o}=Lo(n),i=[...t,...o],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=t.filter(u=>u.name!=="text").map(u=>u.name),a=o.map(u=>u.name),c=[...l,...a];return n.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage,extensions:i},f=Ee(u,"addGlobalAttributes",d);if(!f)return;f().forEach(p=>{let m;Array.isArray(p.types)?m=p.types:p.types==="*"?m=c:p.types==="nodes"?m=l:p.types==="marks"?m=a:m=[],m.forEach(g=>{Object.entries(p.attributes).forEach(([v,y])=>{e.push({type:g,name:v,attribute:{...s,...y}})})})})}),i.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage},f=Ee(u,"addAttributes",d);if(!f)return;const h=f();Object.entries(h).forEach(([p,m])=>{const g={...s,...m};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:u.name,name:p,attribute:g})})}),e}function dt(...n){return n.filter(e=>!!e).reduce((e,t)=>{const o={...e};return Object.entries(t).forEach(([i,s])=>{if(!o[i]){o[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],c=o[i]?o[i].split(" "):[],u=a.filter(d=>!c.includes(d));o[i]=[...c,...u].join(" ")}else if(i==="style"){const a=s?s.split(";").map(d=>d.trim()).filter(Boolean):[],c=o[i]?o[i].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;c.forEach(d=>{const[f,h]=d.split(":").map(p=>p.trim());u.set(f,h)}),a.forEach(d=>{const[f,h]=d.split(":").map(p=>p.trim());u.set(f,h)}),o[i]=Array.from(u.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else o[i]=s}),o},{})}function Cr(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,o)=>dt(t,o),{})}function gk(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function $c(n,e){return"style"in n?n:{...n,getAttrs:t=>{const o=n.getAttrs?n.getAttrs(t):n.attrs;if(o===!1)return!1;const i=e.reduce((s,l)=>{const a=l.attribute.parseHTML?l.attribute.parseHTML(t):gk(t.getAttribute(l.name));return a==null?s:{...s,[l.name]:a}},{});return{...o,...i}}}}function Oc(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&mk(t)?!1:t!=null))}function Ic(n){var e,t;const o={};return!((e=n?.attribute)!=null&&e.isRequired)&&"default"in(n?.attribute||{})&&(o.default=n.attribute.default),((t=n?.attribute)==null?void 0:t.validate)!==void 0&&(o.validate=n.attribute.validate),[n.name,o]}function vk(n,e){var t;const o=zd(n),{nodeExtensions:i,markExtensions:s}=Lo(n),l=(t=i.find(u=>Ee(u,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(u=>{const d=o.filter(y=>y.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=n.reduce((y,b)=>{const C=Ee(b,"extendNodeSchema",f);return{...y,...C?C(u):{}}},{}),p=Oc({...h,content:We(Ee(u,"content",f)),marks:We(Ee(u,"marks",f)),group:We(Ee(u,"group",f)),inline:We(Ee(u,"inline",f)),atom:We(Ee(u,"atom",f)),selectable:We(Ee(u,"selectable",f)),draggable:We(Ee(u,"draggable",f)),code:We(Ee(u,"code",f)),whitespace:We(Ee(u,"whitespace",f)),linebreakReplacement:We(Ee(u,"linebreakReplacement",f)),defining:We(Ee(u,"defining",f)),isolating:We(Ee(u,"isolating",f)),attrs:Object.fromEntries(d.map(Ic))}),m=We(Ee(u,"parseHTML",f));m&&(p.parseDOM=m.map(y=>$c(y,d)));const g=Ee(u,"renderHTML",f);g&&(p.toDOM=y=>g({node:y,HTMLAttributes:Cr(y,d)}));const v=Ee(u,"renderText",f);return v&&(p.toText=v),[u.name,p]})),c=Object.fromEntries(s.map(u=>{const d=o.filter(v=>v.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=n.reduce((v,y)=>{const b=Ee(y,"extendMarkSchema",f);return{...v,...b?b(u):{}}},{}),p=Oc({...h,inclusive:We(Ee(u,"inclusive",f)),excludes:We(Ee(u,"excludes",f)),group:We(Ee(u,"group",f)),spanning:We(Ee(u,"spanning",f)),code:We(Ee(u,"code",f)),attrs:Object.fromEntries(d.map(Ic))}),m=We(Ee(u,"parseHTML",f));m&&(p.parseDOM=m.map(v=>$c(v,d)));const g=Ee(u,"renderHTML",f);return g&&(p.toDOM=v=>g({mark:v,HTMLAttributes:Cr(v,d)})),[u.name,p]}));return new wu({topNode:l,nodes:a,marks:c})}function yk(n){const e=n.filter((t,o)=>n.indexOf(t)!==o);return Array.from(new Set(e))}function lr(n){return n.sort((t,o)=>{const i=Ee(t,"priority")||100,s=Ee(o,"priority")||100;return i>s?-1:i<s?1:0})}function Pd(n){const e=lr(Pl(n)),t=yk(e.map(o=>o.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function Hd(n,e,t){const{from:o,to:i}=e,{blockSeparator:s=`
|
|
14
|
+
|
|
15
|
+
`,textSerializers:l={}}=t||{};let a="";return n.nodesBetween(o,i,(c,u,d,f)=>{var h;c.isBlock&&u>o&&(a+=s);const p=l?.[c.type.name];if(p)return d&&(a+=p({node:c,pos:u,parent:d,index:f,range:e})),!1;c.isText&&(a+=(h=c?.text)==null?void 0:h.slice(Math.max(o,u)-u,i-u))}),a}function kk(n,e){const t={from:0,to:n.content.size};return Hd(n,t,e)}function _d(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function bk(n,e){const t=ut(e,n.schema),{from:o,to:i}=n.selection,s=[];n.doc.nodesBetween(o,i,a=>{s.push(a)});const l=s.reverse().find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function Fd(n,e){const t=Qi(typeof e=="string"?e:e.name,n.schema);return t==="node"?bk(n,e):t==="mark"?Dd(n,e):{}}function xk(n,e=JSON.stringify){const t={};return n.filter(o=>{const i=e(o);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function wk(n){const e=xk(n);return e.length===1?e:e.filter((t,o)=>!e.filter((s,l)=>l!==o).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Ud(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((i,s)=>{const l=[];if(i.ranges.length)i.forEach((a,c)=>{l.push({from:a,to:c})});else{const{from:a,to:c}=t[s];if(a===void 0||c===void 0)return;l.push({from:a,to:c})}l.forEach(({from:a,to:c})=>{const u=e.slice(s).map(a,-1),d=e.slice(s).map(c),f=e.invert().map(u,-1),h=e.invert().map(d);o.push({oldRange:{from:f,to:h},newRange:{from:u,to:d}})})}),wk(o)}function _l(n,e,t){const o=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),l=zl(s,i.type);l&&o.push({mark:i,...l})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||o.push(...i.marks.map(l=>({from:s,to:s+i.nodeSize,mark:l})))}),o}var Ck=(n,e,t,o=20)=>{const i=n.doc.resolve(t);let s=o,l=null;for(;s>0&&l===null;){const a=i.node(s);a?.type.name===e?l=a:s-=1}return[l,s]};function Go(n,e){return e.nodes[n]||e.marks[n]||null}function Yr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([o])=>{const i=n.find(s=>s.type===e&&s.name===o);return i?i.attribute.keepOnSplit:!1}))}var Ek=(n,e=500)=>{let t="";const o=n.parentOffset;return n.parent.nodesBetween(Math.max(0,o-e),o,(i,s,l,a)=>{var c,u;const d=((u=(c=i.type.spec).toText)==null?void 0:u.call(c,{node:i,pos:s,parent:l,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,o-s))}),t};function nl(n,e,t={}){const{empty:o,ranges:i}=n.selection,s=e?bn(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>ui(f.attrs,t,{strict:!1}));let l=0;const a=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;n.doc.nodesBetween(p,m,(g,v)=>{if(s&&g.inlineContent&&!g.type.allowsMarkType(s))return!1;if(!g.isText&&!g.marks.length)return;const y=Math.max(p,v),b=Math.min(m,v+g.nodeSize),C=b-y;l+=C,a.push(...g.marks.map(k=>({mark:k,from:y,to:b})))})}),l===0)return!1;const c=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>ui(f.mark.attrs,t,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),u=a.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,h)=>f+h.to-h.from,0);return(c>0?c+u:c)>=l}function Sk(n,e,t={}){if(!e)return _n(n,null,t)||nl(n,null,t);const o=Qi(e,n.schema);return o==="node"?_n(n,e,t):o==="mark"?nl(n,e,t):!1}var Mk=(n,e)=>{const{$from:t,$to:o,$anchor:i}=n.selection;if(e){const s=es(a=>a.type.name===e)(n.selection);if(!s)return!1;const l=n.doc.resolve(s.pos+1);return i.pos+1===l.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},Tk=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Lc(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Dc(n,e){const{nodeExtensions:t}=Lo(e),o=t.find(l=>l.name===n);if(!o)return!1;const i={name:o.name,options:o.options,storage:o.storage},s=We(Ee(o,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function ts(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var o;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((o=n.text)!=null?o:"")}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(s=>{i!==!1&&(ts(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function qd(n){return n instanceof Te}var jd=class Wd{constructor(e){this.position=e}static fromJSON(e){return new Wd(e.position)}toJSON(){return{position:this.position}}};function Nk(n,e){const t=e.mapping.mapResult(n.position);return{position:new jd(t.pos),mapResult:t}}function Bk(n){return new jd(n)}function Ak(n,e,t){var o;const{selection:i}=e;let s=null;if($d(i)&&(s=i.$cursor),s){const a=(o=n.storedMarks)!=null?o:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(u=>u.type.excludes(t)))}const{ranges:l}=i;return l.some(({$from:a,$to:c})=>{let u=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,c.pos,(d,f,h)=>{if(u)return!1;if(d.isInline){const p=!h||h.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));u=p&&m}return!u}),u})}var $k=(n,e={})=>({tr:t,state:o,dispatch:i})=>{const{selection:s}=t,{empty:l,ranges:a}=s,c=bn(n,o.schema);if(i)if(l){const u=Dd(o,c);t.addStoredMark(c.create({...u,...e}))}else a.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;o.doc.nodesBetween(d,f,(h,p)=>{const m=Math.max(p,d),g=Math.min(p+h.nodeSize,f);h.marks.find(y=>y.type===c)?h.marks.forEach(y=>{c===y.type&&t.addMark(m,g,c.create({...y.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return Ak(o,t,c)},Ok=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Ik=(n,e={})=>({state:t,dispatch:o,chain:i})=>{const s=ut(n,t.schema);let l;return t.selection.$anchor.sameParent(t.selection.$head)&&(l=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>Ga(s,{...l,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Ga(s,{...l,...e})(a,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Lk=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,i=Zn(n,0,o.content.size),s=Te.create(o,i);e.setSelection(s)}return!0},Dk=(n,e)=>({tr:t,state:o,dispatch:i})=>{const{selection:s}=o;let l,a;return typeof e=="number"?(l=e,a=e):e&&"from"in e&&"to"in e?(l=e.from,a=e.to):(l=s.from,a=s.to),i&&t.doc.nodesBetween(l,a,(c,u)=>{c.isText||t.setNodeMarkup(u,void 0,{...c.attrs,dir:n})}),!0},Vk=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,l=Oe.atStart(o).from,a=Oe.atEnd(o).to,c=Zn(i,l,a),u=Zn(s,l,a),d=Oe.create(o,c,u);e.setSelection(d)}return!0},Rk=n=>({state:e,dispatch:t})=>{const o=ut(n,e.schema);return Av(o)(e,t)};function Vc(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const o=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(o)}}var zk=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:i})=>{const{selection:s,doc:l}=e,{$from:a,$to:c}=s,u=i.extensionManager.attributes,d=Yr(u,a.node().type.name,a.node().attrs);if(s instanceof Te&&s.node.isBlock)return!a.parentOffset||!Mo(l,a.pos)?!1:(o&&(n&&Vc(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,h=a.depth===0?void 0:fk(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0,m=Mo(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&Mo(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:d}]:void 0),o){if(m&&(s instanceof Oe&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),h&&!f&&!a.parentOffset&&a.parent.type!==h)){const g=e.mapping.map(a.before()),v=e.doc.resolve(g);a.node(-1).canReplaceWith(v.index(),v.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&Vc(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},Pk=(n,e={})=>({tr:t,state:o,dispatch:i,editor:s})=>{var l;const a=ut(n,o.schema),{$from:c,$to:u}=o.selection,d=o.selection.node;if(d&&d.isBlock||c.depth<2||!c.sameParent(u))return!1;const f=c.node(-1);if(f.type!==a)return!1;const h=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let y=G.empty;const b=c.index(-1)?1:c.index(-2)?2:3;for(let L=c.depth-b;L>=c.depth-3;L-=1)y=G.from(c.node(L).copy(y));const C=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,k={...Yr(h,c.node().type.name,c.node().attrs),...e},x=((l=a.contentMatch.defaultType)==null?void 0:l.createAndFill(k))||void 0;y=y.append(G.from(a.createAndFill(null,x)||void 0));const S=c.before(c.depth-(b-1));t.replace(S,c.after(-C),new pe(y,4-b,0));let M=-1;t.doc.nodesBetween(S,t.doc.content.size,(L,R)=>{if(M>-1)return!1;L.isTextblock&&L.content.size===0&&(M=R+1)}),M>-1&&t.setSelection(Oe.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const p=u.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Yr(h,f.type.name,f.attrs),...e},g={...Yr(h,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,u.pos);const v=p?[{type:a,attrs:m},{type:p,attrs:g}]:[{type:a,attrs:m}];if(!Mo(t.doc,c.pos,2))return!1;if(i){const{selection:y,storedMarks:b}=o,{splittableMarks:C}=s.extensionManager,k=b||y.$to.parentOffset&&y.$from.marks();if(t.split(c.pos,2,v).scrollIntoView(),!k||!i)return!0;const x=k.filter(S=>C.includes(S.type.name));t.ensureMarks(x)}return!0},Ss=(n,e)=>{const t=es(l=>l.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(o===void 0)return!0;const i=n.doc.nodeAt(o);return t.node.type===i?.type&&Fn(n.doc,t.pos)&&n.join(t.pos),!0},Ms=(n,e)=>{const t=es(l=>l.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(t.start).after(t.depth);if(o===void 0)return!0;const i=n.doc.nodeAt(o);return t.node.type===i?.type&&Fn(n.doc,o)&&n.join(o),!0},Hk=(n,e,t,o={})=>({editor:i,tr:s,state:l,dispatch:a,chain:c,commands:u,can:d})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=ut(n,l.schema),m=ut(e,l.schema),{selection:g,storedMarks:v}=l,{$from:y,$to:b}=g,C=y.blockRange(b),k=v||g.$to.parentOffset&&g.$from.marks();if(!C)return!1;const x=es(S=>Dc(S.type.name,f))(g);if(C.depth>=1&&x&&C.depth-x.depth<=1){if(x.node.type===p)return u.liftListItem(m);if(Dc(x.node.type.name,f)&&p.validContent(x.node.content)&&a)return c().command(()=>(s.setNodeMarkup(x.pos,p),!0)).command(()=>Ss(s,p)).command(()=>Ms(s,p)).run()}return!t||!k||!a?c().command(()=>d().wrapInList(p,o)?!0:u.clearNodes()).wrapInList(p,o).command(()=>Ss(s,p)).command(()=>Ms(s,p)).run():c().command(()=>{const S=d().wrapInList(p,o),M=k.filter(L=>h.includes(L.type.name));return s.ensureMarks(M),S?!0:u.clearNodes()}).wrapInList(p,o).command(()=>Ss(s,p)).command(()=>Ms(s,p)).run()},_k=(n,e={},t={})=>({state:o,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,l=bn(n,o.schema);return nl(o,l,e)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,e)},Fk=(n,e,t={})=>({state:o,commands:i})=>{const s=ut(n,o.schema),l=ut(e,o.schema),a=_n(o,s,t);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),a?i.setNode(l,c):i.setNode(s,{...c,...t})},Uk=(n,e={})=>({state:t,commands:o})=>{const i=ut(n,t.schema);return _n(t,i,e)?o.lift(i):o.wrapIn(i,e)},qk=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let o=0;o<t.length;o+=1){const i=t[o];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const l=n.tr,a=s.transform;for(let c=a.steps.length-1;c>=0;c-=1)l.step(a.steps[c].invert(a.docs[c]));if(s.text){const c=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,n.schema.text(s.text,c))}else l.delete(s.from,s.to)}return!0}}return!1},jk=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:o,ranges:i}=t;return o||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},Wk=(n,e={})=>({tr:t,state:o,dispatch:i})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:a}=t,c=bn(n,o.schema),{$from:u,empty:d,ranges:f}=a;if(!i)return!0;if(d&&l){let{from:h,to:p}=a;const m=(s=u.marks().find(v=>v.type===c))==null?void 0:s.attrs,g=zl(u,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},Kk=n=>({tr:e,state:t,dispatch:o})=>{const{selection:i}=t;let s,l;return typeof n=="number"?(s=n,l=n):n&&"from"in n&&"to"in n?(s=n.from,l=n.to):(s=i.from,l=i.to),o&&e.doc.nodesBetween(s,l,(a,c)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(c,void 0,u)}),!0},Gk=(n,e={})=>({tr:t,state:o,dispatch:i})=>{let s=null,l=null;const a=Qi(typeof n=="string"?n:n.name,o.schema);if(!a)return!1;a==="node"&&(s=ut(n,o.schema)),a==="mark"&&(l=bn(n,o.schema));let c=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let h,p,m,g;t.selection.empty?o.doc.nodesBetween(d,f,(v,y)=>{s&&s===v.type&&(c=!0,m=Math.max(y,d),g=Math.min(y+v.nodeSize,f),h=y,p=v)}):o.doc.nodesBetween(d,f,(v,y)=>{y<d&&s&&s===v.type&&(c=!0,m=Math.max(y,d),g=Math.min(y+v.nodeSize,f),h=y,p=v),y>=d&&y<=f&&(s&&s===v.type&&(c=!0,i&&t.setNodeMarkup(y,void 0,{...v.attrs,...e})),l&&v.marks.length&&v.marks.forEach(b=>{if(l===b.type&&(c=!0,i)){const C=Math.max(y,d),k=Math.min(y+v.nodeSize,f);t.addMark(C,k,l.create({...b.attrs,...e}))}}))}),p&&(h!==void 0&&i&&t.setNodeMarkup(h,void 0,{...p.attrs,...e}),l&&p.marks.length&&p.marks.forEach(v=>{l===v.type&&i&&t.addMark(m,g,l.create({...v.attrs,...e}))}))}),c},Jk=(n,e={})=>({state:t,dispatch:o})=>{const i=ut(n,t.schema);return Cv(i,e)(t,o)},Yk=(n,e={})=>({state:t,dispatch:o})=>{const i=ut(n,t.schema);return Ev(i,e)(t,o)},Xk=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(o=>o.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(o=>o!==e):delete this.callbacks[n]),this}once(n,e){const t=(...o)=>{this.off(n,t),e.apply(this,o)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},ns=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},Zk=(n,e)=>{if(Rl(e))return e.exec(n);const t=e(n);if(!t)return null;const o=[t.text];return o.index=t.index,o.input=n,o.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(t.replaceWith)),o};function Hr(n){var e;const{editor:t,from:o,to:i,text:s,rules:l,plugin:a}=n,{view:c}=t;if(c.composing)return!1;const u=c.state.doc.resolve(o);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const f=Ek(u)+s;return l.forEach(h=>{if(d)return;const p=Zk(f,h.find);if(!p)return;const m=c.state.tr,g=Xi({state:c.state,transaction:m}),v={from:o-(p[0].length-s.length),to:i},{commands:y,chain:b,can:C}=new Zi({editor:t,state:g});h.handler({state:g,range:v,match:p,commands:y,chain:b,can:C})===null||!m.steps.length||(h.undoable&&m.setMeta(a,{transform:m,from:o,to:i,text:s}),c.dispatch(m),d=!0)}),d}function Qk(n){const{editor:e,rules:t}=n,o=new ot({state:{init(){return null},apply(i,s,l){const a=i.getMeta(o);if(a)return a;const c=i.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:d}=c;typeof d=="string"?d=d:d=Hl(G.from(d),l.schema);const{from:f}=c,h=f+d.length;Hr({editor:e,from:f,to:h,text:d,rules:t,plugin:o})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,a){return Hr({editor:e,from:s,to:l,text:a,rules:t,plugin:o})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Hr({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:o})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?Hr({editor:e,from:l.pos,to:l.pos,text:`
|
|
16
|
+
`,rules:t,plugin:o}):!1}},isInputRules:!0});return o}function eb(n){return Object.prototype.toString.call(n).slice(8,-1)}function _r(n){return eb(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Kd(n,e){const t={...n};return _r(n)&&_r(e)&&Object.keys(e).forEach(o=>{_r(e[o])&&_r(n[o])?t[o]=Kd(n[o],e[o]):t[o]=e[o]}),t}var Fl=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{...We(Ee(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...We(Ee(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Kd(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}},po=class Gd extends Fl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Gd(t)}static handleExit({editor:e,mark:t}){const{tr:o}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const l=i.marks();if(!!!l.find(u=>u?.type.name===t.name))return!1;const c=l.find(u=>u?.type.name===t.name);return c&&o.removeStoredMark(c),o.insertText(" ",i.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function tb(n){return typeof n=="number"}var nb=class{constructor(n){this.find=n.find,this.handler=n.handler}},ob=(n,e,t)=>{if(Rl(e))return[...n.matchAll(e)];const o=e(n,t);return o?o.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function rb(n){const{editor:e,state:t,from:o,to:i,rule:s,pasteEvent:l,dropEvent:a}=n,{commands:c,chain:u,can:d}=new Zi({editor:e,state:t}),f=[];return t.doc.nodesBetween(o,i,(p,m)=>{var g,v,y,b,C;if((v=(g=p.type)==null?void 0:g.spec)!=null&&v.code||!(p.isText||p.isTextblock||p.isInline))return;const k=(C=(b=(y=p.content)==null?void 0:y.size)!=null?b:p.nodeSize)!=null?C:0,x=Math.max(o,m),S=Math.min(i,m+k);if(x>=S)return;const M=p.isText?p.text||"":p.textBetween(x-m,S-m,void 0,"");ob(M,s.find,l).forEach(R=>{if(R.index===void 0)return;const X=x+R.index+1,ve=X+R[0].length,fe={from:t.tr.mapping.map(X),to:t.tr.mapping.map(ve)},Se=s.handler({state:t,range:fe,match:R,commands:c,chain:u,can:d,pasteEvent:l,dropEvent:a});f.push(Se)})}),f.every(p=>p!==null)}var Fr=null,ib=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function sb(n){const{editor:e,rules:t}=n;let o=null,i=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:d,from:f,to:h,rule:p,pasteEvt:m})=>{const g=d.tr,v=Xi({state:d,transaction:g});if(!(!rb({editor:e,state:v,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(d=>new ot({view(f){const h=m=>{var g;o=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,o&&(Fr=e)},p=()=>{Fr&&(Fr=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(s=o===f.dom.parentElement,a=h,!s){const p=Fr;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 l=h,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!i,v=m.getMeta("uiEvent")==="drop"&&!s,y=m.getMeta("applyPasteRules"),b=!!y;if(!g&&!v&&!b)return;if(b){let{text:x}=y;typeof x=="string"?x=x:x=Hl(G.from(x),p.schema);const{from:S}=y,M=S+x.length,L=ib(x);return c({rule:d,state:p,from:S,to:{b:M},pasteEvt:L})}const C=h.doc.content.findDiffStart(p.doc.content),k=h.doc.content.findDiffEnd(p.doc.content);if(!(!tb(C)||!k||C===k.b))return c({rule:d,state:p,from:C,to:k,pasteEvt:l})}}))}var rs=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Pd(n),this.schema=vk(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:Go(e.name,this.schema)},o=Ee(e,"addCommands",t);return o?{...n,...o()}:n},{})}get plugins(){const{editor:n}=this;return lr([...this.extensions].reverse()).flatMap(o=>{const i={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:n,type:Go(o.name,this.schema)},s=[],l=Ee(o,"addKeyboardShortcuts",i);let a={};if(o.type==="mark"&&Ee(o,"exitable",i)&&(a.ArrowRight=()=>po.handleExit({editor:n,mark:o})),l){const h=Object.fromEntries(Object.entries(l()).map(([p,m])=>[p,()=>m({editor:n})]));a={...a,...h}}const c=b0(a);s.push(c);const u=Ee(o,"addInputRules",i);if(Lc(o,n.options.enableInputRules)&&u){const h=u();if(h&&h.length){const p=Qk({editor:n,rules:h}),m=Array.isArray(p)?p:[p];s.push(...m)}}const d=Ee(o,"addPasteRules",i);if(Lc(o,n.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const p=sb({editor:n,rules:h});s.push(...p)}}const f=Ee(o,"addProseMirrorPlugins",i);if(f){const h=f();s.push(...h)}return s})}get attributes(){return zd(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Lo(this.extensions);return Object.fromEntries(e.filter(t=>!!Ee(t,"addNodeView")).map(t=>{const o=this.attributes.filter(c=>c.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:ut(t.name,this.schema)},s=Ee(t,"addNodeView",i);if(!s)return[];const l=s();if(!l)return[];const a=(c,u,d,f,h)=>{const p=Cr(c,o);return l({node:c,view:u,getPos:d,decorations:f,innerDecorations:h,editor:n,extension:t,HTMLAttributes:p})};return[t.name,a]}))}dispatchTransaction(n){const{editor:e}=this;return lr([...this.extensions].reverse()).reduceRight((o,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Go(i.name,this.schema)},l=Ee(i,"dispatchTransaction",s);return l?a=>{l.call(s,{transaction:a,next:o})}:o},n)}transformPastedHTML(n){const{editor:e}=this;return lr([...this.extensions]).reduce((o,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Go(i.name,this.schema)},l=Ee(i,"transformPastedHTML",s);return l?(a,c)=>{const u=o(a,c);return l.call(s,u)}:o},n||(o=>o))}get markViews(){const{editor:n}=this,{markExtensions:e}=Lo(this.extensions);return Object.fromEntries(e.filter(t=>!!Ee(t,"addMarkView")).map(t=>{const o=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:bn(t.name,this.schema)},s=Ee(t,"addMarkView",i);if(!s)return[];const l=(a,c,u)=>{const d=Cr(a,o);return s()({mark:a,view:c,inline:u,editor:n,extension:t,HTMLAttributes:d,updateAttributes:f=>{bb(a,n,f)}})};return[t.name,l]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Go(e.name,this.schema)};e.type==="mark"&&((t=We(Ee(e,"keepOnSplit",o)))==null||t)&&this.splittableMarks.push(e.name);const i=Ee(e,"onBeforeCreate",o),s=Ee(e,"onCreate",o),l=Ee(e,"onUpdate",o),a=Ee(e,"onSelectionUpdate",o),c=Ee(e,"onTransaction",o),u=Ee(e,"onFocus",o),d=Ee(e,"onBlur",o),f=Ee(e,"onDestroy",o);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};rs.resolve=Pd;rs.sort=lr;rs.flatten=Pl;var lb={};Vl(lb,{ClipboardTextSerializer:()=>Yd,Commands:()=>Xd,Delete:()=>Zd,Drop:()=>Qd,Editable:()=>ef,FocusEvents:()=>nf,Keymap:()=>of,Paste:()=>rf,Tabindex:()=>sf,TextDirection:()=>lf,focusEventsPluginKey:()=>tf});var st=class Jd extends Fl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Jd(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Yd=st.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ot({key:new ht("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:i}=e,{ranges:s}=i,l=Math.min(...s.map(d=>d.$from.pos)),a=Math.max(...s.map(d=>d.$to.pos)),c=_d(t);return Hd(o,{from:l,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Xd=st.create({name:"commands",addCommands(){return{...Bd}}}),Zd=st.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,i;const s=()=>{var l,a,c,u;if((u=(c=(a=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:a.filterTransaction)==null?void 0:c.call(a,n))!=null?u:n.getMeta("y-sync$"))return;const d=Vd(n.before,[n,...e]);Ud(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const v=g+m.nodeSize-2,y=p.oldRange.from<=g&&v<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:v,newFrom:d.mapping.map(g),newTo:d.mapping.map(v),deletedRange:p.oldRange,newRange:p.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((p,m)=>{var g,v;if(p instanceof Gt){const y=h.slice(m).map(p.from,-1),b=h.slice(m).map(p.to),C=h.invert().map(y,-1),k=h.invert().map(b),x=(g=d.doc.nodeAt(y-1))==null?void 0:g.marks.some(M=>M.eq(p.mark)),S=(v=d.doc.nodeAt(b))==null?void 0:v.marks.some(M=>M.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:C,to:k},newRange:{from:y,to:b},partial:!!(S||x),editor:this.editor,transaction:n,combinedTransform:d})}})};(i=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||i?setTimeout(s,0):s()}}),Qd=st.create({name:"drop",addProseMirrorPlugins(){return[new ot({key:new ht("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),ef=st.create({name:"editable",addProseMirrorPlugins(){return[new ot({key:new ht("editable"),props:{editable:()=>this.editor.options.editable}})]}}),tf=new ht("focusEvents"),nf=st.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ot({key:tf,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const o=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,t)=>{n.isFocused=!1;const o=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),of=st.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:a})=>{const{selection:c,doc:u}=a,{empty:d,$anchor:f}=c,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?a.doc.resolve(h-1):f,g=m.parent.type.spec.isolating,v=f.pos-f.parentOffset,y=g&&m.parent.childCount===1?v===f.pos:Re.atStart(u).from===h;return!d||!p.type.isTextblock||p.textContent.length||!y||y&&f.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.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={...o},s={...o,"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 di()||Ld()?s:i},addProseMirrorPlugins(){return[new ot({key:new ht("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const o=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),i=n.some(g=>g.getMeta("preventClearDocument"));if(!o||i)return;const{empty:s,from:l,to:a}=e.selection,c=Re.atStart(e.doc).from,u=Re.atEnd(e.doc).to;if(s||!(l===c&&a===u)||!ts(t.doc))return;const h=t.tr,p=Xi({state:t,transaction:h}),{commands:m}=new Zi({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),rf=st.create({name:"paste",addProseMirrorPlugins(){return[new ot({key:new ht("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),sf=st.create({name:"tabindex",addProseMirrorPlugins(){return[new ot({key:new ht("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),lf=st.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Lo(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 ot({key:new ht("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),ab=class tr{constructor(e,t,o=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,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,o=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,o=this.to-1}this.editor.commands.insertContentAt({from:t,to:o},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 tr(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 tr(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 tr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,o)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,l=t.isInline,a=this.pos+o+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(a);if(!i&&!l&&c.depth<=this.depth)return;const u=new tr(c,this.editor,i,i||l?t:null);i&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let o=null,i=this.parent;for(;i&&!o;)i.node.type.name===e&&(Object.keys(t).length>0||(o=i)),i=i.parent;return o}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},o=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(l=>{o&&i.length>0||(l.node.type.name===e&&s.every(c=>t[c]===l.node.attrs[c])&&i.push(l),!(o&&i.length>0)&&(i=i.concat(l.querySelectorAll(e,t,o))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},cb=`.ProseMirror {
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ProseMirror {
|
|
21
|
+
word-wrap: break-word;
|
|
22
|
+
white-space: pre-wrap;
|
|
23
|
+
white-space: break-spaces;
|
|
24
|
+
-webkit-font-variant-ligatures: none;
|
|
25
|
+
font-variant-ligatures: none;
|
|
26
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ProseMirror [contenteditable="false"] {
|
|
30
|
+
white-space: normal;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
34
|
+
white-space: pre-wrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ProseMirror pre {
|
|
38
|
+
white-space: pre-wrap;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
img.ProseMirror-separator {
|
|
42
|
+
display: inline !important;
|
|
43
|
+
border: none !important;
|
|
44
|
+
margin: 0 !important;
|
|
45
|
+
width: 0 !important;
|
|
46
|
+
height: 0 !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ProseMirror-gapcursor {
|
|
50
|
+
display: none;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
position: absolute;
|
|
53
|
+
margin: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ProseMirror-gapcursor:after {
|
|
57
|
+
content: "";
|
|
58
|
+
display: block;
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: -2px;
|
|
61
|
+
width: 20px;
|
|
62
|
+
border-top: 1px solid black;
|
|
63
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@keyframes ProseMirror-cursor-blink {
|
|
67
|
+
to {
|
|
68
|
+
visibility: hidden;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ProseMirror-hideselection *::selection {
|
|
73
|
+
background: transparent;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
77
|
+
background: transparent;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ProseMirror-hideselection * {
|
|
81
|
+
caret-color: transparent;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
85
|
+
display: block;
|
|
86
|
+
}`;function ub(n,e,t){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;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 db=class extends Xk{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:Nk,createMappablePosition:Bk},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:s,moved:l})=>this.options.onDrop(i,s,l)),this.on("paste",({event:i,slice:s})=>this.options.onPaste(i,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),o=Od(t,this.options.autofocus);this.editorState=So.create({doc:t,schema:this.schema,selection:o||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=ub(cb,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 o=Rd(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:o});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let o=t;if([].concat(e).forEach(s=>{const l=typeof s=="string"?`${s}$`:s.key;o=o.filter(a=>!a.key.startsWith(l))}),t.length===o.length)return;const i=this.state.reconfigure({plugins:o});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[ef,Yd.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),Xd,nf,of,sf,Qd,rf,Zd,lf.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new rs(i,this)}createCommandManager(){this.commandManager=new Zi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=tl(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(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=tl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:o}=this.options,i=t.dispatchTransaction||this.dispatchTransaction.bind(this),s=o?this.extensionManager.dispatchTransaction(i):i,l=t.transformPastedHTML,a=this.extensionManager.transformPastedHTML(l);this.editorView=new Td(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:s,transformPastedHTML:a,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.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(d=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(d)});return}const{state:t,transactions:o}=this.state.applyTransaction(e),i=!this.state.selection.eq(t.selection),s=o.includes(e),l=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:o.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:e});const a=o.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),c=a?.getMeta("focus"),u=a?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:a}),u&&this.emit("blur",{editor:this,event:u.event,transaction:a}),!(e.getMeta("preventUpdate")||!o.some(d=>d.docChanged)||l.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:o.slice(1)})}getAttributes(e){return Fd(this.state,e)}isActive(e,t){const o=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Sk(this.state,o,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Hl(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
87
|
+
|
|
88
|
+
`,textSerializers:o={}}=e||{};return kk(this.state.doc,{blockSeparator:t,textSerializers:{..._d(this.schema),...o}})}get isEmpty(){return ts(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 o;return((o=this.$doc)==null?void 0:o.querySelector(e,t))||null}$nodes(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new ab(t,this)}get $doc(){return this.$pos(0)}};function Do(n){return new ns({find:n.find,handler:({state:e,range:t,match:o})=>{const i=We(n.getAttributes,void 0,o);if(i===!1||i===null)return null;const{tr:s}=e,l=o[o.length-1],a=o[0];if(l){const c=a.search(/\S/),u=t.from+a.indexOf(l),d=u+l.length;if(_l(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>u).length)return null;d<t.to&&s.delete(d,t.to),u>t.from&&s.delete(t.from+c,u);const h=t.from+c+l.length;s.addMark(t.from+c,h,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function fb(n){return new ns({find:n.find,handler:({state:e,range:t,match:o})=>{const i=We(n.getAttributes,void 0,o)||{},{tr:s}=e,l=t.from;let a=t.to;const c=n.type.create(i);if(o[1]){const u=o[0].lastIndexOf(o[1]);let d=l+u;d>a?d=a:a=d+o[1].length;const f=o[0][o[0].length-1];s.insertText(f,l+o[0].length-1),s.replaceWith(d,a,c)}else if(o[0]){const u=n.type.isInline?l:l-1;s.insert(u,n.type.create(i)).delete(s.mapping.map(l),s.mapping.map(a))}s.scrollIntoView()},undoable:n.undoable})}function ol(n){return new ns({find:n.find,handler:({state:e,range:t,match:o})=>{const i=e.doc.resolve(t.from),s=We(n.getAttributes,void 0,o)||{};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,s)},undoable:n.undoable})}function Vo(n){return new ns({find:n.find,handler:({state:e,range:t,match:o,chain:i})=>{const s=We(n.getAttributes,void 0,o)||{},l=e.tr.delete(t.from,t.to),c=l.doc.resolve(t.from).blockRange(),u=c&&Cl(c,n.type,s);if(!u)return null;if(l.wrap(c,u),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(v=>p.includes(v.type.name));l.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const d=l.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Fn(l.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,d))&&l.join(t.from-1)},undoable:n.undoable})}function hb(n,e){const{selection:t}=n,{$from:o}=t;if(t instanceof Te){const s=o.index();return o.parent.canReplaceWith(s,s+1,e)}let i=o.depth;for(;i>=0;){const s=o.index(i);if(o.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}var pb={};Vl(pb,{createAtomBlockMarkdownSpec:()=>mb,createBlockMarkdownSpec:()=>gb,createInlineMarkdownSpec:()=>kb,parseAttributes:()=>Ul,parseIndentedBlocks:()=>rl,renderNestedMarkdownContent:()=>jl,serializeAttributes:()=>ql});function Ul(n){if(!n?.trim())return{};const e={},t=[],o=n.replace(/["']([^"']*)["']/g,u=>(t.push(u),`__QUOTED_${t.length-1}__`)),i=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const u=i.map(d=>d.trim().slice(1));e.class=u.join(" ")}const s=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const l=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(l)).forEach(([,u,d])=>{var f;const h=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),p=t[h];p&&(e[u]=p.slice(1,-1))});const c=o.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(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function ql(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(o=>e.push(`.${o}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,o])=>{t==="class"||t==="id"||(o===!0?e.push(t):o!==!1&&o!=null&&e.push(`${t}="${String(o)}"`))}),e.join(" ")}function mb(n){const{nodeName:e,name:t,parseAttributes:o=Ul,serializeAttributes:i=ql,defaultAttributes:s={},requiredAttributes:l=[],allowedAttributes:a}=n,c=t||e,u=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{const h={...s,...d.attributes};return f.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}(?:\\s|$)`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){const p=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(p);if(!m)return;const g=m[1]||"",v=o(g);if(!l.find(b=>!(b in v)))return{type:e,raw:m[0],attributes:v}}},renderMarkdown:d=>{const f=u(d.attrs||{}),h=i(f),p=h?` {${h}}`:"";return`:::${c}${p} :::`}}}function gb(n){const{nodeName:e,name:t,getContent:o,parseAttributes:i=Ul,serializeAttributes:s=ql,defaultAttributes:l={},content:a="block",allowedAttributes:c}=n,u=t||e,d=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(o){const g=o(f);p=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?p=h.parseChildren(f.tokens||[]):p=h.parseInline(f.tokens||[]);const m={...l,...f.attributes};return h.createNode(e,m,p)},markdownTokenizer:{name:e,level:"block",start(f){var h;const p=new RegExp(`^:::${u}`,"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(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=f.match(g);if(!v)return;const[y,b=""]=v,C=i(b);let k=1;const x=y.length;let S="";const M=/^:::([\w-]*)(\s.*)?/gm,L=f.slice(x);for(M.lastIndex=0;;){const R=M.exec(L);if(R===null)break;const X=R.index,ve=R[1];if(!((m=R[2])!=null&&m.endsWith(":::"))){if(ve)k+=1;else if(k-=1,k===0){const fe=L.slice(0,X);S=fe.trim();const Se=f.slice(0,x+X+R[0].length);let xe=[];if(S)if(a==="block")for(xe=p.blockTokens(fe),xe.forEach(U=>{U.text&&(!U.tokens||U.tokens.length===0)&&(U.tokens=p.inlineTokens(U.text))});xe.length>0;){const U=xe[xe.length-1];if(U.type==="paragraph"&&(!U.text||U.text.trim()===""))xe.pop();else break}else xe=p.inlineTokens(S);return{type:e,raw:Se,attributes:C,content:S,tokens:xe}}}}}},renderMarkdown:(f,h)=>{const p=d(f.attrs||{}),m=s(p),g=m?` {${m}}`:"",v=h.renderChildren(f.content||[],`
|
|
89
|
+
|
|
90
|
+
`);return`:::${u}${g}
|
|
91
|
+
|
|
92
|
+
${v}
|
|
93
|
+
|
|
94
|
+
:::`}}}function vb(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,i,s,l]=o;e[i]=s||l,o=t.exec(n)}return e}function yb(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function kb(n){const{nodeName:e,name:t,getContent:o,parseAttributes:i=vb,serializeAttributes:s=yb,defaultAttributes:l={},selfClosing:a=!1,allowedAttributes:c}=n,u=t||e,d=h=>{if(!c)return h;const p={};return c.forEach(m=>{const g=typeof m=="string"?m:m.name,v=typeof m=="string"?void 0:m.skipIfDefault;if(g in h){const y=h[g];if(v!==void 0&&y===v)return;p[g]=y}}),p},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const m={...l,...h.attributes};if(a)return p.createNode(e,m);const g=o?o(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=a?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=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),v=h.match(g);if(!v)return;let y="",b="";if(a){const[,k]=v;b=k}else{const[,k,x]=v;b=k,y=x||""}const C=i(b.trim());return{type:e,raw:v[0],content:y.trim(),attributes:C}}},renderMarkdown:h=>{let p="";o?p=o(h):h.content&&h.content.length>0&&(p=h.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const m=d(h.attrs||{}),g=s(m),v=g?` ${g}`:"";return a?`[${u}${v}]`:`[${u}${v}]${p}[/${u}]`}}}function rl(n,e,t){var o,i,s,l;const a=n.split(`
|
|
95
|
+
`),c=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<a.length;){const h=a[d],p=h.match(e.itemPattern);if(!p){if(c.length>0)break;if(h.trim()===""){d+=1,u=`${u}${h}
|
|
96
|
+
`;continue}else return}const m=e.extractItemData(p),{indentLevel:g,mainContent:v}=m;u=`${u}${h}
|
|
97
|
+
`;const y=[v];for(d+=1;d<a.length;){const x=a[d];if(x.trim()===""){const M=a.slice(d+1).findIndex(X=>X.trim()!=="");if(M===-1)break;if((((i=(o=a[d+1+M].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:i.length)||0)>g){y.push(x),u=`${u}${x}
|
|
98
|
+
`,d+=1;continue}else break}if((((l=(s=x.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:l.length)||0)>g)y.push(x),u=`${u}${x}
|
|
99
|
+
`,d+=1;else break}let b;const C=y.slice(1);if(C.length>0){const x=C.map(S=>S.slice(g+f)).join(`
|
|
100
|
+
`);x.trim()&&(e.customNestedParser?b=e.customNestedParser(x):b=t.blockTokens(x))}const k=e.createToken(m,b);c.push(k)}if(c.length!==0)return{items:c,raw:u}}function jl(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(o):t,[s,...l]=n.content,a=e.renderChildren([s]),c=[`${i}${a}`];return l&&l.length>0&&l.forEach(u=>{const d=e.renderChildren([u]);if(d){const f=d.split(`
|
|
101
|
+
`).map(h=>h?e.indent(h):"").join(`
|
|
102
|
+
`);c.push(f)}}),c.join(`
|
|
103
|
+
`)}function bb(n,e,t={}){const{state:o}=e,{doc:i,tr:s}=o,l=n;i.descendants((a,c)=>{const u=s.mapping.map(c),d=s.mapping.map(c)+a.nodeSize;let f=null;if(a.marks.forEach(p=>{if(p!==l)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});s.removeMark(u,d,n.type),s.addMark(u,d,p)}}),s.docChanged&&e.view.dispatch(s)}var Rt=class af extends Fl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new af(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function co(n){return new nb({find:n.find,handler:({state:e,range:t,match:o,pasteEvent:i})=>{const s=We(n.getAttributes,void 0,o,i);if(s===!1||s===null)return null;const{tr:l}=e,a=o[o.length-1],c=o[0];let u=t.to;if(a){const d=c.search(/\S/),f=t.from+c.indexOf(a),h=f+a.length;if(_l(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(v=>v===n.type&&v!==m.mark.type)).filter(m=>m.to>f).length)return null;h<t.to&&l.delete(h,t.to),f>t.from&&l.delete(t.from+d,f),u=t.from+d+a.length,l.addMark(t.from+d,u,n.type.create(s||{})),l.removeStoredMark(n.type)}}})}function Rc(n){return r.customRef((e,t)=>({get(){return e(),n},set(o){n=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var xb=class extends db{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=Rc(this.view.state),this.reactiveExtensionStorage=Rc(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),r.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}},wb=r.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=r.ref(),t=r.getCurrentInstance();return r.watchEffect(()=>{const o=n.editor;o&&o.options.element&&e.value&&r.nextTick(()=>{var i;if(!e.value||!((i=o.view.dom)!=null&&i.parentNode))return;const s=r.unref(e.value);e.value.append(...o.view.dom.parentNode.childNodes),o.contentComponent=t.ctx._,t&&(o.appContext={...t.appContext,provides:t.provides}),o.setOptions({element:s}),o.createNodeViews()})}),r.onBeforeUnmount(()=>{const o=n.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return r.h("div",{ref:n=>{this.rootEl=n}})}});r.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return r.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});r.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return r.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 Cb=(n={})=>{const e=r.shallowRef();return r.onMounted(()=>{e.value=new xb(n)}),r.onBeforeUnmount(()=>{var t,o,i,s;const l=(o=(t=e.value)==null?void 0:t.view.dom)==null?void 0:o.parentNode,a=l?.cloneNode(!0);(i=l?.parentNode)==null||i.replaceChild(a,l),(s=e.value)==null||s.destroy()}),e};r.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return r.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var fi=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...o}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,o,t]},Eb=/^\s*>\s$/,Sb=Rt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return fi("blockquote",{...dt(this.options.HTMLAttributes,n),children:fi("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",o=[];return n.content.forEach(i=>{const a=e.renderChildren([i]).split(`
|
|
104
|
+
`).map(c=>c.trim()===""?t:`${t} ${c}`);o.push(a.join(`
|
|
105
|
+
`))}),o.join(`
|
|
106
|
+
${t}
|
|
107
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Vo({find:Eb,type:this.type})]}}),Mb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Tb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Nb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Bb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Ab=po.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return fi("strong",{...dt(this.options.HTMLAttributes,n),children:fi("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Do({find:Mb,type:this.type}),Do({find:Nb,type:this.type})]},addPasteRules(){return[co({find:Tb,type:this.type}),co({find:Bb,type:this.type})]}}),$b=/(^|[^`])`([^`]+)`(?!`)$/,Ob=/(^|[^`])`([^`]+)`(?!`)/g,Ib=po.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",dt(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Do({find:$b,type:this.type})]},addPasteRules(){return[co({find:Ob,type:this.type})]}}),Ts=4,Lb=/^```([a-z]+)?[\s\n]$/,Db=/^~~~([a-z]+)?[\s\n]$/,Vb=Rt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ts,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(l=>l.startsWith(t)).map(l=>l.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",dt(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let o="";const i=((t=n.attrs)==null?void 0:t.language)||"";return n.content?o=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(`
|
|
108
|
+
`):o=`\`\`\`${i}
|
|
109
|
+
|
|
110
|
+
\`\`\``,o},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Ts,{state:o}=n,{selection:i}=o,{$from:s,empty:l}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(t);return l?n.commands.insertContent(a):n.commands.command(({tr:c})=>{const{from:u,to:d}=i,p=o.doc.textBetween(u,d,`
|
|
111
|
+
`,`
|
|
112
|
+
`).split(`
|
|
113
|
+
`).map(m=>a+m).join(`
|
|
114
|
+
`);return c.replaceWith(u,d,o.schema.text(p)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Ts,{state:o}=n,{selection:i}=o,{$from:s,empty:l}=i;return s.parent.type!==this.type?!1:l?n.commands.command(({tr:a})=>{var c;const{pos:u}=s,d=s.start(),f=s.end(),p=o.doc.textBetween(d,f,`
|
|
115
|
+
`,`
|
|
116
|
+
`).split(`
|
|
117
|
+
`);let m=0,g=0;const v=u-d;for(let S=0;S<p.length;S+=1){if(g+p[S].length>=v){m=S;break}g+=p[S].length+1}const b=((c=p[m].match(/^ */))==null?void 0:c[0])||"",C=Math.min(b.length,t);if(C===0)return!0;let k=d;for(let S=0;S<m;S+=1)k+=p[S].length+1;return a.delete(k,k+C),u-k<=C&&a.setSelection(Oe.create(a.doc,k)),!0}):n.commands.command(({tr:a})=>{const{from:c,to:u}=i,h=o.doc.textBetween(c,u,`
|
|
118
|
+
`,`
|
|
119
|
+
`).split(`
|
|
120
|
+
`).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",v=Math.min(g.length,t);return p.slice(v)}).join(`
|
|
121
|
+
`);return a.replaceWith(c,u,o.schema.text(h)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:o,empty:i}=t;if(!i||o.parent.type!==this.type)return!1;const s=o.parentOffset===o.parent.nodeSize-2,l=o.parent.textContent.endsWith(`
|
|
122
|
+
|
|
123
|
+
`);return!s||!l?!1:n.chain().command(({tr:a})=>(a.delete(o.pos-2,o.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:o}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:o.nodeAt(a)?n.commands.command(({tr:u})=>(u.setSelection(Re.near(o.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[ol({find:Lb,type:this.type,getAttributes:n=>({language:n[1]})}),ol({find:Db,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ot({key:new ht("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),i=o?JSON.parse(o):void 0,s=i?.mode;if(!t||!s)return!1;const{tr:l,schema:a}=n.state,c=a.text(t.replace(/\r\n?/g,`
|
|
124
|
+
`));return l.replaceSelectionWith(this.type.create({language:s},c)),l.selection.$from.parent.type!==this.type&&l.setSelection(Oe.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),n.dispatch(l),!0}}})]}}),Rb=Rt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
125
|
+
|
|
126
|
+
`):""}),zb=Rt.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",dt(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
127
|
+
`},renderMarkdown:()=>`
|
|
128
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:o})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:a}=o.extensionManager,c=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&c&&l){const f=c.filter(h=>a.includes(h.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),cf=Rt.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]}`,dt(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 o=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(o);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=>ol({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),Pb=cf,Hb=Rt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",dt(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!hb(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:o}=t,i=n();return qd(t)?i.insertContentAt(o.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:l,dispatch:a})=>{if(a){const{$to:c}=l.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?l.setSelection(Oe.create(l.doc,c.pos+1)):c.nodeAfter.isBlock?l.setSelection(Te.create(l.doc,c.pos)):l.setSelection(Oe.create(l.doc,c.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,f=d?.create();f&&(l.insert(u,f),l.setSelection(Oe.create(l.doc,u+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[fb({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),_b=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Fb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Ub=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,qb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,jb=po.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",dt(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[Do({find:_b,type:this.type}),Do({find:Ub,type:this.type})]},addPasteRules(){return[co({find:Fb,type:this.type}),co({find:qb,type:this.type})]}});const Wb="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Kb="ελ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",il="numeric",sl="ascii",ll="alpha",ar="asciinumeric",nr="alphanumeric",al="domain",uf="emoji",Gb="scheme",Jb="slashscheme",Ns="whitespace";function Yb(n,e){return n in e||(e[n]=[]),e[n]}function Qn(n,e,t){e[il]&&(e[ar]=!0,e[nr]=!0),e[sl]&&(e[ar]=!0,e[ll]=!0),e[ar]&&(e[nr]=!0),e[ll]&&(e[nr]=!0),e[nr]&&(e[al]=!0),e[uf]&&(e[al]=!0);for(const o in e){const i=Yb(o,t);i.indexOf(n)<0&&i.push(n)}}function Xb(n,e){const t={};for(const o in e)e[o].indexOf(n)>=0&&(t[o]=!0);return t}function It(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}It.groups={};It.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let o=0;o<e.jr.length;o++){const i=e.jr[o][0],s=e.jr[o][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,o){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,o)},tr(n,e,t,o){o=o||It.groups;let i;return e&&e.j?i=e:(i=new It(e),t&&o&&Qn(e,t,o)),this.jr.push([n,i]),i},ts(n,e,t,o){let i=this;const s=n.length;if(!s)return i;for(let l=0;l<s-1;l++)i=i.tt(n[l]);return i.tt(n[s-1],e,t,o)},tt(n,e,t,o){o=o||It.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let l,a=i.go(n);if(a?(l=new It,Object.assign(l.j,a.j),l.jr.push.apply(l.jr,a.jr),l.jd=a.jd,l.t=a.t):l=new It,s){if(o)if(l.t&&typeof l.t=="string"){const c=Object.assign(Xb(l.t,o),t);Qn(s,c,o)}else t&&Qn(s,t,o);l.t=s}return i.j[n]=l,l}};const Ve=(n,e,t,o,i)=>n.ta(e,t,o,i),rt=(n,e,t,o,i)=>n.tr(e,t,o,i),zc=(n,e,t,o,i)=>n.ts(e,t,o,i),ne=(n,e,t,o,i)=>n.tt(e,t,o,i),pn="WORD",cl="UWORD",df="ASCIINUMERICAL",ff="ALPHANUMERICAL",Er="LOCALHOST",ul="TLD",dl="UTLD",Xr="SCHEME",Eo="SLASH_SCHEME",Wl="NUM",fl="WS",Kl="NL",cr="OPENBRACE",ur="CLOSEBRACE",hi="OPENBRACKET",pi="CLOSEBRACKET",mi="OPENPAREN",gi="CLOSEPAREN",vi="OPENANGLEBRACKET",yi="CLOSEANGLEBRACKET",ki="FULLWIDTHLEFTPAREN",bi="FULLWIDTHRIGHTPAREN",xi="LEFTCORNERBRACKET",wi="RIGHTCORNERBRACKET",Ci="LEFTWHITECORNERBRACKET",Ei="RIGHTWHITECORNERBRACKET",Si="FULLWIDTHLESSTHAN",Mi="FULLWIDTHGREATERTHAN",Ti="AMPERSAND",Ni="APOSTROPHE",Bi="ASTERISK",Bn="AT",Ai="BACKSLASH",$i="BACKTICK",Oi="CARET",On="COLON",Gl="COMMA",Ii="DOLLAR",en="DOT",Li="EQUALS",Jl="EXCLAMATION",Ft="HYPHEN",dr="PERCENT",Di="PIPE",Vi="PLUS",Ri="POUND",fr="QUERY",Yl="QUOTE",hf="FULLWIDTHMIDDLEDOT",Xl="SEMI",tn="SLASH",hr="TILDE",zi="UNDERSCORE",pf="EMOJI",Pi="SYM";var mf=Object.freeze({__proto__:null,ALPHANUMERICAL:ff,AMPERSAND:Ti,APOSTROPHE:Ni,ASCIINUMERICAL:df,ASTERISK:Bi,AT:Bn,BACKSLASH:Ai,BACKTICK:$i,CARET:Oi,CLOSEANGLEBRACKET:yi,CLOSEBRACE:ur,CLOSEBRACKET:pi,CLOSEPAREN:gi,COLON:On,COMMA:Gl,DOLLAR:Ii,DOT:en,EMOJI:pf,EQUALS:Li,EXCLAMATION:Jl,FULLWIDTHGREATERTHAN:Mi,FULLWIDTHLEFTPAREN:ki,FULLWIDTHLESSTHAN:Si,FULLWIDTHMIDDLEDOT:hf,FULLWIDTHRIGHTPAREN:bi,HYPHEN:Ft,LEFTCORNERBRACKET:xi,LEFTWHITECORNERBRACKET:Ci,LOCALHOST:Er,NL:Kl,NUM:Wl,OPENANGLEBRACKET:vi,OPENBRACE:cr,OPENBRACKET:hi,OPENPAREN:mi,PERCENT:dr,PIPE:Di,PLUS:Vi,POUND:Ri,QUERY:fr,QUOTE:Yl,RIGHTCORNERBRACKET:wi,RIGHTWHITECORNERBRACKET:Ei,SCHEME:Xr,SEMI:Xl,SLASH:tn,SLASH_SCHEME:Eo,SYM:Pi,TILDE:hr,TLD:ul,UNDERSCORE:zi,UTLD:dl,UWORD:cl,WORD:pn,WS:fl});const dn=/[a-z]/,Jo=new RegExp("\\p{L}","u"),Bs=new RegExp("\\p{Emoji}","u"),fn=/\d/,As=/\s/,Pc="\r",$s=`
|
|
129
|
+
`,Zb="️",Qb="",Os="";let Ur=null,qr=null;function e1(n=[]){const e={};It.groups=e;const t=new It;Ur==null&&(Ur=Hc(Wb)),qr==null&&(qr=Hc(Kb)),ne(t,"'",Ni),ne(t,"{",cr),ne(t,"}",ur),ne(t,"[",hi),ne(t,"]",pi),ne(t,"(",mi),ne(t,")",gi),ne(t,"<",vi),ne(t,">",yi),ne(t,"(",ki),ne(t,")",bi),ne(t,"「",xi),ne(t,"」",wi),ne(t,"『",Ci),ne(t,"』",Ei),ne(t,"<",Si),ne(t,">",Mi),ne(t,"&",Ti),ne(t,"*",Bi),ne(t,"@",Bn),ne(t,"`",$i),ne(t,"^",Oi),ne(t,":",On),ne(t,",",Gl),ne(t,"$",Ii),ne(t,".",en),ne(t,"=",Li),ne(t,"!",Jl),ne(t,"-",Ft),ne(t,"%",dr),ne(t,"|",Di),ne(t,"+",Vi),ne(t,"#",Ri),ne(t,"?",fr),ne(t,'"',Yl),ne(t,"/",tn),ne(t,";",Xl),ne(t,"~",hr),ne(t,"_",zi),ne(t,"\\",Ai),ne(t,"・",hf);const o=rt(t,fn,Wl,{[il]:!0});rt(o,fn,o);const i=rt(o,dn,df,{[ar]:!0}),s=rt(o,Jo,ff,{[nr]:!0}),l=rt(t,dn,pn,{[sl]:!0});rt(l,fn,i),rt(l,dn,l),rt(i,fn,i),rt(i,dn,i);const a=rt(t,Jo,cl,{[ll]:!0});rt(a,dn),rt(a,fn,s),rt(a,Jo,a),rt(s,fn,s),rt(s,dn),rt(s,Jo,s);const c=ne(t,$s,Kl,{[Ns]:!0}),u=ne(t,Pc,fl,{[Ns]:!0}),d=rt(t,As,fl,{[Ns]:!0});ne(t,Os,d),ne(u,$s,c),ne(u,Os,d),rt(u,As,d),ne(d,Pc),ne(d,$s),rt(d,As,d),ne(d,Os,d);const f=rt(t,Bs,pf,{[uf]:!0});ne(f,"#"),rt(f,Bs,f),ne(f,Zb,f);const h=ne(f,Qb);ne(h,"#"),rt(h,Bs,f);const p=[[dn,l],[fn,i]],m=[[dn,null],[Jo,a],[fn,s]];for(let g=0;g<Ur.length;g++)Sn(t,Ur[g],ul,pn,p);for(let g=0;g<qr.length;g++)Sn(t,qr[g],dl,cl,m);Qn(ul,{tld:!0,ascii:!0},e),Qn(dl,{utld:!0,alpha:!0},e),Sn(t,"file",Xr,pn,p),Sn(t,"mailto",Xr,pn,p),Sn(t,"http",Eo,pn,p),Sn(t,"https",Eo,pn,p),Sn(t,"ftp",Eo,pn,p),Sn(t,"ftps",Eo,pn,p),Qn(Xr,{scheme:!0,ascii:!0},e),Qn(Eo,{slashscheme:!0,ascii:!0},e),n=n.sort((g,v)=>g[0]>v[0]?1:-1);for(let g=0;g<n.length;g++){const v=n[g][0],b=n[g][1]?{[Gb]:!0}:{[Jb]:!0};v.indexOf("-")>=0?b[al]=!0:dn.test(v)?fn.test(v)?b[ar]=!0:b[sl]=!0:b[il]=!0,zc(t,v,v,b)}return zc(t,"localhost",Er,{ascii:!0}),t.jd=new It(Pi),{start:t,tokens:Object.assign({groups:e},mf)}}function gf(n,e){const t=t1(e.replace(/[A-Z]/g,a=>a.toLowerCase())),o=t.length,i=[];let s=0,l=0;for(;l<o;){let a=n,c=null,u=0,d=null,f=-1,h=-1;for(;l<o&&(c=a.go(t[l]));)a=c,a.accepts()?(f=0,h=0,d=a):f>=0&&(f+=t[l].length,h++),u+=t[l].length,s+=t[l].length,l++;s-=f,l-=h,u-=f,i.push({t:d.t,v:e.slice(s-u,s),s:s-u,e:s})}return i}function t1(n){const e=[],t=n.length;let o=0;for(;o<t;){let i=n.charCodeAt(o),s,l=i<55296||i>56319||o+1===t||(s=n.charCodeAt(o+1))<56320||s>57343?n[o]:n.slice(o,o+2);e.push(l),o+=l.length}return e}function Sn(n,e,t,o,i){let s;const l=e.length;for(let a=0;a<l-1;a++){const c=e[a];n.j[c]?s=n.j[c]:(s=new It(o),s.jr=i.slice(),n.j[c]=s),n=s}return s=new It(t),s.jr=i.slice(),n.j[e[l-1]]=s,s}function Hc(n){const e=[],t=[];let o=0,i="0123456789";for(;o<n.length;){let s=0;for(;i.indexOf(n[o+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let l=parseInt(n.substring(o,o+s),10);l>0;l--)t.pop();o+=s}else t.push(n[o]),o++}return e}const Sr={defaultProtocol:"http",events:null,format:_c,formatHref:_c,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Zl(n,e=null){let t=Object.assign({},Sr);n&&(t=Object.assign(t,n instanceof Zl?n.o:n));const o=t.ignoreTags,i=[];for(let s=0;s<o.length;s++)i.push(o[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Zl.prototype={o:Sr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const o=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Sr[n],typeof i=="function"&&o&&(i=i(e,t))):typeof i=="function"&&o&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let o=this.o[n];return typeof o=="function"&&e!=null&&(o=o(e,t.t,t)),o},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function _c(n){return n}function vf(n,e){this.t="token",this.v=n,this.tk=e}vf.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),o=n.get("format",e,this);return t&&o.length>t?o.substring(0,t)+"…":o},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=Sr.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")),o=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),l={},a=n.get("className",t,e),c=n.get("target",t,e),u=n.get("rel",t,e),d=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return l.href=o,a&&(l.class=a),c&&(l.target=c),u&&(l.rel=u),d&&Object.assign(l,d),{tagName:i,attributes:l,content:s,eventListeners:f}}};function is(n,e){class t extends vf{constructor(i,s){super(i,s),this.t=n}}for(const o in e)t.prototype[o]=e[o];return t.t=n,t}const Fc=is("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Uc=is("text"),n1=is("nl"),jr=is("url",{isLink:!0,toHref(n=Sr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Er&&n[1].t===On}}),Pt=n=>new It(n);function o1({groups:n}){const e=n.domain.concat([Ti,Bi,Bn,Ai,$i,Oi,Ii,Li,Ft,Wl,dr,Di,Vi,Ri,tn,Pi,hr,zi]),t=[Ni,On,Gl,en,Jl,dr,fr,Yl,Xl,vi,yi,cr,ur,pi,hi,mi,gi,ki,bi,xi,wi,Ci,Ei,Si,Mi],o=[Ti,Ni,Bi,Ai,$i,Oi,Ii,Li,Ft,cr,ur,dr,Di,Vi,Ri,fr,tn,Pi,hr,zi],i=Pt(),s=ne(i,hr);Ve(s,o,s),Ve(s,n.domain,s);const l=Pt(),a=Pt(),c=Pt();Ve(i,n.domain,l),Ve(i,n.scheme,a),Ve(i,n.slashscheme,c),Ve(l,o,s),Ve(l,n.domain,l);const u=ne(l,Bn);ne(s,Bn,u),ne(a,Bn,u),ne(c,Bn,u);const d=ne(s,en);Ve(d,o,s),Ve(d,n.domain,s);const f=Pt();Ve(u,n.domain,f),Ve(f,n.domain,f);const h=ne(f,en);Ve(h,n.domain,f);const p=Pt(Fc);Ve(h,n.tld,p),Ve(h,n.utld,p),ne(u,Er,p);const m=ne(f,Ft);ne(m,Ft,m),Ve(m,n.domain,f),Ve(p,n.domain,f),ne(p,en,h),ne(p,Ft,m);const g=ne(p,On);Ve(g,n.numeric,Fc);const v=ne(l,Ft),y=ne(l,en);ne(v,Ft,v),Ve(v,n.domain,l),Ve(y,o,s),Ve(y,n.domain,l);const b=Pt(jr);Ve(y,n.tld,b),Ve(y,n.utld,b),Ve(b,n.domain,l),Ve(b,o,s),ne(b,en,y),ne(b,Ft,v),ne(b,Bn,u);const C=ne(b,On),k=Pt(jr);Ve(C,n.numeric,k);const x=Pt(jr),S=Pt();Ve(x,e,x),Ve(x,t,S),Ve(S,e,x),Ve(S,t,S),ne(b,tn,x),ne(k,tn,x);const M=ne(a,On),L=ne(c,On),R=ne(L,tn),X=ne(R,tn);Ve(a,n.domain,l),ne(a,en,y),ne(a,Ft,v),Ve(c,n.domain,l),ne(c,en,y),ne(c,Ft,v),Ve(M,n.domain,x),ne(M,tn,x),ne(M,fr,x),Ve(X,n.domain,x),Ve(X,e,x),ne(X,tn,x);const ve=[[cr,ur],[hi,pi],[mi,gi],[vi,yi],[ki,bi],[xi,wi],[Ci,Ei],[Si,Mi]];for(let fe=0;fe<ve.length;fe++){const[Se,xe]=ve[fe],U=ne(x,Se);ne(S,Se,U),ne(U,xe,x);const ee=Pt(jr);Ve(U,e,ee);const ce=Pt();Ve(U,t),Ve(ee,e,ee),Ve(ee,t,ce),Ve(ce,e,ee),Ve(ce,t,ce),ne(ee,xe,x),ne(ce,xe,x)}return ne(i,Er,b),ne(i,Kl,n1),{start:i,tokens:mf}}function r1(n,e,t){let o=t.length,i=0,s=[],l=[];for(;i<o;){let a=n,c=null,u=null,d=0,f=null,h=-1;for(;i<o&&!(c=a.go(t[i].t));)l.push(t[i++]);for(;i<o&&(u=c||a.go(t[i].t));)c=null,a=u,a.accepts()?(h=0,f=a):h>=0&&h++,i++,d++;if(h<0)i-=d,i<o&&(l.push(t[i]),i++);else{l.length>0&&(s.push(Is(Uc,e,l)),l=[]),i-=h,d-=h;const p=f.t,m=t.slice(i-d,i);s.push(Is(p,e,m))}}return l.length>0&&s.push(Is(Uc,e,l)),s}function Is(n,e,t){const o=t[0].s,i=t[t.length-1].e,s=e.slice(o,i);return new n(s,t)}const i1=typeof console<"u"&&console&&console.warn||(()=>{}),s1="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ze={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function l1(){return It.groups={},Ze.scanner=null,Ze.parser=null,Ze.tokenQueue=[],Ze.pluginQueue=[],Ze.customSchemes=[],Ze.initialized=!1,Ze}function qc(n,e=!1){if(Ze.initialized&&i1(`linkifyjs: already initialized - will not register custom scheme "${n}" ${s1}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
130
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
131
|
+
2. Cannot start or end with "-"
|
|
132
|
+
3. "-" cannot repeat`);Ze.customSchemes.push([n,e])}function a1(){Ze.scanner=e1(Ze.customSchemes);for(let n=0;n<Ze.tokenQueue.length;n++)Ze.tokenQueue[n][1]({scanner:Ze.scanner});Ze.parser=o1(Ze.scanner.tokens);for(let n=0;n<Ze.pluginQueue.length;n++)Ze.pluginQueue[n][1]({scanner:Ze.scanner,parser:Ze.parser});return Ze.initialized=!0,Ze}function Ql(n){return Ze.initialized||a1(),r1(Ze.parser.start,n,gf(Ze.scanner.start,n))}Ql.scan=gf;function yf(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 o=new Zl(t),i=Ql(n),s=[];for(let l=0;l<i.length;l++){const a=i[l];a.isLink&&(!e||a.t===e)&&o.check(a)&&s.push(a.toFormattedObject(o))}return s}var ea="[\0- -\u2029 ]",c1=new RegExp(ea),u1=new RegExp(`${ea}$`),d1=new RegExp(ea,"g");function f1(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function h1(n){return new ot({key:new ht("autolink"),appendTransaction:(e,t,o)=>{const i=e.some(u=>u.docChanged)&&!t.doc.eq(o.doc),s=e.some(u=>u.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=o,a=Vd(t.doc,[...e]);if(Ud(a).forEach(({newRange:u})=>{const d=hk(o.doc,u,p=>p.isTextblock);let f,h;if(d.length>1)f=d[0],h=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const p=o.doc.textBetween(u.from,u.to," "," ");if(!u1.test(p))return;f=d[0],h=o.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&h){const p=h.split(c1).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 v=Ql(m).map(y=>y.toObject(n.defaultProtocol));if(!f1(v))return!1;v.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>o.schema.marks.code?!o.doc.rangeHasMark(y.from,y.to,o.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{_l(y.from,y.to,o.doc).some(b=>b.mark.type===n.type)||l.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!l.steps.length)return l}})}function p1(n){return new ot({key:new ht("handleClickLink"),props:{handleClick:(e,t,o)=>{var i,s;if(o.button!==0||!e.editable)return!1;let l=null;if(o.target instanceof HTMLAnchorElement)l=o.target;else{const c=o.target;if(!c)return!1;const u=n.editor.view.dom;l=c.closest("a"),l&&!u.contains(l)&&(l=null)}if(!l)return!1;let a=!1;if(n.enableClickSelection&&(a=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const c=Fd(e.state,n.type.name),u=(i=l.href)!=null?i:c.href,d=(s=l.target)!=null?s:c.target;u&&(window.open(u,d),a=!0)}return a}}})}function m1(n){return new ot({key:new ht("handlePasteLink"),props:{handlePaste:(e,t,o)=>{const{shouldAutoLink:i}=n,{state:s}=e,{selection:l}=s,{empty:a}=l;if(a)return!1;let c="";o.content.forEach(d=>{c+=d.textContent});const u=yf(c,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!u||i!==void 0&&!i(u.value)?!1:n.editor.commands.setMark(n.type,{href:u.href})}}})}function Gn(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const i=typeof o=="string"?o:o.scheme;i&&t.push(i)}),!n||n.replace(d1,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var g1=po.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"){qc(n);return}qc(n.scheme,n.optionalSlashes)})},onDestroy(){l1()},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)=>!!Gn(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},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Gn(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=>!!Gn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",dt(this.options.HTMLAttributes,n),0]:["a",dt(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,o,i,s;const l=(o=(t=n.attrs)==null?void 0:t.href)!=null?o:"",a=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"",c=e.renderChildren(n);return a?`[${c}](${l} "${a}")`:`[${c}](${l})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:o=>!!Gn(o,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:o=>!!Gn(o,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[co({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:o}=this.options,i=yf(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!Gn(l,t),protocols:t,defaultProtocol:o}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.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(h1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:i=>!!Gn(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(p1({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(m1({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),v1=Object.defineProperty,y1=(n,e)=>{for(var t in e)v1(n,t,{get:e[t],enumerable:!0})},k1="listItem",jc="textStyle",Wc=/^\s*([-+*])\s$/,kf=Rt.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",dt(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
133
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(k1,this.editor.getAttributes(jc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Vo({find:Wc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Vo({find:Wc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(jc),editor:this.editor})),[n]}}),bf=Rt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",dt(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 l=n.tokens.slice(1),a=e.parseChildren(l);t.push(...a)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>jl(n,e,o=>{var i,s;return o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${(((s=(i=o.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+o.index}. `:"- "},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)}}}),b1={};y1(b1,{findListItemPos:()=>$r,getNextListDepth:()=>ta,handleBackspace:()=>hl,handleDelete:()=>pl,hasListBefore:()=>xf,hasListItemAfter:()=>x1,hasListItemBefore:()=>wf,listItemHasSubList:()=>Cf,nextListIsDeeper:()=>Ef,nextListIsHigher:()=>Sf});var $r=(n,e)=>{const{$from:t}=e.selection,o=ut(n,e.schema);let i=null,s=t.depth,l=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===o?a=s:(s-=1,l-=1);return a===null?null:{$pos:e.doc.resolve(l),depth:a}},ta=(n,e)=>{const t=$r(n,e);if(!t)return!1;const[,o]=Ck(e,n,t.$pos.pos+4);return o},xf=(n,e,t)=>{const{$anchor:o}=n.selection,i=Math.max(0,o.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},wf=(n,e)=>{var t;const{$anchor:o}=e.selection,i=e.doc.resolve(o.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},Cf=(n,e,t)=>{if(!t)return!1;const o=ut(n,e.schema);let i=!1;return t.descendants(s=>{s.type===o&&(i=!0)}),i},hl=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!_n(n.state,e)&&xf(n.state,e,t)){const{$anchor:a}=n.state.selection,c=n.state.doc.resolve(a.before()-1),u=[];c.node().descendants((h,p)=>{h.type.name===e&&u.push({node:h,pos:p})});const d=u.at(-1);if(!d)return!1;const f=n.state.doc.resolve(c.start()+d.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},f.end()).joinForward().run()}if(!_n(n.state,e)||!Tk(n.state))return!1;const o=$r(e,n.state);if(!o)return!1;const s=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),l=Cf(e,n.state,s);return wf(e,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Ef=(n,e)=>{const t=ta(n,e),o=$r(n,e);return!o||!t?!1:t>o.depth},Sf=(n,e)=>{const t=ta(n,e),o=$r(n,e);return!o||!t?!1:t<o.depth},pl=(n,e)=>{if(!_n(n.state,e)||!Mk(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:i}=t;return!t.empty&&o.sameParent(i)?!1:Ef(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Sf(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},x1=(n,e)=>{var t;const{$anchor:o}=e.selection,i=e.doc.resolve(o.pos-o.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},Mf=st.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&&pl(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&&pl(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&hl(n,t,o)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&hl(n,t,o)&&(e=!0)}),e}}}}),Kc=/^(\s*)(\d+)\.\s+(.*)$/,w1=/^\s/;function C1(n){const e=[];let t=0,o=0;for(;t<n.length;){const i=n[t],s=i.match(Kc);if(!s)break;const[,l,a,c]=s,u=l.length;let d=c,f=t+1;const h=[i];for(;f<n.length;){const p=n[f];if(p.match(Kc))break;if(p.trim()==="")h.push(p),d+=`
|
|
134
|
+
`,f+=1;else if(p.match(w1))h.push(p),d+=`
|
|
135
|
+
${p.slice(u+2)}`,f+=1;else break}e.push({indent:u,number:parseInt(a,10),content:d.trim(),raw:h.join(`
|
|
136
|
+
`)}),o=f,t=f}return[e,o]}function Tf(n,e,t){var o;const i=[];let s=0;for(;s<n.length;){const l=n[s];if(l.indent===e){const a=l.content.split(`
|
|
137
|
+
`),c=((o=a[0])==null?void 0:o.trim())||"",u=[];c&&u.push({type:"paragraph",raw:c,tokens:t.inlineTokens(c)});const d=a.slice(1).join(`
|
|
138
|
+
`).trim();if(d){const p=t.blockTokens(d);u.push(...p)}let f=s+1;const h=[];for(;f<n.length&&n[f].indent>e;)h.push(n[f]),f+=1;if(h.length>0){const p=Math.min(...h.map(g=>g.indent)),m=Tf(h,p,t);u.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(g=>g.raw).join(`
|
|
139
|
+
`)})}i.push({type:"list_item",raw:l.raw,tokens:u}),s=f}else s+=1}return i}function E1(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const o=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")o.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);o.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&o.push(...s)}}),{type:"listItem",content:o}})}var S1="listItem",Gc="textStyle",Jc=/^(\d+)\.\s$/,Nf=Rt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",dt(this.options.HTMLAttributes,t),0]:["ol",dt(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,o=n.items?E1(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:o}:{type:"orderedList",content:o}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
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 o;const i=n.split(`
|
|
141
|
+
`),[s,l]=C1(i);if(s.length===0)return;const a=Tf(s,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((o=s[0])==null?void 0:o.number)||1,items:a,raw:i.slice(0,l).join(`
|
|
142
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(S1,this.editor.getAttributes(Gc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Vo({find:Jc,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=Vo({find:Jc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Gc)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),M1=/^\s*(\[([( |x])?\])\s$/,T1=Rt.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",dt(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 o=e.parseChildren(n.nestedTokens);t.push(...o)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return jl(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:o})=>{const i=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div"),u=f=>{var h,p;a.ariaLabel=((p=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:p.call(h,f,a.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};u(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:h}=f.target;o.isEditable&&typeof t=="function"&&o.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(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,h)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,h])=>{i.setAttribute(f,h)}),i.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,l),i.append(s,c),Object.entries(e).forEach(([f,h])=>{i.setAttribute(f,h)});let d=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,a.checked=f.attrs.checked,u(f);const h=o.extensionManager.attributes,p=Cr(f,h),m=new Set(Object.keys(p)),g=this.options.HTMLAttributes;return d.forEach(v=>{m.has(v)||(v in g?i.setAttribute(v,g[v]):i.removeAttribute(v))}),Object.entries(p).forEach(([v,y])=>{y==null?v in g?i.setAttribute(v,g[v]):i.removeAttribute(v):i.setAttribute(v,y)}),d=m,!0}}}},addInputRules(){return[Vo({find:M1,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),N1=Rt.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",dt(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 o=s=>{const l=rl(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,c)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:c}),customNestedParser:o},t);return l?[{type:"taskList",raw:l.raw,items:l.items}]:t.blockTokens(s)},i=rl(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,l)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:l}),customNestedParser:o},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()}}});st.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(kf.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(bf.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Mf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Nf.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(T1.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(N1.configure(this.options.taskList)),n}});var Yc=" ",B1=" ",A1=Rt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",dt(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const o=e.parseInline(t);return o.length===1&&o[0].type==="text"&&(o[0].text===Yc||o[0].text===B1)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,o)},renderMarkdown:(n,e)=>{if(!n)return"";const t=Array.isArray(n.content)?n.content:[];return t.length===0?Yc:e.renderChildren(t)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),$1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,O1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,I1=po.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",dt(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[Do({find:$1,type:this.type})]},addPasteRules(){return[co({find:O1,type:this.type})]}}),L1=Rt.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Bf=po.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",dt(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 s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:t.inlineTokens(s)}}},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()}}}),D1=Bf;function V1(n={}){return new ot({view(e){return new R1(e,n)}})}class R1{constructor(e,t){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=t.width)!==null&&o!==void 0?o:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=l=>{this[i](l)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}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,o,i=this.editorView.dom,s=i.getBoundingClientRect(),l=s.width/i.offsetWidth,a=s.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 v=this.width/2*a;o={left:m.left,right:m.right,top:g-v,bottom:g+v}}}}if(!o){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*l;o={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 u,d;if(!c||c==document.body&&getComputedStyle(c).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=c.getBoundingClientRect(),h=f.width/c.offsetWidth,p=f.height/c.offsetHeight;u=f.left-c.scrollLeft*h,d=f.top-c.scrollTop*p}this.element.style.left=(o.left-u)/l+"px",this.element.style.top=(o.top-d)/a+"px",this.element.style.width=(o.right-o.left)/l+"px",this.element.style.height=(o.bottom-o.top)/a+"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}),o=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=o&&o.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let l=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Iu(this.editorView.state.doc,l,this.editorView.dragging.slice);a!=null&&(l=a)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class it extends Re{constructor(e){super(e,e)}map(e,t){let o=e.resolve(t.map(this.head));return it.valid(o)?new it(o):Re.near(o)}content(){return pe.empty}eq(e){return e instanceof it&&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 it(e.resolve(t.pos))}getBookmark(){return new na(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!z1(e)||!P1(e))return!1;let o=t.type.spec.allowGapCursor;if(o!=null)return o;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,o=!1){e:for(;;){if(!o&&it.valid(e))return e;let i=e.pos,s=null;for(let l=e.depth;;l--){let a=e.node(l);if(t>0?e.indexAfter(l)<a.childCount:e.index(l)>0){s=a.child(t>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;i+=t;let c=e.doc.resolve(i);if(it.valid(c))return c}for(;;){let l=t>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Te.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),o=!1;continue e}break}s=l,i+=t;let a=e.doc.resolve(i);if(it.valid(a))return a}return null}}}it.prototype.visible=!1;it.findFrom=it.findGapCursorFrom;Re.jsonID("gapcursor",it);class na{constructor(e){this.pos=e}map(e){return new na(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return it.valid(t)?new it(t):Re.near(t)}}function Af(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function z1(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),o=n.node(e);if(t==0){if(o.type.spec.isolating)return!0;continue}for(let i=o.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Af(i.type))return!0;if(i.inlineContent)return!1}}return!0}function P1(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),o=n.node(e);if(t==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let i=o.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Af(i.type))return!0;if(i.inlineContent)return!1}}return!0}function H1(){return new ot({props:{decorations:q1,createSelectionBetween(n,e,t){return e.pos==t.pos&&it.valid(t)?new it(t):null},handleClick:F1,handleKeyDown:_1,handleDOMEvents:{beforeinput:U1}}})}const _1=Nd({ArrowLeft:Wr("horiz",-1),ArrowRight:Wr("horiz",1),ArrowUp:Wr("vert",-1),ArrowDown:Wr("vert",1)});function Wr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,i,s){let l=o.selection,a=e>0?l.$to:l.$from,c=l.empty;if(l instanceof Oe){if(!s.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=o.doc.resolve(e>0?a.after():a.before())}let u=it.findGapCursorFrom(a,e,c);return u?(i&&i(o.tr.setSelection(new it(u))),!0):!1}}function F1(n,e,t){if(!n||!n.editable)return!1;let o=n.state.doc.resolve(e);if(!it.valid(o))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&Te.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new it(o))),!0)}function U1(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof it))return!1;let{$from:t}=n.state.selection,o=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!o)return!1;let i=G.empty;for(let l=o.length-1;l>=0;l--)i=G.from(o[l].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new pe(i,0,0));return s.setSelection(Oe.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function q1(n){if(!(n.selection instanceof it))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",nt.create(n.doc,[Bt.widget(n.selection.head,e,{key:"gapcursor"})])}var Hi=200,xt=function(){};xt.prototype.append=function(e){return e.length?(e=xt.from(e),!this.length&&e||e.length<Hi&&this.leafAppend(e)||this.length<Hi&&e.leafPrepend(this)||this.appendInner(e)):this};xt.prototype.prepend=function(e){return e.length?xt.from(e).append(this):this};xt.prototype.appendInner=function(e){return new j1(this,e)};xt.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?xt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};xt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};xt.prototype.forEach=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length),t<=o?this.forEachInner(e,t,o,0):this.forEachInvertedInner(e,t,o,0)};xt.prototype.map=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length);var i=[];return this.forEach(function(s,l){return i.push(e(s,l))},t,o),i};xt.from=function(e){return e instanceof xt?e:e&&e.length?new $f(e):xt.empty};var $f=(function(n){function e(o){n.call(this),this.values=o}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,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,l,a){for(var c=s;c<l;c++)if(i(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,l,a){for(var c=s-1;c>=l;c--)if(i(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Hi)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Hi)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})(xt);xt.empty=new $f([]);var j1=(function(n){function e(t,o){n.call(this),this.left=t,this.right=o,this.length=t.length+o.length,this.depth=Math.max(t.depth,o.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(o){return o<this.left.length?this.left.get(o):this.right.get(o-this.left.length)},e.prototype.forEachInner=function(o,i,s,l){var a=this.left.length;if(i<a&&this.left.forEachInner(o,i,Math.min(s,a),l)===!1||s>a&&this.right.forEachInner(o,Math.max(i-a,0),Math.min(this.length,s)-a,l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(o,i-a,Math.max(s,a)-a,l+a)===!1||s<a&&this.left.forEachInvertedInner(o,Math.min(i,a),s,l)===!1)return!1},e.prototype.sliceInner=function(o,i){if(o==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(o,i):o>=s?this.right.slice(o-s,i-s):this.left.slice(o,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(o){var i=this.right.leafAppend(o);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(o){var i=this.left.leafPrepend(o);if(i)return new e(i,this.right)},e.prototype.appendInner=function(o){return this.left.depth>=Math.max(this.right.depth,o.depth)+1?new e(this.left,new e(this.right,o)):new e(this,o)},e})(xt);const Of=xt,W1=500;class Kt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let i,s;t&&(i=this.remapping(o,this.items.length),s=i.maps.length);let l=e.tr,a,c,u=[],d=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(o,h+1),s=i.maps.length),s--,d.push(f);return}if(i){d.push(new nn(f.map));let p=f.step.map(i.slice(s)),m;p&&l.maybeStep(p).doc&&(m=l.mapping.maps[l.mapping.maps.length-1],u.push(new nn(m,void 0,void 0,u.length+d.length))),s--,m&&i.appendMap(m,s)}else l.maybeStep(f.step);if(f.selection)return a=i?f.selection.map(i.slice(s)):f.selection,c=new Kt(this.items.slice(0,o).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:l,selection:a}}addTransform(e,t,o,i){let s=[],l=this.eventCount,a=this.items,c=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),h=new nn(e.mapping.maps[d],f,t),p;(p=c&&c.merge(h))&&(h=p,d?s.pop():a=a.slice(0,a.length-1)),s.push(h),t&&(l++,t=void 0),i||(c=h)}let u=l-o.depth;return u>G1&&(a=K1(a,u),l-=u),new Kt(a.append(s),l)}remapping(e,t){let o=new vr;return this.items.forEach((i,s)=>{let l=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?o.maps.length-i.mirrorOffset:void 0;o.appendMap(i.map,l)},e,t),o}addMaps(e){return this.eventCount==0?this:new Kt(this.items.append(e.map(t=>new nn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let o=[],i=Math.max(0,this.items.length-t),s=e.mapping,l=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let c=t;this.items.forEach(h=>{let p=s.getMirror(--c);if(p==null)return;l=Math.min(l,p);let m=s.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),v=h.selection&&h.selection.map(s.slice(c+1,p));v&&a++,o.push(new nn(m,g,v))}else o.push(new nn(m))},i);let u=[];for(let h=t;h<l;h++)u.push(new nn(s.maps[h]));let d=this.items.slice(0,i).append(u).append(o),f=new Kt(d,a);return f.emptyItemCount()>W1&&(f=f.compress(this.items.length-o.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),o=t.maps.length,i=[],s=0;return this.items.forEach((l,a)=>{if(a>=e)i.push(l),l.selection&&s++;else if(l.step){let c=l.step.map(t.slice(o)),u=c&&c.getMap();if(o--,u&&t.appendMap(u,o),c){let d=l.selection&&l.selection.map(t.slice(o));d&&s++;let f=new nn(u.invert(),c,d),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else l.map&&o--},this.items.length,0),new Kt(Of.from(i.reverse()),s)}}Kt.empty=new Kt(Of.empty,0);function K1(n,e){let t;return n.forEach((o,i)=>{if(o.selection&&e--==0)return t=i,!1}),n.slice(t)}class nn{constructor(e,t,o,i){this.map=e,this.step=t,this.selection=o,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new nn(t.getMap().invert(),t,this.selection)}}}class An{constructor(e,t,o,i,s){this.done=e,this.undone=t,this.prevRanges=o,this.prevTime=i,this.prevComposition=s}}const G1=20;function J1(n,e,t,o){let i=t.getMeta(ro),s;if(i)return i.historyState;t.getMeta(Z1)&&(n=new An(n.done,n.undone,null,0,-1));let l=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(l&&l.getMeta(ro))return l.getMeta(ro).redo?new An(n.done.addTransform(t,void 0,o,Zr(e)),n.undone,Xc(t.mapping.maps),n.prevTime,n.prevComposition):new An(n.done,n.undone.addTransform(t,void 0,o,Zr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=n.prevTime==0||!l&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-o.newGroupDelay||!Y1(t,n.prevRanges)),u=l?Ls(n.prevRanges,t.mapping):Xc(t.mapping.maps);return new An(n.done.addTransform(t,c?e.selection.getBookmark():void 0,o,Zr(e)),Kt.empty,u,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new An(n.done.rebased(t,s),n.undone.rebased(t,s),Ls(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new An(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ls(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Y1(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((o,i)=>{for(let s=0;s<e.length;s+=2)o<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Xc(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((o,i,s,l)=>e.push(s,l));return e}function Ls(n,e){if(!n)return null;let t=[];for(let o=0;o<n.length;o+=2){let i=e.map(n[o],1),s=e.map(n[o+1],-1);i<=s&&t.push(i,s)}return t}function X1(n,e,t){let o=Zr(e),i=ro.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,o);if(!s)return null;let l=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),c=new An(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(l).setMeta(ro,{redo:t,historyState:c})}let Ds=!1,Zc=null;function Zr(n){let e=n.plugins;if(Zc!=e){Ds=!1,Zc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ds=!0;break}}return Ds}const ro=new ht("history"),Z1=new ht("closeHistory");function Q1(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ot({key:ro,state:{init(){return new An(Kt.empty,Kt.empty,null,0,-1)},apply(e,t,o){return J1(t,o,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let o=t.inputType,i=o=="historyUndo"?Lf:o=="historyRedo"?Df:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function If(n,e){return(t,o)=>{let i=ro.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(o){let s=X1(i,t,n);s&&o(e?s.scrollIntoView():s)}return!0}}const Lf=If(!1,!0),Df=If(!0,!0);st.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 o=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(o)}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 ot({key:new ht("characterCount"),appendTransaction:(e,t,o)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const s=this.storage.characters({node:o.doc});if(s>i){const l=s-i,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=o.tr.deleteRange(a,c);return n=!0,u}n=!0},filterTransaction:(e,t)=>{const o=this.options.limit;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=o||i>o&&s>o&&s<=i)return!0;if(i>o&&s>o&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,c=s-o,u=a-c,d=a;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>o)}})]}});var ex=st.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[V1(this.options)]}});st.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ot({key:new ht("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:o}=this.editor,{anchor:i}=e,s=[];if(!t||!o)return nt.create(n,[]);let l=0;this.options.mode==="deepest"&&n.descendants((c,u)=>{if(c.isText)return;if(!(i>=u&&i<=u+c.nodeSize-1))return!1;l+=1});let a=0;return n.descendants((c,u)=>{if(c.isText||!(i>=u&&i<=u+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&l-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Bt.node(u,u+c.nodeSize,{class:this.options.className}))}),nt.create(n,s)}}})]}});var tx=st.create({name:"gapCursor",addProseMirrorPlugins(){return[H1()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=We(Ee(n,"allowGapCursor",t)))!=null?e:null}}}),Qc="placeholder";function nx(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var ox=st.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Qc,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${nx(this.options.dataAttribute)}`:`data-${Qc}`;return[new ot({key:new ht("placeholder"),props:{decorations:({doc:e,selection:t})=>{const o=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=t,s=[];if(!o)return null;const l=this.editor.isEmpty;return e.descendants((a,c)=>{const u=i>=c&&i<=c+a.nodeSize,d=!a.isLeaf&&ts(a);if((u||!this.options.showOnlyCurrent)&&d){const f=[this.options.emptyNodeClass];l&&f.push(this.options.emptyEditorClass);const h=Bt.node(c,c+a.nodeSize,{class:f.join(" "),[n]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:c,hasAnchor:u}):this.options.placeholder});s.push(h)}return this.options.includeChildren}),nt.create(e,s)}}})]}});st.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new ot({key:new ht("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||qd(t.selection)||n.view.dragging?null:nt.create(t.doc,[Bt.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function eu({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var rx=st.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ht(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",o=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new ot({key:e,appendTransaction:(i,s,l)=>{const{doc:a,tr:c,schema:u}=l,d=e.getState(l),f=a.content.size,h=u.nodes[t];if(d)return c.insert(f,h.create())},state:{init:(i,s)=>{const l=s.tr.doc.lastChild;return!eu({node:l,types:o})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const l=i.doc.lastChild;return!eu({node:l,types:o})}}})]}}),ix=st.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Lf(n,e),redo:()=>({state:n,dispatch:e})=>Df(n,e)}},addProseMirrorPlugins(){return[Q1(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()}}}),sx=st.create({name:"starterKit",addExtensions(){var n,e,t,o;const i=[];return this.options.bold!==!1&&i.push(Ab.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(Sb.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(kf.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Ib.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Vb.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Rb.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(ex.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(tx.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(zb.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(cf.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(ix.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(Hb.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(jb.configure(this.options.italic)),this.options.listItem!==!1&&i.push(bf.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Mf.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(g1.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Nf.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(A1.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(I1.configure(this.options.strike)),this.options.text!==!1&&i.push(L1.configure(this.options.text)),this.options.underline!==!1&&i.push(Bf.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(rx.configure((o=this.options)==null?void 0:o.trailingNode)),i}}),lx=sx,ax=st.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")}}}),cx=ax,ux=ox;const dx={class:"input-richtext-toolbar"},fx={class:"input-richtext-group"},hx={class:"input-richtext-group"},px={class:"input-richtext-group"},mx={class:"input-richtext-group"},gx={class:"input-richtext-group"},vx={class:"input-richtext-group"},yx={key:0},kx={key:1,class:"input-richtext-dropdown-wrapper"},bx={key:0},xx=["onClick"],wx={class:"input-richtext-dropdown-item-label"},Cx=["id"],Ex=r.defineComponent({__name:"LumenInput.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:{},color:{},tabindex:{}},emits:["update:modelValue","blur","focus"],setup(n,{emit:e}){r.useCssVars(x=>({v041fa70c:x.minHeight,v6035d3e8:x.maxHeight}));const t=n,o=e,i=r.useSlots(),s=r.computed(()=>!!i.default),l=r.ref(null),a=r.ref(typeof t.modelValue=="string"?t.modelValue:"");r.onMounted(()=>{(t.modelValue===void 0||t.modelValue==="")&&s.value&&setTimeout(()=>{if(l.value&&k.value){const x=l.value.innerHTML?.trim()||"";x&&(k.value.commands.setContent(x),a.value=x,o("update:modelValue",x))}},0)});const c=r.ref(null),u=r.ref([]),d=r.ref(),{floatingStyle:f,updatePosition:h,cleanup:p}=Mr({trigger:r.computed(()=>c.value!==null?u.value[c.value]:void 0),floating:d,placement:"bottom-start",offset:4,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{g()}}}),m=async x=>{c.value=x,await r.nextTick(),h()},g=()=>{c.value=null},v=x=>{c.value===x?g():m(x)},y=x=>{x.action&&k.value&&x.action(k.value)},b=x=>{k.value&&x.action(k.value),g()},C=(x,S)=>{x&&(u.value[S]=x.$el||x)},k=Cb({content:a.value,editable:!t.disabled&&!t.readonly,extensions:[lx.configure({heading:!1}),Pb.configure({levels:[1,2,3]}),D1,cx.configure({types:["heading","paragraph"]}),ux.configure({placeholder:t.placeholder})],onUpdate:({editor:x})=>{const S=x.getHTML();a.value=S,o("update:modelValue",S)},onFocus:x=>{o("focus",x.event)},onBlur:x=>{o("blur",x.event)}});return r.watch(()=>t.modelValue,x=>{typeof x=="string"&&k.value&&k.value.getHTML()!==x&&(k.value.commands.setContent(x),a.value=x)}),r.watch(()=>t.disabled,x=>{k.value&&k.value.setEditable(!x&&!t.readonly)}),r.watch(()=>t.readonly,x=>{k.value&&k.value.setEditable(!t.disabled&&!x)}),r.onBeforeUnmount(()=>{k.value&&k.value.destroy(),p()}),(x,S)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["input-richtext-container",{"input-error":n.error,"input-disabled":n.disabled}])},[r.createElementVNode("div",dx,[r.createElementVNode("div",fx,[r.createVNode(De,{color:r.unref(k)?.isActive("bold")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[0]||(S[0]=M=>r.unref(k)?.chain().focus().toggleBold().run()),disabled:n.disabled,title:"Bold (Ctrl+B)"},{icon:r.withCtx(()=>[r.createVNode(r.unref(ep),{size:16})]),_:1},8,["color","disabled"]),r.createVNode(De,{color:r.unref(k)?.isActive("italic")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[1]||(S[1]=M=>r.unref(k)?.chain().focus().toggleItalic().run()),disabled:n.disabled,title:"Italic (Ctrl+I)"},{icon:r.withCtx(()=>[r.createVNode(r.unref(gp),{size:16})]),_:1},8,["color","disabled"]),r.createVNode(De,{color:r.unref(k)?.isActive("underline")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[2]||(S[2]=M=>r.unref(k)?.chain().focus().toggleUnderline().run()),disabled:n.disabled,title:"Underline (Ctrl+U)"},{icon:r.withCtx(()=>[r.createVNode(r.unref(Mp),{size:16})]),_:1},8,["color","disabled"]),r.createVNode(De,{color:r.unref(k)?.isActive("strike")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[3]||(S[3]=M=>r.unref(k)?.chain().focus().toggleStrike().run()),disabled:n.disabled,title:"Strikethrough"},{icon:r.withCtx(()=>[r.createVNode(r.unref(Ep),{size:16})]),_:1},8,["color","disabled"])]),r.createVNode(Dt,{orientation:"vertical",spacing:"28px",margin:"4px"}),r.createElementVNode("div",hx,[r.createVNode(De,{color:r.unref(k)?.isActive("heading",{level:1})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[4]||(S[4]=M=>r.unref(k)?.chain().focus().toggleHeading({level:1}).run()),disabled:n.disabled,title:"Heading 1"},{icon:r.withCtx(()=>[r.createVNode(r.unref(hp),{size:16})]),_:1},8,["color","disabled"]),r.createVNode(De,{color:r.unref(k)?.isActive("heading",{level:2})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[5]||(S[5]=M=>r.unref(k)?.chain().focus().toggleHeading({level:2}).run()),disabled:n.disabled,title:"Heading 2"},{icon:r.withCtx(()=>[r.createVNode(r.unref(pp),{size:16})]),_:1},8,["color","disabled"]),r.createVNode(De,{color:r.unref(k)?.isActive("heading",{level:3})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[6]||(S[6]=M=>r.unref(k)?.chain().focus().toggleHeading({level:3}).run()),disabled:n.disabled,title:"Heading 3"},{icon:r.withCtx(()=>[r.createVNode(r.unref(mp),{size:16})]),_:1},8,["color","disabled"])]),r.createVNode(Dt,{orientation:"vertical",spacing:"28px",margin:"4px"}),r.createElementVNode("div",px,[r.createVNode(De,{color:r.unref(k)?.isActive({textAlign:"left"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[7]||(S[7]=M=>r.unref(k)?.chain().focus().setTextAlign("left").run()),disabled:n.disabled,title:"Align Left"},{icon:r.withCtx(()=>[r.createVNode(r.unref(Zh),{size:16})]),_:1},8,["color","disabled"]),r.createVNode(De,{color:r.unref(k)?.isActive({textAlign:"center"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[8]||(S[8]=M=>r.unref(k)?.chain().focus().setTextAlign("center").run()),disabled:n.disabled,title:"Align Center"},{icon:r.withCtx(()=>[r.createVNode(r.unref(Xh),{size:16})]),_:1},8,["color","disabled"]),r.createVNode(De,{color:r.unref(k)?.isActive({textAlign:"right"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[9]||(S[9]=M=>r.unref(k)?.chain().focus().setTextAlign("right").run()),disabled:n.disabled,title:"Align Right"},{icon:r.withCtx(()=>[r.createVNode(r.unref(Qh),{size:16})]),_:1},8,["color","disabled"])]),r.createVNode(Dt,{orientation:"vertical",spacing:"28px",margin:"4px"}),r.createElementVNode("div",mx,[r.createVNode(De,{color:r.unref(k)?.isActive("bulletList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[10]||(S[10]=M=>r.unref(k)?.chain().focus().toggleBulletList().run()),disabled:n.disabled,title:"Bullet List"},{icon:r.withCtx(()=>[r.createVNode(r.unref(yp),{size:16})]),_:1},8,["color","disabled"]),r.createVNode(De,{color:r.unref(k)?.isActive("orderedList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[11]||(S[11]=M=>r.unref(k)?.chain().focus().toggleOrderedList().run()),disabled:n.disabled,title:"Numbered List"},{icon:r.withCtx(()=>[r.createVNode(r.unref(vp),{size:16})]),_:1},8,["color","disabled"]),r.createVNode(De,{color:r.unref(k)?.isActive("blockquote")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[12]||(S[12]=M=>r.unref(k)?.chain().focus().toggleBlockquote().run()),disabled:n.disabled,title:"Quote"},{icon:r.withCtx(()=>[r.createVNode(r.unref(xp),{size:16})]),_:1},8,["color","disabled"]),r.createVNode(De,{color:r.unref(k)?.isActive("codeBlock")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:S[13]||(S[13]=M=>r.unref(k)?.chain().focus().toggleCodeBlock().run()),disabled:n.disabled,title:"Code Block"},{icon:r.withCtx(()=>[r.createVNode(r.unref(sp),{size:16})]),_:1},8,["color","disabled"])]),r.createVNode(Dt,{orientation:"vertical",spacing:"28px",margin:"4px"}),r.createElementVNode("div",gx,[r.createVNode(De,{color:"secondary",size:"sm",icon:"",squircle:"",onClick:S[14]||(S[14]=M=>r.unref(k)?.chain().focus().setHorizontalRule().run()),disabled:n.disabled,title:"Horizontal Rule"},{icon:r.withCtx(()=>[r.createVNode(r.unref(su),{size:16})]),_:1},8,["disabled"]),r.createVNode(De,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!r.unref(k)?.can().undo()||n.disabled,onClick:S[15]||(S[15]=M=>r.unref(k)?.chain().focus().undo().run()),title:"Undo (Ctrl+Z)"},{icon:r.withCtx(()=>[r.createVNode(r.unref(Tp),{size:16})]),_:1},8,["disabled"]),r.createVNode(De,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!r.unref(k)?.can().redo()||n.disabled,onClick:S[16]||(S[16]=M=>r.unref(k)?.chain().focus().redo().run()),title:"Redo (Ctrl+Y)"},{icon:r.withCtx(()=>[r.createVNode(r.unref(wp),{size:16})]),_:1},8,["disabled"])]),n.customControls&&n.customControls.length>0?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[r.createVNode(Dt,{orientation:"vertical",spacing:"28px",margin:"4px"}),r.createElementVNode("div",vx,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(n.customControls,(M,L)=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:L},[M.action?(r.openBlock(),r.createBlock(De,{key:0,color:"secondary",size:"sm",icon:!M.label,squircle:"",onClick:R=>y(M),disabled:n.disabled,title:M.tooltip||M.label},r.createSlots({default:r.withCtx(()=>[M.label&&M.icon?(r.openBlock(),r.createElementBlock("span",yx,r.toDisplayString(M.label),1)):M.label?(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createTextVNode(r.toDisplayString(M.label),1)],64)):r.createCommentVNode("",!0)]),_:2},[M.icon?{name:"icon",fn:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(M.icon),{size:16}))]),key:"0"}:void 0]),1032,["icon","onClick","disabled","title"])):M.list?(r.openBlock(),r.createElementBlock("div",kx,[r.createVNode(De,{ref_for:!0,ref:R=>C(R,L),color:"secondary",size:"sm",squircle:"",onClick:R=>v(L),disabled:n.disabled,title:M.tooltip||M.label,class:r.normalizeClass({"input-richtext-dropdown-open":c.value===L})},r.createSlots({"trailing-icon":r.withCtx(()=>[r.createVNode(r.unref(Ro),{size:14,class:"input-richtext-dropdown-arrow"})]),default:r.withCtx(()=>[M.label?(r.openBlock(),r.createElementBlock("span",bx,r.toDisplayString(M.label),1)):r.createCommentVNode("",!0)]),_:2},[M.icon?{name:"leading-icon",fn:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(M.icon),{size:16}))]),key:"0"}:void 0]),1032,["onClick","disabled","title","class"])])):r.createCommentVNode("",!0)],64))),128))])],64)):r.createCommentVNode("",!0)]),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[c.value!==null&&n.customControls?.[c.value]?.list?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:d,class:"input-richtext-dropdown",style:r.normalizeStyle(r.unref(f))},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(n.customControls[c.value].list,(M,L)=>(r.openBlock(),r.createElementBlock("button",{key:L,class:"input-richtext-dropdown-item",onClick:R=>b(M),type:"button"},[M.icon?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(M.icon),{key:0,size:16,class:"input-richtext-dropdown-item-icon"})):r.createCommentVNode("",!0),r.createElementVNode("span",wx,r.toDisplayString(M.label),1)],8,xx))),128))],4)):r.createCommentVNode("",!0)])),r.createElementVNode("div",{id:n.inputId,class:"input-richtext-editor-wrapper",onClick:S[17]||(S[17]=M=>r.unref(k)?.commands.focus())},[r.createVNode(r.unref(wb),{editor:r.unref(k),class:"input-richtext-editor"},null,8,["editor"])],8,Cx),s.value?(r.openBlock(),r.createElementBlock("span",{key:0,ref_key:"slotContentRef",ref:l,class:"sr-only","aria-hidden":"true"},[r.renderSlot(x.$slots,"default",{},void 0,!0)],512)):r.createCommentVNode("",!0)],2))}}),Sx=_e(Ex,[["__scopeId","data-v-cbd1d13c"]]),Mx={class:"pincode-inputs"},Tx={key:0,class:"pincode-icon pincode-icon-leading"},Nx=["value","disabled","readonly","tabindex","data-index","onInput","onKeydown","onFocus"],Bx={key:1,class:"pincode-divider"},Ax={key:1,class:"pincode-icon pincode-icon-trailing"},$x=r.defineComponent({__name:"LumenInput.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"},color:{},tabindex:{}},emits:["update:modelValue","blur","focus","complete"],setup(n,{emit:e}){const t=n,o=e,i=r.ref([]),s=r.ref(-1),l=r.computed(()=>{const C=(t.modelValue||"").split("");for(;C.length<t.maxLength;)C.push("");return C.slice(0,t.maxLength)}),a=r.computed(()=>t.divider?typeof t.divider=="number"?t.divider:t.divider.count:0),c=r.computed(()=>t.divider?typeof t.divider=="number"?"-":typeof t.divider=="object"&&"character"in t.divider&&t.divider.character||"-":""),u=r.computed(()=>typeof t.divider=="object"&&"component"in t.divider&&t.divider.component==="divider"),d=r.computed(()=>u.value?{orientation:"vertical",variant:"solid",thickness:"1px",margin:"0",spacing:"1.5rem",...t.divider.props}:{}),f=b=>!a.value||b===t.maxLength?!1:b%a.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=(b,C)=>{const k=b.target,S=k.value.slice(-1);if(!h().test(S)&&S!==""){k.value=l.value[C];return}const L=[...l.value];L[C]=S;const R=L.join("");o("update:modelValue",R),S&&C<t.maxLength-1&&r.nextTick(()=>{const X=i.value[C+1];X&&(X.focus(),X.select())}),R.length===t.maxLength&&o("complete",R)},m=(b,C)=>{const k=b.key;if(k==="Backspace"){b.preventDefault();const x=[...l.value];l.value[C]?(x[C]="",o("update:modelValue",x.join(""))):C>0&&(x[C-1]="",o("update:modelValue",x.join("")),r.nextTick(()=>{const S=i.value[C-1];S&&S.focus()}))}else if(k==="ArrowLeft"&&C>0){b.preventDefault();const x=i.value[C-1];x&&x.focus()}else if(k==="ArrowRight"&&C<t.maxLength-1){b.preventDefault();const x=i.value[C+1];x&&x.focus()}else if(k==="Delete"){b.preventDefault();const x=[...l.value];x[C]="",o("update:modelValue",x.join(""))}},g=b=>{b.preventDefault();const C=b.clipboardData?.getData("text")||"",k=h(),x=C.split("").filter(S=>k.test(S)).slice(0,t.maxLength).join("");if(x){o("update:modelValue",x);const S=x.length<t.maxLength?x.length:t.maxLength-1;r.nextTick(()=>{const M=i.value[S];M&&M.focus()}),x.length===t.maxLength&&o("complete",x)}},v=b=>{s.value=b;const C=i.value[b];C&&C.select()},y=b=>{s.value=-1,o("blur",b)};return r.watch(()=>t.modelValue,b=>{b||r.nextTick(()=>{const C=i.value[0];C&&!t.disabled&&!t.readonly&&C.focus()})}),(b,C)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["pincode-wrapper",[`pincode-size-${n.size}`,{"pincode-error":n.error}]])},[r.createElementVNode("div",Mx,[r.renderSlot(b.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(r.openBlock(),r.createElementBlock("div",Tx,[r.renderSlot(b.$slots,"leading-icon",{},void 0,!0)])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(n.maxLength,k=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:k},[r.createElementVNode("input",{ref_for:!0,ref_key:"pincodeRefs",ref:i,type:"text",class:r.normalizeClass(["pincode-input",{"pincode-input-filled":l.value[k-1],"pincode-input-focused":s.value===k-1}]),value:l.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=>v(k-1),onBlur:y,onPaste:g},null,42,Nx),f(k)&&u.value?(r.openBlock(),r.createBlock(Dt,r.mergeProps({key:0,ref_for:!0},d.value,{class:"pincode-custom-divider"}),null,16)):f(k)?(r.openBlock(),r.createElementBlock("span",Bx,r.toDisplayString(c.value),1)):r.createCommentVNode("",!0)],64))),128)),t.hasTrailingIcon?(r.openBlock(),r.createElementBlock("div",Ax,[r.renderSlot(b.$slots,"trailing-icon",{},void 0,!0)])):r.createCommentVNode("",!0),r.renderSlot(b.$slots,"trailing",{},void 0,!0)])],2))}}),Ox=_e($x,[["__scopeId","data-v-0718479e"]]);function Ix(n,e){const t=n[e];if(!t)return!1;const o=t();return!o||o.length===0?!1:o.some(i=>!!(i.children&&i.children!==""||i.type&&typeof i.type=="object"||i.props&&Object.keys(i.props).length>0))}const Lx={key:0,class:"input-required"},Dx={key:10,class:"input-hint"},Vx={key:11,class:"input-error-text"},Rx={key:12,class:"input-help-text"},zx=r.defineComponent({__name:"LumenInput",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:{},color:{},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,o=e,i=r.useSlots(),s=r.ref(t.value!==void 0?t.value:t.modelValue!==void 0?t.modelValue:""),l=r.computed(()=>s.value);r.watch(()=>t.modelValue,k=>{k!==void 0&&k!==s.value&&(s.value=k)},{immediate:!0});const a=`input-${r.useId()}`,c=k=>Ix(i,k),u=r.computed(()=>t.type||"text"),d=r.computed(()=>{const k=["text","email","password","number","tel","url","search"],x=t.type||"text";return k.includes(x)}),f=k=>{s.value=k,o("update:modelValue",k),o("input",k),o("change",k)},h=k=>{s.value=k,o("input",k)},p=k=>{o("change",k)},m=k=>{o("blur",k)},g=k=>{o("focus",k)},v=k=>{o("keydown",k)},y=k=>{o("file-error",k)},b=()=>{o("clear-preview")},C=k=>{o("complete",k)};return(k,x)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["input-container",[`input-container--${t.size||"md"}`,`input-color-${t.color||"primary"}`,{"input-container--full-width":t.fullWidth}]])},[t.label?(r.openBlock(),r.createElementBlock("label",{key:0,for:a,tabindex:"-1",class:"input-label"},[r.createTextVNode(r.toDisplayString(t.label)+" ",1),t.required?(r.openBlock(),r.createElementBlock("span",Lx,"*")):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),d.value?(r.openBlock(),r.createBlock(Lp,{key:1,"model-value":l.value,type:u.value,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":a,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":f,onInput:h,onChange:p,onBlur:m,onFocus:g,onKeydown:v},{leading:r.withCtx(()=>[r.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":r.withCtx(()=>[r.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":r.withCtx(()=>[r.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:r.withCtx(()=>[r.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"])):u.value==="textarea"?(r.openBlock(),r.createBlock(Pp,{key:2,"model-value":l.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":a,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":f,onBlur:m,onFocus:g,onKeydown:v},r.createSlots({leading:r.withCtx(()=>[r.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":r.withCtx(()=>[r.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":r.withCtx(()=>[r.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:r.withCtx(()=>[r.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:2},[c("default")?{name:"default",fn:r.withCtx(()=>[r.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"])):u.value==="select"?(r.openBlock(),r.createBlock(cm,{key:3,"model-value":l.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":a,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":f,onBlur:m,onFocus:g},{leading:r.withCtx(()=>[r.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":r.withCtx(()=>[r.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":r.withCtx(()=>[r.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:r.withCtx(()=>[r.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"])):u.value==="file"?(r.openBlock(),r.createBlock(Bm,{key:4,"model-value":l.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":a,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":c("leading-icon"),"has-trailing-icon":c("trailing-icon"),"onUpdate:modelValue":f,onFileError:y,onClearPreview:b,onBlur:m,onFocus:g},{leading:r.withCtx(()=>[r.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":r.withCtx(()=>[r.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":r.withCtx(()=>[r.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:r.withCtx(()=>[r.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"])):u.value==="date"?(r.openBlock(),r.createBlock(lg,{key:5,"model-value":l.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,"input-id":a,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":f,onBlur:m,onFocus:g},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","tabindex"])):u.value==="time"?(r.openBlock(),r.createBlock(ag,{key:6,"model-value":l.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,"input-id":a,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":f,onBlur:m,onFocus:g},null,8,["model-value","placeholder","disabled","readonly","required","error","size","tabindex"])):u.value==="datetime"?(r.openBlock(),r.createBlock(cg,{key:7,"model-value":l.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,"input-id":a,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":f,onBlur:m,onFocus:g},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","tabindex"])):u.value==="richtext"?(r.openBlock(),r.createBlock(Sx,{key:8,"model-value":l.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,"input-id":a,error:t.error,"min-height":t.minHeight,"max-height":t.maxHeight,"custom-controls":t.customControls,tabindex:n.tabindex,"onUpdate:modelValue":f,onBlur:m,onFocus:g},r.createSlots({_:2},[c("default")?{name:"default",fn:r.withCtx(()=>[r.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"])):u.value==="pincode"?(r.openBlock(),r.createBlock(Ox,{key:9,"model-value":l.value,"max-length":t.maxLength||6,variant:t.variant||"numeric",divider:t.divider,disabled:n.disabled,readonly:n.readonly,"input-id":a,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":f,onBlur:m,onFocus:g,onComplete:C},r.createSlots({_:2},[c("leading")?{name:"leading",fn:r.withCtx(()=>[r.renderSlot(k.$slots,"leading",{},void 0,!0)]),key:"0"}:void 0,c("leading-icon")?{name:"leading-icon",fn:r.withCtx(()=>[r.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),key:"1"}:void 0,c("trailing-icon")?{name:"trailing-icon",fn:r.withCtx(()=>[r.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),key:"2"}:void 0,c("trailing")?{name:"trailing",fn:r.withCtx(()=>[r.renderSlot(k.$slots,"trailing",{},void 0,!0)]),key:"3"}:void 0]),1032,["model-value","max-length","variant","divider","disabled","readonly","error","size","tabindex"])):r.createCommentVNode("",!0),k.$slots.hint?(r.openBlock(),r.createElementBlock("div",Dx,[r.renderSlot(k.$slots,"hint",{},void 0,!0)])):r.createCommentVNode("",!0),t.error&&t.error!==!0?(r.openBlock(),r.createElementBlock("p",Vx,r.toDisplayString(typeof t.error=="string"?t.error:t.error?.message||String(t.error)),1)):t.helpText?(r.openBlock(),r.createElementBlock("p",Rx,r.toDisplayString(t.helpText),1)):r.createCommentVNode("",!0)],2))}}),uo=_e(zx,[["__scopeId","data-v-c0ffc770"]]),Px=["disabled","aria-disabled"],Hx=["href","target","rel","aria-disabled"],_x=r.defineComponent({__name:"LumenLink",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,o=e,i=r.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 s(){if(typeof window<"u"){const d=getComputedStyle(document.documentElement).getPropertyValue("--lumen-accent").trim();if(d)return d}return"#EA00A8"}const l=()=>({primary:s(),success:"#059669",warning:"#d97706",danger:"#dc2626"}),a=d=>{const f=l();return`color-mix(in srgb, ${f[d]||f.primary} 85%, black 15%)`},c=r.computed(()=>{if(!t.color)return{};const d=l(),f=d[t.color]||d.primary,h=a(t.color),p={"--link-color":f,"--link-hover-color":h,color:f};return t.variant==="underline"?{...p,textDecorationColor:f}:p}),u=d=>{t.disabled||o("click",d)};return(d,f)=>!n.to&&!n.href?(r.openBlock(),r.createElementBlock("button",{key:0,type:"button",class:r.normalizeClass(["lumen-link",[`lumen-link-${n.variant}`,`lumen-link-${n.size}`,{"lumen-link-disabled":n.disabled},{"lumen-link-custom-color":n.color}]]),style:r.normalizeStyle(c.value),disabled:n.disabled,"aria-disabled":n.disabled,onClick:u},[r.renderSlot(d.$slots,"default",{},void 0,!0)],14,Px)):(r.openBlock(),r.createElementBlock("a",{key:1,class:r.normalizeClass(["lumen-link",[`lumen-link-${n.variant}`,`lumen-link-${n.size}`,{"lumen-link-disabled":n.disabled},{"lumen-link-custom-color":n.color}]]),style:r.normalizeStyle(c.value),href:i.value,target:n.external?"_blank":void 0,rel:n.external?"noopener noreferrer":void 0,"aria-disabled":n.disabled,onClick:u},[r.renderSlot(d.$slots,"default",{},void 0,!0)],14,Hx))}}),oa=_e(_x,[["__scopeId","data-v-1a90d181"]]),Fx={class:"lumen-toggle-container"},Ux=["for"],qx={key:0,class:"lumen-toggle-required"},jx=["id","aria-pressed","aria-labelledby"],Wx=r.defineComponent({__name:"LumenToggle",props:{modelValue:{type:Boolean,default:void 0},checked:{type:[Boolean,String],default:void 0},disabled:{type:Boolean,default:!1},id:{},label:{},required:{type:Boolean},color:{default:"primary"}},emits:["update:modelValue","change"],setup(n,{emit:e}){const t=n,o=e,i=f=>f===void 0?!1:typeof f=="string"?f===""||f==="true":!!f,s=r.ref(t.checked!==void 0?i(t.checked):t.modelValue!==void 0?!!t.modelValue:!1),l=r.computed(()=>s.value);r.watch(()=>t.modelValue,f=>{f!==void 0&&!!f!==s.value&&(s.value=!!f)},{immediate:!0});const a=r.computed(()=>t.id||`lumen-toggle-${Math.random().toString(36).substr(2,9)}`),c=r.computed(()=>["lumen-toggle",`lumen-toggle-color-${t.color}`,{"lumen-toggle--on":l.value,"lumen-toggle--off":!l.value,"lumen-toggle--disabled":t.disabled}]),u=r.computed(()=>[{"lumen-toggle-thumb--on":l.value,"lumen-toggle-thumb--off":!l.value}]),d=()=>{if(t.disabled)return;const f=!l.value;s.value=f,o("update:modelValue",f),o("change",f)};return(f,h)=>(r.openBlock(),r.createElementBlock("div",Fx,[n.label?(r.openBlock(),r.createElementBlock("label",{key:0,for:a.value,class:"lumen-toggle-label"},[r.createTextVNode(r.toDisplayString(n.label)+" ",1),n.required?(r.openBlock(),r.createElementBlock("span",qx,"*")):r.createCommentVNode("",!0)],8,Ux)):r.createCommentVNode("",!0),r.createElementVNode("button",{id:a.value,type:"button",class:r.normalizeClass(c.value),"aria-pressed":l.value,"aria-labelledby":n.label?`${a.value}-label`:void 0,onClick:d},[r.createElementVNode("span",{class:r.normalizeClass(["lumen-toggle-thumb",u.value])},null,2)],10,jx)]))}}),ra=_e(Wx,[["__scopeId","data-v-fdadc4df"]]),Kx={class:"lumen-scope"},Gx={class:"avatar-editor-simple"},Jx={key:1,class:"editor-container"},Yx={class:"editor-main"},Xx=["width","height"],Zx={class:"crop-overlay"},Qx={class:"crop-backdrop"},ew={class:"crop-svg"},tw={id:"backdrop-mask"},nw=["width","height"],ow=["cx","cy","r"],rw=["width","height"],iw={class:"crop-svg"},sw=["cx","cy","r"],lw={class:"controls"},aw={class:"zoom-control"},cw=["min","max"],uw={class:"action-buttons"},dw={class:"preview-section"},fw=["width","height"],ia=r.defineComponent({__name:"LumenAvatarEditor",props:{size:{default:300},previewSize:{default:100},maxFileSize:{default:5*1024*1024},uploading:{type:Boolean,default:!1},preselectedFile:{}},emits:["upload","error"],setup(n,{emit:e}){const t=n,o=e,i=r.ref(),s=r.ref(),l=r.ref(),a=r.ref(""),c=r.ref(),u=r.ref(Number(t.size)),d=r.ref(Number(t.previewSize)),f=r.ref(Number(t.size)/2.5),h=r.reactive({x:0,y:0}),p=r.ref(1),m=r.ref(.1),g=r.ref(3),v=r.ref(!1),y=r.ref(!1),b=r.ref(!1),C=r.reactive({x:0,y:0,imageX:0,imageY:0});r.onMounted(()=>{if(s.value){const K=s.value.getContext("2d");K&&(K.fillStyle="#f9fafb",K.fillRect(0,0,u.value,u.value))}});const k=()=>{i.value?.click()},x=K=>{const Y=K.target.files?.[0];Y&&M(Y)},S=K=>{K.preventDefault();const J=K.dataTransfer?.files[0];J&&M(J)},M=K=>{if(!K.type.startsWith("image/")){o("error","Please select an image file");return}if(K.size>t.maxFileSize){o("error",`File size must be less than ${Math.round(t.maxFileSize/1024/1024)}MB`);return}const J=new FileReader;J.onload=Y=>{const me=Y.target?.result;L(me)},J.readAsDataURL(K)},L=K=>{a.value=K;const J=new Image;J.onload=()=>{c.value=J,y.value=!0;const Y=Math.max(f.value*2/J.width,f.value*2/J.height),me=Y;m.value=Y,g.value=Math.max(1,Y);const ke=J.width*me,Fe=J.height*me;h.x=(u.value-ke)/2,h.y=(u.value-Fe)/2,p.value=me,fe(),r.nextTick(()=>{y.value=!1}),r.nextTick(()=>{R()})},J.src=K},R=()=>{if(!c.value||!s.value)return;const K=s.value.getContext("2d");if(!K)return;K.fillStyle="#f9fafb",K.fillRect(0,0,u.value,u.value);const J=c.value,Y=J.width*p.value,me=J.height*p.value;K.drawImage(J,h.x,h.y,Y,me),X()},X=()=>{if(!c.value||!l.value||!s.value)return;const K=l.value.getContext("2d");if(!K)return;K.fillStyle="#ffffff",K.fillRect(0,0,d.value,d.value),K.save(),K.beginPath(),K.arc(d.value/2,d.value/2,d.value/2,0,Math.PI*2),K.clip();const J=u.value/2-f.value,Y=u.value/2-f.value,me=f.value*2;K.drawImage(s.value,J,Y,me,me,0,0,d.value,d.value),K.restore()},ve=K=>{c.value&&(v.value=!0,C.x=K.clientX,C.y=K.clientY,C.imageX=h.x,C.imageY=h.y,document.addEventListener("mousemove",Se),document.addEventListener("mouseup",xe))},fe=()=>{if(!c.value)return;const K=c.value,J=K.width*p.value,Y=K.height*p.value,me=u.value/2-f.value,ke=u.value/2-f.value,Fe=u.value/2+f.value,$e=u.value/2+f.value,re=Fe-J,ie=me,A=$e-Y,I=ke;h.x=Math.min(ie,Math.max(re,h.x)),h.y=Math.min(I,Math.max(A,h.y))},Se=K=>{if(!v.value)return;const J=K.clientX-C.x,Y=K.clientY-C.y;h.x=C.imageX+J,h.y=C.imageY+Y,fe(),R()},xe=()=>{v.value=!1,document.removeEventListener("mousemove",Se),document.removeEventListener("mouseup",xe)},U=K=>{K.preventDefault();const J=K.deltaY>0?-.05:.05,Y=Math.max(m.value,Math.min(g.value,p.value+J));if(Y!==p.value&&c.value){b.value=!0;const me=c.value,ke=u.value/2,Fe=me.width*p.value,$e=me.height*p.value,re=me.width*Y,ie=me.height*Y,A=h.x+Fe/2-ke,I=h.y+$e/2-ke,P=Y/p.value,Q=A*P,de=I*P;h.x=ke+Q-re/2,h.y=ke+de-ie/2,p.value=Y,fe(),R(),setTimeout(()=>{b.value=!1},16)}},ee=()=>{if(!c.value)return;const K=c.value;y.value=!0;const J=Math.max(f.value*2/K.width,f.value*2/K.height),Y=J;m.value=J,g.value=Math.max(1,J);const me=K.width*Y,ke=K.height*Y;h.x=(u.value-me)/2,h.y=(u.value-ke)/2,p.value=Y,fe(),r.nextTick(()=>{y.value=!1}),R()},ce=async()=>{if(!c.value||!s.value)return;const K=document.createElement("canvas");K.width=256,K.height=256;const J=K.getContext("2d");if(!J)return;J.fillStyle="#ffffff",J.fillRect(0,0,256,256),J.save(),J.beginPath(),J.arc(128,128,128,0,Math.PI*2),J.clip();const Y=u.value/2-f.value,me=u.value/2-f.value,ke=f.value*2;J.drawImage(s.value,Y,me,ke,ke,0,0,256,256),J.restore(),K.toBlob(Fe=>{if(Fe){const $e=new File([Fe],"avatar.jpg",{type:"image/jpeg"});o("upload",$e)}},"image/jpeg",.9)},be=()=>{k()};return r.watch(p,(K,J)=>{if(!(y.value||b.value)){if(K!==J&&c.value&&J>0&&J!==1){const Y=c.value,me=u.value/2,ke=Y.width*J,Fe=Y.height*J,$e=Y.width*K,re=Y.height*K,ie=h.x+ke/2-me,A=h.y+Fe/2-me,I=K/J,P=ie*I,Q=A*I;h.x=me+P-$e/2,h.y=me+Q-re/2}R()}}),r.watch(()=>t.preselectedFile,K=>{K&&M(K)},{immediate:!0}),(K,J)=>(r.openBlock(),r.createElementBlock("div",Kx,[r.createElementVNode("div",Gx,[r.createElementVNode("input",{ref_key:"fileInput",ref:i,type:"file",accept:"image/*",class:"hidden-input",onChange:x},null,544),a.value?(r.openBlock(),r.createElementBlock("div",Jx,[r.createElementVNode("div",Yx,[r.createElementVNode("div",{class:"canvas-container",style:r.normalizeStyle({width:u.value+"px",height:u.value+"px"})},[r.createElementVNode("canvas",{ref_key:"canvas",ref:s,width:u.value,height:u.value,class:"canvas",onMousedown:ve,onWheel:U},null,40,Xx),r.createElementVNode("div",Zx,[r.createElementVNode("div",Qx,[(r.openBlock(),r.createElementBlock("svg",ew,[r.createElementVNode("defs",null,[r.createElementVNode("mask",tw,[r.createElementVNode("rect",{x:"0",y:"0",width:u.value,height:u.value,fill:"white"},null,8,nw),r.createElementVNode("circle",{cx:u.value/2,cy:u.value/2,r:f.value,fill:"black"},null,8,ow)])]),r.createElementVNode("rect",{x:"0",y:"0",width:u.value,height:u.value,fill:"black",opacity:"0.5",mask:"url(#backdrop-mask)"},null,8,rw)]))]),(r.openBlock(),r.createElementBlock("svg",iw,[r.createElementVNode("circle",{cx:u.value/2,cy:u.value/2,r:f.value,fill:"none",stroke:"white","stroke-width":"2",class:"crop-circle"},null,8,sw)]))])],4),r.createElementVNode("div",lw,[r.createElementVNode("div",aw,[r.createVNode(De,{onClick:J[2]||(J[2]=Y=>{p.value=Math.max(m.value,p.value-.1),fe(),R()}),icon:!0,squircle:!0,variant:"secondary",size:"sm","aria-label":"Zoom out"},{icon:r.withCtx(()=>[r.createVNode(r.unref(su))]),_:1}),r.withDirectives(r.createElementVNode("input",{type:"range","onUpdate:modelValue":J[3]||(J[3]=Y=>p.value=Y),min:m.value,max:g.value,step:.01,class:"zoom-slider",onInput:J[4]||(J[4]=Y=>{fe(),R()})},null,40,cw),[[r.vModelText,p.value,void 0,{number:!0}]]),r.createVNode(De,{onClick:J[5]||(J[5]=Y=>{p.value=Math.min(g.value,p.value+.1),fe(),R()}),icon:!0,squircle:!0,variant:"secondary",size:"sm","aria-label":"Zoom in"},{icon:r.withCtx(()=>[r.createVNode(r.unref(bp))]),_:1})]),r.createElementVNode("div",uw,[r.createVNode(De,{onClick:ee,variant:"outline",size:"sm"},{default:r.withCtx(()=>[...J[7]||(J[7]=[r.createTextVNode(" Reset ",-1)])]),_:1}),r.createVNode(De,{onClick:be,variant:"outline",size:"sm"},{default:r.withCtx(()=>[...J[8]||(J[8]=[r.createTextVNode(" Change Photo ",-1)])]),_:1}),r.createVNode(De,{onClick:ce,disabled:n.uploading,variant:"primary",size:"sm",class:"flex-1"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(n.uploading?"Saving...":"Save Avatar"),1)]),_:1},8,["disabled"])])])]),r.createElementVNode("div",dw,[J[9]||(J[9]=r.createElementVNode("h3",{class:"preview-title"},"Preview",-1)),r.createElementVNode("div",{class:"preview-container",style:r.normalizeStyle({width:d.value+"px",height:d.value+"px"})},[r.createElementVNode("canvas",{ref_key:"previewCanvas",ref:l,width:d.value,height:d.value,class:"preview-canvas"},null,8,fw)],4),J[10]||(J[10]=r.createElementVNode("p",{class:"preview-instructions"},[r.createTextVNode(" Drag image to reposition"),r.createElementVNode("br"),r.createTextVNode(" Scroll to zoom ")],-1))])])):(r.openBlock(),r.createElementBlock("div",{key:0,class:"upload-area",onClick:k,onDrop:S,onDragover:J[0]||(J[0]=r.withModifiers(()=>{},["prevent"])),onDragenter:J[1]||(J[1]=r.withModifiers(()=>{},["prevent"]))},[...J[6]||(J[6]=[r.createStaticVNode('<div class="upload-content"><svg class="upload-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg><h3 class="upload-title">Upload your photo</h3><p class="upload-subtitle">Drag and drop or click to browse</p><div class="upload-formats"><span class="format-tag">JPG</span><span class="format-tag">PNG</span><span class="format-tag">GIF</span></div></div>',1)])],32))])]))}});class hw{static audioContext=null;static getAudioContext(){try{return this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext.state==="suspended"&&this.audioContext.resume(),this.audioContext}catch(e){return console.warn("Audio context not available:",e),null}}static playLevelUp(e,t){const i=e&&[10,25,50,100,150,200].includes(e);t&&(i&&t.milestoneSounds===!1||!i&&t.levelUpSounds===!1)||(i?this.playMilestoneLevelUp():this.playRegularLevelUp())}static playRegularLevelUp(){const e=this.getAudioContext();if(!e)return;const t=e.currentTime;[{freq:523.25,time:0},{freq:659.25,time:.15},{freq:783.99,time:.3}].forEach(c=>{const u=e.createOscillator(),d=e.createGain();u.connect(d),d.connect(e.destination),u.type="sine",u.frequency.setValueAtTime(c.freq,t+c.time),u.frequency.exponentialRampToValueAtTime(c.freq*1.02,t+c.time+.1),u.frequency.exponentialRampToValueAtTime(c.freq,t+c.time+.4),d.gain.setValueAtTime(0,t+c.time),d.gain.linearRampToValueAtTime(.08,t+c.time+.03),d.gain.linearRampToValueAtTime(.06,t+c.time+.2),d.gain.exponentialRampToValueAtTime(.01,t+c.time+.5),u.start(t+c.time),u.stop(t+c.time+.5)});const i=e.createOscillator(),s=e.createGain();i.connect(s),s.connect(e.destination),i.type="triangle",i.frequency.setValueAtTime(261.63,t),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(.04,t+.1),s.gain.linearRampToValueAtTime(.03,t+.4),s.gain.exponentialRampToValueAtTime(.01,t+.8),i.start(t),i.stop(t+.8);const l=e.createOscillator(),a=e.createGain();l.connect(a),a.connect(e.destination),l.type="sine",l.frequency.setValueAtTime(1046.5,t+.2),a.gain.setValueAtTime(0,t+.2),a.gain.linearRampToValueAtTime(.03,t+.25),a.gain.exponentialRampToValueAtTime(.001,t+.6),l.start(t+.2),l.stop(t+.6)}static playMilestoneLevelUp(){const e=this.getAudioContext();if(!e)return;const t=e.currentTime,o=2.5;[{freq:261.63,time:0},{freq:329.63,time:.2},{freq:392,time:.4},{freq:523.25,time:.6},{freq:659.25,time:.8}].forEach(c=>{const u=e.createOscillator(),d=e.createGain();u.connect(d),d.connect(e.destination),u.type="sine",u.frequency.setValueAtTime(c.freq,t+c.time),d.gain.setValueAtTime(0,t+c.time),d.gain.linearRampToValueAtTime(.15,t+c.time+.05),d.gain.exponentialRampToValueAtTime(.01,t+c.time+.8),u.start(t+c.time),u.stop(t+c.time+.8)}),[{freq:130.81,time:0,duration:1.5},{freq:196,time:.8,duration:1.7}].forEach(c=>{const u=e.createOscillator(),d=e.createGain();u.connect(d),d.connect(e.destination),u.type="triangle",u.frequency.setValueAtTime(c.freq,t+c.time),d.gain.setValueAtTime(0,t+c.time),d.gain.linearRampToValueAtTime(.08,t+c.time+.3),d.gain.exponentialRampToValueAtTime(.01,t+c.time+c.duration),u.start(t+c.time),u.stop(t+c.time+c.duration)}),[{freq:1046.5,time:1},{freq:1318.51,time:1.3},{freq:1567.98,time:1.6}].forEach(c=>{const u=e.createOscillator(),d=e.createGain();u.connect(d),d.connect(e.destination),u.type="sine",u.frequency.setValueAtTime(c.freq,t+c.time),d.gain.setValueAtTime(0,t+c.time),d.gain.linearRampToValueAtTime(.1,t+c.time+.02),d.gain.exponentialRampToValueAtTime(.01,t+c.time+.4),u.start(t+c.time),u.stop(t+c.time+.4)}),[261.63,329.63,392,523.25].forEach(c=>{const u=e.createOscillator(),d=e.createGain();u.connect(d),d.connect(e.destination),u.type="sine",u.frequency.setValueAtTime(c,t+1.8),d.gain.setValueAtTime(0,t+1.8),d.gain.linearRampToValueAtTime(.12,t+1.9),d.gain.exponentialRampToValueAtTime(.01,t+o),u.start(t+1.8),u.stop(t+o)})}static playSuccess(){const e=this.getAudioContext();if(!e)return;const t=e.currentTime;[659.25,830.61].forEach((i,s)=>{const l=e.createOscillator(),a=e.createGain();l.connect(a),a.connect(e.destination),l.type="sine",l.frequency.setValueAtTime(i,t);const c=s*.1,u=.15;a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.2,t+c+.01),a.gain.exponentialRampToValueAtTime(.01,t+c+u),l.start(t+c),l.stop(t+c+u)})}static playError(){const e=this.getAudioContext();if(!e)return;const t=e.currentTime,o=e.createOscillator(),i=e.createGain();o.connect(i),i.connect(e.destination),o.type="sawtooth",o.frequency.setValueAtTime(200,t),o.frequency.exponentialRampToValueAtTime(100,t+.3),i.gain.setValueAtTime(.15,t),i.gain.exponentialRampToValueAtTime(.01,t+.3),o.start(t),o.stop(t+.3)}static playClick(){const e=this.getAudioContext();if(!e)return;const t=e.currentTime,o=e.createOscillator(),i=e.createGain();o.connect(i),i.connect(e.destination),o.type="sine",o.frequency.setValueAtTime(1e3,t),i.gain.setValueAtTime(.1,t),i.gain.exponentialRampToValueAtTime(.01,t+.03),o.start(t),o.stop(t+.03)}static playNotification(){const e=this.getAudioContext();if(!e)return;const t=e.currentTime;[880,1174.66].forEach((i,s)=>{const l=e.createOscillator(),a=e.createGain();l.connect(a),a.connect(e.destination),l.type="sine",l.frequency.setValueAtTime(i,t);const c=s*.15;a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(.12,t+c+.02),a.gain.exponentialRampToValueAtTime(.01,t+c+.4),l.start(t+c),l.stop(t+c+.4)})}static playXpGain(){const e=this.getAudioContext();if(!e)return;const t=e.currentTime,o=e.createOscillator(),i=e.createGain();o.connect(i),i.connect(e.destination),o.type="sine",o.frequency.setValueAtTime(440,t),o.frequency.exponentialRampToValueAtTime(880,t+.15),i.gain.setValueAtTime(0,t),i.gain.linearRampToValueAtTime(.15,t+.01),i.gain.exponentialRampToValueAtTime(.01,t+.2),o.start(t),o.stop(t+.2)}}const pw=(n,e)=>hw.playLevelUp(n,e),mw={class:"level-progress-container"},gw=["width","height","viewBox"],vw={key:0},yw=["r"],kw=["y"],bw=["d","stroke-width"],xw=["d","stroke","stroke-width"],ww=["d"],Cw=["d","stroke","stroke-width"],Ew={"font-size":"30","font-weight":"bold",fill:"var(--lumen-purple-100)",style:{"font-family":"'Montserrat', sans-serif","letter-spacing":"8px"}},Sw={"xlink:href":"#labelTextArc",startOffset:"50%","text-anchor":"middle","alignment-baseline":"hanging","dominant-baseline":"hanging","text-length":"100%"},Mw=["x1","y1","x2","y2"],Yo=400,tu=18,Tw=18,Nw=600,Bw=12,Aw=8,$w=r.defineComponent({__name:"LumenLevelProgress",props:{value:{},max:{},level:{},levelLabel:{},size:{},thickness:{},labelThickness:{},staticArcAngle:{},gapAngle:{},userSettings:{}},emits:["levelup"],setup(n,{emit:e}){const t=n,o=e,i=r.ref(!1),s=r.ref(t.value),l=r.ref("forward");let a=null,c=t.value,u=t.level;const d=Yo,f=t.size??Yo,h=Yo/2,p=r.computed(()=>t.thickness??24),m=r.computed(()=>t.labelThickness??46),g=r.computed(()=>t.gapAngle??16),v=r.computed(()=>(Yo-p.value)/2-tu),y=r.computed(()=>(Yo-m.value)/1.9-tu),b=r.computed(()=>y.value+10),C=r.computed(()=>v.value-p.value/2-Tw),k=r.computed(()=>t.levelLabel?.length??0),x=r.computed(()=>k.value*Aw+Bw),S=r.computed(()=>-x.value/2),M=r.computed(()=>x.value/2),L=r.computed(()=>ce(h,h,y.value,S.value,M.value)),R=r.computed(()=>ce(h,h,b.value,-90,90)),X=r.computed(()=>{const Y=Math.max(0,Math.min(1,s.value/t.max)),me=M.value+g.value,ke=360-x.value-3*g.value;if(Y>=1){const re=S.value-g.value+360;return ce(h,h,v.value,me,re)}const Fe=ke*Y,$e=me+Fe;return ce(h,h,v.value,me,$e)}),ve=r.computed(()=>{const Y=M.value+g.value,me=360-x.value-3*g.value,ke=Math.max(0,Math.min(1,s.value/t.max)),Fe=me*ke,$e=Y+Fe,re=ke===0?Y:$e+g.value,ie=S.value-g.value+360;return ce(h,h,v.value,re,ie)}),fe=r.computed(()=>"url(#staticGradient)"),Se=r.computed(()=>"url(#progressGradient)"),xe=r.computed(()=>{const Y=M.value+g.value;return ee(h,h,v.value,Y)}),U=r.computed(()=>{const Y=M.value+g.value,me=360-x.value-3*g.value,ke=Math.max(0,Math.min(1,s.value/t.max)),Fe=me*ke,$e=Y+Fe;return ee(h,h,v.value,$e)});function ee(Y,me,ke,Fe){const $e=(Fe-90)*Math.PI/180;return{x:Y+ke*Math.cos($e),y:me+ke*Math.sin($e)}}function ce(Y,me,ke,Fe,$e){const re=ee(Y,me,ke,$e%360),ie=ee(Y,me,ke,Fe%360),I=($e-Fe+360)%360<=180?"0":"1";return["M",re.x,re.y,"A",ke,ke,0,I,0,ie.x,ie.y].join(" ")}function be(Y){return Y<.5?2*Y*Y:-1+(4-2*Y)*Y}function K(Y,me){a&&cancelAnimationFrame(a);const ke=me,Fe=Y-ke,$e=performance.now();function re(ie){const A=ie-$e,I=Math.min(A/Nw,1),P=be(I);s.value=ke+Fe*P,I<1?a=requestAnimationFrame(re):(s.value=Y,a=null)}a=requestAnimationFrame(re)}function J(){i.value=!0,pw(t.level,t.userSettings),o("levelup");const me=[10,25,50,100,150,200].includes(t.level);setTimeout(()=>{i.value=!1},me?2e3:1200)}return r.watch(()=>t.value,Y=>{l.value=Y>=c?"forward":"backward",K(Y,c),c=Y}),r.watch(()=>t.level,Y=>{Y!==u&&Y>u&&J(),u=Y}),(Y,me)=>(r.openBlock(),r.createElementBlock("div",mw,[(r.openBlock(),r.createElementBlock("svg",{width:r.unref(f),height:r.unref(f),viewBox:`0 0 ${r.unref(d)} ${r.unref(d)}`,style:{position:"relative"}},[i.value?(r.openBlock(),r.createElementBlock("g",vw,[r.createElementVNode("circle",{cx:h,cy:h,r:C.value,fill:"#a800ff",opacity:"0.92"},null,8,yw),r.createElementVNode("text",{x:h,y:h+15,"text-anchor":"middle","font-size":"38","font-weight":"bold",fill:"#fff",style:{"font-family":"'Montserrat', sans-serif"}},"Level Up",8,kw)])):r.createCommentVNode("",!0),s.value>=0&&s.value<t.max?(r.openBlock(),r.createElementBlock("path",{key:1,d:ve.value,stroke:"#ddd","stroke-width":p.value,fill:"none","stroke-linecap":"round"},null,8,bw)):r.createCommentVNode("",!0),r.createElementVNode("path",{d:L.value,stroke:fe.value,"stroke-width":m.value,fill:"none","stroke-linecap":"round"},null,8,xw),r.createElementVNode("path",{id:"labelTextArc",d:R.value,stroke:"transparent",fill:"none",transform:"scale(-1, 1) translate(-400, 0)"},null,8,ww),s.value>0?(r.openBlock(),r.createElementBlock("path",{key:2,d:X.value,stroke:Se.value,"stroke-width":p.value,fill:"none","stroke-linecap":"round"},null,8,Cw)):r.createCommentVNode("",!0),r.createElementVNode("text",Ew,[r.createElementVNode("textPath",Sw,r.toDisplayString(n.levelLabel),1)]),r.createElementVNode("defs",null,[me[1]||(me[1]=r.createElementVNode("linearGradient",{id:"staticGradient",x1:"0",y1:"0",x2:"1",y2:"0"},[r.createElementVNode("stop",{offset:"0%","stop-color":"var(--lumen-brand-500)"}),r.createElementVNode("stop",{offset:"100%","stop-color":"var(--lumen-brand-600)"})],-1)),r.createElementVNode("linearGradient",{id:"progressGradient",gradientUnits:"userSpaceOnUse",x1:xe.value.x,y1:xe.value.y,x2:U.value.x,y2:U.value.y},[...me[0]||(me[0]=[r.createElementVNode("stop",{offset:"0%","stop-color":"var(--lumen-brand-600)"},null,-1),r.createElementVNode("stop",{offset:"100%","stop-color":"var(--lumen-brand-400)"},null,-1)])],8,Mw)])],8,gw))]))}}),sa=_e($w,[["__scopeId","data-v-1e45ca3b"]]);class Ow{stack=[];escapeHandlerRegistered=!1;baseZIndex=2147483647;subscribers=new Set;originalBodyOverflow=null;handleEscape=e=>{if(e.key==="Escape"&&this.stack.length>0){e.stopPropagation(),e.preventDefault();const t=this.stack[this.stack.length-1];t&&t.closeOnEscape&&t.closeModal()}};calculateZIndex(e="normal"){const t={low:0,normal:100,high:200,critical:300},o=this.baseZIndex+t[e],i=this.stack.length;return o+i}lockBodyScroll(){typeof document>"u"||(this.originalBodyOverflow===null&&(this.originalBodyOverflow=document.body.style.overflow||""),document.body.style.overflow="hidden")}unlockBodyScroll(){typeof document>"u"||this.stack.length===0&&(document.body.style.overflow=this.originalBodyOverflow||"",this.originalBodyOverflow=null)}notifySubscribers(){const e={modals:[...this.stack],topModal:this.stack[this.stack.length-1]||null,hasModals:this.stack.length>0,highestZIndex:this.stack.length>0?Math.max(...this.stack.map(t=>t.zIndex)):0};this.subscribers.forEach(t=>t(e))}add(e){const t={...e,zIndex:this.calculateZIndex(e.priority)};return this.stack.push(t),this.lockBodyScroll(),this.escapeHandlerRegistered||(document.addEventListener("keydown",this.handleEscape,!0),this.escapeHandlerRegistered=!0),this.notifySubscribers(),t}remove(e){const t=this.stack.findIndex(o=>o.id===e);t>-1&&this.stack.splice(t,1),this.unlockBodyScroll(),this.stack.length===0&&this.escapeHandlerRegistered&&(document.removeEventListener("keydown",this.handleEscape,!0),this.escapeHandlerRegistered=!1),this.notifySubscribers()}subscribe(e){return this.subscribers.add(e),e({modals:[...this.stack],topModal:this.stack[this.stack.length-1]||null,hasModals:this.stack.length>0,highestZIndex:this.stack.length>0?Math.max(...this.stack.map(t=>t.zIndex)):0}),()=>{this.subscribers.delete(e)}}get length(){return this.stack.length}get state(){return{modals:[...this.stack],topModal:this.stack[this.stack.length-1]||null,hasModals:this.stack.length>0,highestZIndex:this.stack.length>0?Math.max(...this.stack.map(e=>e.zIndex)):0}}cleanup(){this.escapeHandlerRegistered&&(document.removeEventListener("keydown",this.handleEscape,!0),this.escapeHandlerRegistered=!1),this.stack=[],this.subscribers.clear(),typeof document<"u"&&this.originalBodyOverflow!==null&&(document.body.style.overflow=this.originalBodyOverflow,this.originalBodyOverflow=null)}}const Bo=new Ow;typeof window<"u"&&window.addEventListener("beforeunload",()=>{Bo.cleanup()});function Vf(n={}){const{closeOnEscape:e=!0,priority:t="normal",component:o}=n,i=r.ref(null),s=r.ref(!1),l=r.ref(null),a=async f=>{if(s.value)return;const h=Symbol("modal");i.value=h;const p=Bo.add({id:h,closeModal:f||c,closeOnEscape:e,priority:t,component:o});return l.value=p,s.value=!0,await r.nextTick(),p},c=()=>{!i.value||!s.value||(Bo.remove(i.value),i.value=null,l.value=null,s.value=!1)},u=()=>i.value?document.querySelector(`[data-modal-id="${i.value.toString()}"]`):null,d=()=>l.value?document.querySelector(`.lumen-modal-backdrop[style*="z-index: ${l.value.zIndex-1}"]`):null;try{r.onUnmounted(()=>{s.value&&c()})}catch{}return{isOpen:s,modalId:i,modalInstance:l,openModal:a,closeModal:c,getModalContainer:u,getModalBackdrop:d,zIndex:()=>l.value?.zIndex||0,isTopModal:()=>{const f=Bo.state;return l.value===f.topModal}}}function Iw(n){const e=()=>`[data-modal-id="${n.toString()}"]`,t=()=>document.querySelector(e())!==null;return{target:e(),isAvailable:t}}function Lw(){const n=r.ref(Bo.state),e=Bo.subscribe(t=>{n.value=t});try{r.onUnmounted(e)}catch{}return{state:n,closeAll:()=>{[...n.value.modals].reverse().forEach(o=>o.closeModal())},closeTop:()=>{const t=n.value.topModal;t&&t.closeModal()},getModalByComponent:t=>n.value.modals.find(o=>o.component===t)}}const Dw={key:0,class:"lumen-modal-backdrop",role:"dialog","aria-modal":"true"},Vw={class:"lumen-modal-header-content"},Rw={class:"lumen-modal-title"},zw={key:0},Pw={key:1,class:"lumen-modal-subtitle"},Hw={class:"lumen-modal-body-content"},_w=r.defineComponent({inheritAttrs:!1,__name:"LumenModal",props:{modelValue:{type:Boolean,default:void 0},closeOnBackdrop:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0},size:{default:"auto"},cardVariant:{default:"modern"},cardPadding:{default:"lg"},cardShadow:{default:"lg"},cardColor:{default:"default"},cardClass:{default:""},title:{},subtitle:{}},emits:["update:modelValue","open","close"],setup(n,{emit:e}){const t=n,o=e,i=r.ref(!1),s=r.ref(null),l=r.ref(null),a=r.ref(null),c=Vf({closeOnEscape:t.closeOnEscape,priority:"normal",component:"UiModal"});r.ref(!0);const u=r.computed(()=>t.modelValue!==void 0?t.modelValue:i.value),d=r.computed(()=>({sm:"lumen-modal-size-sm",md:"lumen-modal-size-md",lg:"lumen-modal-size-lg",xl:"lumen-modal-size-xl","2xl":"lumen-modal-size-2xl","3xl":"lumen-modal-size-3xl","4xl":"lumen-modal-size-4xl","5xl":"lumen-modal-size-5xl","6xl":"lumen-modal-size-6xl",full:"lumen-modal-size-full",auto:"lumen-modal-size-auto"})[t.size]),f=async()=>{a.value=document.activeElement,await c.openModal(p),t.modelValue!==void 0?o("update:modelValue",!0):i.value=!0,o("open")},h=()=>{s.value&&(a.value=s.value.querySelector('button, [tabindex]:not([tabindex="-1"]), a[href], input, select, textarea'),a.value||(a.value=s.value)),f()},p=()=>{t.modelValue!==void 0?o("update:modelValue",!1):i.value=!1,o("close"),c.closeModal(),r.nextTick(()=>{a.value&&document.contains(a.value)&&a.value.focus(),a.value=null})};r.watch(u,async g=>{g?(c.isOpen.value||await c.openModal(p),await r.nextTick(),l.value&&l.value.focus()):c.isOpen.value&&c.closeModal()});const m=g=>{if(!u.value||g.key!=="Tab"||!l.value)return;const v=l.value.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),y=Array.from(v);if(y.length===0)return;const b=y[0],C=y[y.length-1];g.shiftKey?document.activeElement===b&&(g.preventDefault(),C.focus()):document.activeElement===C&&(g.preventDefault(),b.focus())};return r.onMounted(()=>{document.addEventListener("keydown",m)}),r.onUnmounted(()=>{document.removeEventListener("keydown",m)}),(g,v)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[g.$slots.trigger?(r.openBlock(),r.createElementBlock("span",{key:0,ref_key:"triggerElement",ref:s,onClick:h},[r.renderSlot(g.$slots,"trigger",{open:h,close:p,isOpen:u.value},void 0,!0)],512)):r.createCommentVNode("",!0),u.value?(r.openBlock(),r.createBlock(r.Teleport,{key:1,to:"body"},[r.createVNode(r.Transition,{name:"modal"},{default:r.withCtx(()=>[u.value?(r.openBlock(),r.createElementBlock("div",Dw,[r.createElementVNode("div",{class:"lumen-modal-container",ref_key:"modalContainer",ref:l},[r.createVNode(Ui,{variant:n.cardVariant,padding:n.cardPadding,shadow:n.cardShadow,color:n.cardColor,class:r.normalizeClass([n.cardClass,d.value]),tabindex:"-1"},r.createSlots({header:r.withCtx(()=>[r.createElementVNode("div",Vw,[r.createElementVNode("div",Rw,[r.renderSlot(g.$slots,"header",{handleClose:p,isOpen:u.value,openModal:f},()=>[g.$props.title?(r.openBlock(),r.createElementBlock("h2",zw,r.toDisplayString(g.$props.title),1)):r.createCommentVNode("",!0),g.$props.subtitle?(r.openBlock(),r.createElementBlock("p",Pw,r.toDisplayString(g.$props.subtitle),1)):r.createCommentVNode("",!0)],!0)]),n.showCloseButton?(r.openBlock(),r.createElementBlock("button",{key:0,type:"button",class:"lumen-modal-close-button",onClick:p,"aria-label":"Close modal"},[...v[0]||(v[0]=[r.createElementVNode("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[r.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])])):r.createCommentVNode("",!0)])]),default:r.withCtx(()=>[r.createElementVNode("div",Hw,[r.renderSlot(g.$slots,"default",{},void 0,!0)])]),_:2},[g.$slots.footer?{name:"footer",fn:r.withCtx(()=>[r.renderSlot(g.$slots,"footer",{handleClose:p,isOpen:u.value,openModal:f},void 0,!0)]),key:"0"}:void 0]),1032,["variant","padding","shadow","color","class"])],512)])):r.createCommentVNode("",!0)]),_:3})])):r.createCommentVNode("",!0)],64))}}),la=_e(_w,[["__scopeId","data-v-d3177907"]]),Rf={"#000000":{label:"Black"},"#ffffff":{label:"White"},"#64748b":{label:"Tailwind Slate",shades:["#f8fafc","#f1f5f9","#e2e8f0","#cbd5e1","#94a3b8","#64748b","#475569","#334155","#1e293b","#0f172a","#020617"]},"#6b7280":{label:"Tailwind Gray",shades:["#f9fafb","#f3f4f6","#e5e7eb","#d1d5db","#9ca3af","#6b7280","#4b5563","#374151","#1f2937","#111827","#030712"]},"#71717a":{label:"Tailwind Zinc",shades:["#fafafa","#f4f4f5","#e4e4e7","#d4d4d8","#a1a1aa","#71717a","#52525b","#3f3f46","#27272a","#18181b","#09090b"]},"#737373":{label:"Tailwind Neutral",shades:["#fafafa","#f5f5f5","#e5e5e5","#d4d4d4","#a3a3a3","#737373","#525252","#404040","#262626","#171717","#0a0a0a"]},"#78716c":{label:"Tailwind Stone",shades:["#fafaf9","#f5f5f4","#e7e5e4","#d6d3d1","#a8a29e","#78716c","#57534e","#44403c","#292524","#1c1917","#0c0a09"]},"#ef4444":{label:"Tailwind Red",shades:["#fef2f2","#fee2e2","#fecaca","#fca5a5","#f87171","#ef4444","#dc2626","#b91c1c","#991b1b","#7f1d1d","#450a0a"]},"#f97316":{label:"Tailwind Orange",shades:["#fff7ed","#ffedd5","#fed7aa","#fdba74","#fb923c","#f97316","#ea580c","#c2410c","#9a3412","#7c2d12","#431407"]},"#f59e0b":{label:"Tailwind Amber",shades:["#fffbeb","#fef3c7","#fde68a","#fcd34d","#fbbf24","#f59e0b","#d97706","#b45309","#92400e","#78350f","#451a03"]},"#eab308":{label:"Tailwind Yellow",shades:["#fefce8","#fef3c7","#fde68a","#fcd34d","#fbbf24","#eab308","#ca8a04","#a16207","#854d0e","#713f12","#422006"]},"#84cc16":{label:"Tailwind Lime",shades:["#f7fee7","#ecfccb","#d9f99d","#bef264","#a3e635","#84cc16","#65a30d","#4d7c0f","#365314","#1a2e05","#0a0f02"]},"#22c55e":{label:"Tailwind Green",shades:["#f0fdf4","#dcfce7","#bbf7d0","#86efac","#4ade80","#22c55e","#16a34a","#15803d","#166534","#14532d","#052e16"]},"#10b981":{label:"Tailwind Emerald",shades:["#ecfdf5","#d1fae5","#a7f3d0","#6ee7b7","#34d399","#10b981","#059669","#047857","#065f46","#064e3b","#022c22"]},"#14b8a6":{label:"Tailwind Teal",shades:["#f0fdfa","#ccfbf1","#99f6e4","#5eead4","#2dd4bf","#14b8a6","#0d9488","#0f766e","#115e59","#134e4a","#042f2e"]},"#06b6d4":{label:"Tailwind Cyan",shades:["#ecfeff","#cffafe","#a5f3fc","#67e8f9","#22d3ee","#06b6d4","#0891b2","#0e7490","#155e75","#164e63","#083344"]},"#0ea5e9":{label:"Tailwind Sky",shades:["#f0f9ff","#e0f2fe","#bae6fd","#7dd3fc","#38bdf8","#0ea5e9","#0284c7","#0369a1","#075985","#0c4a6e","#082f49"]},"#3b82f6":{label:"Tailwind Blue",shades:["#eff6ff","#dbeafe","#bfdbfe","#93c5fd","#60a5fa","#3b82f6","#2563eb","#1d4ed8","#1e40af","#1e3a8a","#172554"]},"#6366f1":{label:"Tailwind Indigo",shades:["#eef2ff","#e0e7ff","#c7d2fe","#a5b4fc","#818cf8","#6366f1","#4f46e5","#4338ca","#3730a3","#312e81","#1e1b4b"]},"#8b5cf6":{label:"Tailwind Violet",shades:["#f5f3ff","#ede9fe","#ddd6fe","#c4b5fd","#a78bfa","#8b5cf6","#7c3aed","#6d28d9","#5b21b6","#4c1d95","#2e1065"]},"#a855f7":{label:"Tailwind Purple",shades:["#faf5ff","#f3e8ff","#e9d5ff","#d8b4fe","#c084fc","#a855f7","#9333ea","#7c3aed","#6b21a8","#581c87","#3b0764"]},"#d946ef":{label:"Tailwind Fuchsia",shades:["#fdf4ff","#fae8ff","#f5d0fe","#f0abfc","#e879f9","#d946ef","#c026d3","#a21caf","#86198f","#701a75","#4a044e"]},"#ec4899":{label:"Tailwind Pink",shades:["#fdf2f8","#fce7f3","#fbcfe8","#f9a8d4","#f472b6","#ec4899","#db2777","#be185d","#9d174d","#831843","#500724"]},"#f43f5e":{label:"Tailwind Rose",shades:["#fff1f2","#ffe4e6","#fecdd3","#fda4af","#fb7185","#f43f5e","#e11d48","#be123c","#9f1239","#881337","#4c0519"]}},Fw={class:"lumen-color-picker"},Uw={class:"lumen-color-picker-main"},qw=["viewBox"],jw=["d"],Ww=["d"],Kw=["d"],Gw=["d"],Jw=["d"],Yw=["d"],Xw={class:"lumen-color-picker-preview"},Zw={key:0,class:"lumen-color-picker-contrast"},Qw={class:"lumen-color-picker-contrast-header"},eC={class:"lumen-color-picker-contrast-colors"},tC={class:"lumen-color-picker-contrast-color-demo"},nC={class:"lumen-color-picker-contrast-ratio"},oC={class:"lumen-color-picker-contrast-levels"},rC={class:"lumen-color-picker-contrast-level-value"},iC={class:"lumen-color-picker-contrast-level-value"},sC={class:"lumen-color-picker-contrast-graph"},lC={viewBox:"0 0 280 40",class:"lumen-color-picker-contrast-svg"},aC=["cx","fill"],cC={class:"lumen-color-picker-inputs"},uC={key:0,class:"lumen-color-picker-input-row"},dC={class:"lumen-color-picker-input-group"},fC={class:"lumen-color-picker-button-wrapper"},hC={key:1,class:"lumen-color-picker-input-row"},pC={class:"lumen-color-picker-input-group"},mC={class:"lumen-color-picker-input-group"},gC={class:"lumen-color-picker-input-group"},vC={key:0,class:"lumen-color-picker-input-group"},yC={class:"lumen-color-picker-button-wrapper"},kC={key:2,class:"lumen-color-picker-input-row"},bC={class:"lumen-color-picker-input-group"},xC={class:"lumen-color-picker-input-group"},wC={class:"lumen-color-picker-input-group"},CC={key:0,class:"lumen-color-picker-input-group"},EC={class:"lumen-color-picker-button-wrapper"},SC={key:3,class:"lumen-color-picker-input-row"},MC={class:"lumen-color-picker-input-group"},TC={class:"lumen-color-picker-input-group"},NC={class:"lumen-color-picker-input-group"},BC={key:0,class:"lumen-color-picker-input-group"},AC={class:"lumen-color-picker-button-wrapper"},$C={key:1,class:"lumen-color-picker-swatches"},OC={class:"lumen-color-picker-swatch-row lumen-color-picker-swatch-row--additional"},IC=["onClick"],LC={class:"lumen-color-picker-swatch-row"},DC=["onClick"],VC={class:"lumen-color-picker-shades-inner"},RC={class:"lumen-color-picker-swatch-row lumen-color-picker-swatch-row--shades"},zC=["onClick"],Ht=200,_t=150,PC=r.defineComponent({__name:"LumenColorPicker.Picker",props:{contrastLabel:{},modelValue:{},disabled:{type:Boolean},showAlpha:{type:Boolean},defaultColorFormat:{default:"hex"},swatches:{},additionalSwatches:{},additionalSwatchesLabel:{},showSwatches:{type:Boolean,default:!0},compareColor:{},showContrast:{type:Boolean}},emits:["update:modelValue","change"],setup(n,{emit:e}){function t(){if(typeof window<"u"){const E=getComputedStyle(document.documentElement).getPropertyValue("--lumen-accent").trim();if(E)return E}return"#EA00A8"}const o=n,i=e,s=r.ref(),l=r.ref(),a=r.ref(),c=r.ref(0),u=r.ref(1),d=r.ref(1),f=r.ref(1),h=r.ref(o.modelValue||t()),p=r.ref({r:234,g:0,b:168}),m=r.ref(100),g=r.ref(o.defaultColorFormat||"hex"),v=r.ref({h:0,s:0,l:0}),y=r.ref({l:0,c:0,h:0}),b=r.ref(!1),C=r.ref(!1),k=r.ref(!1),x=r.ref(!1),S=r.ref(!1),M=r.computed(()=>b.value),L=r.ref(null),R=r.ref(o.compareColor);let X=null,ve=null;const fe=r.ref(!1);let Se="";r.watch(()=>[o.showContrast,o.compareColor],([E,w],N)=>{E&&w&&!x.value&&(x.value=!0),typeof w=="string"&&(R.value=w),N&&w!==N[1]&&(lt.value=[],zt.value=[],Nt.value="",Un.value="",wn.value="",qn.value="")},{immediate:!0}),r.watch(x,E=>{E&&o.showContrast&&o.compareColor&&ae()});const xe=r.computed(()=>o.swatches?o.swatches:Rf),U=r.computed(()=>{const E=xe.value;if(Array.isArray(E)){const w={};return E.forEach(N=>{w[N]={label:N}}),w}return E}),ee=r.computed(()=>{if(!o.additionalSwatches)return{};const E=o.additionalSwatches;if(Array.isArray(E)){const w={};return E.forEach(N=>{w[N]={label:N}}),w}return E}),ce=r.computed(()=>Object.keys(U.value)),be=r.computed(()=>Object.keys(ee.value)),K=r.computed(()=>{const E=U.value,w=ee.value,N=q.value.toLowerCase();for(const[W,O]of Object.entries(E))if(W.toLowerCase()===N&&O.shades||O.shades?.some(F=>F.toLowerCase()===N))return W;for(const[W,O]of Object.entries(w))if(W.toLowerCase()===N&&O.shades||O.shades?.some(F=>F.toLowerCase()===N))return W;return null}),J=r.ref([]),Y=r.ref(""),me=r.computed(()=>{if(!K.value)return J.value;const E=U.value[K.value],w=ee.value[K.value],N=E?.shades||w?.shades||[];return N.length>0&&(J.value=N),N}),ke=r.computed(()=>K.value!==null),Fe=r.computed(()=>{if(!K.value)return Y.value;const E=U.value,w=ee.value;let N="";const W=E[K.value];if(W?.label)N=W.label;else{const O=w[K.value];O?.label?N=O.label:N=K.value}return N&&(Y.value=N),N}),$e=E=>E.toLowerCase()===q.value.toLowerCase(),re=E=>{const w=E.replace("#",""),N=parseInt(w.substring(0,2),16),W=parseInt(w.substring(2,4),16),O=parseInt(w.substring(4,6),16),F=Math.pow(N/255,2.4),z=Math.pow(W/255,2.4),D=Math.pow(O/255,2.4);return .2126729*F+.7151522*z+.072175*D<.3?"#ffffff":"#000000"},ie=E=>{const w={"--_color":E};if($e(E)){const N=re(E);return{...w,outlineColor:N,outlineOffset:"-4px"}}return w},A=E=>{const w=U.value,N=ee.value,W=w[E]||N[E];if(W&&W.label)return`${W.label} (${E})`;for(const[O,F]of Object.entries(w))if(F.shades&&F.shades.includes(E)){const z=F.shades.indexOf(E),T=["50","100","200","300","400","500","600","700","800","900","950"][z]||`${z+1}`;return F.label?`${F.label} ${T} (${E})`:`${O} ${T} (${E})`}for(const[O,F]of Object.entries(N))if(F.shades&&F.shades.includes(E)){const z=F.shades.indexOf(E),T=["50","100","200","300","400","500","600","700","800","900","950"][z]||`${z+1}`;return F.label?`${F.label} ${T} (${E})`:`${O} ${T} (${E})`}return E},I=(E,w,N)=>{E=Math.round(E*1e3)/1e3,w=Math.round(w*1e3)/1e3,N=Math.round(N*1e3)/1e3;const W=Math.floor(E/60),O=E/60-W,F=N*(1-w),z=N*(1-w*O),D=N*(1-w*(1-O));let T,V,$;switch(W%6){case 0:T=N,V=D,$=F;break;case 1:T=z,V=N,$=F;break;case 2:T=F,V=N,$=D;break;case 3:T=F,V=z,$=N;break;case 4:T=D,V=F,$=N;break;case 5:T=N,V=F,$=z;break;default:T=V=$=0}return{r:Math.round(T*255),g:Math.round(V*255),b:Math.round($*255)}},P=(E,w,N)=>{E/=255,w/=255,N/=255;const W=Math.max(E,w,N),O=Math.min(E,w,N),F=W-O;let z=0;const D=W===0?0:F/W,T=W;if(F!==0)switch(W){case E:z=((w-N)/F+(w<N?6:0))*60;break;case w:z=((N-E)/F+2)*60;break;case N:z=((E-w)/F+4)*60;break}return{h:Math.round(z*1e3)/1e3,s:Math.round(D*1e3)/1e3,v:Math.round(T*1e3)/1e3}},Q=E=>{const w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(E);return w?{r:parseInt(w[1],16),g:parseInt(w[2],16),b:parseInt(w[3],16)}:null},de=(E,w,N)=>`#${((1<<24)+(E<<16)+(w<<8)+N).toString(16).slice(1)}`,Me=(E,w,N)=>{E/=255,w/=255,N/=255;const W=Math.max(E,w,N),O=Math.min(E,w,N),F=W-O,z=W+O;let D=0,T=0,V=z/2;if(F!==0)switch(T=V>.5?F/(2-z):F/z,W){case E:D=((w-N)/F+(w<N?6:0))/6;break;case w:D=((N-E)/F+2)/6;break;case N:D=((E-w)/F+4)/6;break}return{h:Math.round(D*360),s:Math.round(T*100),l:Math.round(V*100)}},Ne=(E,w,N)=>{E/=360,w/=100,N/=100;const W=(z,D,T)=>(T<0&&(T+=1),T>1&&(T-=1),T<1/6?z+(D-z)*6*T:T<1/2?D:T<2/3?z+(D-z)*(2/3-T)*6:z);if(w===0)return{r:Math.round(N*255),g:Math.round(N*255),b:Math.round(N*255)};const O=N<.5?N*(1+w):N+w-N*w,F=2*N-O;return{r:Math.round(W(F,O,E+1/3)*255),g:Math.round(W(F,O,E)*255),b:Math.round(W(F,O,E-1/3)*255)}},Le=(E,w,N)=>{const W=ft=>(ft/=255,ft<=.04045?ft/12.92:Math.pow((ft+.055)/1.055,2.4)),O=W(E),F=W(w),z=W(N),D=.4122214708*O+.5363325363*F+.0514459929*z,T=.2119034982*O+.6806995451*F+.1073969566*z,V=.0883024619*O+.2817188376*F+.6299787005*z,$=Math.sign(D)*Math.pow(Math.abs(D),1/3),_=Math.sign(T)*Math.pow(Math.abs(T),1/3),Z=Math.sign(V)*Math.pow(Math.abs(V),1/3),oe=.2104542553*$+.793617785*_-.0040720468*Z,se=1.9779984951*$-2.428592205*_+.4505937099*Z,we=.0259040371*$+.7827717662*_-.808675766*Z,Ue=oe,Ye=Math.sqrt(se*se+we*we);let qe=Math.atan2(we,se)*180/Math.PI;return qe<0&&(qe+=360),{l:Math.round(Ue*100),c:Math.round(Ye*100),h:Math.round(qe)}},Ge=(E,w,N)=>{E/=100,w/=100,N=N*Math.PI/180;const W=w*Math.cos(N),O=w*Math.sin(N),F=E+.3963377774*W+.2158037573*O,z=E-.1055613458*W-.0638541728*O,D=E-.0894841775*W-1.291485548*O,T=F*F*F,V=z*z*z,$=D*D*D,_=4.0767416621*T-3.3077115913*V+.2309699292*$,Z=-1.2684380046*T+2.6097574011*V-.3413193965*$,oe=-.0041960863*T-.7034186147*V+1.707614701*$,se=we=>we<=.0031308?we*12.92:1.055*Math.pow(we,1/2.4)-.055;return{r:Math.max(0,Math.min(255,Math.round(se(_)*255))),g:Math.max(0,Math.min(255,Math.round(se(Z)*255))),b:Math.max(0,Math.min(255,Math.round(se(oe)*255)))}},wt=E=>{if(!E)return E;const w=Q(E);if(!w)return E;const N={r:Math.round(w.r),g:Math.round(w.g),b:Math.round(w.b)};return de(N.r,N.g,N.b)},Xt=(E,w,N)=>{const[W,O,F]=[E,w,N].map(z=>(z=z/255,z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4)));return .2126*W+.7152*O+.0722*F},Ot=(E,w)=>{const N=Q(E),W=Q(w);if(!N||!W)return 1;const O=Xt(N.r,N.g,N.b),F=Xt(W.r,W.g,W.b),z=Math.max(O,F),D=Math.min(O,F);return(z+.05)/(D+.05)},xn=(E,w="normal")=>{if(w==="large"){if(E>=4.5)return"AAA";if(E>=3)return"AA"}else{if(E>=7)return"AAA";if(E>=4.5)return"AA"}return"FAIL"},Ct=r.computed(()=>I(c.value,u.value,d.value)),Ho=r.computed(()=>`rgb(${Ct.value.r}, ${Ct.value.g}, ${Ct.value.b})`),q=r.computed(()=>{const{r:E,g:w,b:N}=Ct.value;return o.showAlpha&&f.value<.99?`rgba(${E}, ${w}, ${N}, ${f.value})`:de(E,w,N)}),ae=()=>{if(!o.showContrast||!o.compareColor){L.value=null;return}const E=de(Ct.value.r,Ct.value.g,Ct.value.b),w=Ot(E,o.compareColor);L.value={ratio:w,normalText:xn(w,"normal"),largeText:xn(w,"large"),currentColor:E,compareColor:o.compareColor}},H=r.computed(()=>(X&&clearTimeout(X),X=setTimeout(()=>{ae()},100),L.value)),te=r.computed(()=>{if(!x.value||!R.value)return"";if(Nt.value)return Nt.value;const E=Ht,w=_t,N=4.5,W=(T,V)=>{const $=Math.max(0,Math.min(E,T)),_=Math.max(0,Math.min(w,V)),Z=Math.max(0,Math.min(1,$/E)),oe=Math.max(0,Math.min(1,1-_/w)),se=I(c.value,Z,oe),we=de(se.r,se.g,se.b);return Ot(we,R.value)},O=[],F=[];for(let T=-20;T<=E+20;T+=2){let V=!1,$=-1;for(let _=0;_<w-1;_++){const Z=W(T,_),oe=W(T,_+1);if(Z>=N&&oe<N){let se=_,we=_+1;for(let Ue=0;Ue<8;Ue++){const Ye=(se+we)/2,qe=W(T,Ye);if(Math.abs(qe-N)<.01){$=Ye,V=!0;break}qe>=N?se=Ye:we=Ye}V||($=(se+we)/2,V=!0);break}}V&&$>=0&&F.push({x:T,y:$})}if(F.length===0)return"";if(O.push(...F),O.length>0){const T=O[0],V=O[O.length-1];T.x<0&&(T.x=0),V.x<E&&V.y>5&&V.y<w-5?O.push({x:E,y:V.y}):V.x>E&&(V.x=E)}if(O.length<2)return"";if(O.length===2)return`M ${O[0].x} ${O[0].y} L ${O[1].x} ${O[1].y}`;if(O.length===0)return"";const z=[];for(let T=0;T<O.length;T+=8)z.push(O[T]);if(z.length>0&&z[z.length-1]!==O[O.length-1]&&z.push(O[O.length-1]),z.length===0)return"";if(z.length===1)return`M ${z[0].x} ${z[0].y}`;let D=`M ${z[0].x} ${z[0].y}`;if(z.length===2)D+=` L ${z[1].x} ${z[1].y}`;else{for(let V=1;V<z.length-1;V++){const $=z[V],_=z[V+1],Z=($.x+_.x)/2,oe=($.y+_.y)/2;D+=` Q ${$.x} ${$.y} ${Z} ${oe}`}const T=z[z.length-1];D+=` Q ${T.x} ${T.y} ${T.x} ${T.y}`}return Nt.value=D,D}),le=r.computed(()=>{if(!x.value||!R.value)return"";if(Un.value)return Un.value;const E=Ht,w=_t,N=4.5,W=(D,T)=>{const V=Math.max(0,Math.min(E,D)),$=Math.max(0,Math.min(w,T)),_=Math.max(0,Math.min(1,V/E)),Z=Math.max(0,Math.min(1,1-$/w)),oe=I(c.value,_,Z),se=de(oe.r,oe.g,oe.b);return Ot(se,R.value)},O=[],F=[];for(let D=-20;D<=E+20;D+=2){let T=!1,V=-1;for(let $=w-1;$>=1;$--){const _=W(D,$),Z=W(D,$-1);if(_>=N&&Z<N){let oe=$-1,se=$;for(let we=0;we<8;we++){const Ue=(oe+se)/2,Ye=W(D,Ue);if(Math.abs(Ye-N)<.01){V=Ue,T=!0;break}Ye<N?se=Ue:oe=Ue}T||(V=(oe+se)/2,T=!0);break}}T&&V>=0&&F.push({x:D,y:V})}if(F.length===0)return"";if(F.length>4){O.push(F[0]);const D=Math.floor(F.length/4);for(let V=D;V<F.length-D;V+=D)O.push(F[V]);const T=F[F.length-1];O.push(T)}else O.push(...F);if(O.length>0){const D=O[0],T=O[O.length-1];D.x<0&&(D.x=0),T.x<E&&T.y>5&&T.y<w-5?O.push({x:E,y:T.y}):T.x>E&&(T.x=E)}if(O.length<2)return"";if(O.length===2)return`M ${O[0].x} ${O[0].y} L ${O[1].x} ${O[1].y}`;let z=`M ${O[0].x} ${O[0].y}`;for(let D=1;D<O.length;D++){const T=O[D];if(O.length<=3)if(D===1&&O.length===3){z+=` Q ${T.x} ${T.y} ${O[2].x} ${O[2].y}`;break}else z+=` L ${T.x} ${T.y}`;else{const V=O[D-1];if(D===1){const $=O[D+1],_=V.x+(T.x-V.x)*.3,Z=V.y+(T.y-V.y)*.3,oe=T.x-($.x-V.x)*.1,se=T.y-($.y-V.y)*.1;z+=` C ${_} ${Z}, ${oe} ${se}, ${T.x} ${T.y}`}else if(D===O.length-1){const $=O[D-2],_=V.x+(T.x-$.x)*.1,Z=V.y+(T.y-$.y)*.1,oe=T.x-(T.x-V.x)*.3,se=T.y-(T.y-V.y)*.3;z+=` C ${_} ${Z}, ${oe} ${se}, ${T.x} ${T.y}`}else{const $=O[D+1],_=D>=2?O[D-2]:V,Z=V.x+(T.x-_.x)*.1,oe=V.y+(T.y-_.y)*.1,se=T.x-($.x-V.x)*.1,we=T.y-($.y-V.y)*.1;z+=` C ${Z} ${oe}, ${se} ${we}, ${T.x} ${T.y}`}}}return Un.value=z,z}),He=r.computed(()=>{if(!x.value||!R.value)return"";if(wn.value)return wn.value;const E=Ht,w=_t,N=3,W=(T,V)=>{const $=Math.max(0,Math.min(E,T)),_=Math.max(0,Math.min(w,V)),Z=Math.max(0,Math.min(1,$/E)),oe=Math.max(0,Math.min(1,1-_/w)),se=I(c.value,Z,oe),we=de(se.r,se.g,se.b);return Ot(we,R.value)},O=[],F=[];for(let T=-20;T<=E+20;T+=2){let V=!1,$=-1;for(let _=0;_<w-1;_++){const Z=W(T,_),oe=W(T,_+1);if(Z>=N&&oe<N){let se=_,we=_+1;for(let Ue=0;Ue<8;Ue++){const Ye=(se+we)/2,qe=W(T,Ye);if(Math.abs(qe-N)<.01){$=Ye,V=!0;break}qe>=N?se=Ye:we=Ye}V||($=(se+we)/2,V=!0);break}}V&&$>=0&&F.push({x:T,y:$})}if(F.length===0)return"";if(O.push(...F),O.length>0){const T=O[0],V=O[O.length-1];T.x<0&&(T.x=0),V.x<E&&V.y>5&&V.y<w-5?O.push({x:E,y:V.y}):V.x>E&&(V.x=E)}if(O.length<2)return"";if(O.length===2)return`M ${O[0].x} ${O[0].y} L ${O[1].x} ${O[1].y}`;if(O.length===0)return"";const z=[];for(let T=0;T<O.length;T+=8)z.push(O[T]);if(z.length>0&&z[z.length-1]!==O[O.length-1]&&z.push(O[O.length-1]),z.length===0)return"";if(z.length===1)return`M ${z[0].x} ${z[0].y}`;let D=`M ${z[0].x} ${z[0].y}`;if(z.length===2)D+=` L ${z[1].x} ${z[1].y}`;else{for(let V=1;V<z.length-1;V++){const $=z[V],_=z[V+1],Z=($.x+_.x)/2,oe=($.y+_.y)/2;D+=` Q ${$.x} ${$.y} ${Z} ${oe}`}const T=z[z.length-1];D+=` Q ${T.x} ${T.y} ${T.x} ${T.y}`}return wn.value=D,D}),tt=r.computed(()=>{if(!x.value||!R.value)return"";if(qn.value)return qn.value;const E=Ht,w=_t,N=3,W=(D,T)=>{const V=Math.max(0,Math.min(E,D)),$=Math.max(0,Math.min(w,T)),_=Math.max(0,Math.min(1,V/E)),Z=Math.max(0,Math.min(1,1-$/w)),oe=I(c.value,_,Z),se=de(oe.r,oe.g,oe.b);return Ot(se,R.value)},O=[],F=[];for(let D=-20;D<=E+20;D+=2){let T=!1,V=-1;for(let $=w-1;$>=1;$--){const _=W(D,$),Z=W(D,$-1);if(_>=N&&Z<N){let oe=$-1,se=$;for(let we=0;we<8;we++){const Ue=(oe+se)/2,Ye=W(D,Ue);if(Math.abs(Ye-N)<.01){V=Ue,T=!0;break}Ye<N?se=Ue:oe=Ue}T||(V=(oe+se)/2,T=!0);break}}T&&V>=0&&F.push({x:D,y:V})}if(F.length===0)return"";if(F.length>4){O.push(F[0]);const D=Math.floor(F.length/4);for(let V=D;V<F.length-D;V+=D)O.push(F[V]);const T=F[F.length-1];O.push(T)}else O.push(...F);if(O.length>0){const D=O[0],T=O[O.length-1];D.x<0&&(D.x=0),T.x<E&&T.y>5&&T.y<w-5?O.push({x:E,y:T.y}):T.x>E&&(T.x=E)}if(O.length<2)return"";if(O.length===2)return`M ${O[0].x} ${O[0].y} L ${O[1].x} ${O[1].y}`;let z=`M ${O[0].x} ${O[0].y}`;for(let D=1;D<O.length;D++){const T=O[D];if(O.length<=3)if(D===1&&O.length===3){z+=` Q ${T.x} ${T.y} ${O[2].x} ${O[2].y}`;break}else z+=` L ${T.x} ${T.y}`;else{const V=O[D-1];if(D===1){const $=O[D+1],_=V.x+(T.x-V.x)*.3,Z=V.y+(T.y-V.y)*.3,oe=T.x-($.x-V.x)*.1,se=T.y-($.y-V.y)*.1;z+=` C ${_} ${Z}, ${oe} ${se}, ${T.x} ${T.y}`}else if(D===O.length-1){const $=O[D-2],_=V.x+(T.x-$.x)*.1,Z=V.y+(T.y-$.y)*.1,oe=T.x-(T.x-V.x)*.3,se=T.y-(T.y-V.y)*.3;z+=` C ${_} ${Z}, ${oe} ${se}, ${T.x} ${T.y}`}else{const $=O[D+1],_=D>=2?O[D-2]:V,Z=V.x+(T.x-_.x)*.1,oe=V.y+(T.y-_.y)*.1,se=T.x-($.x-V.x)*.1,we=T.y-($.y-V.y)*.1;z+=` C ${Z} ${oe}, ${se} ${we}, ${T.x} ${T.y}`}}}return qn.value=z,z});r.computed(()=>{if(!x.value||!H.value)return[];const E=Ht,w=_t,N=(O,F)=>{const z=Math.max(0,Math.min(E,O)),D=Math.max(0,Math.min(w,F)),T=Math.max(0,Math.min(1,z/E)),V=Math.max(0,Math.min(1,1-D/w)),$=I(c.value,T,V),_=de($.r,$.g,$.b);return Ot(_,R.value)},W=[];for(let O=0;O<=E;O+=3)for(let F=0;F<w;F++){const z=N(O,F),D=N(O,F+1);if(z<3.1&&D>=3.1||z>=3.1&&D<3.1){W.push({x:O,y:F});break}}for(let O=w-3;O>=0;O-=3)for(let F=0;F<E;F++){const z=N(F,O),D=N(F+1,O);if(z<3.1&&D>=3.1||z>=3.1&&D<3.1){!W.some(V=>Math.abs(V.x-F)<6&&Math.abs(V.y-O)<6)&&W.push({x:F,y:O});break}}return W});const lt=r.ref([]),zt=r.ref([]),Nt=r.ref(""),Un=r.ref(""),wn=r.ref(""),qn=r.ref(""),Or=r.computed(()=>x.value&&R.value&&(!lt.value.length||!zt.value.length)),ss=r.computed(()=>x.value&&R.value);r.computed(()=>ss.value),r.computed(()=>{if(!x.value||!R.value)return[];if(M.value&<.value.length>0||!Or.value&<.value.length>0)return lt.value;const E=[],w=Ht,N=_t,W=6,O=(D,T)=>{const V=Math.max(0,Math.min(w,D)),$=Math.max(0,Math.min(N,T)),_=Math.max(0,Math.min(1,V/w)),Z=Math.max(0,Math.min(1,1-$/N)),oe=I(c.value,_,Z),se=de(oe.r,oe.g,oe.b);return Ot(se,R.value)},F=[];for(let D=0;D<=w;D+=6)for(let T=0;T<N-1;T+=1){const V=O(D,T),$=O(D,T+1);if(V>=4.5&&$<4.5||V<4.5&&$>=4.5){let _=T,Z=T+1;for(let oe=0;oe<6;oe++){const se=(_+Z)/2,we=O(D,se);if(Math.abs(we-4.5)<.05){F.push({x:D,y:se});break}we>4.5?_=se:Z=se}(F.length===0||F[F.length-1].x!==D)&&F.push({x:D,y:(_+Z)/2});break}}const z=(D,T)=>{if(F.length===0)return 50;let V=1/0;for(const $ of F){const _=Math.sqrt(Math.pow(D-$.x,2)+Math.pow(T-$.y,2));V=Math.min(V,_)}return V};for(let D=W/2;D<w;D+=W)for(let T=W/2;T<N;T+=W)if(O(D,T)<4.5){const $=z(D,T),_=4;if($>=_){const oe=$-_,se=Math.min(oe/40,1),we=.6,Ye=we-(we-.3)*Math.pow(se,.7),qe=1.8,ko=qe-(qe-1.5)*Math.pow(se,.6);Ye>.2&&ko>.8&&E.push({x:D,y:T,radius:ko,opacity:Ye,fill:"#ff8c00"})}}return lt.value=E,E}),r.computed(()=>{if(!x.value||!R.value)return[];if(M.value&&zt.value.length>0||!Or.value&&zt.value.length>0)return zt.value;const E=[],w=Ht,N=_t,W=3,O=6,F=(T,V)=>{const $=Math.max(0,Math.min(w,T)),_=Math.max(0,Math.min(N,V)),Z=Math.max(0,Math.min(1,$/w)),oe=Math.max(0,Math.min(1,1-_/N)),se=I(c.value,Z,oe),we=de(se.r,se.g,se.b);return Ot(we,R.value)},z=[];for(let T=0;T<=w;T+=6)for(let V=0;V<N-1;V+=1){const $=F(T,V),_=F(T,V+1);if($>=W&&_<W||$<W&&_>=W){let Z=V,oe=V+1;for(let se=0;se<6;se++){const we=(Z+oe)/2,Ue=F(T,we);if(Math.abs(Ue-W)<.05){z.push({x:T,y:we});break}Ue<W?oe=we:Z=we}}}const D=(T,V)=>{let $=1/0;for(const _ of z){const Z=Math.sqrt(Math.pow(T-_.x,2)+Math.pow(V-_.y,2));$=Math.min($,Z)}return $};for(let T=O/2;T<w;T+=O)for(let V=O/2;V<N;V+=O)if(F(T,V)<W){const _=D(T,V),Z=4;if(_>=Z){const se=_-Z,we=Math.min(se/40,1),Ue=.6,qe=Ue-(Ue-.3)*Math.pow(we,.7),ft=1.8,jo=ft-(ft-1.5)*Math.pow(we,.6);qe>.2&&jo>.8&&E.push({x:T,y:V,radius:jo,opacity:qe,fill:"#ef4444"})}}return zt.value=E,E});const mo=r.computed(()=>{if(!x.value||!R.value)return"";const E=Ht,w=_t,N=(z,D)=>{const T=Math.max(0,Math.min(E,z)),V=Math.max(0,Math.min(w,D)),$=Math.max(0,Math.min(1,T/E)),_=Math.max(0,Math.min(1,1-V/w)),Z=I(c.value,$,_),oe=de(Z.r,Z.g,Z.b);return Ot(oe,R.value)},W=[],O=[];for(let z=-20;z<=E+20;z+=2){for(let D=0;D<w;D++)if(N(z,D)<4.5){W.push({x:z,y:D});break}for(let D=w-1;D>=0;D--)if(N(z,D)<4.5){O.push({x:z,y:D});break}}if(W.length<3||O.length<3)return"";let F="M";for(let z=0;z<W.length;z++){const D=W[z];z===0?F+=` ${D.x} ${D.y}`:F+=` L ${D.x} ${D.y}`}for(let z=O.length-1;z>=0;z--){const D=O[z];F+=` L ${D.x} ${D.y}`}return F+=" Z",F}),_o=r.computed(()=>{if(!x.value||!R.value)return"";const E=Ht,w=_t,N=3,W=(D,T)=>{const V=Math.max(0,Math.min(E,D)),$=Math.max(0,Math.min(w,T)),_=Math.max(0,Math.min(1,V/E)),Z=Math.max(0,Math.min(1,1-$/w)),oe=I(c.value,_,Z),se=de(oe.r,oe.g,oe.b);return Ot(se,R.value)},O=[],F=[];for(let D=-20;D<=E+20;D+=2){for(let T=0;T<w;T++)if(W(D,T)<N){O.push({x:D,y:T});break}for(let T=w-1;T>=0;T--)if(W(D,T)<N){F.push({x:D,y:T});break}}if(O.length<3||F.length<3)return"";let z="M";for(let D=0;D<O.length;D++){const T=O[D];D===0?z+=` ${T.x} ${T.y}`:z+=` L ${T.x} ${T.y}`}for(let D=F.length-1;D>=0;D--){const T=F[D];z+=` L ${T.x} ${T.y}`}return z+=" Z",z}),Fo=E=>{o.disabled||(b.value=!0,ln(E),document.addEventListener("mousemove",Cn),document.addEventListener("mouseup",sn),document.addEventListener("touchmove",Cn),document.addEventListener("touchend",sn))},Cn=E=>{b.value&&ln(E)},sn=()=>{b.value=!1,document.removeEventListener("mousemove",Cn),document.removeEventListener("mouseup",sn),document.removeEventListener("touchmove",Cn),document.removeEventListener("touchend",sn)},ln=E=>{if(!s.value)return;const w=s.value.getBoundingClientRect(),N="touches"in E?E.touches[0].clientX:E.clientX,W="touches"in E?E.touches[0].clientY:E.clientY,O=Math.max(0,Math.min(w.width,N-w.left)),F=Math.max(0,Math.min(w.height,W-w.top));u.value=O/w.width,d.value=1-F/w.height},B=E=>{o.disabled||(C.value=!0,Ae(E),document.addEventListener("mousemove",j),document.addEventListener("mouseup",ue),document.addEventListener("touchmove",j),document.addEventListener("touchend",ue))},j=E=>{C.value&&Ae(E)},ue=()=>{C.value=!1,document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",ue),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",ue)},Ae=E=>{if(!l.value)return;const w=l.value.getBoundingClientRect(),N="touches"in E?E.touches[0].clientY:E.clientY,W=Math.max(0,Math.min(w.height,N-w.top));c.value=W/w.height*360},Qe=E=>{o.disabled||!o.showAlpha||(k.value=!0,ge(E),document.addEventListener("mousemove",Je),document.addEventListener("mouseup",ye),document.addEventListener("touchmove",Je),document.addEventListener("touchend",ye))},Je=E=>{k.value&&ge(E)},ye=()=>{k.value=!1,document.removeEventListener("mousemove",Je),document.removeEventListener("mouseup",ye),document.removeEventListener("touchmove",Je),document.removeEventListener("touchend",ye)},ge=E=>{if(!a.value)return;const w=a.value.getBoundingClientRect(),N="touches"in E?E.touches[0].clientX:E.clientX,W=Math.max(0,Math.min(w.width,N-w.left));f.value=W/w.width,m.value=Math.round(f.value*100)},Be=()=>{const E=h.value;if(E.length===7&&E.startsWith("#")){const w=Q(E);if(w){const N=P(w.r,w.g,w.b);c.value=N.h,u.value=N.s,d.value=N.v,En()}}},at=()=>{const{r:E,g:w,b:N}=Ct.value;h.value=de(E,w,N)},et=()=>{const{r:E,g:w,b:N}=p.value;if(E>=0&&E<=255&&w>=0&&w<=255&&N>=0&&N<=255){const W=P(E,w,N);c.value=W.h,u.value=W.s,d.value=W.v,Zt(),Uo(),qo()}},an=()=>{const{h:E,s:w,l:N}=v.value;if(E>=0&&E<=360&&w>=0&&w<=100&&N>=0&&N<=100){const W=Ne(E,w,N),O=P(W.r,W.g,W.b);c.value=O.h,u.value=O.s,d.value=O.v,Zt(),En(),qo()}},jn=()=>{const{l:E,c:w,h:N}=y.value;if(E>=0&&E<=100&&w>=0&&w<=100&&N>=0&&N<=360){const W=Ge(E,w,N),O=P(W.r,W.g,W.b);c.value=O.h,u.value=O.s,d.value=O.v,Zt(),En(),Uo()}},Wn=()=>{const E=Math.max(0,Math.min(100,m.value));f.value=E/100,m.value=E},go=()=>{const E=["hex","rgb","hsl","oklch"],N=(E.indexOf(g.value)+1)%E.length;g.value=E[N]},Zt=()=>{const{r:E,g:w,b:N}=Ct.value;h.value=de(E,w,N)},En=()=>{const{r:E,g:w,b:N}=Ct.value;p.value={r:E,g:w,b:N}},Uo=()=>{const{r:E,g:w,b:N}=Ct.value,W=Me(E,w,N);v.value=W},qo=()=>{const{r:E,g:w,b:N}=Ct.value,W=Le(E,w,N);y.value=W},vo=E=>{if(o.disabled)return;const w=Q(E);if(w){const N=P(w.r,w.g,w.b);c.value=N.h,u.value=N.s,d.value=N.v,Zt(),En()}},yo=()=>{x.value=!x.value},Ir=()=>{if(!o.modelValue)return;let E;if(o.modelValue.startsWith("#"))E=Q(o.modelValue),h.value=o.modelValue;else{const w=o.modelValue.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/);w&&(E={r:parseInt(w[1]),g:parseInt(w[2]),b:parseInt(w[3])},h.value=de(E.r,E.g,E.b))}if(E){const w=P(E.r,E.g,E.b);c.value=w.h,u.value=w.s,d.value=w.v,Zt(),En()}};return r.watch([c,u,d,f],()=>{Zt(),En(),Uo(),qo();const E=wt(q.value);E!==Se&&(S.value?(ve&&clearTimeout(ve),ve=setTimeout(()=>{const w=wt(q.value);w!==Se&&(fe.value=!0,Se=w,i("update:modelValue",w),i("change",w),setTimeout(()=>{fe.value=!1},5))},16)):(fe.value=!0,Se=E,i("update:modelValue",E),i("change",E),setTimeout(()=>{fe.value=!1},5)))},{deep:!0}),r.watch(c,()=>{x.value&&o.compareColor&&(lt.value=[],zt.value=[],Nt.value="",Un.value="",wn.value="",qn.value="")}),r.watch(()=>o.modelValue,E=>{if(E&&!fe.value){const w=wt(E),N=wt(q.value);w!==N&&Ir()}}),r.onMounted(()=>{Ir()}),r.onUnmounted(()=>{X&&clearTimeout(X),document.removeEventListener("mousemove",Cn),document.removeEventListener("mouseup",sn),document.removeEventListener("touchmove",Cn),document.removeEventListener("touchend",sn)}),(E,w)=>(r.openBlock(),r.createElementBlock("div",Fw,[r.createElementVNode("div",Uw,[r.createElementVNode("div",{ref_key:"colorAreaRef",ref:s,class:"lumen-color-picker-area",style:r.normalizeStyle({"--_global-picker-width":`${Ht}px`,"--_global-picker-height":`${_t}px`,backgroundColor:`hsl(${c.value}, 100%, 50%)`}),onMousedown:Fo,onTouchstart:Fo},[w[16]||(w[16]=r.createElementVNode("div",{class:"lumen-color-picker-saturation"},null,-1)),w[17]||(w[17]=r.createElementVNode("div",{class:"lumen-color-picker-brightness"},null,-1)),R.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["lumen-color-picker-contrast-overlay",{"contrast-overlay-visible":x.value}])},[H.value?(r.openBlock(),r.createElementBlock("svg",{key:0,class:"lumen-color-picker-contrast-svg-overlay",viewBox:`0 0 ${Ht} ${_t}`},[r.createElementVNode("defs",null,[r.createElementVNode("clipPath",{id:"canvasClip"},[r.createElementVNode("rect",{x:"0",y:"0",width:Ht,height:_t})]),w[13]||(w[13]=r.createElementVNode("pattern",{id:"orangeDotsPattern",x:"0",y:"0",width:"6",height:"6",patternUnits:"userSpaceOnUse"},[r.createElementVNode("circle",{cx:"3",cy:"3",r:"1.8",fill:"white",opacity:"0.3"})],-1)),w[14]||(w[14]=r.createElementVNode("pattern",{id:"redDotsPattern",x:"0",y:"0",width:"6",height:"6",patternUnits:"userSpaceOnUse"},[r.createElementVNode("circle",{cx:"3",cy:"3",r:"1.8",fill:"white",opacity:"0.3"})],-1))]),mo.value?(r.openBlock(),r.createElementBlock("path",{key:0,d:mo.value,fill:"url(#orangeDotsPattern)","clip-path":"url(#canvasClip)",opacity:"0.4"},null,8,jw)):r.createCommentVNode("",!0),_o.value?(r.openBlock(),r.createElementBlock("path",{key:1,d:_o.value,fill:"url(#redDotsPattern)","clip-path":"url(#canvasClip)",opacity:"0.4"},null,8,Ww)):r.createCommentVNode("",!0),He.value?(r.openBlock(),r.createElementBlock("path",{key:2,d:He.value,fill:"none",stroke:"white","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"6 8","stroke-opacity":"0.5","clip-path":"url(#canvasClip)"},null,8,Kw)):r.createCommentVNode("",!0),tt.value?(r.openBlock(),r.createElementBlock("path",{key:3,d:tt.value,fill:"none",stroke:"white","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"6 8","stroke-opacity":"0.5","clip-path":"url(#canvasClip)"},null,8,Gw)):r.createCommentVNode("",!0),te.value?(r.openBlock(),r.createElementBlock("path",{key:4,d:te.value,fill:"none",stroke:"white","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round","stroke-opacity":"0.5","clip-path":"url(#canvasClip)"},null,8,Jw)):r.createCommentVNode("",!0),le.value?(r.openBlock(),r.createElementBlock("path",{key:5,d:le.value,fill:"none",stroke:"white","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round","stroke-opacity":"0.5","clip-path":"url(#canvasClip)"},null,8,Yw)):r.createCommentVNode("",!0)],8,qw)):r.createCommentVNode("",!0)],2)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"lumen-color-picker-cursor",style:r.normalizeStyle({left:`${u.value*100}%`,top:`${(1-d.value)*100}%`,backgroundColor:q.value})},[...w[15]||(w[15]=[r.createElementVNode("div",{class:"lumen-color-picker-cursor-inner"},null,-1)])],4)],36),r.createElementVNode("div",{ref_key:"hueSliderRef",ref:l,class:"lumen-color-picker-hue-slider",onMousedown:B,onTouchstart:B},[r.createElementVNode("div",{class:"lumen-color-picker-hue-thumb",style:r.normalizeStyle({top:`${c.value/360*100}%`})},null,4)],544),r.createElementVNode("div",Xw,[r.createElementVNode("div",{class:"lumen-color-picker-preview-color",style:r.normalizeStyle({"--background-color":q.value})},null,4),o.showContrast&&o.compareColor?(r.openBlock(),r.createBlock(r.unref(vn),{key:0,content:x.value?"Hide contrast analysis":"Show contrast analysis",position:"top",delay:300},{default:r.withCtx(()=>[r.createVNode(r.unref(gn),{onClick:yo,icon:!0,squircle:!0,size:"xs",variant:x.value?"primary":"ghost"},{icon:r.withCtx(()=>[r.createVNode(r.unref(lp))]),_:1},8,["variant"])]),_:1},8,["content"])):r.createCommentVNode("",!0)])]),r.createElementVNode("div",{class:r.normalizeClass(["lumen-color-picker-contrast-wrapper",{"contrast-block-visible":x.value}])},[H.value?(r.openBlock(),r.createElementBlock("div",Zw,[r.createElementVNode("div",Qw,[w[18]||(w[18]=r.createElementVNode("h4",{class:"lumen-color-picker-contrast-title"},"Contrast Check",-1)),r.createElementVNode("div",eC,[r.createElementVNode("div",tC,[r.createElementVNode("div",{class:"lumen-color-picker-contrast-text",style:r.normalizeStyle({color:H.value.currentColor,backgroundColor:H.value.compareColor})}," Aa ",4)]),r.createElementVNode("div",nC,r.toDisplayString(H.value.ratio.toFixed(2))+":1 ",1)])]),r.createElementVNode("div",oC,[r.createElementVNode("div",{class:r.normalizeClass(["lumen-color-picker-contrast-level",{"lumen-color-picker-contrast-level--pass":H.value.normalText!=="FAIL","lumen-color-picker-contrast-level--fail":H.value.normalText==="FAIL"}])},[w[19]||(w[19]=r.createElementVNode("div",{class:"lumen-color-picker-contrast-level-indicator"},[r.createElementVNode("div",{class:"lumen-color-picker-contrast-level-line lumen-color-picker-contrast-level-line--solid"}),r.createElementVNode("span",{class:"lumen-color-picker-contrast-level-label"},"Normal Text")],-1)),r.createElementVNode("span",rC,r.toDisplayString(H.value.normalText),1)],2),r.createElementVNode("div",{class:r.normalizeClass(["lumen-color-picker-contrast-level",{"lumen-color-picker-contrast-level--pass":H.value.largeText!=="FAIL","lumen-color-picker-contrast-level--fail":H.value.largeText==="FAIL"}])},[w[20]||(w[20]=r.createElementVNode("div",{class:"lumen-color-picker-contrast-level-indicator"},[r.createElementVNode("div",{class:"lumen-color-picker-contrast-level-line lumen-color-picker-contrast-level-line--dashed"}),r.createElementVNode("span",{class:"lumen-color-picker-contrast-level-label"},"Large Text")],-1)),r.createElementVNode("span",iC,r.toDisplayString(H.value.largeText),1)],2)]),r.createElementVNode("div",sC,[(r.openBlock(),r.createElementBlock("svg",lC,[w[21]||(w[21]=r.createStaticVNode('<defs data-v-c26009d5><linearGradient id="contrastGradientDefault" x1="0%" y1="0%" x2="100%" y2="0%" data-v-c26009d5><stop offset="0%" stop-color="#ef4444" data-v-c26009d5></stop><stop offset="21.4%" stop-color="#ef4444" data-v-c26009d5></stop><stop offset="21.4%" stop-color="#f59e0b" data-v-c26009d5></stop><stop offset="64.3%" stop-color="#f59e0b" data-v-c26009d5></stop><stop offset="64.3%" stop-color="#22c55e" data-v-c26009d5></stop><stop offset="100%" stop-color="#22c55e" data-v-c26009d5></stop></linearGradient></defs><rect x="0" y="15" width="280" height="10" fill="url(#contrastGradientDefault)" rx="5" data-v-c26009d5></rect><line x1="60" y1="10" x2="60" y2="30" stroke="#666" stroke-width="1" opacity="0.5" data-v-c26009d5></line><line x1="180" y1="10" x2="180" y2="30" stroke="#666" stroke-width="1" opacity="0.5" data-v-c26009d5></line>',4)),r.createElementVNode("circle",{cx:Math.min(270,Math.max(10,Math.min(H.value.ratio,14)/14*260+10)),cy:"20",r:"6",fill:H.value.normalText==="FAIL"?"#ef4444":"#22c55e",stroke:"white","stroke-width":"2"},null,8,aC)])),w[22]||(w[22]=r.createStaticVNode('<div class="lumen-color-picker-contrast-labels" data-v-c26009d5><span class="lumen-color-picker-contrast-label" data-v-c26009d5>1:1</span><span class="lumen-color-picker-contrast-label" style="left:60px;" data-v-c26009d5>3:1</span><span class="lumen-color-picker-contrast-label" style="left:180px;" data-v-c26009d5>4.5:1</span><span class="lumen-color-picker-contrast-label" style="right:0;" data-v-c26009d5>14:1+</span></div>',1))])])):r.createCommentVNode("",!0)],2),o.showAlpha?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"alphaSliderRef",ref:a,class:"lumen-color-picker-alpha-slider",onMousedown:Qe,onTouchstart:Qe},[w[23]||(w[23]=r.createElementVNode("div",{class:"lumen-color-picker-alpha-bg"},null,-1)),r.createElementVNode("div",{class:"lumen-color-picker-alpha-gradient",style:r.normalizeStyle({background:`linear-gradient(to right, transparent, ${Ho.value})`})},null,4),r.createElementVNode("div",{class:"lumen-color-picker-alpha-thumb",style:r.normalizeStyle({left:`${f.value*100}%`})},null,4)],544)):r.createCommentVNode("",!0),r.createElementVNode("div",cC,[g.value==="hex"?(r.openBlock(),r.createElementBlock("div",uC,[r.createElementVNode("div",dC,[w[24]||(w[24]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"Hex",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[0]||(w[0]=N=>h.value=N),onInput:Be,onBlur:at,class:"lumen-color-picker-input",type:"text",maxlength:"7",placeholder:"#000000"},null,544),[[r.vModelText,h.value]])]),r.createElementVNode("div",fC,[r.createVNode(r.unref(gn),{color:"secondary",size:"xs",icon:"",squircle:"",onClick:go,"aria-label":"Switch color format"},{icon:r.withCtx(()=>[r.createVNode(r.unref(Xo))]),_:1})])])):g.value==="rgb"?(r.openBlock(),r.createElementBlock("div",hC,[r.createElementVNode("div",pC,[w[25]||(w[25]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"R",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[1]||(w[1]=N=>p.value.r=N),onInput:et,class:"lumen-color-picker-input",type:"number",min:"0",max:"255"},null,544),[[r.vModelText,p.value.r,void 0,{number:!0}]])]),r.createElementVNode("div",mC,[w[26]||(w[26]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"G",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[2]||(w[2]=N=>p.value.g=N),onInput:et,class:"lumen-color-picker-input",type:"number",min:"0",max:"255"},null,544),[[r.vModelText,p.value.g,void 0,{number:!0}]])]),r.createElementVNode("div",gC,[w[27]||(w[27]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"B",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[3]||(w[3]=N=>p.value.b=N),onInput:et,class:"lumen-color-picker-input",type:"number",min:"0",max:"255"},null,544),[[r.vModelText,p.value.b,void 0,{number:!0}]])]),o.showAlpha?(r.openBlock(),r.createElementBlock("div",vC,[w[28]||(w[28]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"A",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[4]||(w[4]=N=>m.value=N),onInput:Wn,class:"lumen-color-picker-input",type:"number",min:"0",max:"100"},null,544),[[r.vModelText,m.value,void 0,{number:!0}]])])):r.createCommentVNode("",!0),r.createElementVNode("div",yC,[r.createVNode(r.unref(gn),{color:"secondary",size:"xs",icon:"",squircle:"",onClick:go,"aria-label":"Switch color format"},{icon:r.withCtx(()=>[r.createVNode(r.unref(Xo))]),_:1})])])):g.value==="hsl"?(r.openBlock(),r.createElementBlock("div",kC,[r.createElementVNode("div",bC,[w[29]||(w[29]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"H",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[5]||(w[5]=N=>v.value.h=N),onInput:an,class:"lumen-color-picker-input",type:"number",min:"0",max:"360"},null,544),[[r.vModelText,v.value.h,void 0,{number:!0}]])]),r.createElementVNode("div",xC,[w[30]||(w[30]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"S",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[6]||(w[6]=N=>v.value.s=N),onInput:an,class:"lumen-color-picker-input",type:"number",min:"0",max:"100"},null,544),[[r.vModelText,v.value.s,void 0,{number:!0}]])]),r.createElementVNode("div",wC,[w[31]||(w[31]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"L",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[7]||(w[7]=N=>v.value.l=N),onInput:an,class:"lumen-color-picker-input",type:"number",min:"0",max:"100"},null,544),[[r.vModelText,v.value.l,void 0,{number:!0}]])]),o.showAlpha?(r.openBlock(),r.createElementBlock("div",CC,[w[32]||(w[32]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"A",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[8]||(w[8]=N=>m.value=N),onInput:Wn,class:"lumen-color-picker-input",type:"number",min:"0",max:"100"},null,544),[[r.vModelText,m.value,void 0,{number:!0}]])])):r.createCommentVNode("",!0),r.createElementVNode("div",EC,[r.createVNode(r.unref(gn),{color:"secondary",size:"xs",icon:"",squircle:"",onClick:go,"aria-label":"Switch color format"},{icon:r.withCtx(()=>[r.createVNode(r.unref(Xo))]),_:1})])])):g.value==="oklch"?(r.openBlock(),r.createElementBlock("div",SC,[r.createElementVNode("div",MC,[w[33]||(w[33]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"L",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[9]||(w[9]=N=>y.value.l=N),onInput:jn,class:"lumen-color-picker-input",type:"number",min:"0",max:"100"},null,544),[[r.vModelText,y.value.l,void 0,{number:!0}]])]),r.createElementVNode("div",TC,[w[34]||(w[34]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"C",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[10]||(w[10]=N=>y.value.c=N),onInput:jn,class:"lumen-color-picker-input",type:"number",min:"0",max:"100"},null,544),[[r.vModelText,y.value.c,void 0,{number:!0}]])]),r.createElementVNode("div",NC,[w[35]||(w[35]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"H",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[11]||(w[11]=N=>y.value.h=N),onInput:jn,class:"lumen-color-picker-input",type:"number",min:"0",max:"360"},null,544),[[r.vModelText,y.value.h,void 0,{number:!0}]])]),o.showAlpha?(r.openBlock(),r.createElementBlock("div",BC,[w[36]||(w[36]=r.createElementVNode("label",{class:"lumen-color-picker-label"},"A",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":w[12]||(w[12]=N=>m.value=N),onInput:Wn,class:"lumen-color-picker-input",type:"number",min:"0",max:"100"},null,544),[[r.vModelText,m.value,void 0,{number:!0}]])])):r.createCommentVNode("",!0),r.createElementVNode("div",AC,[r.createVNode(r.unref(gn),{color:"secondary",size:"xs",icon:"",squircle:"",onClick:go,"aria-label":"Switch color format"},{icon:r.withCtx(()=>[r.createVNode(r.unref(Xo))]),_:1})])])):r.createCommentVNode("",!0)]),o.showSwatches?(r.openBlock(),r.createElementBlock("div",$C,[be.value.length>0?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[r.createVNode(r.unref(Dt),{text:n.additionalSwatchesLabel||"Custom Colors","text-position":"left",color:"#d1d5db",margin:12},null,8,["text"]),r.createElementVNode("div",OC,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(be.value,N=>(r.openBlock(),r.createBlock(r.unref(vn),{key:N,content:A(N),position:"top",delay:300},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(["lumen-color-picker-swatch",{"lumen-color-picker-swatch--active":$e(N)}]),style:r.normalizeStyle(ie(N)),onClick:W=>vo(N)},null,14,IC)]),_:2},1032,["content"]))),128))])],64)):r.createCommentVNode("",!0),r.createVNode(r.unref(Dt),{color:"#d1d5db",margin:8}),r.createElementVNode("div",LC,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(ce.value,N=>(r.openBlock(),r.createBlock(r.unref(vn),{key:N,content:A(N),position:"top",delay:300},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(["lumen-color-picker-swatch",{"lumen-color-picker-swatch--active":$e(N)}]),style:r.normalizeStyle(ie(N)),onClick:W=>vo(N)},null,14,DC)]),_:2},1032,["content"]))),128))]),r.createElementVNode("div",{class:r.normalizeClass(["lumen-color-picker-shades-container",{"lumen-color-picker-shades-container--expanded":ke.value}])},[r.createElementVNode("div",VC,[r.createVNode(r.unref(Dt),{text:`${Fe.value} Shades`,"text-position":"left",color:"#d1d5db",margin:8},null,8,["text"]),r.createElementVNode("div",RC,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(me.value,N=>(r.openBlock(),r.createBlock(r.unref(vn),{key:N,content:A(N),position:"top",delay:300},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(["lumen-color-picker-swatch lumen-color-picker-swatch--shade",{"lumen-color-picker-swatch--active":$e(N)}]),style:r.normalizeStyle(ie(N)),onClick:W=>vo(N)},null,14,zC)]),_:2},1032,["content"]))),128))])])],2)])):r.createCommentVNode("",!0)]))}}),zf=_e(PC,[["__scopeId","data-v-c26009d5"]]),HC={class:"lumen-color-picker-button-preview"},_C=r.defineComponent({__name:"LumenColorPicker.Button",props:{modelValue:{},disabled:{type:Boolean,default:!1},showAlpha:{type:Boolean,default:!1},defaultColorFormat:{default:"hex"},swatches:{},additionalSwatches:{},additionalSwatchesLabel:{},showSwatches:{type:Boolean,default:!0},compareColor:{},showContrast:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,i=r.ref(),s=r.ref(),l=r.ref(!1),a=r.computed({get:()=>t.modelValue,set:p=>o("update:modelValue",p)}),c=r.computed(()=>t.modelValue||"#000000"),{floatingStyle:u,updatePosition:d,cleanup:f}=Mr({trigger:i,floating:s,placement:"bottom-start",offset:8,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{l.value=!1}}}),h=async()=>{t.disabled||(l.value=!l.value,l.value&&(await r.nextTick(),d()))};return r.watch([()=>t.showContrast,()=>t.compareColor],()=>{l.value&&r.nextTick(()=>{setTimeout(()=>{d()},50)})},{flush:"post"}),r.watch(()=>t.modelValue,()=>{l.value&&t.showContrast&&t.compareColor&&r.nextTick(()=>{setTimeout(()=>{d()},100)})}),r.onUnmounted(()=>{f()}),(p,m)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"containerRef",ref:i,class:"lumen-color-picker-button-container"},[r.createVNode(De,{disabled:t.disabled,color:"secondary",onClick:h},{"leading-icon":r.withCtx(()=>[r.createElementVNode("div",HC,[r.createElementVNode("div",{class:"lumen-color-picker-button-color",style:r.normalizeStyle({backgroundColor:c.value})},null,4)])]),"trailing-icon":r.withCtx(()=>[r.createVNode(r.unref(Ro))]),default:r.withCtx(()=>[m[2]||(m[2]=r.createTextVNode(" Color ",-1))]),_:1},8,["disabled"]),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[l.value?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:s,class:"lumen-color-picker-popover",style:r.normalizeStyle(r.unref(u))},[r.createVNode(zf,r.mergeProps({modelValue:a.value,"onUpdate:modelValue":m[0]||(m[0]=g=>a.value=g)},t,{"onUpdate:modelValue":m[1]||(m[1]=g=>p.$emit("update:modelValue",g))}),null,16,["modelValue"])],4)):r.createCommentVNode("",!0)]))],512))}}),FC=_e(_C,[["__scopeId","data-v-4f2b96ba"]]),aa=r.defineComponent({__name:"LumenColorPicker",props:{modelValue:{default:"#EA00A8"},disabled:{type:Boolean,default:!1},showAlpha:{type:Boolean,default:!0},swatches:{},variant:{default:"default"},compareColor:{},showContrast:{type:Boolean,default:!1},defaultColorFormat:{default:"hex"},additionalSwatches:{},additionalSwatchesLabel:{},showSwatches:{type:Boolean,default:!0},contrastLabel:{}},emits:["update:modelValue","change"],setup(n,{emit:e}){const t=n,o=e;function i(){if(typeof window<"u"){const l=getComputedStyle(document.documentElement).getPropertyValue("--lumen-accent").trim();if(l)return l}return"#EA00A8"}const s=r.computed({get:()=>t.modelValue==="#EA00A8"?i():t.modelValue,set:l=>{o("update:modelValue",l),o("change",l)}});return(l,a)=>t.variant==="button"?(r.openBlock(),r.createBlock(FC,r.mergeProps({key:0,modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=c=>s.value=c)},t),null,16,["modelValue"])):(r.openBlock(),r.createBlock(zf,r.mergeProps({key:1,modelValue:s.value,"onUpdate:modelValue":a[1]||(a[1]=c=>s.value=c)},t),null,16,["modelValue"]))}}),UC={class:"bunny-font-picker"},qC={class:"font-picker-container"},jC={key:0,class:"font-loading-state"},WC={key:1},KC=r.defineComponent({__name:"LumenBunnyFontPicker",props:{modelValue:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"Select a font..."},previewText:{default:"The quick brown fox jumps over the lazy dog"},showPreview:{type:Boolean,default:!0},maxResults:{default:50}},emits:["update:modelValue","change"],setup(n,{emit:e}){const t=n,o=e,i=r.ref(!1),s=r.ref([]),l=r.ref(""),a=r.ref(""),c=r.ref(null),u=r.computed({get:()=>t.modelValue,set:y=>{o("update:modelValue",y||""),o("change",y||""),y&&v(y)}});function d(y){a.value=y}const f=r.computed(()=>{const y=a.value.toLowerCase().trim();if(!y){const C=[...s.value];if(t.modelValue){const k=C.findIndex(x=>x.familyName===t.modelValue);if(k>0){const[x]=C.splice(k,1);C.unshift(x)}}return C}const b=s.value.filter(C=>C.familyName.toLowerCase().includes(y)||C.category.toLowerCase().includes(y));return b.sort((C,k)=>{const x=C.familyName.toLowerCase().startsWith(y),S=k.familyName.toLowerCase().startsWith(y);return x&&!S?-1:!x&&S?1:C.familyName.localeCompare(k.familyName)}),b}),h=r.computed(()=>f.value.map(y=>({value:y.familyName,label:y.familyName,description:y.category}))),p=r.computed(()=>a.value?`No fonts matching "${a.value}"`:"No fonts found"),m=r.computed(()=>l.value?{fontFamily:`"${l.value}", sans-serif`}:{});async function g(){if(!(s.value.length>0)){i.value=!0;try{const b=await(await fetch("https://fonts.bunny.net/list")).json();s.value=Object.values(b).sort((C,k)=>C.familyName.localeCompare(k.familyName))}catch(y){console.error("Failed to fetch Bunny Fonts:",y)}finally{i.value=!1}}}async function v(y){if(!(!y||l.value===y))try{const b=`bunny-font-${y.replace(/\s+/g,"-").toLowerCase()}`;let C=document.getElementById(b);C||(C=document.createElement("link"),C.id=b,C.rel="stylesheet",C.href=`https://fonts.bunny.net/css?family=${encodeURIComponent(y)}:400,500,600,700`,document.head.appendChild(C),await new Promise(k=>setTimeout(k,100))),l.value=y}catch(b){console.error("Failed to load font for preview:",b)}}return r.watch(()=>t.modelValue,y=>{y&&v(y)},{immediate:!0}),r.onMounted(()=>{g()}),(y,b)=>(r.openBlock(),r.createElementBlock("div",UC,[r.createElementVNode("div",qC,[r.createVNode(uo,{ref_key:"selectRef",ref:c,modelValue:u.value,"onUpdate:modelValue":b[0]||(b[0]=C=>u.value=C),type:"select",options:h.value,placeholder:n.placeholder,disabled:n.disabled||i.value,searchable:!0,"search-placeholder":"Search fonts...","no-options-text":i.value?"Loading fonts...":p.value,"max-dropdown-height":300,virtual:!0,"virtual-item-height":44,onSearch:d},{"zero-state":r.withCtx(()=>[i.value?(r.openBlock(),r.createElementBlock("div",jC,[...b[1]||(b[1]=[r.createElementVNode("span",{class:"font-loading-spinner"},null,-1),r.createTextVNode(" Loading fonts... ",-1)])])):(r.openBlock(),r.createElementBlock("span",WC,r.toDisplayString(p.value),1))]),_:1},8,["modelValue","options","placeholder","disabled","no-options-text"]),u.value&&n.showPreview?(r.openBlock(),r.createElementBlock("div",{key:0,class:"font-preview",style:r.normalizeStyle(m.value)},r.toDisplayString(n.previewText),5)):r.createCommentVNode("",!0)])]))}}),ca=_e(KC,[["__scopeId","data-v-0032e44d"]]),GC={class:"lumen-table-container"},JC={key:0,class:"lumen-table-header"},YC=["onDragenter","onDrop"],XC={class:"lumen-table-header-content"},ZC=["onClick"],QC=["onDragstart"],eE={key:1,class:"lumen-table-sort-icon"},tE={class:"lumen-table-header-actions"},nE=["onClick"],oE=["onClick"],rE={key:0,class:"lumen-table-filter-input"},iE={class:"lumen-table-body"},sE={class:"lumen-table-group-content"},lE={class:"lumen-table-group-name"},aE={class:"lumen-table-group-count"},cE=["onClick"],uE=["onClick"],dE={key:1},fE={class:"lumen-table-subrow-content"},hE={class:"lumen-table-subrow-default"},pE={key:2,class:"lumen-table-empty"},mE={key:1,class:"lumen-table-footer"},gE=r.defineComponent({__name:"LumenTable",props:{columns:{},data:{},variant:{default:"default"},striped:{type:Boolean,default:!1},bordered:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!0},selectable:{type:Boolean,default:!1},expandable:{type:Boolean,default:!1},subRowToggle:{default:"auto"},onToggleSubRow:{},sortable:{type:Boolean,default:!1},maxHeight:{},maxWidth:{},filterable:{type:Boolean,default:!1},groupable:{type:Boolean,default:!1},reorderable:{type:Boolean,default:!1},stickyHeader:{type:Boolean,default:!1},stickyColumns:{default:()=>[]},virtualise:{type:Boolean,default:!1},rowHeight:{default:45}},emits:["rowClick","rowSelect","sort","columnReorder","cellUpdate"],setup(n,{expose:e,emit:t}){const o=n,i=t,s=r.useSlots(),l=r.ref(null),a=r.ref([...o.data||[]]),c=r.ref([...o.columns||[]]);r.watch(()=>o.data,q=>{a.value=[...q]},{deep:!0}),r.watch(()=>o.columns,q=>{c.value=[...q]},{deep:!0});const u=()=>{a.value=[...o.data],b.value.clear(),C.value.clear()},d=()=>{c.value=[...o.columns]},f=r.ref(""),h=r.ref("asc"),p=r.ref({}),m=r.ref({}),g=r.ref(""),v=r.ref(new Set),y=r.ref(new Set),b=r.ref(new Set),C=r.ref(new Map),k=r.ref(null),x=r.ref(null),S=r.ref(!1),M=r.ref(0),L=r.ref(0),R=r.ref(0),X=r.ref(600),ve=r.computed(()=>{const q={"--_cols":o.columns.length.toString()};return o.maxHeight&&(q.maxHeight=typeof o.maxHeight=="number"||!o.maxHeight.endsWith("px")?`${o.maxHeight}px`:o.maxHeight),o.maxWidth&&(q.maxWidth=typeof o.maxWidth=="number"||!o.maxWidth.endsWith("px")?`${o.maxWidth}px`:o.maxWidth),q}),fe=r.computed(()=>({gridColumn:`1 / ${o.columns.length+1}`})),Se=q=>S.value?q===k.value?{transform:`translateX(${L.value-M.value}px)`,opacity:"0.8",zIndex:1e3,transition:"none"}:q===x.value&&x.value!==null?{transform:`translateX(${(k.value<x.value?-1:1)*100}px)`,transition:"transform var(--lumen-transition-duration) ease"}:{}:{},xe=q=>!S.value||q!==k.value?{}:{opacity:"0.8",zIndex:10},U=r.computed(()=>{let q=[...a.value];if(o.filterable&&Object.keys(p.value).length>0&&(q=q.filter(ae=>Object.entries(p.value).every(([H,te])=>{if(!te||te==="")return!0;const le=c.value.find(lt=>lt.key===H),He=K(ae,H,le),tt=String(He||"").toLowerCase();return Array.isArray(te)?te.some(lt=>tt.includes(String(lt).toLowerCase())):tt.includes(String(te).toLowerCase())}))),f.value&&(o.sortable||c.value.find(ae=>ae.key===f.value)?.sortable)){const ae=c.value.find(H=>H.key===f.value);q.sort((H,te)=>{const le=K(H,f.value,ae),He=K(te,f.value,ae);return le<He?h.value==="asc"?-1:1:le>He?h.value==="asc"?1:-1:0})}if(g.value&&o.groupable){const ae=o.columns.find(te=>te.key===g.value),H=q.reduce((te,le)=>{const He=K(le,g.value,ae),tt=String(He||"Ungrouped");return te[tt]||(te[tt]=[]),te[tt].push(le),te},{});return Object.entries(H).flatMap(([te,le])=>[{_isGroupHeader:!0,_groupName:te,_groupCount:le.length},...le])}return q}),ee=r.computed(()=>{if(!o.virtualise)return{topSpace:0,bottomSpace:0,start:0,end:U.value.length};const q=o.rowHeight,ae=U.value.length,H=5,te=Math.max(0,Math.floor(R.value/q)-H),le=Math.ceil(X.value/q)+H*2,He=Math.min(ae,te+le);return{start:te,end:He,topSpace:te*q,bottomSpace:Math.max(0,(ae-He)*q)}}),ce=r.computed(()=>{const q=U.value;if(!o.virtualise)return q.map((te,le)=>({row:te,rowIndex:le}));const{start:ae,end:H}=ee.value;return q.slice(ae,H).map((te,le)=>({row:te,rowIndex:ae+le}))}),be=()=>{!o.virtualise||!l.value||(R.value=l.value.scrollTop,X.value=l.value.clientHeight)},K=(q,ae,H)=>{if(!ae)return;const te=ae.split(".");let le=q;for(const He of te)le=le?.[He];return H?.formatters&&Array.isArray(H.formatters)&&(le=H.formatters.reduce((He,tt)=>{try{return tt(He)}catch(lt){return console.warn(`Formatter error for column ${H.key}:`,lt),He}},le)),le},J=(q,ae)=>{if(!ae.highlight)return;const H=K(q,ae.key,ae);return typeof ae.highlight=="function"?ae.highlight(H,q):ae.highlight},Y=(q,ae,H)=>{const te={},le=xe(H);Object.assign(te,le);const He=J(q,ae);return He&&(te["--cell-highlight"]=He),te},me=q=>{const ae=o.columns.find(H=>H.key===q);!o.sortable&&!ae?.sortable||(f.value===q?h.value=h.value==="asc"?"desc":"asc":(f.value=q,h.value="asc"),i("sort",q,h.value))},ke=r.computed(()=>o.stickyColumns||[]),Fe=r.computed(()=>o.columns.some(q=>s[`footer-${q.key}`])),$e=(q,ae)=>{const H=s[`cell-${q.key}`]||q.key==="actions"||s.actions;return q.key==="actions"&&H},re=q=>{if(q.filterOptions){const H=Array.isArray(q.filterOptions)&&q.filterOptions.length>0?q.filterOptions[0]:null;return H!==null&&typeof H=="object"&&"label"in H?q.filterOptions:q.filterOptions.map(te=>({label:String(te),value:String(te)}))}const ae=new Set;return a.value.forEach(H=>{const te=K(H,q.key,q);te!=null&&ae.add(String(te))}),Array.from(ae).sort().map(H=>({label:H,value:H}))},ie=q=>{m.value[q]=!m.value[q]},A=q=>{g.value=g.value===q?"":q},I=q=>{v.value.has(q)?v.value.delete(q):v.value.add(q)},P=(q,ae)=>{if(!o.expandable)return;const H=v.value.has(q),te=()=>I(q);if(o.onToggleSubRow){const le=ae||U.value[q];o.onToggleSubRow(le,q,H,te)}else te()},Q=q=>v.value.has(q),de=(q,ae)=>{q._isGroupHeader||(o.expandable&&o.subRowToggle==="auto"&&P(ae),o.selectable&&(y.value.has(ae)?y.value.delete(ae):y.value.add(ae),i("rowSelect",y.value)),i("rowClick",q,ae))},Me=(q,ae,H,te)=>{const le=a.value.findIndex(Nt=>Nt===q);if(le===-1)return;const He=`${le}-${ae}`;if(!C.value.has(He)){const Nt=K(q,ae);C.value.set(He,Nt)}const tt=ae.split(".");let lt=a.value[le];for(let Nt=0;Nt<tt.length-1;Nt++)lt=lt[tt[Nt]];lt[tt[tt.length-1]]=H;const zt=C.value.get(He);H!==zt?b.value.add(He):b.value.delete(He),i("cellUpdate",q,ae,H,le)},Ne=(q,ae)=>{if(o.reorderable){if(k.value=ae,S.value=!0,M.value=q.clientX,L.value=q.clientX,q.dataTransfer){q.dataTransfer.effectAllowed="move",q.dataTransfer.setData("text/plain",ae.toString());try{const H=document.createElement("canvas");H.width=1,H.height=1;const te=H.getContext("2d");te&&(te.globalAlpha=.01,te.fillStyle="transparent",te.fillRect(0,0,1,1)),q.dataTransfer.setDragImage(H,-1e3,-1e3)}catch{const H=new Image;H.src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=",q.dataTransfer.setDragImage(H,-1e3,-1e3)}}document.addEventListener("dragover",Le),document.addEventListener("drag",Le)}},Le=q=>{S.value&&(L.value=q.clientX)},Ge=q=>{!S.value||q===k.value||(x.value=q)},wt=()=>{},Xt=(q,ae)=>{if(!o.reorderable||k.value===null)return;const H=k.value;if(H!==ae){const te=[...c.value],le=te.splice(H,1)[0];te.splice(ae,0,le),c.value=te,i("columnReorder",H,ae,te)}xn()},Ot=()=>{xn()},xn=()=>{document.removeEventListener("dragover",Le),document.removeEventListener("drag",Le),k.value=null,x.value=null,S.value=!1,M.value=0,L.value=0},Ct=()=>{if(!l.value)return!1;const q=l.value.querySelector(".lumen-table-cell--highlight");return q?(q.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),!0):!1};r.onMounted(()=>{o.virtualise&&l.value&&(X.value=l.value.clientHeight)}),e({internalData:a,internalColumns:c,restoreData:u,restoreColumns:d,modifiedCells:b,cellValues:C,toggleSubRow:P,isRowExpanded:Q,expandedRows:v,scrollToFirstHighlight:Ct});const Ho=q=>{let ae=0;for(let H=0;H<=q;H++)if(U.value[H]?._isGroupHeader){if(H===q)return ae;ae++}return ae};return(q,ae)=>(r.openBlock(),r.createElementBlock("div",GC,[r.createElementVNode("div",{ref_key:"tableRef",ref:l,class:r.normalizeClass(["lumen-table",`lumen-table--${n.variant}`,{"lumen-table--striped":n.striped,"lumen-table--bordered":n.bordered,"lumen-table--hoverable":n.hoverable}]),style:r.normalizeStyle(ve.value),onScroll:be},[c.value.length>0?(r.openBlock(),r.createElementBlock("div",JC,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(c.value,(H,te)=>(r.openBlock(),r.createElementBlock("div",{key:`header-${te}`,class:r.normalizeClass(["lumen-table-cell","lumen-table-header-cell",{[`lumen-table-cell--align-${H.align||"left"}`]:H.align,"lumen-table-cell--sortable":H.sortable,"lumen-table-cell--sticky":H.sticky||ke.value.includes(H.key)||$e(H),"lumen-table-cell--actions":$e(H),"lumen-table-cell--dragging":k.value===te,"lumen-table-cell--drag-over":x.value===te&&k.value!==te,"lumen-table-cell--drag-target":S.value&&k.value!==te}]),onDragover:ae[1]||(ae[1]=r.withModifiers(()=>{},["prevent"])),onDragenter:le=>Ge(te),onDragleave:ae[2]||(ae[2]=le=>wt()),onDrop:le=>Xt(le,te),style:r.normalizeStyle(Se(te))},[r.createElementVNode("div",XC,[r.createElementVNode("div",{class:"lumen-table-header-main",onClick:le=>H.sortable?me(H.key):null},[n.reorderable?(r.openBlock(),r.createElementBlock("div",{key:0,class:"lumen-table-drag-handle",draggable:"true",onDragstart:le=>Ne(le,te),onDragend:Ot},[r.createVNode(r.unref(fp),{size:14})],40,QC)):r.createCommentVNode("",!0),r.renderSlot(q.$slots,`col-${H.key}`,{column:H,colIndex:te},()=>[r.createElementVNode("span",null,r.toDisplayString(H.label),1)],!0),H.sortable?(r.openBlock(),r.createElementBlock("span",eE,[f.value===H.key&&h.value==="asc"?(r.openBlock(),r.createBlock(r.unref(iu),{key:0,size:16})):f.value===H.key&&h.value==="desc"?(r.openBlock(),r.createBlock(r.unref(Ro),{key:1,size:16})):(r.openBlock(),r.createBlock(r.unref(Xo),{key:2,size:16}))])):r.createCommentVNode("",!0)],8,ZC),r.createElementVNode("div",tE,[n.filterable||H.filterable?(r.openBlock(),r.createElementBlock("button",{key:0,onClick:le=>ie(H.key),class:r.normalizeClass(["lumen-table-filter-btn",{"lumen-table-filter-btn--active":p.value[H.key]}])},[r.createVNode(r.unref(dp),{size:14})],10,nE)):r.createCommentVNode("",!0),n.groupable||H.groupable?(r.openBlock(),r.createElementBlock("button",{key:1,onClick:le=>A(H.key),class:r.normalizeClass(["lumen-table-group-btn",{"lumen-table-group-btn--active":g.value===H.key}])},[r.createVNode(r.unref(Na),{size:14})],10,oE)):r.createCommentVNode("",!0)])]),m.value[H.key]?(r.openBlock(),r.createElementBlock("div",rE,[r.createVNode(uo,{modelValue:p.value[H.key],"onUpdate:modelValue":le=>p.value[H.key]=le,type:H.filterType,options:H.filterType==="select"?re(H):void 0,placeholder:`Filter ${H.label}...`,onClick:ae[0]||(ae[0]=r.withModifiers(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue","type","options","placeholder"])])):r.createCommentVNode("",!0)],46,YC))),128))])):r.createCommentVNode("",!0),r.createElementVNode("div",iE,[n.virtualise&&ee.value.topSpace>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"lumen-table-virtual-spacer",style:r.normalizeStyle({height:ee.value.topSpace+"px",gridColumn:"1 / -1"})},null,4)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(ce.value,({row:H,rowIndex:te})=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:`row-${te}`},[H._isGroupHeader?(r.openBlock(),r.createElementBlock("div",{key:0,class:"lumen-table-group-header",style:r.normalizeStyle({"--group-index":Ho(te)})},[r.createElementVNode("div",sE,[r.createVNode(r.unref(Na),{size:16}),r.createElementVNode("span",lE,r.toDisplayString(H._groupName),1),r.createElementVNode("span",aE,"("+r.toDisplayString(H._groupCount)+" items)",1)])],4)):(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["lumen-table-row",{"lumen-table-row--expanded":v.value.has(te),"lumen-table-row--selected":y.value.has(te)}]),onClick:le=>de(H,te)},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(c.value,(le,He)=>(r.openBlock(),r.createElementBlock("div",{key:`cell-${te}-${He}`,class:r.normalizeClass(["lumen-table-cell","lumen-table-body-cell",{[`lumen-table-cell--align-${le.align||"left"}`]:le.align,"lumen-table-cell--editable":le.editable,"lumen-table-cell--modified":b.value.has(`${a.value.findIndex(tt=>tt===H)}-${le.key}`),"lumen-table-cell--sticky":le.sticky||ke.value.includes(le.key)||$e(le),"lumen-table-cell--actions":$e(le),"lumen-table-cell--dragging":k.value===He,"lumen-table-cell--drag-target":S.value&&k.value!==He,"lumen-table-cell--highlight":J(H,le)}]),style:r.normalizeStyle(Y(H,le,He)),onClick:r.withModifiers(tt=>$e(le)?null:de(H,te),["stop"])},[$e(le)?r.renderSlot(q.$slots,`cell-${le.key}`,{key:0,row:H,column:le,rowIndex:te,colIndex:He,toggleSubRow:()=>P(te,H),isExpanded:Q(te)},void 0,!0):r.renderSlot(q.$slots,`cell-${le.key}`,{key:1,value:K(H,le.key,le),row:H,column:le,rowIndex:te,colIndex:He,toggleSubRow:()=>P(te,H),isExpanded:Q(te)},()=>[le.editable?(r.openBlock(),r.createBlock(uo,{key:0,modelValue:K(H,le.key,le),type:le.filterType||"text",size:"sm",options:le.filterType==="select"?re(le):void 0,"full-width":"","onUpdate:modelValue":tt=>Me(H,le.key,tt),onClick:ae[3]||(ae[3]=r.withModifiers(()=>{},["stop"])),onMousedown:ae[4]||(ae[4]=r.withModifiers(()=>{},["stop"]))},r.createSlots({_:2},[q.$slots["input-leading-icon"]?{name:"leading-icon",fn:r.withCtx(()=>[r.renderSlot(q.$slots,"input-leading-icon",{row:H,column:le,rowIndex:te,colIndex:He},void 0,!0)]),key:"0"}:void 0,q.$slots["input-trailing-icon"]?{name:"trailing-icon",fn:r.withCtx(()=>[r.renderSlot(q.$slots,"input-trailing-icon",{row:H,column:le,rowIndex:te,colIndex:He},void 0,!0)]),key:"1"}:void 0]),1032,["modelValue","type","options","onUpdate:modelValue"])):(r.openBlock(),r.createElementBlock("span",dE,r.toDisplayString(K(H,le.key,le)),1))],!0)],14,uE))),128))],10,cE)),v.value.has(te)?(r.openBlock(),r.createElementBlock("div",{key:2,class:"lumen-table-subrow",style:r.normalizeStyle(fe.value)},[r.createElementVNode("div",fE,[r.renderSlot(q.$slots,"expanded-row",{row:H,rowIndex:te},()=>[r.createElementVNode("div",hE,[r.createElementVNode("pre",null,r.toDisplayString(JSON.stringify(H,null,2)),1)])],!0)])],4)):r.createCommentVNode("",!0)],64))),128)),n.virtualise&&ee.value.bottomSpace>0?(r.openBlock(),r.createElementBlock("div",{key:1,class:"lumen-table-virtual-spacer",style:r.normalizeStyle({height:ee.value.bottomSpace+"px",gridColumn:"1 / -1"})},null,4)):r.createCommentVNode("",!0),U.value.length===0?(r.openBlock(),r.createElementBlock("div",pE,[r.renderSlot(q.$slots,"empty",{},()=>[ae[5]||(ae[5]=r.createElementVNode("div",{class:"lumen-table-empty-content"},[r.createElementVNode("span",null,"No data available")],-1))],!0)])):r.createCommentVNode("",!0)]),Fe.value?(r.openBlock(),r.createElementBlock("div",mE,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(c.value,(H,te)=>(r.openBlock(),r.createElementBlock("div",{key:`footer-${te}`,class:r.normalizeClass(["lumen-table-cell","lumen-table-footer-cell",{[`lumen-table-cell--align-${H.align||"left"}`]:H.align,"lumen-table-cell--sticky":H.sticky||ke.value.includes(H.key)||$e(H),"lumen-table-cell--actions":$e(H)}]),style:r.normalizeStyle(xe(te))},[r.renderSlot(q.$slots,`footer-${H.key}`,{column:H,colIndex:te},void 0,!0)],6))),128))])):r.createCommentVNode("",!0)],38)]))}}),ua=_e(gE,[["__scopeId","data-v-b40554fe"]]),vE={class:"lumen-hero-content"},yE={key:0,class:"lumen-hero-header"},kE={key:0,class:"lumen-hero-title"},bE={key:1,class:"lumen-hero-description"},xE={key:1,class:"lumen-hero-navigation"},wE={key:2,class:"lumen-hero-body"},CE={key:0,class:"lumen-hero-background"},EE={key:1,class:"lumen-hero-background"},SE=r.defineComponent({__name:"LumenHero",props:{variant:{default:"minimal"},orientation:{default:"horizontal"},title:{},description:{},sticky:{type:[Object,Boolean,null],default:null},gradient:{},shadow:{default:"none"},borderColor:{default:"transparent"}},setup(n){const e=n,t=r.useSlots(),o=r.computed(()=>!!t.default),i=r.computed(()=>!!t.header),s=r.computed(()=>!!t.navigation),l=r.computed(()=>e.sticky?e.sticky===!0?{side:"top",offset:"0"}:{side:e.sticky.side||"top",offset:e.sticky.offset||"0"}:null),a=r.computed(()=>{if(!l.value)return{};const{side:f,offset:h}=l.value;return{position:"sticky",[f]:h,zIndex:20}}),c=r.computed(()=>{if(!e.gradient||e.variant!=="gradient"&&e.variant!=="space")return null;const{angle:f="135deg",stops:h=[]}=e.gradient;if(h.length===0)return null;const p=h.sort((m,g)=>m.position-g.position).map(m=>`${m.color} ${m.position}%`).join(", ");return`linear-gradient(${f}, ${p})`}),u=r.computed(()=>{const f={};return c.value&&(f["--hero-custom-background"]=c.value),f}),d=r.computed(()=>{const f={...a.value};return c.value&&(f["--shadow-gradient"]=c.value),f["--border-color"]=e.borderColor,f});return(f,h)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["lumen-hero-wrapper",[`lumen-hero-wrapper--${n.variant}`,`lumen-hero-wrapper--shadow-${n.shadow}`]]),style:r.normalizeStyle(d.value)},[r.createElementVNode("div",{class:r.normalizeClass(["lumen-hero",[`lumen-hero--${n.variant}`,`lumen-hero--${n.orientation}`,{"lumen-hero--sticky":!!n.sticky}]]),style:r.normalizeStyle(u.value)},[r.createElementVNode("div",vE,[i.value||n.title||n.description?(r.openBlock(),r.createElementBlock("div",yE,[r.renderSlot(f.$slots,"header",{},()=>[n.title?(r.openBlock(),r.createElementBlock("h1",kE,r.toDisplayString(n.title),1)):r.createCommentVNode("",!0),n.description?(r.openBlock(),r.createElementBlock("p",bE,r.toDisplayString(n.description),1)):r.createCommentVNode("",!0)],!0)])):r.createCommentVNode("",!0),s.value?(r.openBlock(),r.createElementBlock("div",xE,[r.renderSlot(f.$slots,"navigation",{},void 0,!0)])):r.createCommentVNode("",!0),o.value?(r.openBlock(),r.createElementBlock("div",wE,[r.renderSlot(f.$slots,"default",{},void 0,!0)])):r.createCommentVNode("",!0)]),n.variant==="space"?(r.openBlock(),r.createElementBlock("div",CE,[...h[0]||(h[0]=[r.createStaticVNode('<div class="lumen-hero-gradient" data-v-fb1ef579></div><div class="lumen-hero-pattern" data-v-fb1ef579></div><div class="lumen-hero-particles" data-v-fb1ef579></div><div class="lumen-hero-shooting-stars" data-v-fb1ef579><div class="shooting-star-1" data-v-fb1ef579></div><div class="shooting-star-2" data-v-fb1ef579></div><div class="shooting-star-3" data-v-fb1ef579></div><div class="shooting-star-4" data-v-fb1ef579></div><div class="shooting-star-5" data-v-fb1ef579></div><div class="shooting-star-6" data-v-fb1ef579></div></div><div class="lumen-hero-starfield" data-v-fb1ef579></div>',5)])])):n.variant==="gradient"?(r.openBlock(),r.createElementBlock("div",EE,[...h[1]||(h[1]=[r.createElementVNode("div",{class:"lumen-hero-simple-gradient"},null,-1)])])):r.createCommentVNode("",!0)],6)],6))}}),da=_e(SE,[["__scopeId","data-v-fb1ef579"]]),Tn=r.ref("system"),Vs=r.ref(!1),fa="strands-ui-theme";function ME(){return typeof window>"u"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function TE(){if(typeof window>"u")return"system";try{const n=localStorage.getItem(fa);if(n&&["light","dark","system"].includes(n))return n}catch(n){console.warn("Failed to read theme preference from localStorage:",n)}return"system"}function NE(n){if(!(typeof window>"u"))try{localStorage.setItem(fa,n)}catch(e){console.warn("Failed to save theme preference to localStorage:",e)}}function nu(n){typeof document>"u"||(n?(document.documentElement.setAttribute("data-theme","dark"),document.documentElement.classList.add("dark")):(document.documentElement.setAttribute("data-theme","light"),document.documentElement.classList.remove("dark")))}function Pf(n={}){const{skipAutoInit:e=!1}=n,t=r.computed(()=>Tn.value==="dark"?!0:Tn.value==="light"?!1:Vs.value),o=r.computed(()=>{switch(Tn.value){case"light":return"Light";case"dark":return"Dark";case"system":return"System";default:return"System"}});function i(c){Tn.value=c,NE(c)}function s(){const c=t.value?"light":"dark";i(c)}function l(){switch(Tn.value){case"light":i("dark");break;case"dark":i("system");break;case"system":i("light");break;default:i("light");break}}function a(){if(typeof window>"u")return;Vs.value=ME();const c=window.matchMedia("(prefers-color-scheme: dark)"),u=f=>{Vs.value=f.matches};c.addEventListener?c.addEventListener("change",u):c.addListener(u);const d=TE();Tn.value=d,nu(t.value),r.watch(t,f=>{nu(f)},{immediate:!1})}return!e&&r.getCurrentInstance()&&r.onMounted(()=>{a()}),{currentTheme:r.computed(()=>Tn.value),isDark:t,themeLabel:o,setTheme:i,toggle:s,cycleTheme:l,initialize:a,themeOptions:[{value:"light",label:"Light",icon:"sun"},{value:"dark",label:"Dark",icon:"moon"},{value:"system",label:"System",icon:"monitor"}]}}let Kr=null;function Hf(){return Kr||(Kr=Pf({skipAutoInit:!0}),typeof window<"u"&&(localStorage.getItem(fa)===null&&(Tn.value="system"),Kr.initialize())),Kr}function _f(n="auto"){const e=r.inject("themeProvider",null),t=r.inject("uiApp",null),o=r.computed(()=>e?.isForced.value?e.theme.value:t?.theme.value?t.theme.value:n),i=r.computed(()=>e?.isForced.value??!1),s=r.computed(()=>o.value==="auto"?typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:!1:o.value==="dark"),l=r.computed(()=>o.value==="auto"?typeof window<"u"?!window.matchMedia("(prefers-color-scheme: dark)").matches:!0:o.value==="light"),a=r.computed(()=>({"lumen-theme--light":l.value,"lumen-theme--dark":s.value,"lumen-theme--forced":i.value}));return{theme:o,isDark:s,isLight:l,isForced:i,themeClass:a}}const BE={key:1,class:"lumen-theme-toggle-dropdown"},AE=["disabled","onClick"],$E={key:0,class:"lumen-theme-toggle-option-indicator"},OE={key:2,class:"lumen-theme-toggle-segmented",role:"group","aria-label":"Theme selection"},IE=r.defineComponent({__name:"LumenThemeToggle",props:{variant:{default:"button"},size:{default:"md"},fullWidth:{type:Boolean,default:!1},includeLabel:{type:Boolean,default:!1}},setup(n){const e=n,{isForced:t}=_f(),{currentTheme:o,themeLabel:i,setTheme:s,cycleTheme:l,themeOptions:a}=Hf(),c=r.computed(()=>t.value),u=r.ref(!1),d={sun:Sp,moon:kp,monitor:Ta,"chevron-up":iu,"chevron-down":Ro},f=v=>d[v]||Ta,h=r.computed(()=>o.value==="dark"?"moon":o.value==="light"?"sun":"monitor"),p=r.computed(()=>o.value==="dark"?"Light":o.value==="light"?"System":"Dark"),m=()=>{e.variant==="button"&&l()},g=v=>{v.target.closest(".lumen-theme-toggle-dropdown")||(u.value=!1)};return r.onMounted(()=>{document.addEventListener("click",g)}),r.onUnmounted(()=>{document.removeEventListener("click",g)}),(v,y)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["lumen-theme-toggle",{"lumen-theme-toggle--full-width":n.fullWidth}])},[n.variant==="button"?(r.openBlock(),r.createBlock(De,{key:0,icon:!n.includeLabel,squircle:"",variant:"ghost",size:n.size,disabled:c.value,onClick:m,title:c.value?"Theme is locked by app settings":`Switch to ${p.value.toLowerCase()} theme`,class:r.normalizeClass(["lumen-theme-toggle-button",{"lumen-theme-toggle--disabled":c.value}])},r.createSlots({default:r.withCtx(()=>[n.includeLabel?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[r.createTextVNode(r.toDisplayString(r.unref(i))+r.toDisplayString(c.value?" (Locked)":""),1)],64)):r.createCommentVNode("",!0)]),_:2},[n.includeLabel?{name:"leading-icon",fn:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(f(h.value))))]),key:"0"}:{name:"icon",fn:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(f(h.value))))]),key:"1"}]),1032,["icon","size","disabled","title","class"])):n.variant==="dropdown"?(r.openBlock(),r.createElementBlock("div",BE,[r.createVNode(De,{squircle:!0,variant:"ghost",size:n.size,disabled:c.value,onClick:y[0]||(y[0]=b=>c.value?null:u.value=!u.value),class:r.normalizeClass(["lumen-theme-toggle-trigger",{"lumen-theme-toggle--disabled":c.value}]),title:c.value?"Theme is locked by app settings":void 0},{"leading-icon":r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(f(h.value))))]),"trailing-icon":r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(f(u.value?"chevron-up":"chevron-down"))))]),default:r.withCtx(()=>[r.createTextVNode(" "+r.toDisplayString(r.unref(i))+r.toDisplayString(c.value?" (Locked)":"")+" ",1)]),_:1},8,["size","disabled","class","title"]),u.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"lumen-theme-toggle-menu",onClick:y[1]||(y[1]=b=>u.value=!1)},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(a),b=>(r.openBlock(),r.createElementBlock("button",{key:b.value,class:r.normalizeClass(["lumen-theme-toggle-option",{"lumen-theme-toggle-option--active":r.unref(o)===b.value,"lumen-theme-toggle-option--disabled":c.value}]),disabled:c.value,onClick:C=>c.value?null:r.unref(s)(b.value)},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(f(b.icon)),{class:"lumen-theme-toggle-option-icon"})),r.createElementVNode("span",null,r.toDisplayString(b.label),1),r.unref(o)===b.value?(r.openBlock(),r.createElementBlock("div",$E)):r.createCommentVNode("",!0)],10,AE))),128))])):r.createCommentVNode("",!0)])):n.variant==="segmented"?(r.openBlock(),r.createElementBlock("div",OE,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(a),b=>(r.openBlock(),r.createBlock(De,{key:b.value,variant:r.unref(o)===b.value?"primary":"ghost",size:n.size,squircle:"",icon:!n.includeLabel,"full-width":"",class:r.normalizeClass(["lumen-theme-toggle-segment",{"lumen-theme-toggle-segment--active":r.unref(o)===b.value}]),"aria-pressed":r.unref(o)===b.value,"aria-label":`${b.label} theme`,onClick:C=>r.unref(s)(b.value),title:`Switch to ${b.label.toLowerCase()} theme`},r.createSlots({default:r.withCtx(()=>[n.includeLabel?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[r.createTextVNode(r.toDisplayString(b.label),1)],64)):r.createCommentVNode("",!0)]),_:2},[n.includeLabel?{name:"leading-icon",fn:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(f(b.icon))))]),key:"0"}:{name:"icon",fn:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(f(b.icon))))]),key:"1"}]),1032,["variant","size","icon","class","aria-pressed","aria-label","onClick","title"]))),128))])):r.createCommentVNode("",!0)],2))}}),ha=_e(IE,[["__scopeId","data-v-cceca8e5"]]),LE={key:0,class:"slider-header"},DE=["for"],VE={key:0,class:"slider-required"},RE={key:1,class:"slider-value"},zE={key:0,class:"slider-min-label"},PE={class:"slider-track-container"},HE=["id","value","min","max","step","disabled","required"],_E={class:"slider-track"},FE={key:1,class:"slider-max-label"},UE={key:1,class:"slider-ticks"},qE={key:0,class:"slider-tick-label"},jE={key:2,class:"slider-help"},WE={key:0,class:"slider-error-text"},KE={key:1,class:"slider-help-text"},GE=r.defineComponent({__name:"LumenSlider",props:{modelValue:{default:void 0},value:{default:void 0},min:{default:0},max:{default:100},step:{default:1},label:{},helpText:{},error:{type:[String,Boolean]},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},showValue:{type:Boolean,default:!0},showMinMax:{type:Boolean,default:!1},showTicks:{type:Boolean,default:!1},showTickLabels:{type:Boolean,default:!1},tickCount:{default:5},unit:{default:""},size:{default:"md"},color:{default:"primary"},inputId:{}},emits:["update:modelValue","change","input","focus","blur"],setup(n,{emit:e}){const t=n,o=e,i=r.ref(),s=r.ref(!1),l=r.ref(0),a=r.ref(null),c=r.ref(t.value!==void 0?Number(t.value):t.modelValue!==void 0?Number(t.modelValue):0),u=r.computed(()=>c.value);r.watch(()=>t.modelValue,x=>{x!==void 0&&Number(x)!==c.value&&(c.value=Number(x))},{immediate:!0});const d=r.computed(()=>{const x=t.max-t.min,S=(u.value-t.min)/x*100;return Math.max(0,Math.min(100,S))}),f=r.computed(()=>u.value?.toFixed(t.step<1?1:0)||"0"),h=r.computed(()=>`slider-size-${t.size}`),p=r.computed(()=>t.color?`slider-color-${t.color}`:""),m=r.computed(()=>{if(!t.showTicks)return[];const x=[],S=t.max-t.min,M=S/(t.tickCount-1);for(let L=0;L<t.tickCount;L++){const R=t.min+M*L,X=(R-t.min)/S*100;x.push({value:R,position:X,label:R.toFixed(t.step<1?1:0)})}return x}),g=x=>{const S=x.target,M=parseFloat(S.value);l.value++,l.value>1&&(s.value=!0,a.value&&clearTimeout(a.value),a.value=setTimeout(()=>{s.value=!1,l.value=0},100)),c.value=M,o("update:modelValue",M),o("input",M)},v=x=>{const S=x.target,M=parseFloat(S.value);o("change",M)},y=x=>{o("focus",x)},b=x=>{o("blur",x)},C=()=>{l.value=0},k=()=>{l.value=0,s.value=!1,a.value&&(clearTimeout(a.value),a.value=null)};return(x,S)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["slider-wrapper",[h.value,p.value,{"slider-disabled":n.disabled,"slider-dragging":s.value}]])},[n.label||n.showValue?(r.openBlock(),r.createElementBlock("div",LE,[n.label?(r.openBlock(),r.createElementBlock("label",{key:0,for:n.inputId,class:"slider-label"},[r.createTextVNode(r.toDisplayString(n.label)+" ",1),n.required?(r.openBlock(),r.createElementBlock("span",VE,"*")):r.createCommentVNode("",!0)],8,DE)):r.createCommentVNode("",!0),n.showValue?(r.openBlock(),r.createElementBlock("div",RE,r.toDisplayString(f.value)+r.toDisplayString(n.unit),1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass(["slider-container",{"slider-error":n.error}])},[n.showMinMax?(r.openBlock(),r.createElementBlock("div",zE,r.toDisplayString(n.min)+r.toDisplayString(n.unit),1)):r.createCommentVNode("",!0),r.createElementVNode("div",PE,[r.createElementVNode("input",{id:n.inputId,ref_key:"sliderRef",ref:i,type:"range",value:u.value,min:n.min,max:n.max,step:n.step,disabled:n.disabled,required:n.required,class:"slider-input",onInput:g,onChange:v,onFocus:y,onBlur:b,onMousedown:C,onMouseup:k,onTouchstart:C,onTouchend:k},null,40,HE),r.createElementVNode("div",_E,[r.createElementVNode("div",{class:"slider-progress",style:r.normalizeStyle({width:d.value+"%"})},null,4)]),r.createElementVNode("div",{class:"slider-thumb",style:r.normalizeStyle({left:d.value+"%"})},null,4)]),n.showMinMax?(r.openBlock(),r.createElementBlock("div",FE,r.toDisplayString(n.max)+r.toDisplayString(n.unit),1)):r.createCommentVNode("",!0)],2),n.showTicks?(r.openBlock(),r.createElementBlock("div",UE,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(m.value,M=>(r.openBlock(),r.createElementBlock("div",{key:M.value,class:"slider-tick",style:r.normalizeStyle({left:M.position+"%"})},[S[0]||(S[0]=r.createElementVNode("div",{class:"slider-tick-mark"},null,-1)),n.showTickLabels?(r.openBlock(),r.createElementBlock("div",qE,r.toDisplayString(M.label)+r.toDisplayString(n.unit),1)):r.createCommentVNode("",!0)],4))),128))])):r.createCommentVNode("",!0),n.helpText||n.error?(r.openBlock(),r.createElementBlock("div",jE,[n.error?(r.openBlock(),r.createElementBlock("p",WE,r.toDisplayString(n.error),1)):n.helpText?(r.openBlock(),r.createElementBlock("p",KE,r.toDisplayString(n.helpText),1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0)],2))}}),pa=_e(GE,[["__scopeId","data-v-a167a2b1"]]),JE={key:0,class:"radio-group-label"},YE={key:0,class:"radio-group-required"},XE={key:1,class:"radio-group-description"},ZE=["onClick"],QE=["id","name","value","checked","disabled","required"],eS={class:"radio-content"},tS=["for"],nS={key:0,class:"radio-description"},oS={key:1,class:"radio-icon"},rS={key:2,class:"radio-help"},iS={key:0,class:"radio-error-text"},sS={key:1,class:"radio-help-text"},lS=r.defineComponent({__name:"LumenRadioGroup",props:{modelValue:{},options:{default:()=>[]},label:{},description:{},helpText:{},error:{type:[String,Boolean]},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},orientation:{default:"vertical"},variant:{default:"default"},size:{default:"md"},color:{default:"primary"},fieldId:{default:()=>`radio-group-${Math.random().toString(36).substr(2,9)}`}},emits:["update:modelValue","change","focus","blur"],setup(n,{emit:e}){const t=n,o=e,i=r.computed(()=>`radio-group-size-${t.size}`),s=r.computed(()=>t.orientation==="horizontal"?"radio-options-horizontal":"radio-options-vertical"),l=d=>{t.disabled||d.disabled||t.modelValue!==d.value&&(o("update:modelValue",d.value),o("change",d.value))},a=d=>{const h=d.target.value;o("update:modelValue",h),o("change",h)},c=d=>{o("focus",d)},u=d=>{o("blur",d)};return(d,f)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["radio-group",[i.value,`radio-color-${n.color}`,{"radio-group-disabled":n.disabled}]])},[n.label?(r.openBlock(),r.createElementBlock("label",JE,[r.createTextVNode(r.toDisplayString(n.label)+" ",1),n.required?(r.openBlock(),r.createElementBlock("span",YE,"*")):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),n.description?(r.openBlock(),r.createElementBlock("p",XE,r.toDisplayString(n.description),1)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass(["radio-options",[s.value,{"radio-options-cards":n.variant==="card"}]])},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(n.options,h=>(r.openBlock(),r.createElementBlock("div",{key:h.value,class:r.normalizeClass(["radio-option",[{"radio-option-selected":n.modelValue===h.value,"radio-option-disabled":n.disabled||h.disabled,"radio-option-card":n.variant==="card"}]]),onClick:p=>l(h)},[r.createElementVNode("input",{id:`${n.fieldId}-${h.value}`,type:"radio",name:n.fieldId,value:h.value,checked:n.modelValue===h.value,disabled:n.disabled||h.disabled,required:n.required,class:"radio-input",onChange:a,onFocus:c,onBlur:u},null,40,QE),f[0]||(f[0]=r.createElementVNode("div",{class:"radio-button"},[r.createElementVNode("div",{class:"radio-button-inner"})],-1)),r.createElementVNode("div",eS,[r.createElementVNode("label",{for:`${n.fieldId}-${h.value}`,class:"radio-label"},r.toDisplayString(h.label),9,tS),h.description?(r.openBlock(),r.createElementBlock("p",nS,r.toDisplayString(h.description),1)):r.createCommentVNode("",!0),h.icon&&n.variant==="card"?(r.openBlock(),r.createElementBlock("div",oS,[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(h.icon)))])):r.createCommentVNode("",!0)])],10,ZE))),128))],2),n.helpText||n.error?(r.openBlock(),r.createElementBlock("div",rS,[n.error?(r.openBlock(),r.createElementBlock("p",iS,r.toDisplayString(n.error),1)):n.helpText?(r.openBlock(),r.createElementBlock("p",sS,r.toDisplayString(n.helpText),1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0)],2))}}),ma=_e(lS,[["__scopeId","data-v-a23d3501"]]),aS={key:0,class:"checkbox-group-label"},cS={key:0,class:"checkbox-group-required"},uS={key:1,class:"checkbox-group-description"},dS=["onClick"],fS=["id","name","value","checked","disabled","required","indeterminate","onChange"],hS={class:"checkbox-button"},pS={key:0,class:"checkbox-check",viewBox:"0 0 20 20",fill:"currentColor"},mS={key:1,class:"checkbox-indeterminate",viewBox:"0 0 20 20",fill:"currentColor"},gS={class:"checkbox-content"},vS=["for"],yS={key:0,class:"checkbox-description"},kS={key:1,class:"checkbox-icon"},bS={key:2,class:"checkbox-select-all"},xS=["id","checked","indeterminate"],wS={class:"checkbox-button"},CS={key:0,class:"checkbox-check",viewBox:"0 0 20 20",fill:"currentColor"},ES={key:1,class:"checkbox-indeterminate",viewBox:"0 0 20 20",fill:"currentColor"},SS=["for"],MS={key:3,class:"checkbox-help"},TS={key:0,class:"checkbox-error-text"},NS={key:1,class:"checkbox-help-text"},BS=r.defineComponent({__name:"LumenCheckboxGroup",props:{modelValue:{default:()=>[]},options:{default:()=>[]},label:{},description:{},helpText:{},error:{type:[String,Boolean]},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},orientation:{default:"vertical"},variant:{default:"default"},size:{default:"md"},showSelectAll:{type:Boolean,default:!1},selectAllLabel:{default:"Select All"},color:{default:"primary"},fieldId:{default:()=>`checkbox-group-${Math.random().toString(36).substr(2,9)}`}},emits:["update:modelValue","change","focus","blur"],setup(n,{emit:e}){const t=n,o=e,i=r.computed(()=>`checkbox-group-size-${t.size}`),s=r.computed(()=>t.orientation==="horizontal"?"checkbox-options-horizontal":"checkbox-options-vertical"),l=r.computed(()=>{const v=t.options.filter(y=>!y.disabled);return v.length>0&&v.every(y=>t.modelValue.includes(y.value))}),a=r.computed(()=>t.options.filter(y=>!y.disabled).some(y=>t.modelValue.includes(y.value))),c=v=>t.modelValue.includes(v),u=v=>t.options.find(b=>b.value===v)?.indeterminate||!1,d=v=>{t.disabled||v.disabled||f(v)},f=(v,y)=>{const b=[...t.modelValue],C=b.indexOf(v.value);C>-1?b.splice(C,1):b.push(v.value),o("update:modelValue",b),o("change",b)},h=()=>{t.disabled||p()},p=()=>{const v=t.options.filter(y=>!y.disabled);if(l.value){const y=t.modelValue.filter(b=>!v.some(C=>C.value===b));o("update:modelValue",y),o("change",y)}else{const y=v.map(C=>C.value),b=[...new Set([...t.modelValue,...y])];o("update:modelValue",b),o("change",b)}},m=v=>{o("focus",v)},g=v=>{o("blur",v)};return(v,y)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["checkbox-group",[i.value,`checkbox-color-${n.color}`,{"checkbox-group-disabled":n.disabled}]])},[n.label?(r.openBlock(),r.createElementBlock("label",aS,[r.createTextVNode(r.toDisplayString(n.label)+" ",1),n.required?(r.openBlock(),r.createElementBlock("span",cS,"*")):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),n.description?(r.openBlock(),r.createElementBlock("p",uS,r.toDisplayString(n.description),1)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass(["checkbox-options",[s.value,{"checkbox-options-cards":n.variant==="card"}]])},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(n.options,b=>(r.openBlock(),r.createElementBlock("div",{key:b.value,class:r.normalizeClass(["checkbox-option",[{"checkbox-option-selected":c(b.value),"checkbox-option-disabled":n.disabled||b.disabled,"checkbox-option-card":n.variant==="card","checkbox-option-indeterminate":u(b.value)}]]),onClick:C=>d(b)},[r.createElementVNode("input",{id:`${n.fieldId}-${b.value}`,type:"checkbox",name:n.fieldId,value:b.value,checked:c(b.value),disabled:n.disabled||b.disabled,required:n.required&&n.modelValue.length===0,indeterminate:u(b.value),class:"checkbox-input",onChange:C=>f(b),onFocus:m,onBlur:g},null,40,fS),r.createElementVNode("div",hS,[c(b.value)?(r.openBlock(),r.createElementBlock("svg",pS,[...y[0]||(y[0]=[r.createElementVNode("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"},null,-1)])])):u(b.value)?(r.openBlock(),r.createElementBlock("svg",mS,[...y[1]||(y[1]=[r.createElementVNode("path",{"fill-rule":"evenodd",d:"M4 10a1 1 0 011-1h10a1 1 0 110 2H5a1 1 0 01-1-1z","clip-rule":"evenodd"},null,-1)])])):r.createCommentVNode("",!0)]),r.createElementVNode("div",gS,[r.createElementVNode("label",{for:`${n.fieldId}-${b.value}`,class:"checkbox-label"},r.toDisplayString(b.label),9,vS),b.description?(r.openBlock(),r.createElementBlock("p",yS,r.toDisplayString(b.description),1)):r.createCommentVNode("",!0),b.icon&&n.variant==="card"?(r.openBlock(),r.createElementBlock("div",kS,[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(b.icon)))])):r.createCommentVNode("",!0)])],10,dS))),128))],2),n.showSelectAll&&n.options.length>1?(r.openBlock(),r.createElementBlock("div",bS,[r.createElementVNode("div",{class:r.normalizeClass(["checkbox-option",{"checkbox-option-selected":l.value,"checkbox-option-indeterminate":a.value&&!l.value}]),onClick:h},[r.createElementVNode("input",{id:`${n.fieldId}-select-all`,type:"checkbox",checked:l.value,indeterminate:a.value&&!l.value,class:"checkbox-input select-all-input",onChange:p},null,40,xS),r.createElementVNode("div",wS,[l.value?(r.openBlock(),r.createElementBlock("svg",CS,[...y[2]||(y[2]=[r.createElementVNode("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"},null,-1)])])):a.value?(r.openBlock(),r.createElementBlock("svg",ES,[...y[3]||(y[3]=[r.createElementVNode("path",{"fill-rule":"evenodd",d:"M4 10a1 1 0 011-1h10a1 1 0 110 2H5a1 1 0 01-1-1z","clip-rule":"evenodd"},null,-1)])])):r.createCommentVNode("",!0)]),r.createElementVNode("label",{for:`${n.fieldId}-select-all`,class:"checkbox-label"},r.toDisplayString(n.selectAllLabel),9,SS)],2)])):r.createCommentVNode("",!0),n.helpText||n.error?(r.openBlock(),r.createElementBlock("div",MS,[n.error?(r.openBlock(),r.createElementBlock("p",TS,r.toDisplayString(n.error),1)):n.helpText?(r.openBlock(),r.createElementBlock("p",NS,r.toDisplayString(n.helpText),1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0)],2))}}),ga=_e(BS,[["__scopeId","data-v-1f5df1cb"]]),AS={class:"lumen-scope"},$S={key:0,class:"lumen-pill-leading-icon"},OS={key:1,class:"lumen-pill-icon"},IS={key:2,class:"lumen-pill-content"},LS={key:3,class:"lumen-pill-trailing-icon"},DS=r.defineComponent({__name:"LumenPill",props:{variant:{default:"filled"},size:{default:"md"},color:{default:"primary"},icon:{type:Boolean,default:!1},iconOnly:{type:Boolean,default:!1},removable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},tooltip:{}},emits:["remove"],setup(n,{emit:e}){const t=n,o=r.computed(()=>["lumen-pill",`lumen-pill-${t.variant}`,`lumen-pill-${t.size}`,`lumen-pill-color-${t.color}`,t.icon?"lumen-pill-has-icon":"",t.iconOnly?"lumen-pill-icon-only":"",t.removable?"lumen-pill-removable":"",t.disabled?"lumen-pill-disabled":""].filter(Boolean).join(" ")),i=r.computed(()=>({}));return(s,l)=>(r.openBlock(),r.createElementBlock("div",AS,[n.variant==="dot-only"?(r.openBlock(),r.createBlock(vn,{key:0,content:n.tooltip||s.$slots.default?.({})?.[0]?.children||"",delay:0},{default:r.withCtx(()=>[r.createElementVNode("span",{class:r.normalizeClass(o.value),style:r.normalizeStyle(i.value)},null,6)]),_:1},8,["content"])):(r.openBlock(),r.createElementBlock("span",{key:1,class:r.normalizeClass([o.value,{"lumen-pill-has-leading-icon":s.$slots["leading-icon"],"lumen-pill-has-trailing-icon":s.$slots["trailing-icon"]}]),style:r.normalizeStyle(i.value)},[s.$slots["leading-icon"]&&!n.iconOnly?(r.openBlock(),r.createElementBlock("span",$S,[r.renderSlot(s.$slots,"leading-icon",{},void 0,!0)])):r.createCommentVNode("",!0),n.icon&&n.iconOnly?(r.openBlock(),r.createElementBlock("span",OS,[r.renderSlot(s.$slots,"icon",{},void 0,!0)])):r.createCommentVNode("",!0),n.iconOnly?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",IS,[r.renderSlot(s.$slots,"default",{},void 0,!0)])),s.$slots["trailing-icon"]&&!n.iconOnly?(r.openBlock(),r.createElementBlock("span",LS,[r.renderSlot(s.$slots,"trailing-icon",{},void 0,!0)])):r.createCommentVNode("",!0)],6))]))}}),va=_e(DS,[["__scopeId","data-v-4c672578"]]),VS={key:0,class:"item-icon"},RS={class:"item-label"},zS={key:0,class:"lumen-mega-menu-item-mobile-panel"},PS=r.defineComponent({__name:"LumenMegaMenu.Item",props:{to:{},href:{},label:{},active:{type:Boolean},disabled:{type:Boolean,default:!1}},emits:["click"],setup(n,{emit:e}){const t=n,o=e,i=r.useSlots(),s=r.computed(()=>!!i.panel),l=`menu-item-${Math.random().toString(36).slice(2,9)}`,a=r.inject("megaMenuContext",{triggerMode:r.computed(()=>"hover"),closeDelay:r.computed(()=>150),openDelay:r.computed(()=>0),isMobile:r.computed(()=>!1),closeMobileMenu:()=>{},registerItem:()=>{},unregisterItem:()=>{},updateItemPanel:()=>{},handleItemHover:()=>{},handleItemLeave:()=>{},handleItemClick:()=>{},activeItemId:r.computed(()=>null),isAnyPanelOpen:r.computed(()=>!1)}),c=r.ref(),u=r.ref(!1),d=r.computed(()=>a.isMobile.value?u.value:a.activeItemId.value===l);let f=null;try{f=typeof useRoute<"u"?useRoute():null}catch{f=null}const h=r.computed(()=>{if(t.active!==void 0)return t.active;if(!f||!t.to)return!1;const S=typeof t.to=="string"?t.to:t.to.path;return S?S==="/"?f.path==="/":f.path===S||f.path.startsWith(S+"/"):!1}),p=r.computed(()=>{if(!t.to||s.value)return null;try{const S=r.resolveComponent("NuxtLink");if(typeof S!="string")return S}catch{}try{const S=r.resolveComponent("RouterLink");if(typeof S!="string")return S}catch{}return"a"}),m=r.computed(()=>s.value||!t.to?"button":p.value||"a"),g=r.computed(()=>typeof m.value!="string"),v=r.computed(()=>m.value==="a"&&!!t.to),y=r.computed(()=>[{"lumen-mega-menu-item--disabled":t.disabled},{"lumen-mega-menu-item--has-panel":s.value},{"lumen-mega-menu-item--panel-open":d.value},{"lumen-mega-menu-item--mobile":a.isMobile.value}]),b=()=>i.panel?r.defineComponent({name:"MegaMenuPanelContent",setup(){return()=>i.panel?.({})}}):null,C=()=>{!s.value||a.isMobile.value||a.handleItemHover(l)},k=()=>{!s.value||a.isMobile.value||a.handleItemLeave()},x=S=>{o("click",S),s.value?a.isMobile.value?u.value=!u.value:a.triggerMode.value==="click"&&a.handleItemClick(l):t.to&&a.isMobile.value&&a.closeMobileMenu()};return r.onMounted(()=>{if(s.value&&c.value){const S=b();a.registerItem(l,c.value,S)}}),r.watch(()=>i.panel,()=>{if(s.value){const S=b();a.updateItemPanel(l,S)}},{deep:!0}),r.watch(()=>a.isMobile.value,S=>{!S&&u.value&&(u.value=!1)}),r.onUnmounted(()=>{a.unregisterItem(l)}),(S,M)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"itemRef",ref:c,class:r.normalizeClass(["lumen-mega-menu-item",y.value]),onMouseenter:C,onMouseleave:k},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(m.value),{to:g.value?n.to:void 0,href:v.value?typeof n.to=="string"?n.to:"":void 0,class:r.normalizeClass(["lumen-mega-menu-item-trigger",{"trigger-active":h.value,"trigger-panel-open":d.value}]),onClick:x},{default:r.withCtx(()=>[S.$slots.icon?(r.openBlock(),r.createElementBlock("span",VS,[r.renderSlot(S.$slots,"icon",{},void 0,!0)])):r.createCommentVNode("",!0),r.createElementVNode("span",RS,r.toDisplayString(n.label),1),s.value?(r.openBlock(),r.createElementBlock("span",{key:1,class:r.normalizeClass(["item-chevron",{"chevron-open":d.value}])},[...M[0]||(M[0]=[r.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[r.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1)])],2)):r.createCommentVNode("",!0)]),_:3},8,["to","href","class"])),r.createVNode(r.Transition,{name:"mobile-expand"},{default:r.withCtx(()=>[s.value&&d.value&&r.unref(a).isMobile.value?(r.openBlock(),r.createElementBlock("div",zS,[r.renderSlot(S.$slots,"panel",{},void 0,!0)])):r.createCommentVNode("",!0)]),_:3})],34))}}),ml=_e(PS,[["__scopeId","data-v-3fd97d0d"]]),HS=r.defineComponent({__name:"LumenMegaMenu.Panel",props:{width:{default:"auto"},columns:{default:1},align:{default:"left"},gap:{default:"sm"}},setup(n){const e=n,t=r.computed(()=>[`lumen-mega-menu-panel--columns-${e.columns}`,`lumen-mega-menu-panel--align-${e.align}`,`lumen-mega-menu-panel--gap-${e.gap}`]),o=r.computed(()=>{const i={};return e.width!=="auto"&&e.width!=="full"&&(i.width=e.width),i});return(i,s)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["lumen-mega-menu-panel",t.value]),style:r.normalizeStyle(o.value)},[r.renderSlot(i.$slots,"default",{},void 0,!0)],6))}}),gl=_e(HS,[["__scopeId","data-v-9e78d711"]]),_S={class:"lumen-mega-menu-group"},FS={key:0,class:"lumen-mega-menu-group-title"},US={class:"lumen-mega-menu-group-items"},qS=r.defineComponent({__name:"LumenMegaMenu.Group",props:{title:{}},setup(n){return(e,t)=>(r.openBlock(),r.createElementBlock("div",_S,[n.title?(r.openBlock(),r.createElementBlock("div",FS,r.toDisplayString(n.title),1)):r.createCommentVNode("",!0),r.createElementVNode("div",US,[r.renderSlot(e.$slots,"default",{},void 0,!0)])]))}}),vl=_e(qS,[["__scopeId","data-v-b9c47e98"]]),jS={class:"lumen-mega-menu-container"},WS=["aria-expanded"],KS={class:"hamburger-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},GS={class:"lumen-mega-menu-logo"},JS={class:"panel-link-label"},YS={key:0,class:"panel-link-description"},XS={class:"lumen-mega-menu-actions"},ZS={class:"mobile-drawer-header"},QS={class:"mobile-drawer-content"},eM={class:"panel-link-label"},tM={key:0,class:"panel-link-description"},nM={key:0,class:"mobile-drawer-footer"},oM=r.defineComponent({__name:"LumenMegaMenu",props:{triggerMode:{default:"hover"},closeDelay:{default:150},openDelay:{default:0},sticky:{type:Boolean,default:!0},stickyOffset:{default:0},maxWidth:{default:"1280px"},variant:{default:"default"},mobileBreakpoint:{default:768},items:{default:()=>[]}},emits:["navigate"],setup(n,{emit:e}){const t=n,o=e,i=r.computed(()=>t.items&&t.items.length>0),s=r.ref(typeof window<"u"?window.innerWidth:1024),l=r.computed(()=>s.value<t.mobileBreakpoint),a=r.ref(!1),c=r.ref(),u=r.ref(),d=r.shallowRef(new Map),f=r.ref(null),h=r.ref(!1),p=r.ref(0),m=r.ref({width:0,height:0}),g=r.ref(!1);let v=null,y=null;const b=()=>{let A=1/0,I=0;for(const P of d.value.values()){if(!P.panelComponent)continue;const Q=P.triggerRef.getBoundingClientRect();Q.left<A&&(A=Q.left,I=Q.bottom+4)}return{left:A===1/0?0:A,top:I}},C=A=>{const I=d.value.get(A);if(!I)return 0;const P=b();return I.triggerRef.getBoundingClientRect().left-P.left},k=A=>({left:`${C(A)}px`}),x=(A,I,P)=>{const Q=new Map(d.value);Q.set(A,{id:A,triggerRef:I,panelComponent:P}),d.value=Q},S=A=>{const I=new Map(d.value);I.delete(A),d.value=I,f.value===A&&(f.value=null,h.value=!1)},M=(A,I)=>{const P=d.value.get(A);if(P){const Q=new Map(d.value);Q.set(A,{...P,panelComponent:I}),d.value=Q}},L=async()=>{await r.nextTick();const A=u.value;if(!A)return;const I=A.querySelector(".shared-panel-content.panel-active");I&&(m.value={width:I.offsetWidth,height:I.offsetHeight})},R=async A=>{v&&(clearTimeout(v),v=null);const I=d.value.get(A);if(!I||!I.panelComponent)return;const P=h.value;P||(g.value=!0),p.value=C(A),f.value=A,h.value=!0,await L(),P||requestAnimationFrame(()=>{requestAnimationFrame(()=>{g.value=!1})})},X=()=>{y&&(clearTimeout(y),y=null),v=setTimeout(()=>{h.value=!1,f.value=null},t.closeDelay)},ve=()=>{v&&(clearTimeout(v),v=null)},fe=A=>{t.triggerMode!=="hover"||l.value||!d.value.get(A)?.panelComponent||(ve(),t.openDelay>0&&!h.value?y=setTimeout(()=>R(A),t.openDelay):R(A))},Se=()=>{t.triggerMode!=="hover"||l.value||X()},xe=A=>{d.value.get(A)?.panelComponent&&(t.triggerMode==="click"||l.value)&&(f.value===A&&h.value?(h.value=!1,f.value=null):R(A))},U=()=>{ve()},ee=()=>{t.triggerMode==="hover"&&!l.value&&X()},ce=r.computed(()=>({"panel-visible":h.value,"no-transition":g.value})),be=r.computed(()=>{const A=b();return{position:"fixed",top:`${A.top}px`,left:`${A.left}px`,transform:`translate3d(${p.value}px, 0, 0)`,zIndex:150,...m.value.width>0?{width:`${m.value.width+16}px`,height:`${m.value.height+16}px`}:{}}}),K=r.computed(()=>({transform:`translate3d(${-p.value}px, 0, 0)`,...m.value.width>0?{width:`${m.value.width}px`,height:`${m.value.height}px`}:{}}));r.provide("megaMenuContext",{triggerMode:r.computed(()=>t.triggerMode),closeDelay:r.computed(()=>t.closeDelay),openDelay:r.computed(()=>t.openDelay),isMobile:l,closeMobileMenu:()=>ke(),registerItem:x,unregisterItem:S,updateItemPanel:M,handleItemHover:fe,handleItemLeave:Se,handleItemClick:xe,activeItemId:r.computed(()=>f.value),isAnyPanelOpen:r.computed(()=>h.value)});const J=r.computed(()=>[`lumen-mega-menu--${t.variant}`,{"lumen-mega-menu--sticky":t.sticky}]),Y=r.computed(()=>({"--mega-menu-max-width":t.maxWidth,...t.sticky?{top:`${t.stickyOffset}px`}:{}})),me=()=>{a.value=!a.value,a.value?document.body.style.overflow="hidden":document.body.style.overflow=""},ke=()=>{a.value=!1,document.body.style.overflow=""},Fe=(A,I)=>{o("navigate",I),l.value?ke():(h.value=!1,f.value=null)},$e=()=>{s.value=window.innerWidth,!l.value&&a.value&&ke(),l.value&&h.value&&(h.value=!1,f.value=null)},re=A=>{A.key==="Escape"&&(a.value&&ke(),h.value&&(h.value=!1,f.value=null))},ie=A=>{if(!h.value||l.value)return;const I=A.target,P=c.value?.contains(I),Q=u.value?.contains(I);!P&&!Q&&(h.value=!1,f.value=null)};return r.watch(l,A=>{!A&&a.value&&ke()}),r.onMounted(()=>{window.addEventListener("resize",$e),window.addEventListener("keydown",re),document.addEventListener("click",ie)}),r.onUnmounted(()=>{window.removeEventListener("resize",$e),window.removeEventListener("keydown",re),document.removeEventListener("click",ie),document.body.style.overflow="",v&&clearTimeout(v),y&&clearTimeout(y)}),(A,I)=>(r.openBlock(),r.createElementBlock("nav",{class:r.normalizeClass(["lumen-mega-menu",J.value]),style:r.normalizeStyle(Y.value)},[r.createElementVNode("div",jS,[l.value?(r.openBlock(),r.createElementBlock("button",{key:0,class:"lumen-mega-menu-hamburger",type:"button","aria-label":"Toggle menu","aria-expanded":a.value,onClick:me},[(r.openBlock(),r.createElementBlock("svg",KS,[a.value?(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[I[4]||(I[4]=r.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)),I[5]||(I[5]=r.createElementVNode("line",{x1:"6",y1:"18",x2:"18",y2:"6"},null,-1))],64)):(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[I[1]||(I[1]=r.createElementVNode("line",{x1:"3",y1:"6",x2:"21",y2:"6"},null,-1)),I[2]||(I[2]=r.createElementVNode("line",{x1:"3",y1:"12",x2:"21",y2:"12"},null,-1)),I[3]||(I[3]=r.createElementVNode("line",{x1:"3",y1:"18",x2:"21",y2:"18"},null,-1))],64))]))],8,WS)):r.createCommentVNode("",!0),r.createElementVNode("div",GS,[r.renderSlot(A.$slots,"logo",{},void 0,!0)]),r.withDirectives(r.createElementVNode("div",{ref_key:"navRef",ref:c,class:"lumen-mega-menu-nav"},[i.value?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(n.items,(P,Q)=>(r.openBlock(),r.createBlock(ml,{key:"nav-"+Q,label:P.label,to:P.href,active:P.active,disabled:P.disabled},r.createSlots({_:2},[P.panel?{name:"panel",fn:r.withCtx(()=>[r.createVNode(gl,{columns:P.panel.columns,width:P.panel.width,gap:P.panel.gap},{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(P.panel.groups,(de,Me)=>(r.openBlock(),r.createBlock(vl,{key:Me,title:de.title},{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(de.links,(Ne,Le)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(Ne.href?"a":"button"),{key:Le,href:Ne.href||void 0,class:"mega-menu-panel-link",onClick:Ge=>Fe(Ge,Ne)},{default:r.withCtx(()=>[r.createElementVNode("span",JS,r.toDisplayString(Ne.label),1),Ne.description?(r.openBlock(),r.createElementBlock("span",YS,r.toDisplayString(Ne.description),1)):r.createCommentVNode("",!0)]),_:2},1032,["href","onClick"]))),128))]),_:2},1032,["title"]))),128))]),_:2},1032,["columns","width","gap"])]),key:"0"}:void 0]),1032,["label","to","active","disabled"]))),128)):r.renderSlot(A.$slots,"navigation",{key:1},void 0,!0)],512),[[r.vShow,!l.value]]),r.createElementVNode("div",XS,[r.renderSlot(A.$slots,"actions",{},void 0,!0)])]),l.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(r.Teleport,{key:0,to:"body"},[r.withDirectives(r.createElementVNode("div",{ref_key:"sharedPanelRef",ref:u,class:r.normalizeClass(["lumen-mega-menu-shared-panel",ce.value]),style:r.normalizeStyle(be.value),onMouseenter:U,onMouseleave:ee},[r.createElementVNode("div",{class:"shared-panel-slider",style:r.normalizeStyle(K.value)},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(d.value,([P,Q])=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:P},[Q.panelComponent?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["shared-panel-content",{"panel-active":P===f.value}]),style:r.normalizeStyle(k(P))},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(Q.panelComponent)))],6)):r.createCommentVNode("",!0)],64))),128))],4)],38),[[r.vShow,h.value]])])),l.value?(r.openBlock(),r.createBlock(r.Teleport,{key:1,to:"body"},[r.createVNode(r.Transition,{name:"mobile-menu"},{default:r.withCtx(()=>[a.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"lumen-mega-menu-mobile-backdrop",onClick:ke},[r.createElementVNode("div",{class:"lumen-mega-menu-mobile-drawer",onClick:I[0]||(I[0]=r.withModifiers(()=>{},["stop"]))},[r.createElementVNode("div",ZS,[r.renderSlot(A.$slots,"logo",{},void 0,!0),r.createElementVNode("button",{class:"mobile-close-btn",type:"button","aria-label":"Close menu",onClick:ke},[...I[6]||(I[6]=[r.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[r.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),r.createElementVNode("line",{x1:"6",y1:"18",x2:"18",y2:"6"})],-1)])])]),r.createElementVNode("div",QS,[i.value?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(n.items,(P,Q)=>(r.openBlock(),r.createBlock(ml,{key:"mobile-"+Q,label:P.label,to:P.href,active:P.active,disabled:P.disabled},r.createSlots({_:2},[P.panel?{name:"panel",fn:r.withCtx(()=>[r.createVNode(gl,{columns:1,gap:P.panel.gap},{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(P.panel.groups,(de,Me)=>(r.openBlock(),r.createBlock(vl,{key:Me,title:de.title},{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(de.links,(Ne,Le)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(Ne.href?"a":"button"),{key:Le,href:Ne.href||void 0,class:"mega-menu-panel-link",onClick:Ge=>Fe(Ge,Ne)},{default:r.withCtx(()=>[r.createElementVNode("span",eM,r.toDisplayString(Ne.label),1),Ne.description?(r.openBlock(),r.createElementBlock("span",tM,r.toDisplayString(Ne.description),1)):r.createCommentVNode("",!0)]),_:2},1032,["href","onClick"]))),128))]),_:2},1032,["title"]))),128))]),_:2},1032,["gap"])]),key:"0"}:void 0]),1032,["label","to","active","disabled"]))),128)):r.renderSlot(A.$slots,"mobile",{key:1},()=>[r.renderSlot(A.$slots,"navigation",{},void 0,!0)],!0)]),A.$slots["mobile-footer"]?(r.openBlock(),r.createElementBlock("div",nM,[r.renderSlot(A.$slots,"mobile-footer",{},void 0,!0)])):r.createCommentVNode("",!0)])])):r.createCommentVNode("",!0)]),_:3})])):r.createCommentVNode("",!0)],6))}}),ya=_e(oM,[["__scopeId","data-v-925cb61c"]]);function rM(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Rs,ou;function iM(){if(ou)return Rs;ou=1;function n(B){return B instanceof Map?B.clear=B.delete=B.set=function(){throw new Error("map is read-only")}:B instanceof Set&&(B.add=B.clear=B.delete=function(){throw new Error("set is read-only")}),Object.freeze(B),Object.getOwnPropertyNames(B).forEach(j=>{const ue=B[j],Ae=typeof ue;(Ae==="object"||Ae==="function")&&!Object.isFrozen(ue)&&n(ue)}),B}class e{constructor(j){j.data===void 0&&(j.data={}),this.data=j.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(B){return B.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function o(B,...j){const ue=Object.create(null);for(const Ae in B)ue[Ae]=B[Ae];return j.forEach(function(Ae){for(const Qe in Ae)ue[Qe]=Ae[Qe]}),ue}const i="</span>",s=B=>!!B.scope,l=(B,{prefix:j})=>{if(B.startsWith("language:"))return B.replace("language:","language-");if(B.includes(".")){const ue=B.split(".");return[`${j}${ue.shift()}`,...ue.map((Ae,Qe)=>`${Ae}${"_".repeat(Qe+1)}`)].join(" ")}return`${j}${B}`};class a{constructor(j,ue){this.buffer="",this.classPrefix=ue.classPrefix,j.walk(this)}addText(j){this.buffer+=t(j)}openNode(j){if(!s(j))return;const ue=l(j.scope,{prefix:this.classPrefix});this.span(ue)}closeNode(j){s(j)&&(this.buffer+=i)}value(){return this.buffer}span(j){this.buffer+=`<span class="${j}">`}}const c=(B={})=>{const j={children:[]};return Object.assign(j,B),j};class u{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(j){this.top.children.push(j)}openNode(j){const ue=c({scope:j});this.add(ue),this.stack.push(ue)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(j){return this.constructor._walk(j,this.rootNode)}static _walk(j,ue){return typeof ue=="string"?j.addText(ue):ue.children&&(j.openNode(ue),ue.children.forEach(Ae=>this._walk(j,Ae)),j.closeNode(ue)),j}static _collapse(j){typeof j!="string"&&j.children&&(j.children.every(ue=>typeof ue=="string")?j.children=[j.children.join("")]:j.children.forEach(ue=>{u._collapse(ue)}))}}class d extends u{constructor(j){super(),this.options=j}addText(j){j!==""&&this.add(j)}startScope(j){this.openNode(j)}endScope(){this.closeNode()}__addSublanguage(j,ue){const Ae=j.root;ue&&(Ae.scope=`language:${ue}`),this.add(Ae)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(B){return B?typeof B=="string"?B:B.source:null}function h(B){return g("(?=",B,")")}function p(B){return g("(?:",B,")*")}function m(B){return g("(?:",B,")?")}function g(...B){return B.map(ue=>f(ue)).join("")}function v(B){const j=B[B.length-1];return typeof j=="object"&&j.constructor===Object?(B.splice(B.length-1,1),j):{}}function y(...B){return"("+(v(B).capture?"":"?:")+B.map(Ae=>f(Ae)).join("|")+")"}function b(B){return new RegExp(B.toString()+"|").exec("").length-1}function C(B,j){const ue=B&&B.exec(j);return ue&&ue.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function x(B,{joinWith:j}){let ue=0;return B.map(Ae=>{ue+=1;const Qe=ue;let Je=f(Ae),ye="";for(;Je.length>0;){const ge=k.exec(Je);if(!ge){ye+=Je;break}ye+=Je.substring(0,ge.index),Je=Je.substring(ge.index+ge[0].length),ge[0][0]==="\\"&&ge[1]?ye+="\\"+String(Number(ge[1])+Qe):(ye+=ge[0],ge[0]==="("&&ue++)}return ye}).map(Ae=>`(${Ae})`).join(j)}const S=/\b\B/,M="[a-zA-Z]\\w*",L="[a-zA-Z_]\\w*",R="\\b\\d+(\\.\\d+)?",X="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",ve="\\b(0b[01]+)",fe="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Se=(B={})=>{const j=/^#![ ]*\//;return B.binary&&(B.begin=g(j,/.*\b/,B.binary,/\b.*/)),o({scope:"meta",begin:j,end:/$/,relevance:0,"on:begin":(ue,Ae)=>{ue.index!==0&&Ae.ignoreMatch()}},B)},xe={begin:"\\\\[\\s\\S]",relevance:0},U={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[xe]},ee={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[xe]},ce={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},be=function(B,j,ue={}){const Ae=o({scope:"comment",begin:B,end:j,contains:[]},ue);Ae.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Qe=y("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Ae.contains.push({begin:g(/[ ]+/,"(",Qe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ae},K=be("//","$"),J=be("/\\*","\\*/"),Y=be("#","$"),me={scope:"number",begin:R,relevance:0},ke={scope:"number",begin:X,relevance:0},Fe={scope:"number",begin:ve,relevance:0},$e={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[xe,{begin:/\[/,end:/\]/,relevance:0,contains:[xe]}]},re={scope:"title",begin:M,relevance:0},ie={scope:"title",begin:L,relevance:0},A={begin:"\\.\\s*"+L,relevance:0};var P=Object.freeze({__proto__:null,APOS_STRING_MODE:U,BACKSLASH_ESCAPE:xe,BINARY_NUMBER_MODE:Fe,BINARY_NUMBER_RE:ve,COMMENT:be,C_BLOCK_COMMENT_MODE:J,C_LINE_COMMENT_MODE:K,C_NUMBER_MODE:ke,C_NUMBER_RE:X,END_SAME_AS_BEGIN:function(B){return Object.assign(B,{"on:begin":(j,ue)=>{ue.data._beginMatch=j[1]},"on:end":(j,ue)=>{ue.data._beginMatch!==j[1]&&ue.ignoreMatch()}})},HASH_COMMENT_MODE:Y,IDENT_RE:M,MATCH_NOTHING_RE:S,METHOD_GUARD:A,NUMBER_MODE:me,NUMBER_RE:R,PHRASAL_WORDS_MODE:ce,QUOTE_STRING_MODE:ee,REGEXP_MODE:$e,RE_STARTERS_RE:fe,SHEBANG:Se,TITLE_MODE:re,UNDERSCORE_IDENT_RE:L,UNDERSCORE_TITLE_MODE:ie});function Q(B,j){B.input[B.index-1]==="."&&j.ignoreMatch()}function de(B,j){B.className!==void 0&&(B.scope=B.className,delete B.className)}function Me(B,j){j&&B.beginKeywords&&(B.begin="\\b("+B.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",B.__beforeBegin=Q,B.keywords=B.keywords||B.beginKeywords,delete B.beginKeywords,B.relevance===void 0&&(B.relevance=0))}function Ne(B,j){Array.isArray(B.illegal)&&(B.illegal=y(...B.illegal))}function Le(B,j){if(B.match){if(B.begin||B.end)throw new Error("begin & end are not supported with match");B.begin=B.match,delete B.match}}function Ge(B,j){B.relevance===void 0&&(B.relevance=1)}const wt=(B,j)=>{if(!B.beforeMatch)return;if(B.starts)throw new Error("beforeMatch cannot be used with starts");const ue=Object.assign({},B);Object.keys(B).forEach(Ae=>{delete B[Ae]}),B.keywords=ue.keywords,B.begin=g(ue.beforeMatch,h(ue.begin)),B.starts={relevance:0,contains:[Object.assign(ue,{endsParent:!0})]},B.relevance=0,delete ue.beforeMatch},Xt=["of","and","for","in","not","or","if","then","parent","list","value"],Ot="keyword";function xn(B,j,ue=Ot){const Ae=Object.create(null);return typeof B=="string"?Qe(ue,B.split(" ")):Array.isArray(B)?Qe(ue,B):Object.keys(B).forEach(function(Je){Object.assign(Ae,xn(B[Je],j,Je))}),Ae;function Qe(Je,ye){j&&(ye=ye.map(ge=>ge.toLowerCase())),ye.forEach(function(ge){const Be=ge.split("|");Ae[Be[0]]=[Je,Ct(Be[0],Be[1])]})}}function Ct(B,j){return j?Number(j):Ho(B)?0:1}function Ho(B){return Xt.includes(B.toLowerCase())}const q={},ae=B=>{console.error(B)},H=(B,...j)=>{console.log(`WARN: ${B}`,...j)},te=(B,j)=>{q[`${B}/${j}`]||(console.log(`Deprecated as of ${B}. ${j}`),q[`${B}/${j}`]=!0)},le=new Error;function He(B,j,{key:ue}){let Ae=0;const Qe=B[ue],Je={},ye={};for(let ge=1;ge<=j.length;ge++)ye[ge+Ae]=Qe[ge],Je[ge+Ae]=!0,Ae+=b(j[ge-1]);B[ue]=ye,B[ue]._emit=Je,B[ue]._multi=!0}function tt(B){if(Array.isArray(B.begin)){if(B.skip||B.excludeBegin||B.returnBegin)throw ae("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),le;if(typeof B.beginScope!="object"||B.beginScope===null)throw ae("beginScope must be object"),le;He(B,B.begin,{key:"beginScope"}),B.begin=x(B.begin,{joinWith:""})}}function lt(B){if(Array.isArray(B.end)){if(B.skip||B.excludeEnd||B.returnEnd)throw ae("skip, excludeEnd, returnEnd not compatible with endScope: {}"),le;if(typeof B.endScope!="object"||B.endScope===null)throw ae("endScope must be object"),le;He(B,B.end,{key:"endScope"}),B.end=x(B.end,{joinWith:""})}}function zt(B){B.scope&&typeof B.scope=="object"&&B.scope!==null&&(B.beginScope=B.scope,delete B.scope)}function Nt(B){zt(B),typeof B.beginScope=="string"&&(B.beginScope={_wrap:B.beginScope}),typeof B.endScope=="string"&&(B.endScope={_wrap:B.endScope}),tt(B),lt(B)}function Un(B){function j(ye,ge){return new RegExp(f(ye),"m"+(B.case_insensitive?"i":"")+(B.unicodeRegex?"u":"")+(ge?"g":""))}class ue{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(ge,Be){Be.position=this.position++,this.matchIndexes[this.matchAt]=Be,this.regexes.push([Be,ge]),this.matchAt+=b(ge)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const ge=this.regexes.map(Be=>Be[1]);this.matcherRe=j(x(ge,{joinWith:"|"}),!0),this.lastIndex=0}exec(ge){this.matcherRe.lastIndex=this.lastIndex;const Be=this.matcherRe.exec(ge);if(!Be)return null;const at=Be.findIndex((an,jn)=>jn>0&&an!==void 0),et=this.matchIndexes[at];return Be.splice(0,at),Object.assign(Be,et)}}class Ae{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(ge){if(this.multiRegexes[ge])return this.multiRegexes[ge];const Be=new ue;return this.rules.slice(ge).forEach(([at,et])=>Be.addRule(at,et)),Be.compile(),this.multiRegexes[ge]=Be,Be}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(ge,Be){this.rules.push([ge,Be]),Be.type==="begin"&&this.count++}exec(ge){const Be=this.getMatcher(this.regexIndex);Be.lastIndex=this.lastIndex;let at=Be.exec(ge);if(this.resumingScanAtSamePosition()&&!(at&&at.index===this.lastIndex)){const et=this.getMatcher(0);et.lastIndex=this.lastIndex+1,at=et.exec(ge)}return at&&(this.regexIndex+=at.position+1,this.regexIndex===this.count&&this.considerAll()),at}}function Qe(ye){const ge=new Ae;return ye.contains.forEach(Be=>ge.addRule(Be.begin,{rule:Be,type:"begin"})),ye.terminatorEnd&&ge.addRule(ye.terminatorEnd,{type:"end"}),ye.illegal&&ge.addRule(ye.illegal,{type:"illegal"}),ge}function Je(ye,ge){const Be=ye;if(ye.isCompiled)return Be;[de,Le,Nt,wt].forEach(et=>et(ye,ge)),B.compilerExtensions.forEach(et=>et(ye,ge)),ye.__beforeBegin=null,[Me,Ne,Ge].forEach(et=>et(ye,ge)),ye.isCompiled=!0;let at=null;return typeof ye.keywords=="object"&&ye.keywords.$pattern&&(ye.keywords=Object.assign({},ye.keywords),at=ye.keywords.$pattern,delete ye.keywords.$pattern),at=at||/\w+/,ye.keywords&&(ye.keywords=xn(ye.keywords,B.case_insensitive)),Be.keywordPatternRe=j(at,!0),ge&&(ye.begin||(ye.begin=/\B|\b/),Be.beginRe=j(Be.begin),!ye.end&&!ye.endsWithParent&&(ye.end=/\B|\b/),ye.end&&(Be.endRe=j(Be.end)),Be.terminatorEnd=f(Be.end)||"",ye.endsWithParent&&ge.terminatorEnd&&(Be.terminatorEnd+=(ye.end?"|":"")+ge.terminatorEnd)),ye.illegal&&(Be.illegalRe=j(ye.illegal)),ye.contains||(ye.contains=[]),ye.contains=[].concat(...ye.contains.map(function(et){return qn(et==="self"?ye:et)})),ye.contains.forEach(function(et){Je(et,Be)}),ye.starts&&Je(ye.starts,ge),Be.matcher=Qe(Be),Be}if(B.compilerExtensions||(B.compilerExtensions=[]),B.contains&&B.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return B.classNameAliases=o(B.classNameAliases||{}),Je(B)}function wn(B){return B?B.endsWithParent||wn(B.starts):!1}function qn(B){return B.variants&&!B.cachedVariants&&(B.cachedVariants=B.variants.map(function(j){return o(B,{variants:null},j)})),B.cachedVariants?B.cachedVariants:wn(B)?o(B,{starts:B.starts?o(B.starts):null}):Object.isFrozen(B)?o(B):B}var Or="11.11.1";class ss extends Error{constructor(j,ue){super(j),this.name="HTMLInjectionError",this.html=ue}}const mo=t,_o=o,Fo=Symbol("nomatch"),Cn=7,sn=function(B){const j=Object.create(null),ue=Object.create(null),Ae=[];let Qe=!0;const Je="Could not find the language '{}', did you forget to load/include a language module?",ye={disableAutodetect:!0,name:"Plain text",contains:[]};let ge={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function Be($){return ge.noHighlightRe.test($)}function at($){let _=$.className+" ";_+=$.parentNode?$.parentNode.className:"";const Z=ge.languageDetectRe.exec(_);if(Z){const oe=N(Z[1]);return oe||(H(Je.replace("{}",Z[1])),H("Falling back to no-highlight mode for this block.",$)),oe?Z[1]:"no-highlight"}return _.split(/\s+/).find(oe=>Be(oe)||N(oe))}function et($,_,Z){let oe="",se="";typeof _=="object"?(oe=$,Z=_.ignoreIllegals,se=_.language):(te("10.7.0","highlight(lang, code, ...args) has been deprecated."),te("10.7.0",`Please use highlight(code, options) instead.
|
|
144
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),se=$,oe=_),Z===void 0&&(Z=!0);const we={code:oe,language:se};T("before:highlight",we);const Ue=we.result?we.result:an(we.language,we.code,Z);return Ue.code=we.code,T("after:highlight",Ue),Ue}function an($,_,Z,oe){const se=Object.create(null);function we(he,Ce){return he.keywords[Ce]}function Ue(){if(!Ie.keywords){gt.addText(Xe);return}let he=0;Ie.keywordPatternRe.lastIndex=0;let Ce=Ie.keywordPatternRe.exec(Xe),ze="";for(;Ce;){ze+=Xe.substring(he,Ce.index);const je=Qt.case_insensitive?Ce[0].toLowerCase():Ce[0],Et=we(Ie,je);if(Et){const[cn,rh]=Et;if(gt.addText(ze),ze="",se[je]=(se[je]||0)+1,se[je]<=Cn&&(Dr+=rh),cn.startsWith("_"))ze+=Ce[0];else{const ih=Qt.classNameAliases[cn]||cn;ft(Ce[0],ih)}}else ze+=Ce[0];he=Ie.keywordPatternRe.lastIndex,Ce=Ie.keywordPatternRe.exec(Xe)}ze+=Xe.substring(he),gt.addText(ze)}function Ye(){if(Xe==="")return;let he=null;if(typeof Ie.subLanguage=="string"){if(!j[Ie.subLanguage]){gt.addText(Xe);return}he=an(Ie.subLanguage,Xe,!0,Ca[Ie.subLanguage]),Ca[Ie.subLanguage]=he._top}else he=Wn(Xe,Ie.subLanguage.length?Ie.subLanguage:null);Ie.relevance>0&&(Dr+=he.relevance),gt.__addSublanguage(he._emitter,he.language)}function qe(){Ie.subLanguage!=null?Ye():Ue(),Xe=""}function ft(he,Ce){he!==""&&(gt.startScope(Ce),gt.addText(he),gt.endScope())}function ko(he,Ce){let ze=1;const je=Ce.length-1;for(;ze<=je;){if(!he._emit[ze]){ze++;continue}const Et=Qt.classNameAliases[he[ze]]||he[ze],cn=Ce[ze];Et?ft(cn,Et):(Xe=cn,Ue(),Xe=""),ze++}}function jo(he,Ce){return he.scope&&typeof he.scope=="string"&>.openNode(Qt.classNameAliases[he.scope]||he.scope),he.beginScope&&(he.beginScope._wrap?(ft(Xe,Qt.classNameAliases[he.beginScope._wrap]||he.beginScope._wrap),Xe=""):he.beginScope._multi&&(ko(he.beginScope,Ce),Xe="")),Ie=Object.create(he,{parent:{value:Ie}}),Ie}function xa(he,Ce,ze){let je=C(he.endRe,ze);if(je){if(he["on:end"]){const Et=new e(he);he["on:end"](Ce,Et),Et.isMatchIgnored&&(je=!1)}if(je){for(;he.endsParent&&he.parent;)he=he.parent;return he}}if(he.endsWithParent)return xa(he.parent,Ce,ze)}function Qf(he){return Ie.matcher.regexIndex===0?(Xe+=he[0],1):(cs=!0,0)}function eh(he){const Ce=he[0],ze=he.rule,je=new e(ze),Et=[ze.__beforeBegin,ze["on:begin"]];for(const cn of Et)if(cn&&(cn(he,je),je.isMatchIgnored))return Qf(Ce);return ze.skip?Xe+=Ce:(ze.excludeBegin&&(Xe+=Ce),qe(),!ze.returnBegin&&!ze.excludeBegin&&(Xe=Ce)),jo(ze,he),ze.returnBegin?0:Ce.length}function th(he){const Ce=he[0],ze=_.substring(he.index),je=xa(Ie,he,ze);if(!je)return Fo;const Et=Ie;Ie.endScope&&Ie.endScope._wrap?(qe(),ft(Ce,Ie.endScope._wrap)):Ie.endScope&&Ie.endScope._multi?(qe(),ko(Ie.endScope,he)):Et.skip?Xe+=Ce:(Et.returnEnd||Et.excludeEnd||(Xe+=Ce),qe(),Et.excludeEnd&&(Xe=Ce));do Ie.scope&>.closeNode(),!Ie.skip&&!Ie.subLanguage&&(Dr+=Ie.relevance),Ie=Ie.parent;while(Ie!==je.parent);return je.starts&&jo(je.starts,he),Et.returnEnd?0:Ce.length}function nh(){const he=[];for(let Ce=Ie;Ce!==Qt;Ce=Ce.parent)Ce.scope&&he.unshift(Ce.scope);he.forEach(Ce=>gt.openNode(Ce))}let Lr={};function wa(he,Ce){const ze=Ce&&Ce[0];if(Xe+=he,ze==null)return qe(),0;if(Lr.type==="begin"&&Ce.type==="end"&&Lr.index===Ce.index&&ze===""){if(Xe+=_.slice(Ce.index,Ce.index+1),!Qe){const je=new Error(`0 width match regex (${$})`);throw je.languageName=$,je.badRule=Lr.rule,je}return 1}if(Lr=Ce,Ce.type==="begin")return eh(Ce);if(Ce.type==="illegal"&&!Z){const je=new Error('Illegal lexeme "'+ze+'" for mode "'+(Ie.scope||"<unnamed>")+'"');throw je.mode=Ie,je}else if(Ce.type==="end"){const je=th(Ce);if(je!==Fo)return je}if(Ce.type==="illegal"&&ze==="")return Xe+=`
|
|
145
|
+
`,1;if(as>1e5&&as>Ce.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Xe+=ze,ze.length}const Qt=N($);if(!Qt)throw ae(Je.replace("{}",$)),new Error('Unknown language: "'+$+'"');const oh=Un(Qt);let ls="",Ie=oe||oh;const Ca={},gt=new ge.__emitter(ge);nh();let Xe="",Dr=0,Kn=0,as=0,cs=!1;try{if(Qt.__emitTokens)Qt.__emitTokens(_,gt);else{for(Ie.matcher.considerAll();;){as++,cs?cs=!1:Ie.matcher.considerAll(),Ie.matcher.lastIndex=Kn;const he=Ie.matcher.exec(_);if(!he)break;const Ce=_.substring(Kn,he.index),ze=wa(Ce,he);Kn=he.index+ze}wa(_.substring(Kn))}return gt.finalize(),ls=gt.toHTML(),{language:$,value:ls,relevance:Dr,illegal:!1,_emitter:gt,_top:Ie}}catch(he){if(he.message&&he.message.includes("Illegal"))return{language:$,value:mo(_),illegal:!0,relevance:0,_illegalBy:{message:he.message,index:Kn,context:_.slice(Kn-100,Kn+100),mode:he.mode,resultSoFar:ls},_emitter:gt};if(Qe)return{language:$,value:mo(_),illegal:!1,relevance:0,errorRaised:he,_emitter:gt,_top:Ie};throw he}}function jn($){const _={value:mo($),illegal:!1,relevance:0,_top:ye,_emitter:new ge.__emitter(ge)};return _._emitter.addText($),_}function Wn($,_){_=_||ge.languages||Object.keys(j);const Z=jn($),oe=_.filter(N).filter(O).map(qe=>an(qe,$,!1));oe.unshift(Z);const se=oe.sort((qe,ft)=>{if(qe.relevance!==ft.relevance)return ft.relevance-qe.relevance;if(qe.language&&ft.language){if(N(qe.language).supersetOf===ft.language)return 1;if(N(ft.language).supersetOf===qe.language)return-1}return 0}),[we,Ue]=se,Ye=we;return Ye.secondBest=Ue,Ye}function go($,_,Z){const oe=_&&ue[_]||Z;$.classList.add("hljs"),$.classList.add(`language-${oe}`)}function Zt($){let _=null;const Z=at($);if(Be(Z))return;if(T("before:highlightElement",{el:$,language:Z}),$.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",$);return}if($.children.length>0&&(ge.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn($)),ge.throwUnescapedHTML))throw new ss("One of your code blocks includes unescaped HTML.",$.innerHTML);_=$;const oe=_.textContent,se=Z?et(oe,{language:Z,ignoreIllegals:!0}):Wn(oe);$.innerHTML=se.value,$.dataset.highlighted="yes",go($,Z,se.language),$.result={language:se.language,re:se.relevance,relevance:se.relevance},se.secondBest&&($.secondBest={language:se.secondBest.language,relevance:se.secondBest.relevance}),T("after:highlightElement",{el:$,result:se,text:oe})}function En($){ge=_o(ge,$)}const Uo=()=>{yo(),te("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function qo(){yo(),te("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let vo=!1;function yo(){function $(){yo()}if(document.readyState==="loading"){vo||window.addEventListener("DOMContentLoaded",$,!1),vo=!0;return}document.querySelectorAll(ge.cssSelector).forEach(Zt)}function Ir($,_){let Z=null;try{Z=_(B)}catch(oe){if(ae("Language definition for '{}' could not be registered.".replace("{}",$)),Qe)ae(oe);else throw oe;Z=ye}Z.name||(Z.name=$),j[$]=Z,Z.rawDefinition=_.bind(null,B),Z.aliases&&W(Z.aliases,{languageName:$})}function E($){delete j[$];for(const _ of Object.keys(ue))ue[_]===$&&delete ue[_]}function w(){return Object.keys(j)}function N($){return $=($||"").toLowerCase(),j[$]||j[ue[$]]}function W($,{languageName:_}){typeof $=="string"&&($=[$]),$.forEach(Z=>{ue[Z.toLowerCase()]=_})}function O($){const _=N($);return _&&!_.disableAutodetect}function F($){$["before:highlightBlock"]&&!$["before:highlightElement"]&&($["before:highlightElement"]=_=>{$["before:highlightBlock"](Object.assign({block:_.el},_))}),$["after:highlightBlock"]&&!$["after:highlightElement"]&&($["after:highlightElement"]=_=>{$["after:highlightBlock"](Object.assign({block:_.el},_))})}function z($){F($),Ae.push($)}function D($){const _=Ae.indexOf($);_!==-1&&Ae.splice(_,1)}function T($,_){const Z=$;Ae.forEach(function(oe){oe[Z]&&oe[Z](_)})}function V($){return te("10.7.0","highlightBlock will be removed entirely in v12.0"),te("10.7.0","Please use highlightElement now."),Zt($)}Object.assign(B,{highlight:et,highlightAuto:Wn,highlightAll:yo,highlightElement:Zt,highlightBlock:V,configure:En,initHighlighting:Uo,initHighlightingOnLoad:qo,registerLanguage:Ir,unregisterLanguage:E,listLanguages:w,getLanguage:N,registerAliases:W,autoDetection:O,inherit:_o,addPlugin:z,removePlugin:D}),B.debugMode=function(){Qe=!1},B.safeMode=function(){Qe=!0},B.versionString=Or,B.regex={concat:g,lookahead:h,either:y,optional:m,anyNumberOfTimes:p};for(const $ in P)typeof P[$]=="object"&&n(P[$]);return Object.assign(B,P),B},ln=sn({});return ln.newInstance=()=>sn({}),Rs=ln,ln.HighlightJS=ln,ln.default=ln,Rs}var sM=iM();const hn=rM(sM);function lM(n){const e=n.regex,t=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),o=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},l=n.inherit(s,{begin:/\(/,end:/\)/}),a=n.inherit(n.APOS_STRING_MODE,{className:"string"}),c=n.inherit(n.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:o,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,c,a,l,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,l,c,a]}]}]},n.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(t,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:u}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}const ru="[A-Za-z$_][0-9A-Za-z$_]*",aM=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],cM=["true","false","null","undefined","NaN","Infinity"],Ff=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Uf=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],qf=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],uM=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],dM=[].concat(qf,Ff,Uf);function fM(n){const e=n.regex,t=(be,{after:K})=>{const J="</"+be[0].slice(1);return be.input.indexOf(J,K)!==-1},o=ru,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(be,K)=>{const J=be[0].length+be.index,Y=be.input[J];if(Y==="<"||Y===","){K.ignoreMatch();return}Y===">"&&(t(be,{after:J})||K.ignoreMatch());let me;const ke=be.input.substring(J);if(me=ke.match(/^\s*=/)){K.ignoreMatch();return}if((me=ke.match(/^\s+extends\s+/))&&me.index===0){K.ignoreMatch();return}}},a={$pattern:ru,keyword:aM,literal:cM,built_in:dM,"variable.language":uM},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,h]},b={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:o+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},C=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,m,g,v,{match:/\$\d+/},f];h.contains=C.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(C)});const k=[].concat(b,h.contains),x=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x},M={variants:[{match:[/class/,/\s+/,o,/\s+/,/extends/,/\s+/,e.concat(o,"(",e.concat(/\./,o),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,o],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ff,...Uf]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},X={variants:[{match:[/function/,/\s+/,o,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},ve={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function fe(be){return e.concat("(?!",be.join("|"),")")}const Se={match:e.concat(/\b/,fe([...qf,"super","import"].map(be=>`${be}\\s*\\(`)),o,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},xe={begin:e.concat(/\./,e.lookahead(e.concat(o,/(?![0-9A-Za-z$_(])/))),end:o,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,o,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},ee="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",ce={match:[/const|var|let/,/\s+/,o,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ee)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,m,g,v,b,{match:/\$\d+/},f,L,{scope:"attr",match:o+e.lookahead(":"),relevance:0},ce,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[b,n.REGEXP_MODE,{className:"function",begin:ee,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},X,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[S,n.inherit(n.TITLE_MODE,{begin:o,className:"title.function"})]},{match:/\.\.\./,relevance:0},xe,{match:"\\$"+o,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},Se,ve,M,U,{match:/\$[(.]/}]}}const _i="[A-Za-z$_][0-9A-Za-z$_]*",jf=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Wf=["true","false","null","undefined","NaN","Infinity"],Kf=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Gf=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Jf=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Yf=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Xf=[].concat(Jf,Kf,Gf);function hM(n){const e=n.regex,t=(be,{after:K})=>{const J="</"+be[0].slice(1);return be.input.indexOf(J,K)!==-1},o=_i,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(be,K)=>{const J=be[0].length+be.index,Y=be.input[J];if(Y==="<"||Y===","){K.ignoreMatch();return}Y===">"&&(t(be,{after:J})||K.ignoreMatch());let me;const ke=be.input.substring(J);if(me=ke.match(/^\s*=/)){K.ignoreMatch();return}if((me=ke.match(/^\s+extends\s+/))&&me.index===0){K.ignoreMatch();return}}},a={$pattern:_i,keyword:jf,literal:Wf,built_in:Xf,"variable.language":Yf},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,h]},b={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:o+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},C=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,m,g,v,{match:/\$\d+/},f];h.contains=C.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(C)});const k=[].concat(b,h.contains),x=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x},M={variants:[{match:[/class/,/\s+/,o,/\s+/,/extends/,/\s+/,e.concat(o,"(",e.concat(/\./,o),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,o],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Kf,...Gf]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},X={variants:[{match:[/function/,/\s+/,o,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},ve={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function fe(be){return e.concat("(?!",be.join("|"),")")}const Se={match:e.concat(/\b/,fe([...Jf,"super","import"].map(be=>`${be}\\s*\\(`)),o,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},xe={begin:e.concat(/\./,e.lookahead(e.concat(o,/(?![0-9A-Za-z$_(])/))),end:o,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,o,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},ee="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",ce={match:[/const|var|let/,/\s+/,o,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ee)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,m,g,v,b,{match:/\$\d+/},f,L,{scope:"attr",match:o+e.lookahead(":"),relevance:0},ce,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[b,n.REGEXP_MODE,{className:"function",begin:ee,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},X,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[S,n.inherit(n.TITLE_MODE,{begin:o,className:"title.function"})]},{match:/\.\.\./,relevance:0},xe,{match:"\\$"+o,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},Se,ve,M,U,{match:/\$[(.]/}]}}function pM(n){const e=n.regex,t=hM(n),o=_i,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,n.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},l={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[t.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:_i,keyword:jf.concat(c),literal:Wf,built_in:Xf.concat(i),"variable.language":Yf},d={className:"meta",begin:"@"+o},f=(g,v,y)=>{const b=g.contains.findIndex(C=>C.label===v);if(b===-1)throw new Error("can not find mode to replace");g.contains.splice(b,1,y)};Object.assign(t.keywords,u),t.exports.PARAMS_CONTAINS.push(d);const h=t.contains.find(g=>g.scope==="attr"),p=Object.assign({},h,{match:e.concat(o,e.lookahead(/\s*\?:/))});t.exports.PARAMS_CONTAINS.push([t.exports.CLASS_REFERENCE,h,p]),t.contains=t.contains.concat([d,s,l,p]),f(t,"shebang",n.SHEBANG()),f(t,"use_strict",a);const m=t.contains.find(g=>g.label==="func.def");return m.relevance=0,Object.assign(t,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),t}const mM=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),gM=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],vM=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],yM=[...gM,...vM],kM=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),bM=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),xM=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),wM=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function CM(n){const e=n.regex,t=mM(n),o={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,l="[a-zA-Z-][a-zA-Z0-9_-]*",a=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[t.BLOCK_COMMENT,o,t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+l,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+bM.join("|")+")"},{begin:":(:)?("+xM.join("|")+")"}]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+wM.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},t.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:kM.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+yM.join("|")+")\\b"}]}}function EM(n){const e=n.regex,t={},o={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},o]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[n.BACKSLASH_ESCAPE]},s=n.inherit(n.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),l={begin:/<<-?\s*(?=\w+)/,starts:{contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,t,i]};i.contains.push(a);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},n.NUMBER_MODE,t]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=n.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[n.inherit(n.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],v=["true","false"],y={match:/(\/[a-z._-]+)+/},b=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],C=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],k=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],x=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:v,built_in:[...b,...C,"set","shopt",...k,...x]},contains:[p,n.SHEBANG(),m,f,s,l,y,a,c,u,d,t]}}function SM(n){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},t={match:/[{}[\],:]/,className:"punctuation",relevance:0},o=["true","false","null"],i={scope:"literal",beginKeywords:o.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:o},contains:[e,t,n.QUOTE_STRING_MODE,i,n.C_NUMBER_MODE,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}const MM={class:"lumen-codeblock-header"},TM={key:1,class:"lumen-codeblock-language"},NM={key:2},BM=["aria-label"],AM={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},$M={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},OM=["innerHTML"],IM=r.defineComponent({__name:"LumenCodeBlock",props:{code:{},language:{},tabs:{},modelValue:{},copyable:{type:Boolean,default:!0},maxHeight:{}},emits:["update:modelValue","copy"],setup(n,{emit:e}){hn.registerLanguage("xml",lM),hn.registerLanguage("javascript",fM),hn.registerLanguage("typescript",pM),hn.registerLanguage("css",CM),hn.registerLanguage("bash",EM),hn.registerLanguage("json",SM);const t=n,o=e,i=r.computed(()=>t.tabs&&t.tabs.length>0),s=r.computed(()=>(t.tabs||[]).map(C=>({label:C.label,value:C.value}))),l=r.ref(t.tabs?.[0]?.value||""),a=r.computed(()=>t.modelValue||l.value);function c(C){l.value=C,o("update:modelValue",C)}const u=r.computed(()=>i.value&&t.tabs?t.tabs.find(k=>k.value===a.value)?.code||t.tabs[0]?.code||"":t.code||""),d=r.computed(()=>i.value&&t.tabs?t.tabs.find(k=>k.value===a.value)?.language||t.tabs[0]?.language||"":t.language||""),f=r.computed(()=>{const C=d.value;return C?{vue:"language-xml",html:"language-xml",xml:"language-xml",js:"language-javascript",javascript:"language-javascript",ts:"language-typescript",typescript:"language-typescript",css:"language-css",bash:"language-bash",shell:"language-bash",json:"language-json"}[C.toLowerCase()]||`language-${C.toLowerCase()}`:""});function h(C){return C.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const p={vue:"xml",html:"xml",xml:"xml",js:"javascript",javascript:"javascript",ts:"typescript",typescript:"typescript",css:"css",bash:"bash",shell:"bash",json:"json"},m=r.computed(()=>{const C=u.value;if(!C)return"";const k=d.value?.toLowerCase(),x=k?p[k]:void 0;try{return x&&hn.getLanguage(x)?hn.highlight(C,{language:x}).value:hn.highlightAuto(C).value}catch{return h(C)}}),g=r.ref(),v=r.ref(!1);let y=null;async function b(){try{await navigator.clipboard.writeText(u.value)}catch{const C=document.createElement("textarea");C.value=u.value,C.style.position="fixed",C.style.opacity="0",document.body.appendChild(C),C.select(),document.execCommand("copy"),document.body.removeChild(C)}v.value=!0,o("copy"),y&&clearTimeout(y),y=setTimeout(()=>{v.value=!1},2e3)}return r.onUnmounted(()=>{y&&clearTimeout(y)}),(C,k)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["lumen-codeblock",{"lumen-codeblock--has-tabs":i.value}])},[r.createElementVNode("div",MM,[i.value?(r.openBlock(),r.createBlock(Tr,{key:0,"model-value":a.value,tabs:s.value,variant:"pills",size:"sm","tab-width":"fit","onUpdate:modelValue":c},null,8,["model-value","tabs"])):n.language?(r.openBlock(),r.createElementBlock("span",TM,r.toDisplayString(n.language),1)):(r.openBlock(),r.createElementBlock("span",NM)),n.copyable?(r.openBlock(),r.createElementBlock("button",{key:3,class:r.normalizeClass(["lumen-codeblock-copy",{"lumen-codeblock-copy--copied":v.value}]),"aria-label":v.value?"Copied":"Copy code",onClick:b},[v.value?(r.openBlock(),r.createElementBlock("svg",$M,[...k[1]||(k[1]=[r.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(r.openBlock(),r.createElementBlock("svg",AM,[...k[0]||(k[0]=[r.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),r.createElementVNode("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])),r.createElementVNode("span",null,r.toDisplayString(v.value?"Copied!":"Copy"),1)],10,BM)):r.createCommentVNode("",!0)]),r.createElementVNode("div",{class:"lumen-codeblock-body",style:r.normalizeStyle(n.maxHeight&&n.maxHeight!=="none"?{maxHeight:n.maxHeight,overflowY:"auto"}:{})},[r.createElementVNode("pre",null,[r.createElementVNode("code",{ref_key:"codeRef",ref:g,class:r.normalizeClass(f.value),innerHTML:m.value},null,10,OM)])],4)],2))}}),ka=_e(IM,[["__scopeId","data-v-301a405f"]]),LM={key:0,class:"scrollspy-island-anchor"},DM={class:"scrollspy-island-progress",viewBox:"0 0 24 24","aria-hidden":"true"},VM=["stroke-dasharray","stroke-dashoffset"],RM={class:"scrollspy-island-label"},zM={class:"scrollspy-island-percent"},PM={class:"scrollspy-island-body"},HM=["onClick"],_M=["data-key","onClick"],FM=["data-key","onClick"],UM=["height"],qM=["d"],jM=["d"],WM=2,KM=14,GM=r.defineComponent({__name:"LumenScrollSpy",props:{sections:{},scrollContainer:{},scrollSnap:{},orientation:{default:"vertical"},hashNavigation:{type:Boolean},variant:{default:"default"}},setup(n){const e=n,t=r.ref(),o=r.ref(),i=r.ref(),s=r.ref(""),l=r.ref({opacity:"0"}),a=r.ref(""),c=r.ref(0),u=r.ref(new Map),d=r.ref(0);let f=null,h=null;const p=r.ref(!1),m=r.ref(0),g=r.ref();let v=null;const y=2*Math.PI*9,b=r.computed(()=>e.orientation==="horizontal"),C=r.computed(()=>e.variant==="island"),k=r.computed(()=>e.sections.some(A=>A.children&&A.children.length>0)),x=r.computed(()=>{const A=[];for(const I of e.sections)if(A.push({key:I.id,parentId:I.id,label:I.label,depth:0}),I.children)for(const P of I.children)A.push({key:`${I.id}::${P.selector}`,parentId:I.id,selector:P.selector,label:P.label,depth:1});return A}),S=r.computed(()=>b.value?"left":"top"),M=r.computed(()=>{const A=u.value.get(s.value);return!A||c.value===0?{opacity:"0"}:{strokeDasharray:`${A.length} ${c.value}`,strokeDashoffset:`${-A.startOffset}`,opacity:"1"}}),L=r.computed(()=>x.value.find(I=>I.key===s.value)?.label||e.sections[0]?.label||"");function R(){p.value=!p.value}function X(A){Y(A),p.value=!1}function ve(){if(!g.value)return;g.value.querySelector(".scrollspy-island-link--active")?.scrollIntoView({block:"nearest",behavior:"smooth"})}function fe(){if(Se(),!C.value)return;const A=be(),I=A||window,P=()=>{if(!t.value)return;const de=t.value.getBoundingClientRect(),Ne=(A?A.getBoundingClientRect().bottom:window.innerHeight)-de.top-16;t.value.style.setProperty("--_island-available",`${Math.max(Ne,120)}px`)},Q=()=>{if(A){const de=A.scrollHeight-A.clientHeight;m.value=de>0?Math.min(1,A.scrollTop/de):0}else{const de=document.body.scrollHeight-window.innerHeight;m.value=de>0?Math.min(1,window.scrollY/de):0}P()};I.addEventListener("scroll",Q,{passive:!0}),window.addEventListener("resize",P,{passive:!0}),Q(),v=()=>{I.removeEventListener("scroll",Q),window.removeEventListener("resize",P)}}function Se(){v?.(),v=null}function xe(){const A=e.scrollSnap;if(!A)return{snap:S.value,offsetPx:0};const I=typeof A=="string"?{snap:A,offset:void 0}:A,P=I.offset?U(I.offset):0;return{snap:I.snap,offsetPx:P}}function U(A){const I=parseFloat(A);return isNaN(I)?0:A.endsWith("rem")?I*parseFloat(getComputedStyle(document.documentElement).fontSize):I}function ee(A){if(A.includes("::")){const[I,P]=A.split("::");return`#${I}${P}`}return`#${A}`}function ce(A){if(!A||A==="#")return"";const I=A.slice(1),P=I.indexOf(".");if(P>0){const Q=I.slice(0,P),de=I.slice(P);return`${Q}::${de}`}return I}function be(){const A=e.scrollContainer;if(A instanceof HTMLElement)return A;if(typeof A=="string"&&A){const I=A.startsWith("#")||A.startsWith(".")||A.startsWith("[")?A:`#${A}`;return document.querySelector(I)??null}if(t.value){let I=t.value.parentElement;for(;I&&I!==document.body&&I!==document.documentElement;){const{overflowY:P,overflowX:Q}=getComputedStyle(I);if(b.value){if(Q==="auto"||Q==="scroll")return I}else if(P==="auto"||P==="scroll")return I;I=I.parentElement}}return null}function K(A){const I=x.value.find(P=>P.key===A);return I?I.depth===0?document.getElementById(I.parentId):I.selector?document.getElementById(I.parentId)?.querySelector(I.selector)??null:null:null}function J(){f?.disconnect();const A=be(),I=b.value?"0px -80% 0px -10%":"-10% 0px -80% 0px",P=new Map;f=new IntersectionObserver(Q=>{for(const de of Q)if(de.isIntersecting){const Me=P.get(de.target);Me&&(s.value=Me)}},{root:A,rootMargin:I,threshold:0});for(const Q of x.value){const de=K(Q.key);de&&(P.set(de,Q.key),f.observe(de))}}function Y(A){const I=K(A);if(!I)return;const P=be(),{snap:Q,offsetPx:de}=xe(),Me=b.value;if(P){const Ne=P.getBoundingClientRect(),Le=I.getBoundingClientRect();if(Me){let Ge=P.scrollLeft+(Le.left-Ne.left);if(Q==="right")Ge=P.scrollLeft+(Le.right-Ne.right);else if(Q==="center"){const wt=Ne.width/2,Xt=Le.left-Ne.left+Le.width/2;Ge=P.scrollLeft+(Xt-wt)}Q==="right"?Ge+=de:Ge-=de,P.scrollTo({left:Ge,behavior:"smooth"})}else{let Ge=P.scrollTop+(Le.top-Ne.top);if(Q==="bottom")Ge=P.scrollTop+(Le.bottom-Ne.bottom);else if(Q==="center"){const wt=Ne.height/2,Xt=Le.top-Ne.top+Le.height/2;Ge=P.scrollTop+(Xt-wt)}Q==="bottom"?Ge+=de:Ge-=de,P.scrollTo({top:Ge,behavior:"smooth"})}}else{const Ne=I.getBoundingClientRect();if(Me){let Le=window.scrollX+Ne.left;Q==="right"?Le=window.scrollX+Ne.right-window.innerWidth:Q==="center"&&(Le=window.scrollX+Ne.left+Ne.width/2-window.innerWidth/2),Q==="right"?Le+=de:Le-=de,window.scrollTo({left:Le,behavior:"smooth"})}else{let Le=window.scrollY+Ne.top;Q==="bottom"?Le=window.scrollY+Ne.bottom-window.innerHeight:Q==="center"&&(Le=window.scrollY+Ne.top+Ne.height/2-window.innerHeight/2),Q==="bottom"?Le+=de:Le-=de,window.scrollTo({top:Le,behavior:"smooth"})}}e.hashNavigation&&history.pushState(null,"",ee(A))}function me(){if(b.value||!o.value){a.value="";return}const A=x.value,I=[];for(const Q of A){const de=o.value.querySelector(`[data-key="${CSS.escape(Q.key)}"]`);if(!de)continue;const Me=de.offsetTop+de.offsetHeight/2,Ne=Q.depth===0?WM:KM;I.push({x:Ne,yCenter:Me,depth:Q.depth,key:Q.key})}if(I.length===0){a.value="";return}d.value=o.value.scrollHeight;let P=`M ${I[0].x},${I[0].yCenter}`;for(let Q=1;Q<I.length;Q++){const de=I[Q-1],Me=I[Q];if(de.x===Me.x)P+=` L ${Me.x},${Me.yCenter}`;else{const Ne=Me.yCenter-de.yCenter,Le=Math.min(Math.abs(Ne)*.5,20);P+=` C ${de.x},${de.yCenter+Le} ${Me.x},${Me.yCenter-Le} ${Me.x},${Me.yCenter}`}}a.value=P}function ke(A,I,P){let Q=0,de=I;for(let Me=0;Me<20;Me++){const Ne=(Q+de)/2;A.getPointAtLength(Ne).y<P?Q=Ne:de=Ne}return(Q+de)/2}function Fe(){if(!i.value||!o.value)return;const A=i.value.querySelector(".scrollspy-svg-active");if(!A||!a.value)return;const I=A.getTotalLength();c.value=I;const P=x.value,Q=new Map;for(const de of P){const Me=o.value.querySelector(`[data-key="${CSS.escape(de.key)}"]`);if(!Me)continue;const Ne=Me.offsetTop,Le=Me.offsetTop+Me.offsetHeight,Ge=ke(A,I,Ne),wt=ke(A,I,Le);Q.set(de.key,{key:de.key,startOffset:Ge,length:wt-Ge})}u.value=Q}function $e(){if(!o.value||!s.value){l.value={opacity:"0"};return}const A=o.value.querySelector(".scrollspy-link--active");if(!A){l.value={opacity:"0"};return}l.value={left:`${A.offsetLeft}px`,width:`${A.offsetWidth}px`,opacity:"1"}}function re(){if(b.value){$e();return}me(),r.nextTick(()=>Fe())}r.watch([()=>e.sections,()=>e.scrollContainer,()=>e.orientation],()=>{J(),r.nextTick(()=>re())},{flush:"post"}),r.watch(s,()=>{b.value&&r.nextTick($e),C.value&&p.value&&r.nextTick(ve),e.hashNavigation&&s.value&&history.replaceState(null,"",ee(s.value))});function ie(){if(!e.hashNavigation)return;const A=ce(location.hash);A&&x.value.some(I=>I.key===A)&&(s.value=A,Y(A))}return r.onMounted(()=>{if(J(),r.nextTick(()=>re()),o.value&&(h=new ResizeObserver(()=>re()),h.observe(o.value)),fe(),e.hashNavigation&&location.hash){const A=ce(location.hash);A&&x.value.some(I=>I.key===A)&&(s.value=A,r.nextTick(()=>Y(A)))}window.addEventListener("popstate",ie)}),r.onUnmounted(()=>{f?.disconnect(),h?.disconnect(),Se(),window.removeEventListener("popstate",ie)}),(A,I)=>C.value?(r.openBlock(),r.createElementBlock("div",LM,[r.createElementVNode("nav",{ref_key:"navRef",ref:t,class:r.normalizeClass(["scrollspy-island",{"scrollspy-island--open":p.value}])},[r.createElementVNode("div",{class:"scrollspy-island-header",onClick:R},[(r.openBlock(),r.createElementBlock("svg",DM,[I[0]||(I[0]=r.createElementVNode("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor","stroke-width":"2.5",opacity:"0.15"},null,-1)),r.createElementVNode("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"var(--lumen-accent, #EA00A8)","stroke-width":"2.5","stroke-linecap":"round",transform:"rotate(-90 12 12)","stroke-dasharray":`${y} ${y}`,"stroke-dashoffset":y-y*m.value},null,8,VM)])),r.createElementVNode("span",RM,r.toDisplayString(L.value),1),r.createElementVNode("span",zM,r.toDisplayString(Math.round(m.value*100))+"%",1)]),r.createElementVNode("div",PM,[r.createElementVNode("div",{ref_key:"sectionsRef",ref:g,class:"scrollspy-island-sections"},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(x.value,P=>(r.openBlock(),r.createElementBlock("button",{key:P.key,class:r.normalizeClass(["scrollspy-island-link",{"scrollspy-island-link--active":s.value===P.key,"scrollspy-island-link--child":P.depth>0}]),onClick:r.withModifiers(Q=>X(P.key),["stop"])},r.toDisplayString(P.label),11,HM))),128))],512)])],2)])):(r.openBlock(),r.createElementBlock("nav",{key:1,ref_key:"navRef",ref:t,class:r.normalizeClass(["scrollspy",{"scrollspy--horizontal":b.value,"scrollspy--has-children":k.value}])},[r.createElementVNode("ul",{ref_key:"listRef",ref:o,class:"scrollspy-list"},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(n.sections,P=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:P.id},[r.createElementVNode("li",null,[r.createElementVNode("button",{class:r.normalizeClass(["scrollspy-link",{"scrollspy-link--active":s.value===P.id}]),"data-key":P.id,onClick:Q=>Y(P.id)},r.toDisplayString(P.label),11,_M)]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(P.children||[],Q=>(r.openBlock(),r.createElementBlock("li",{key:`${P.id}::${Q.selector}`},[r.createElementVNode("button",{class:r.normalizeClass(["scrollspy-link scrollspy-link--child",{"scrollspy-link--active":s.value===`${P.id}::${Q.selector}`}]),"data-key":`${P.id}::${Q.selector}`,onClick:de=>Y(`${P.id}::${Q.selector}`)},r.toDisplayString(Q.label),11,FM)]))),128))],64))),128)),b.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"scrollspy-indicator",style:r.normalizeStyle(l.value)},null,4)):r.createCommentVNode("",!0)],512),!b.value&&a.value?(r.openBlock(),r.createElementBlock("svg",{key:0,ref_key:"svgRef",ref:i,class:"scrollspy-svg",width:20,height:d.value,"aria-hidden":"true"},[r.createElementVNode("path",{d:a.value,class:"scrollspy-svg-track",fill:"none",stroke:"currentColor","stroke-width":2},null,8,qM),r.createElementVNode("path",{d:a.value,class:"scrollspy-svg-active",fill:"none",stroke:"var(--lumen-accent, #EA00A8)","stroke-width":2,style:r.normalizeStyle(M.value)},null,12,jM)],8,UM)):r.createCommentVNode("",!0)],2))}}),ba=_e(GM,[["__scopeId","data-v-847dc413"]]),JM={LumenAlert:kl,LumenApp:yl,LumenAvatarEditor:ia,LumenBunnyFontPicker:ca,LumenButton:De,LumenCard:Ui,LumenCheckboxGroup:ga,LumenCodeBlock:ka,LumenColorPicker:aa,LumenDateTimePicker:zo,LumenDivider:Dt,LumenHero:da,LumenInput:uo,LumenLevelProgress:sa,LumenLink:oa,LumenLoader:Fi,LumenMegaMenu:ya,LumenModal:la,LumenPill:va,LumenRadioGroup:ma,LumenSlider:pa,LumenTable:ua,LumenTabs:Tr,LumenThemeToggle:ha,LumenToggle:ra,LumenTooltip:vn,LumenScrollSpy:ba},Zf={install(n,e={}){const{prefix:t=""}=e;Object.entries(JM).forEach(([o,i])=>{const s=t?`${t}${o}`:o;n.component(s,i)})}},YM=Object.freeze(Object.defineProperty({__proto__:null,LumenAlert:kl,LumenApp:yl,LumenAvatarEditor:ia,LumenBunnyFontPicker:ca,LumenButton:De,LumenCard:Ui,LumenCheckboxGroup:ga,LumenCodeBlock:ka,LumenColorPicker:aa,LumenDateTimePicker:zo,LumenDivider:Dt,LumenHero:da,LumenInput:uo,LumenLevelProgress:sa,LumenLink:oa,LumenLoader:Fi,LumenMegaMenu:ya,LumenModal:la,LumenPill:va,LumenRadioGroup:ma,LumenScrollSpy:ba,LumenSlider:pa,LumenTable:ua,LumenTabs:Tr,LumenThemeToggle:ha,LumenToggle:ra,LumenTooltip:vn,default:Zf},Symbol.toStringTag,{value:"Module"}));exports.CompoundLumenButton=gn;exports.LumenAlert=kl;exports.LumenApp=yl;exports.LumenBunnyFontPicker=ca;exports.LumenCard=Ui;exports.LumenCheckboxGroup=ga;exports.LumenCodeBlock=ka;exports.LumenDateTimePicker=zo;exports.LumenDivider=Dt;exports.LumenHero=da;exports.LumenInput=uo;exports.LumenLevelProgress=sa;exports.LumenLink=oa;exports.LumenLoader=Fi;exports.LumenMegaMenu=ya;exports.LumenMegaMenuGroup=vl;exports.LumenMegaMenuItem=ml;exports.LumenMegaMenuPanel=gl;exports.LumenModal=la;exports.LumenPill=va;exports.LumenRadioGroup=ma;exports.LumenScrollSpy=ba;exports.LumenSlider=pa;exports.LumenTable=ua;exports.LumenTabs=Tr;exports.LumenThemeToggle=ha;exports.LumenToggle=ra;exports.LumenTooltip=vn;exports.LumenUIPlugin=Zf;exports.LumenUIPlugin$1=YM;exports._sfc_main=ia;exports._sfc_main$1=aa;exports.tailwindColors=Rf;exports.useDarkMode=Pf;exports.useFloatingPosition=Mr;exports.useGlobalDarkMode=Hf;exports.useGlobalModalStack=Lw;exports.useModalStack=Vf;exports.useModalTeleport=Iw;exports.useTheme=_f;
|