@veevarts/design-system 1.0.0-alpha.12 → 1.0.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,20 +1,20 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),A=require("@heroui/react"),k=require("react"),S=require("lucide-react"),Re=require("framer-motion"),an=require("@tiptap/react"),b=require("@tiptap/core"),Is=require("@tiptap/extension-underline"),Os=require("@tiptap/extension-color"),Ds=require("@tiptap/extension-highlight"),Ls=require("@tiptap/extension-link"),Rs=require("@tiptap/extension-task-list"),Ps=require("@tiptap/extension-task-item"),js=require("@tiptap/extension-text-align"),Kt={brand:{primary:{50:"#fef5f1",100:"#fde8e0",200:"#fbd5c7",300:"#f7b79f",400:"#f18d68",500:"#C14615",600:"#a83b11",700:"#8b2f0e",800:"#73260d",900:"#5f210c",DEFAULT:"#C14615"}},semantic:{secondary:"#000000",success:"#057A54",warning:"#F5A524",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",black:"#000000",gray:{50:"#F9FAFB",100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",600:"#4B5563",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{secondary:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#000000",600:"#000000",700:"#000000",800:"#000000",900:"#000000",DEFAULT:"#000000"},danger:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#B62214",600:"#a31e12",700:"#8b1a0f",800:"#73160d",900:"#5c120a",DEFAULT:"#B62214"},success:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#057A54",600:"#046c4a",700:"#035e40",800:"#025035",900:"#01422b",DEFAULT:"#057A54"},warning:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#F5A524",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",DEFAULT:"#F5A524"}}},Fs={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem","4xl":"6rem","5xl":"8rem"},zs={fontFamily:{primary:'"NeueMontreal", system-ui, sans-serif',secondary:'"Scholar", Georgia, serif',sans:'"NeueMontreal", system-ui, sans-serif',serif:'"Scholar", Georgia, serif',mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem"},fontWeight:{normal:"400",semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5",relaxed:"1.75"}},Bs={colors:{primary:{50:"#fef5f1",100:"#fde8e0",200:"#fbd5c7",300:"#f7b79f",400:"#f18d68",500:Kt.brand.primary,600:"#a83b11",700:"#8b2f0e",800:"#73260d",900:"#5f210c",DEFAULT:Kt.brand.primary},secondary:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#000000",600:"#000000",700:"#000000",800:"#000000",900:"#000000",DEFAULT:"#000000"}}};function Hs({children:n}){return d.jsx(A.HeroUIProvider,{children:n})}function Z({color:n="primary",radius:e="full",...t}){return d.jsx(A.Button,{color:n,radius:e,...t})}function $s(n,e){const t=n.icons,r=n.aliases||Object.create(null),s=Object.create(null);function i(o){if(t[o])return s[o]=[];if(!(o in s)){s[o]=null;const l=r[o]&&r[o].parent,a=l&&i(l);a&&(s[o]=[l].concat(a))}return s[o]}return Object.keys(t).concat(Object.keys(r)).forEach(i),s}const xr=Object.freeze({left:0,top:0,width:16,height:16}),ot=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),cn=Object.freeze({...xr,...ot}),Jt=Object.freeze({...cn,body:"",hidden:!1});function Vs(n,e){const t={};!n.hFlip!=!e.hFlip&&(t.hFlip=!0),!n.vFlip!=!e.vFlip&&(t.vFlip=!0);const r=((n.rotate||0)+(e.rotate||0))%4;return r&&(t.rotate=r),t}function Mn(n,e){const t=Vs(n,e);for(const r in Jt)r in ot?r in n&&!(r in t)&&(t[r]=ot[r]):r in e?t[r]=e[r]:r in n&&(t[r]=n[r]);return t}function qs(n,e,t){const r=n.icons,s=n.aliases||Object.create(null);let i={};function o(l){i=Mn(r[l]||s[l],i)}return o(e),t.forEach(o),Mn(n,i)}function br(n,e){const t=[];if(typeof n!="object"||typeof n.icons!="object")return t;n.not_found instanceof Array&&n.not_found.forEach(s=>{e(s,null),t.push(s)});const r=$s(n);for(const s in r){const i=r[s];i&&(e(s,qs(n,s,i)),t.push(s))}return t}const Ks={provider:"",aliases:{},not_found:{},...xr};function wt(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function kr(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!wt(n,Ks))return null;const t=e.icons;for(const s in t){const i=t[s];if(!s||typeof i.body!="string"||!wt(i,Jt))return null}const r=e.aliases||Object.create(null);for(const s in r){const i=r[s],o=i.parent;if(!s||typeof o!="string"||!t[o]&&!r[o]||!wt(i,Jt))return null}return e}const wn=Object.create(null);function Js(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function Ie(n,e){const t=wn[n]||(wn[n]=Object.create(null));return t[e]||(t[e]=Js(n,e))}function Sr(n,e){return kr(e)?br(e,(t,r)=>{r?n.icons[t]=r:n.missing.add(t)}):[]}function Us(n,e,t){try{if(typeof t.body=="string")return n.icons[e]={...t},!0}catch{}return!1}const Cr=/^[a-z0-9]+(-[a-z0-9]+)*$/,yt=(n,e,t,r="")=>{const s=n.split(":");if(n.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const l=s.pop(),a=s.pop(),c={provider:s.length>0?s[0]:r,prefix:a,name:l};return e&&!tt(c)?null:c}const i=s[0],o=i.split("-");if(o.length>1){const l={provider:r,prefix:o.shift(),name:o.join("-")};return e&&!tt(l)?null:l}if(t&&r===""){const l={provider:r,prefix:"",name:i};return e&&!tt(l,t)?null:l}return null},tt=(n,e)=>n?!!((e&&n.prefix===""||n.prefix)&&n.name):!1;let He=!1;function Ar(n){return typeof n=="boolean"&&(He=n),He}function Nn(n){const e=typeof n=="string"?yt(n,!0,He):n;if(e){const t=Ie(e.provider,e.prefix),r=e.name;return t.icons[r]||(t.missing.has(r)?null:void 0)}}function Ws(n,e){const t=yt(n,!0,He);if(!t)return!1;const r=Ie(t.provider,t.prefix);return e?Us(r,t.name,e):(r.missing.add(t.name),!0)}function _s(n,e){if(typeof n!="object")return!1;if(typeof e!="string"&&(e=n.provider||""),He&&!e&&!n.prefix){let s=!1;return kr(n)&&(n.prefix="",br(n,(i,o)=>{Ws(i,o)&&(s=!0)})),s}const t=n.prefix;if(!tt({prefix:t,name:"a"}))return!1;const r=Ie(e,t);return!!Sr(r,n)}const Tr=Object.freeze({width:null,height:null}),Er=Object.freeze({...Tr,...ot}),Gs=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Zs=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function In(n,e,t){if(e===1)return n;if(t=t||100,typeof n=="number")return Math.ceil(n*e*t)/t;if(typeof n!="string")return n;const r=n.split(Gs);if(r===null||!r.length)return n;const s=[];let i=r.shift(),o=Zs.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?s.push(i):s.push(Math.ceil(l*e*t)/t)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");o=!o}}function Xs(n,e="defs"){let t="";const r=n.indexOf("<"+e);for(;r>=0;){const s=n.indexOf(">",r),i=n.indexOf("</"+e);if(s===-1||i===-1)break;const o=n.indexOf(">",i);if(o===-1)break;t+=n.slice(s+1,i).trim(),n=n.slice(0,r).trim()+n.slice(o+1)}return{defs:t,content:n}}function Qs(n,e){return n?"<defs>"+n+"</defs>"+e:e}function Ys(n,e,t){const r=Xs(n);return Qs(r.defs,e+r.content+t)}const ei=n=>n==="unset"||n==="undefined"||n==="none";function ti(n,e){const t={...cn,...n},r={...Er,...e},s={left:t.left,top:t.top,width:t.width,height:t.height};let i=t.body;[t,r].forEach(m=>{const g=[],x=m.hFlip,w=m.vFlip;let N=m.rotate;x?w?N+=2:(g.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),g.push("scale(-1 1)"),s.top=s.left=0):w&&(g.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),g.push("scale(1 -1)"),s.top=s.left=0);let O;switch(N<0&&(N-=Math.floor(N/4)*4),N=N%4,N){case 1:O=s.height/2+s.top,g.unshift("rotate(90 "+O.toString()+" "+O.toString()+")");break;case 2:g.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:O=s.width/2+s.left,g.unshift("rotate(-90 "+O.toString()+" "+O.toString()+")");break}N%2===1&&(s.left!==s.top&&(O=s.left,s.left=s.top,s.top=O),s.width!==s.height&&(O=s.width,s.width=s.height,s.height=O)),g.length&&(i=Ys(i,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=r.width,l=r.height,a=s.width,c=s.height;let u,f;o===null?(f=l===null?"1em":l==="auto"?c:l,u=In(f,a/c)):(u=o==="auto"?a:o,f=l===null?In(u,c/a):l==="auto"?c:l);const h={},p=(m,g)=>{ei(g)||(h[m]=g.toString())};p("width",u),p("height",f);const y=[s.left,s.top,a,c];return h.viewBox=y.join(" "),{attributes:h,viewBox:y,body:i}}const ni=/\sid="(\S+)"/g,ri="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let si=0;function ii(n,e=ri){const t=[];let r;for(;r=ni.exec(n);)t.push(r[1]);if(!t.length)return n;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(i=>{const o=typeof e=="function"?e(i):e+(si++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+s+"$3")}),n=n.replace(new RegExp(s,"g"),""),n}const Ut=Object.create(null);function oi(n,e){Ut[n]=e}function Wt(n){return Ut[n]||Ut[""]}function un(n){let e;if(typeof n.resources=="string")e=[n.resources];else if(e=n.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:n.path||"/",maxURL:n.maxURL||500,rotate:n.rotate||750,timeout:n.timeout||5e3,random:n.random===!0,index:n.index||0,dataAfterTimeout:n.dataAfterTimeout!==!1}}const fn=Object.create(null),Oe=["https://api.simplesvg.com","https://api.unisvg.com"],nt=[];for(;Oe.length>0;)Oe.length===1||Math.random()>.5?nt.push(Oe.shift()):nt.push(Oe.pop());fn[""]=un({resources:["https://api.iconify.design"].concat(nt)});function li(n,e){const t=un(e);return t===null?!1:(fn[n]=t,!0)}function dn(n){return fn[n]}const ai=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let On=ai();function ci(n,e){const t=dn(n);if(!t)return 0;let r;if(!t.maxURL)r=0;else{let s=0;t.resources.forEach(o=>{s=Math.max(s,o.length)});const i=e+".json?icons=";r=t.maxURL-s-t.path.length-i.length}return r}function ui(n){return n===404}const fi=(n,e,t)=>{const r=[],s=ci(n,e),i="icons";let o={type:i,provider:n,prefix:e,icons:[]},l=0;return t.forEach((a,c)=>{l+=a.length+1,l>=s&&c>0&&(r.push(o),o={type:i,provider:n,prefix:e,icons:[]},l=a.length),o.icons.push(a)}),r.push(o),r};function di(n){if(typeof n=="string"){const e=dn(n);if(e)return e.path}return"/"}const hi=(n,e,t)=>{if(!On){t("abort",424);return}let r=di(e.provider);switch(e.type){case"icons":{const i=e.prefix,l=e.icons.join(","),a=new URLSearchParams({icons:l});r+=i+".json?"+a.toString();break}case"custom":{const i=e.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:t("abort",400);return}let s=503;On(n+r).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{t(ui(o)?"abort":"next",o)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?t("abort",i):t("next",s)});return}setTimeout(()=>{t("success",i)})}).catch(()=>{t("next",s)})},pi={prepare:fi,send:hi};function vr(n,e){n.forEach(t=>{const r=t.loaderCallbacks;r&&(t.loaderCallbacks=r.filter(s=>s.id!==e))})}function mi(n){n.pendingCallbacksFlag||(n.pendingCallbacksFlag=!0,setTimeout(()=>{n.pendingCallbacksFlag=!1;const e=n.loaderCallbacks?n.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const r=n.provider,s=n.prefix;e.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(a=>{if(a.prefix!==s)return!0;const c=a.name;if(n.icons[c])o.loaded.push({provider:r,prefix:s,name:c});else if(n.missing.has(c))o.missing.push({provider:r,prefix:s,name:c});else return t=!0,!0;return!1}),o.pending.length!==l&&(t||vr([n],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let gi=0;function yi(n,e,t){const r=gi++,s=vr.bind(null,t,r);if(!e.pending.length)return s;const i={id:r,icons:e,callback:n,abort:s};return t.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),s}function xi(n){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);n.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return n.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,o=s.prefix,l=s.name,a=t[i]||(t[i]=Object.create(null)),c=a[o]||(a[o]=Ie(i,o));let u;l in c.icons?u=e.loaded:o===""||c.missing.has(l)?u=e.missing:u=e.pending;const f={provider:i,prefix:o,name:l};u.push(f)}),e}function bi(n,e=!0,t=!1){const r=[];return n.forEach(s=>{const i=typeof s=="string"?yt(s,e,t):s;i&&r.push(i)}),r}const ki={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Si(n,e,t,r){const s=n.resources.length,i=n.random?Math.floor(Math.random()*s):n.index;let o;if(n.random){let T=n.resources.slice(0);for(o=[];T.length>1;){const C=Math.floor(Math.random()*T.length);o.push(T[C]),T=T.slice(0,C).concat(T.slice(C+1))}o=o.concat(T)}else o=n.resources.slice(i).concat(n.resources.slice(0,i));const l=Date.now();let a="pending",c=0,u,f=null,h=[],p=[];typeof r=="function"&&p.push(r);function y(){f&&(clearTimeout(f),f=null)}function m(){a==="pending"&&(a="aborted"),y(),h.forEach(T=>{T.status==="pending"&&(T.status="aborted")}),h=[]}function g(T,C){C&&(p=[]),typeof T=="function"&&p.push(T)}function x(){return{startTime:l,payload:e,status:a,queriesSent:c,queriesPending:h.length,subscribe:g,abort:m}}function w(){a="failed",p.forEach(T=>{T(void 0,u)})}function N(){h.forEach(T=>{T.status==="pending"&&(T.status="aborted")}),h=[]}function O(T,C,V){const U=C!=="success";switch(h=h.filter(W=>W!==T),a){case"pending":break;case"failed":if(U||!n.dataAfterTimeout)return;break;default:return}if(C==="abort"){u=V,w();return}if(U){u=V,h.length||(o.length?P():w());return}if(y(),N(),!n.random){const W=n.resources.indexOf(T.resource);W!==-1&&W!==n.index&&(n.index=W)}a="completed",p.forEach(W=>{W(V)})}function P(){if(a!=="pending")return;y();const T=o.shift();if(T===void 0){if(h.length){f=setTimeout(()=>{y(),a==="pending"&&(N(),w())},n.timeout);return}w();return}const C={status:"pending",resource:T,callback:(V,U)=>{O(C,V,U)}};h.push(C),c++,f=setTimeout(P,n.rotate),t(T,e,C.callback)}return setTimeout(P),x}function Mr(n){const e={...ki,...n};let t=[];function r(){t=t.filter(l=>l().status==="pending")}function s(l,a,c){const u=Si(e,l,a,(f,h)=>{r(),c&&c(f,h)});return t.push(u),u}function i(l){return t.find(a=>l(a))||null}return{query:s,find:i,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:r}}function Dn(){}const Nt=Object.create(null);function Ci(n){if(!Nt[n]){const e=dn(n);if(!e)return;const t=Mr(e),r={config:e,redundancy:t};Nt[n]=r}return Nt[n]}function Ai(n,e,t){let r,s;if(typeof n=="string"){const i=Wt(n);if(!i)return t(void 0,424),Dn;s=i.send;const o=Ci(n);o&&(r=o.redundancy)}else{const i=un(n);if(i){r=Mr(i);const o=n.resources?n.resources[0]:"",l=Wt(o);l&&(s=l.send)}}return!r||!s?(t(void 0,424),Dn):r.query(e,s,t)().abort}function Ln(){}function Ti(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,mi(n)}))}function Ei(n){const e=[],t=[];return n.forEach(r=>{(r.match(Cr)?e:t).push(r)}),{valid:e,invalid:t}}function De(n,e,t){function r(){const s=n.pendingIcons;e.forEach(i=>{s&&s.delete(i),n.icons[i]||n.missing.add(i)})}if(t&&typeof t=="object")try{if(!Sr(n,t).length){r();return}}catch(s){console.error(s)}r(),Ti(n)}function Rn(n,e){n instanceof Promise?n.then(t=>{e(t)}).catch(()=>{e(null)}):e(n)}function vi(n,e){n.iconsToLoad?n.iconsToLoad=n.iconsToLoad.concat(e).sort():n.iconsToLoad=e,n.iconsQueueFlag||(n.iconsQueueFlag=!0,setTimeout(()=>{n.iconsQueueFlag=!1;const{provider:t,prefix:r}=n,s=n.iconsToLoad;if(delete n.iconsToLoad,!s||!s.length)return;const i=n.loadIcon;if(n.loadIcons&&(s.length>1||!i)){Rn(n.loadIcons(s,r,t),u=>{De(n,s,u)});return}if(i){s.forEach(u=>{const f=i(u,r,t);Rn(f,h=>{const p=h?{prefix:r,icons:{[u]:h}}:null;De(n,[u],p)})});return}const{valid:o,invalid:l}=Ei(s);if(l.length&&De(n,l,null),!o.length)return;const a=r.match(Cr)?Wt(t):null;if(!a){De(n,o,null);return}a.prepare(t,r,o).forEach(u=>{Ai(t,u,f=>{De(n,u.icons,f)})})}))}const Mi=(n,e)=>{const t=bi(n,!0,Ar()),r=xi(t);if(!r.pending.length){let a=!0;return e&&setTimeout(()=>{a&&e(r.loaded,r.missing,r.pending,Ln)}),()=>{a=!1}}const s=Object.create(null),i=[];let o,l;return r.pending.forEach(a=>{const{provider:c,prefix:u}=a;if(u===l&&c===o)return;o=c,l=u,i.push(Ie(c,u));const f=s[c]||(s[c]=Object.create(null));f[u]||(f[u]=[])}),r.pending.forEach(a=>{const{provider:c,prefix:u,name:f}=a,h=Ie(c,u),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(f)||(p.add(f),s[c][u].push(f))}),i.forEach(a=>{const c=s[a.provider][a.prefix];c.length&&vi(a,c)}),e?yi(e,r,i):Ln};function wi(n,e){const t={...n};for(const r in e){const s=e[r],i=typeof s;r in Tr?(s===null||s&&(i==="string"||i==="number"))&&(t[r]=s):i===typeof t[r]&&(t[r]=r==="rotate"?s%4:s)}return t}const Ni=/[\s,]+/;function Ii(n,e){e.split(Ni).forEach(t=>{switch(t.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0;break}})}function Oi(n,e=0){const t=n.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(t===""){const s=parseInt(n);return isNaN(s)?0:r(s)}else if(t!==n){let s=0;switch(t){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(n.slice(0,n.length-t.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return e}function Di(n,e){let t=n.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)t+=" "+r+'="'+e[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+t+">"+n+"</svg>"}function Li(n){return n.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Ri(n){return"data:image/svg+xml,"+Li(n)}function Pi(n){return'url("'+Ri(n)+'")'}let je;function ji(){try{je=window.trustedTypes.createPolicy("iconify",{createHTML:n=>n})}catch{je=null}}function Fi(n){return je===void 0&&ji(),je?je.createHTML(n):n}const wr={...Er,inline:!1},zi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Bi={display:"inline-block"},_t={backgroundColor:"currentColor"},Nr={backgroundColor:"transparent"},Pn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:_t,mask:_t,background:Nr};for(const n in jn){const e=jn[n];for(const t in Pn)e[n+t]=Pn[t]}const Hi={...wr,inline:!0};function Fn(n){return n+(n.match(/^[-0-9.]+$/)?"px":"")}const $i=(n,e,t)=>{const r=e.inline?Hi:wr,s=wi(r,e),i=e.mode||"svg",o={},l=e.style||{},a={...i==="svg"?zi:{}};if(t){const g=yt(t,!1,!0);if(g){const x=["iconify"],w=["provider","prefix"];for(const N of w)g[N]&&x.push("iconify--"+g[N]);a.className=x.join(" ")}}for(let g in e){const x=e[g];if(x!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":a.ref=x;break;case"className":a[g]=(a[g]?a[g]+" ":"")+x;break;case"inline":case"hFlip":case"vFlip":s[g]=x===!0||x==="true"||x===1;break;case"flip":typeof x=="string"&&Ii(s,x);break;case"color":o.color=x;break;case"rotate":typeof x=="string"?s[g]=Oi(x):typeof x=="number"&&(s[g]=x);break;case"ariaHidden":case"aria-hidden":x!==!0&&x!=="true"&&delete a["aria-hidden"];break;default:r[g]===void 0&&(a[g]=x)}}const c=ti(n,s),u=c.attributes;if(s.inline&&(o.verticalAlign="-0.125em"),i==="svg"){a.style={...o,...l},Object.assign(a,u);let g=0,x=e.id;return typeof x=="string"&&(x=x.replace(/-/g,"_")),a.dangerouslySetInnerHTML={__html:Fi(ii(c.body,x?()=>x+"ID"+g++:"iconifyReact"))},k.createElement("svg",a)}const{body:f,width:h,height:p}=n,y=i==="mask"||(i==="bg"?!1:f.indexOf("currentColor")!==-1),m=Di(f,{...u,width:h+"",height:p+""});return a.style={...o,"--svg":Pi(m),width:Fn(u.width),height:Fn(u.height),...Bi,...y?_t:Nr,...l},k.createElement("span",a)};Ar(!0);oi("",pi);if(typeof document<"u"&&typeof window<"u"){const n=window;if(n.IconifyPreload!==void 0){const e=n.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!_s(r))&&console.error(t)}catch{console.error(t)}})}if(n.IconifyProviders!==void 0){const e=n.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const r="IconifyProviders["+t+"] is invalid.";try{const s=e[t];if(typeof s!="object"||!s||s.resources===void 0)continue;li(t,s)||console.error(r)}catch{console.error(r)}}}}function Ir(n){const[e,t]=k.useState(!!n.ssr),[r,s]=k.useState({});function i(p){if(p){const y=n.icon;if(typeof y=="object")return{name:"",data:y};const m=Nn(y);if(m)return{name:y,data:m}}return{name:""}}const[o,l]=k.useState(i(!!n.ssr));function a(){const p=r.callback;p&&(p(),s({}))}function c(p){if(JSON.stringify(o)!==JSON.stringify(p))return a(),l(p),!0}function u(){var p;const y=n.icon;if(typeof y=="object"){c({name:"",data:y});return}const m=Nn(y);if(c({name:y,data:m}))if(m===void 0){const g=Mi([y],u);s({callback:g})}else m&&((p=n.onLoad)===null||p===void 0||p.call(n,y))}k.useEffect(()=>(t(!0),a),[]),k.useEffect(()=>{e&&u()},[n.icon,e]);const{name:f,data:h}=o;return h?$i({...cn,...h},n,f):n.children?n.children:n.fallback?n.fallback:k.createElement("span",{})}k.forwardRef((n,e)=>Ir({...n,_ref:e}));k.forwardRef((n,e)=>Ir({inline:!0,...n,_ref:e}));const Vi={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function qi({languages:n,selectedLanguage:e,onLanguageChange:t,label:r}){return d.jsx("div",{className:"flex items-center",children:d.jsxs("div",{className:"relative flex items-center",children:[d.jsx(S.Globe,{className:"absolute left-3 w-5 h-5 pointer-events-none text-black"}),d.jsx(A.Select,{"data-testid":"language-select-desktop","aria-label":r,selectedKeys:e?[e]:[],onSelectionChange:s=>{const i=Array.from(s)[0]||e;t?.(i)},className:"min-w-40 hidden md:inline-flex",isDisabled:n.length===0,placeholder:r,startContent:d.jsx(S.Globe,{className:"w-5 h-5 text-black"}),children:n.map(s=>d.jsx(A.SelectItem,{textValue:s.label,"data-testid":`language-select-option-${s.code}`,children:s.label},s.code))}),d.jsx(A.Select,{"aria-label":r,"data-testid":"language-select-mobile",selectedKeys:e?[e]:[],onSelectionChange:s=>{const i=Array.from(s)[0]||e;t?.(i)},className:"min-w-20 inline-flex md:hidden",isDisabled:n.length===0,placeholder:e||"Language",children:n.map(s=>d.jsx(A.SelectItem,{className:"min-w-4",textValue:s.code.toUpperCase(),"data-testid":`language-select-option-mobile-${s.code}`,children:s.code.toUpperCase()},s.code))})]})})}function Ki({isLoggedIn:n,onLogin:e,onLogout:t,labels:r}){return n?d.jsxs(Z,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:t,children:[d.jsx(S.User,{className:"inline w-5 h-5"}),d.jsx("span",{className:"hidden md:inline",children:r.logout})]}):d.jsxs(Z,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:e,children:[d.jsx(S.User,{className:"inline w-5 h-5"}),d.jsx("span",{className:"hidden md:inline",children:r.login})]})}function Ji({logo:n,languages:e=[],selectedLanguage:t,onLanguageChange:r,isLoggedIn:s,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:a,labels:c={},className:u}){const f={...Vi,...c};return d.jsxs("nav",{"data-testid":"navbar",className:A.cn("w-full px-4 md:px-8 py-4 bg-white border-b border-zinc-100 flex items-center justify-between",u),children:[d.jsx("div",{className:"flex items-center min-w-10",children:n&&d.jsx("a",{href:"/",className:"block",children:d.jsx("img",{"data-testid":"navbar-logo",src:n,alt:"Logo",className:"h-8 max-w-28 md:max-w-40"})})}),d.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||e.length>0)&&d.jsx(qi,{languages:e,selectedLanguage:t,onLanguageChange:r,label:f.selectLanguage}),a&&d.jsx(Ki,{isLoggedIn:s,onLogin:i,onLogout:o,labels:f})]})]})}var It;const Ui=typeof document<"u"?(It=k.useInsertionEffect)!==null&&It!==void 0?It:k.useLayoutEffect:()=>{};function hn(n,e,t){let[r,s]=k.useState(n||e),i=k.useRef(r),o=k.useRef(n!==void 0),l=n!==void 0;k.useEffect(()=>{let f=o.current;f!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let a=l?n:r;Ui(()=>{i.current=a});let[,c]=k.useReducer(()=>({}),{}),u=k.useCallback((f,...h)=>{let p=typeof f=="function"?f(i.current):f;Object.is(i.current,p)||(i.current=p,s(p),c(),t?.(p,...h))},[t]);return[a,u]}function Wi(n){return d.jsx("svg",{...n,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:d.jsx(Re.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const Or=k.forwardRef(({color:n="primary",stepsCount:e=3,defaultStep:t=0,label:r,onStepChange:s,currentStep:i,hideProgressBars:o=!1,stepClassName:l,className:a,...c},u)=>{const[f,h]=hn(i,t,s),p=k.useMemo(()=>{let y,m;const g=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(n){case"primary":y="[--step-color:var(--heroui-primary)]",m="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":y="[--step-color:var(--heroui-secondary)]",m="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":y="[--step-color:var(--heroui-success)]",m="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":y="[--step-color:var(--heroui-warning)]",m="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":y="[--step-color:var(--heroui-danger)]",m="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":y="[--step-color:var(--heroui-default)]",m="[--step-fg-color:var(--heroui-default-foreground)]";break;default:y="[--step-color:var(--heroui-primary)]",m="[--step-fg-color:var(--heroui-primary-foreground)]";break}return g.unshift(m),g.unshift(y),g},[n]);return d.jsxs("nav",{ref:u,"aria-label":"Progress",className:A.cn("flex max-w-fit items-center overflow-x-auto",a),"data-testid":"stepper-root",...c,children:[r&&d.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light w-full me-3","data-testid":"stepper-label",children:r}),d.jsx("ol",{className:A.cn("flex flex-row flex-nowrap gap-x-3",p,a),"data-testid":"stepper-list",children:Array.from({length:e})?.map((y,m)=>{const g=f===m?"active":f<m?"inactive":"complete";return d.jsx("li",{className:"relative flex w-full items-center pr-12","data-testid":`stepper-step-${m}`,children:d.jsxs("button",{"aria-current":g==="active"?"step":void 0,className:A.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",l),onClick:()=>h(m),"data-testid":`stepper-step-btn-${m}`,children:[d.jsx("div",{className:"h-full relative flex items-center",children:d.jsx(Re.LazyMotion,{features:Re.domAnimation,children:d.jsx(Re.m.div,{animate:g,className:"relative",children:d.jsx(Re.m.div,{animate:g,className:A.cn("border-medium text-large text-default-foreground relative flex h-[26px] w-[26px] items-center justify-center rounded-full font-semibold",{"shadow-lg":g==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:d.jsx("div",{className:"flex items-center justify-center",children:g==="complete"?d.jsx(Wi,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${m}`}):d.jsx("span",{})})})})})}),m<e-1&&!o&&d.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 left-[26px] w-[calc(100%-13px)] flex-none items-center",style:{"--idx":m},children:d.jsx("div",{className:A.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":m<f})})})]},m)},m)})})]})});Or.displayName="Stepper";function _i(){return d.jsxs("footer",{"data-testid":"footer",className:"fixed left-0 bottom-0 w-full text-left p-4 bg-white font-inter font-light text-base text-zinc-500",children:["Powered by Veevart ® ",new Date().getFullYear()]})}function $e(n){return typeof n=="string"?n:n.type}function pe({className:n}){return d.jsx("div",{className:`flex items-center h-6 ${n||""}`,children:d.jsx(A.Divider,{orientation:"vertical"})})}function le({icon:n,label:e,isActive:t=!1,isDisabled:r=!1,onClick:s,shortcut:i,iconSize:o=16,className:l}){const a=i?`${e} (${i})`:e;return d.jsx(A.Tooltip,{content:a,children:d.jsx(Z,{size:"sm",radius:"sm",color:t?"primary":"default",variant:t?"solid":"bordered",isIconOnly:!0,isDisabled:r,onPress:s,"aria-label":e,className:l,children:d.jsx(n,{size:o})})})}const ie={bold:{execute:({editor:n})=>n.chain().focus().toggleBold().run(),canExecute:n=>n.can().chain().focus().toggleBold().run(),isActive:n=>n.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:n})=>n.chain().focus().toggleItalic().run(),canExecute:n=>n.can().chain().focus().toggleItalic().run(),isActive:n=>n.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:n})=>n.chain().focus().toggleStrike().run(),canExecute:n=>n.can().chain().focus().toggleStrike().run(),isActive:n=>n.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:n})=>n.chain().focus().toggleUnderline().run(),canExecute:n=>n.can().chain().focus().toggleUnderline().run(),isActive:n=>n.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:n})=>n.chain().focus().toggleCode().run(),canExecute:n=>n.can().chain().focus().toggleCode().run(),isActive:n=>n.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:n,config:e})=>{const t=e?.type==="textColor"?e.color:"";t?n.chain().focus().setColor(t).run():n.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:n=>n.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:n,config:e})=>{const t=e?.type==="highlight"?e.color:"";t?n.chain().focus().setHighlight({color:t}).run():n.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:n=>n.isActive("highlight"),label:"Highlight"},link:{execute:({editor:n,config:e})=>{const t=e?.type==="link"?e.href:"";if(t){const r=e?.type==="link"?e.target:void 0,s=e?.type==="link"?e.rel:void 0;n.chain().focus().setLink({href:t,target:r,rel:s}).run()}else n.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:n=>n.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:n})=>n.chain().focus().setParagraph().run(),canExecute:n=>n.can().chain().focus().setParagraph().run(),isActive:n=>n.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:n,config:e})=>{const t=e?.type==="heading"?e.level:1;n.chain().focus().toggleHeading({level:t}).run()},canExecute:(n,e)=>{const t=e?.type==="heading"?e.level:1;return n.can().chain().focus().toggleHeading({level:t}).run()},isActive:(n,e)=>e?.type==="heading"?n.isActive("heading",{level:e.level}):n.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:n})=>n.chain().focus().toggleBulletList().run(),canExecute:n=>n.can().chain().focus().toggleBulletList().run(),isActive:n=>n.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:n})=>n.chain().focus().toggleOrderedList().run(),canExecute:n=>n.can().chain().focus().toggleOrderedList().run(),isActive:n=>n.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:n})=>n.chain().focus().toggleTaskList().run(),canExecute:n=>n.can().chain().focus().toggleTaskList().run(),isActive:n=>n.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:n})=>n.chain().focus().toggleCodeBlock().run(),canExecute:n=>n.can().chain().focus().toggleCodeBlock().run(),isActive:n=>n.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:n})=>n.chain().focus().toggleBlockquote().run(),canExecute:n=>n.can().chain().focus().toggleBlockquote().run(),isActive:n=>n.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:n})=>n.chain().focus().setHorizontalRule().run(),canExecute:n=>n.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:n})=>n.chain().focus().setHardBreak().run(),canExecute:n=>n.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:n,config:e})=>{const t=e?.type==="textAlign"?e.alignment:"left";n.chain().focus().setTextAlign(t).run()},canExecute:()=>!0,isActive:(n,e)=>e?.type==="textAlign"?n.isActive({textAlign:e.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:n})=>n.chain().focus().unsetAllMarks().run(),canExecute:n=>n.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:n})=>n.chain().focus().clearNodes().run(),canExecute:n=>n.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:n})=>n.chain().focus().undo().run(),canExecute:n=>n.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:n})=>n.chain().focus().redo().run(),canExecute:n=>n.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Gi={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Zi({editor:n,levels:e=[1,2,3,4,5,6],isDisabled:t=!1}){const[,r]=k.useState(0);k.useEffect(()=>{const o=()=>r(l=>l+1);return n.on("selectionUpdate",o),n.on("transaction",o),()=>{n.off("selectionUpdate",o),n.off("transaction",o)}},[n]);const s=e.find(o=>n.isActive("heading",{level:o})),i=o=>{const l=Number(o),a=ie.heading;a&&a.execute({editor:n,config:{type:"heading",level:l}})};return d.jsxs(A.Dropdown,{children:[d.jsx(A.DropdownTrigger,{children:d.jsx(Z,{size:"sm",radius:"sm",variant:s?"solid":"bordered",color:s?"primary":"default",isDisabled:t,startContent:d.jsx(S.Heading,{size:16}),"aria-label":"Select heading level",children:s?`H${s}`:"H"})}),d.jsx(A.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:s?new Set([String(s)]):new Set,onAction:i,children:e.map(o=>d.jsx(A.DropdownItem,{startContent:n.isActive("heading",{level:o})?d.jsx(S.Check,{size:16}):d.jsx("div",{className:"w-4"}),children:Gi[o]},o))})]})}const Ot={bulletList:{label:"Bullet List",icon:S.List},orderedList:{label:"Numbered List",icon:S.ListOrdered},taskList:{label:"Task List",icon:S.ListTodo}};function Xi({editor:n,types:e=["bulletList","orderedList","taskList"],isDisabled:t=!1}){const[,r]=k.useState(0);k.useEffect(()=>{const l=()=>r(a=>a+1);return n.on("selectionUpdate",l),n.on("transaction",l),()=>{n.off("selectionUpdate",l),n.off("transaction",l)}},[n]);const s=e.find(l=>n.isActive(l)),i=s?Ot[s].icon:S.List,o=l=>{const c=ie[l];c&&c.execute({editor:n})};return d.jsxs(A.Dropdown,{children:[d.jsx(A.DropdownTrigger,{children:d.jsx(Z,{size:"sm",radius:"sm",variant:s?"solid":"bordered",color:s?"primary":"default",isDisabled:t,isIconOnly:!0,"aria-label":"Select list type",children:d.jsx(i,{size:16})})}),d.jsx(A.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:s?new Set([s]):new Set,onAction:o,children:e.map(l=>{const a=Ot[l].icon;return d.jsx(A.DropdownItem,{startContent:d.jsx(a,{size:16}),children:Ot[l].label},l)})})]})}function Qi({colors:n,selectedColor:e,onColorSelect:t,columns:r=4}){return d.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:n.map(s=>{const i=e===s;return d.jsx("button",{type:"button",onClick:()=>t(s),className:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),C=require("@heroui/react"),k=require("react"),S=require("lucide-react"),Re=require("framer-motion"),cn=require("@tiptap/react"),b=require("@tiptap/core"),Ds=require("@tiptap/extension-underline"),Ls=require("@tiptap/extension-color"),Rs=require("@tiptap/extension-highlight"),Ps=require("@tiptap/extension-link"),js=require("@tiptap/extension-task-list"),Fs=require("@tiptap/extension-task-item"),zs=require("@tiptap/extension-text-align"),Jt={brand:{primary:{50:"#fef5f1",100:"#fde8e0",200:"#fbd5c7",300:"#f7b79f",400:"#f18d68",500:"#C14615",600:"#a83b11",700:"#8b2f0e",800:"#73260d",900:"#5f210c",DEFAULT:"#C14615"}},semantic:{secondary:"#000000",success:"#057A54",warning:"#F5A524",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",black:"#000000",gray:{50:"#F9FAFB",100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",600:"#4B5563",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{secondary:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#000000",600:"#000000",700:"#000000",800:"#000000",900:"#000000",DEFAULT:"#000000"},danger:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#B62214",600:"#a31e12",700:"#8b1a0f",800:"#73160d",900:"#5c120a",DEFAULT:"#B62214"},success:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#057A54",600:"#046c4a",700:"#035e40",800:"#025035",900:"#01422b",DEFAULT:"#057A54"},warning:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#F5A524",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",DEFAULT:"#F5A524"}}},Bs={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem","4xl":"6rem","5xl":"8rem"},Hs={fontFamily:{primary:'"NeueMontreal", system-ui, sans-serif',secondary:'"Scholar", Georgia, serif',sans:'"NeueMontreal", system-ui, sans-serif',serif:'"Scholar", Georgia, serif',mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem"},fontWeight:{normal:"400",semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5",relaxed:"1.75"}},$s={colors:{primary:{50:"#fef5f1",100:"#fde8e0",200:"#fbd5c7",300:"#f7b79f",400:"#f18d68",500:Jt.brand.primary,600:"#a83b11",700:"#8b2f0e",800:"#73260d",900:"#5f210c",DEFAULT:Jt.brand.primary},secondary:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#000000",600:"#000000",700:"#000000",800:"#000000",900:"#000000",DEFAULT:"#000000"}}};function Vs({children:n}){return d.jsx(C.HeroUIProvider,{children:n})}function J({color:n="primary",radius:e="full",...t}){return d.jsx(C.Button,{color:n,radius:e,...t})}function qs(n,e){const t=n.icons,r=n.aliases||Object.create(null),s=Object.create(null);function i(o){if(t[o])return s[o]=[];if(!(o in s)){s[o]=null;const l=r[o]&&r[o].parent,a=l&&i(l);a&&(s[o]=[l].concat(a))}return s[o]}return Object.keys(t).concat(Object.keys(r)).forEach(i),s}const br=Object.freeze({left:0,top:0,width:16,height:16}),ot=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),un=Object.freeze({...br,...ot}),Ut=Object.freeze({...un,body:"",hidden:!1});function Ks(n,e){const t={};!n.hFlip!=!e.hFlip&&(t.hFlip=!0),!n.vFlip!=!e.vFlip&&(t.vFlip=!0);const r=((n.rotate||0)+(e.rotate||0))%4;return r&&(t.rotate=r),t}function Mn(n,e){const t=Ks(n,e);for(const r in Ut)r in ot?r in n&&!(r in t)&&(t[r]=ot[r]):r in e?t[r]=e[r]:r in n&&(t[r]=n[r]);return t}function Js(n,e,t){const r=n.icons,s=n.aliases||Object.create(null);let i={};function o(l){i=Mn(r[l]||s[l],i)}return o(e),t.forEach(o),Mn(n,i)}function kr(n,e){const t=[];if(typeof n!="object"||typeof n.icons!="object")return t;n.not_found instanceof Array&&n.not_found.forEach(s=>{e(s,null),t.push(s)});const r=qs(n);for(const s in r){const i=r[s];i&&(e(s,Js(n,s,i)),t.push(s))}return t}const Us={provider:"",aliases:{},not_found:{},...br};function Mt(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function Cr(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!Mt(n,Us))return null;const t=e.icons;for(const s in t){const i=t[s];if(!s||typeof i.body!="string"||!Mt(i,Ut))return null}const r=e.aliases||Object.create(null);for(const s in r){const i=r[s],o=i.parent;if(!s||typeof o!="string"||!t[o]&&!r[o]||!Mt(i,Ut))return null}return e}const Nn=Object.create(null);function Ws(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function Ie(n,e){const t=Nn[n]||(Nn[n]=Object.create(null));return t[e]||(t[e]=Ws(n,e))}function Sr(n,e){return Cr(e)?kr(e,(t,r)=>{r?n.icons[t]=r:n.missing.add(t)}):[]}function _s(n,e,t){try{if(typeof t.body=="string")return n.icons[e]={...t},!0}catch{}return!1}const Ar=/^[a-z0-9]+(-[a-z0-9]+)*$/,yt=(n,e,t,r="")=>{const s=n.split(":");if(n.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const l=s.pop(),a=s.pop(),c={provider:s.length>0?s[0]:r,prefix:a,name:l};return e&&!tt(c)?null:c}const i=s[0],o=i.split("-");if(o.length>1){const l={provider:r,prefix:o.shift(),name:o.join("-")};return e&&!tt(l)?null:l}if(t&&r===""){const l={provider:r,prefix:"",name:i};return e&&!tt(l,t)?null:l}return null},tt=(n,e)=>n?!!((e&&n.prefix===""||n.prefix)&&n.name):!1;let He=!1;function Tr(n){return typeof n=="boolean"&&(He=n),He}function In(n){const e=typeof n=="string"?yt(n,!0,He):n;if(e){const t=Ie(e.provider,e.prefix),r=e.name;return t.icons[r]||(t.missing.has(r)?null:void 0)}}function Gs(n,e){const t=yt(n,!0,He);if(!t)return!1;const r=Ie(t.provider,t.prefix);return e?_s(r,t.name,e):(r.missing.add(t.name),!0)}function Zs(n,e){if(typeof n!="object")return!1;if(typeof e!="string"&&(e=n.provider||""),He&&!e&&!n.prefix){let s=!1;return Cr(n)&&(n.prefix="",kr(n,(i,o)=>{Gs(i,o)&&(s=!0)})),s}const t=n.prefix;if(!tt({prefix:t,name:"a"}))return!1;const r=Ie(e,t);return!!Sr(r,n)}const vr=Object.freeze({width:null,height:null}),wr=Object.freeze({...vr,...ot}),Xs=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Qs=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function On(n,e,t){if(e===1)return n;if(t=t||100,typeof n=="number")return Math.ceil(n*e*t)/t;if(typeof n!="string")return n;const r=n.split(Xs);if(r===null||!r.length)return n;const s=[];let i=r.shift(),o=Qs.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?s.push(i):s.push(Math.ceil(l*e*t)/t)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");o=!o}}function Ys(n,e="defs"){let t="";const r=n.indexOf("<"+e);for(;r>=0;){const s=n.indexOf(">",r),i=n.indexOf("</"+e);if(s===-1||i===-1)break;const o=n.indexOf(">",i);if(o===-1)break;t+=n.slice(s+1,i).trim(),n=n.slice(0,r).trim()+n.slice(o+1)}return{defs:t,content:n}}function ei(n,e){return n?"<defs>"+n+"</defs>"+e:e}function ti(n,e,t){const r=Ys(n);return ei(r.defs,e+r.content+t)}const ni=n=>n==="unset"||n==="undefined"||n==="none";function ri(n,e){const t={...un,...n},r={...wr,...e},s={left:t.left,top:t.top,width:t.width,height:t.height};let i=t.body;[t,r].forEach(m=>{const y=[],x=m.hFlip,M=m.vFlip;let N=m.rotate;x?M?N+=2:(y.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),y.push("scale(-1 1)"),s.top=s.left=0):M&&(y.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),y.push("scale(1 -1)"),s.top=s.left=0);let O;switch(N<0&&(N-=Math.floor(N/4)*4),N=N%4,N){case 1:O=s.height/2+s.top,y.unshift("rotate(90 "+O.toString()+" "+O.toString()+")");break;case 2:y.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:O=s.width/2+s.left,y.unshift("rotate(-90 "+O.toString()+" "+O.toString()+")");break}N%2===1&&(s.left!==s.top&&(O=s.left,s.left=s.top,s.top=O),s.width!==s.height&&(O=s.width,s.width=s.height,s.height=O)),y.length&&(i=ti(i,'<g transform="'+y.join(" ")+'">',"</g>"))});const o=r.width,l=r.height,a=s.width,c=s.height;let u,f;o===null?(f=l===null?"1em":l==="auto"?c:l,u=On(f,a/c)):(u=o==="auto"?a:o,f=l===null?On(u,c/a):l==="auto"?c:l);const h={},p=(m,y)=>{ni(y)||(h[m]=y.toString())};p("width",u),p("height",f);const g=[s.left,s.top,a,c];return h.viewBox=g.join(" "),{attributes:h,viewBox:g,body:i}}const si=/\sid="(\S+)"/g,ii="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let oi=0;function li(n,e=ii){const t=[];let r;for(;r=si.exec(n);)t.push(r[1]);if(!t.length)return n;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(i=>{const o=typeof e=="function"?e(i):e+(oi++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+s+"$3")}),n=n.replace(new RegExp(s,"g"),""),n}const Wt=Object.create(null);function ai(n,e){Wt[n]=e}function _t(n){return Wt[n]||Wt[""]}function fn(n){let e;if(typeof n.resources=="string")e=[n.resources];else if(e=n.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:n.path||"/",maxURL:n.maxURL||500,rotate:n.rotate||750,timeout:n.timeout||5e3,random:n.random===!0,index:n.index||0,dataAfterTimeout:n.dataAfterTimeout!==!1}}const dn=Object.create(null),Oe=["https://api.simplesvg.com","https://api.unisvg.com"],nt=[];for(;Oe.length>0;)Oe.length===1||Math.random()>.5?nt.push(Oe.shift()):nt.push(Oe.pop());dn[""]=fn({resources:["https://api.iconify.design"].concat(nt)});function ci(n,e){const t=fn(e);return t===null?!1:(dn[n]=t,!0)}function hn(n){return dn[n]}const ui=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let Dn=ui();function fi(n,e){const t=hn(n);if(!t)return 0;let r;if(!t.maxURL)r=0;else{let s=0;t.resources.forEach(o=>{s=Math.max(s,o.length)});const i=e+".json?icons=";r=t.maxURL-s-t.path.length-i.length}return r}function di(n){return n===404}const hi=(n,e,t)=>{const r=[],s=fi(n,e),i="icons";let o={type:i,provider:n,prefix:e,icons:[]},l=0;return t.forEach((a,c)=>{l+=a.length+1,l>=s&&c>0&&(r.push(o),o={type:i,provider:n,prefix:e,icons:[]},l=a.length),o.icons.push(a)}),r.push(o),r};function pi(n){if(typeof n=="string"){const e=hn(n);if(e)return e.path}return"/"}const mi=(n,e,t)=>{if(!Dn){t("abort",424);return}let r=pi(e.provider);switch(e.type){case"icons":{const i=e.prefix,l=e.icons.join(","),a=new URLSearchParams({icons:l});r+=i+".json?"+a.toString();break}case"custom":{const i=e.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:t("abort",400);return}let s=503;Dn(n+r).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{t(di(o)?"abort":"next",o)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?t("abort",i):t("next",s)});return}setTimeout(()=>{t("success",i)})}).catch(()=>{t("next",s)})},gi={prepare:hi,send:mi};function Er(n,e){n.forEach(t=>{const r=t.loaderCallbacks;r&&(t.loaderCallbacks=r.filter(s=>s.id!==e))})}function yi(n){n.pendingCallbacksFlag||(n.pendingCallbacksFlag=!0,setTimeout(()=>{n.pendingCallbacksFlag=!1;const e=n.loaderCallbacks?n.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const r=n.provider,s=n.prefix;e.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(a=>{if(a.prefix!==s)return!0;const c=a.name;if(n.icons[c])o.loaded.push({provider:r,prefix:s,name:c});else if(n.missing.has(c))o.missing.push({provider:r,prefix:s,name:c});else return t=!0,!0;return!1}),o.pending.length!==l&&(t||Er([n],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let xi=0;function bi(n,e,t){const r=xi++,s=Er.bind(null,t,r);if(!e.pending.length)return s;const i={id:r,icons:e,callback:n,abort:s};return t.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),s}function ki(n){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);n.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return n.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,o=s.prefix,l=s.name,a=t[i]||(t[i]=Object.create(null)),c=a[o]||(a[o]=Ie(i,o));let u;l in c.icons?u=e.loaded:o===""||c.missing.has(l)?u=e.missing:u=e.pending;const f={provider:i,prefix:o,name:l};u.push(f)}),e}function Ci(n,e=!0,t=!1){const r=[];return n.forEach(s=>{const i=typeof s=="string"?yt(s,e,t):s;i&&r.push(i)}),r}const Si={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ai(n,e,t,r){const s=n.resources.length,i=n.random?Math.floor(Math.random()*s):n.index;let o;if(n.random){let T=n.resources.slice(0);for(o=[];T.length>1;){const A=Math.floor(Math.random()*T.length);o.push(T[A]),T=T.slice(0,A).concat(T.slice(A+1))}o=o.concat(T)}else o=n.resources.slice(i).concat(n.resources.slice(0,i));const l=Date.now();let a="pending",c=0,u,f=null,h=[],p=[];typeof r=="function"&&p.push(r);function g(){f&&(clearTimeout(f),f=null)}function m(){a==="pending"&&(a="aborted"),g(),h.forEach(T=>{T.status==="pending"&&(T.status="aborted")}),h=[]}function y(T,A){A&&(p=[]),typeof T=="function"&&p.push(T)}function x(){return{startTime:l,payload:e,status:a,queriesSent:c,queriesPending:h.length,subscribe:y,abort:m}}function M(){a="failed",p.forEach(T=>{T(void 0,u)})}function N(){h.forEach(T=>{T.status==="pending"&&(T.status="aborted")}),h=[]}function O(T,A,V){const W=A!=="success";switch(h=h.filter(_=>_!==T),a){case"pending":break;case"failed":if(W||!n.dataAfterTimeout)return;break;default:return}if(A==="abort"){u=V,M();return}if(W){u=V,h.length||(o.length?P():M());return}if(g(),N(),!n.random){const _=n.resources.indexOf(T.resource);_!==-1&&_!==n.index&&(n.index=_)}a="completed",p.forEach(_=>{_(V)})}function P(){if(a!=="pending")return;g();const T=o.shift();if(T===void 0){if(h.length){f=setTimeout(()=>{g(),a==="pending"&&(N(),M())},n.timeout);return}M();return}const A={status:"pending",resource:T,callback:(V,W)=>{O(A,V,W)}};h.push(A),c++,f=setTimeout(P,n.rotate),t(T,e,A.callback)}return setTimeout(P),x}function Mr(n){const e={...Si,...n};let t=[];function r(){t=t.filter(l=>l().status==="pending")}function s(l,a,c){const u=Ai(e,l,a,(f,h)=>{r(),c&&c(f,h)});return t.push(u),u}function i(l){return t.find(a=>l(a))||null}return{query:s,find:i,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:r}}function Ln(){}const Nt=Object.create(null);function Ti(n){if(!Nt[n]){const e=hn(n);if(!e)return;const t=Mr(e),r={config:e,redundancy:t};Nt[n]=r}return Nt[n]}function vi(n,e,t){let r,s;if(typeof n=="string"){const i=_t(n);if(!i)return t(void 0,424),Ln;s=i.send;const o=Ti(n);o&&(r=o.redundancy)}else{const i=fn(n);if(i){r=Mr(i);const o=n.resources?n.resources[0]:"",l=_t(o);l&&(s=l.send)}}return!r||!s?(t(void 0,424),Ln):r.query(e,s,t)().abort}function Rn(){}function wi(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,yi(n)}))}function Ei(n){const e=[],t=[];return n.forEach(r=>{(r.match(Ar)?e:t).push(r)}),{valid:e,invalid:t}}function De(n,e,t){function r(){const s=n.pendingIcons;e.forEach(i=>{s&&s.delete(i),n.icons[i]||n.missing.add(i)})}if(t&&typeof t=="object")try{if(!Sr(n,t).length){r();return}}catch(s){console.error(s)}r(),wi(n)}function Pn(n,e){n instanceof Promise?n.then(t=>{e(t)}).catch(()=>{e(null)}):e(n)}function Mi(n,e){n.iconsToLoad?n.iconsToLoad=n.iconsToLoad.concat(e).sort():n.iconsToLoad=e,n.iconsQueueFlag||(n.iconsQueueFlag=!0,setTimeout(()=>{n.iconsQueueFlag=!1;const{provider:t,prefix:r}=n,s=n.iconsToLoad;if(delete n.iconsToLoad,!s||!s.length)return;const i=n.loadIcon;if(n.loadIcons&&(s.length>1||!i)){Pn(n.loadIcons(s,r,t),u=>{De(n,s,u)});return}if(i){s.forEach(u=>{const f=i(u,r,t);Pn(f,h=>{const p=h?{prefix:r,icons:{[u]:h}}:null;De(n,[u],p)})});return}const{valid:o,invalid:l}=Ei(s);if(l.length&&De(n,l,null),!o.length)return;const a=r.match(Ar)?_t(t):null;if(!a){De(n,o,null);return}a.prepare(t,r,o).forEach(u=>{vi(t,u,f=>{De(n,u.icons,f)})})}))}const Ni=(n,e)=>{const t=Ci(n,!0,Tr()),r=ki(t);if(!r.pending.length){let a=!0;return e&&setTimeout(()=>{a&&e(r.loaded,r.missing,r.pending,Rn)}),()=>{a=!1}}const s=Object.create(null),i=[];let o,l;return r.pending.forEach(a=>{const{provider:c,prefix:u}=a;if(u===l&&c===o)return;o=c,l=u,i.push(Ie(c,u));const f=s[c]||(s[c]=Object.create(null));f[u]||(f[u]=[])}),r.pending.forEach(a=>{const{provider:c,prefix:u,name:f}=a,h=Ie(c,u),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(f)||(p.add(f),s[c][u].push(f))}),i.forEach(a=>{const c=s[a.provider][a.prefix];c.length&&Mi(a,c)}),e?bi(e,r,i):Rn};function Ii(n,e){const t={...n};for(const r in e){const s=e[r],i=typeof s;r in vr?(s===null||s&&(i==="string"||i==="number"))&&(t[r]=s):i===typeof t[r]&&(t[r]=r==="rotate"?s%4:s)}return t}const Oi=/[\s,]+/;function Di(n,e){e.split(Oi).forEach(t=>{switch(t.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0;break}})}function Li(n,e=0){const t=n.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(t===""){const s=parseInt(n);return isNaN(s)?0:r(s)}else if(t!==n){let s=0;switch(t){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(n.slice(0,n.length-t.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return e}function Ri(n,e){let t=n.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)t+=" "+r+'="'+e[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+t+">"+n+"</svg>"}function Pi(n){return n.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ji(n){return"data:image/svg+xml,"+Pi(n)}function Fi(n){return'url("'+ji(n)+'")'}let je;function zi(){try{je=window.trustedTypes.createPolicy("iconify",{createHTML:n=>n})}catch{je=null}}function Bi(n){return je===void 0&&zi(),je?je.createHTML(n):n}const Nr={...wr,inline:!1},Hi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},$i={display:"inline-block"},Gt={backgroundColor:"currentColor"},Ir={backgroundColor:"transparent"},jn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Fn={WebkitMask:Gt,mask:Gt,background:Ir};for(const n in Fn){const e=Fn[n];for(const t in jn)e[n+t]=jn[t]}const Vi={...Nr,inline:!0};function zn(n){return n+(n.match(/^[-0-9.]+$/)?"px":"")}const qi=(n,e,t)=>{const r=e.inline?Vi:Nr,s=Ii(r,e),i=e.mode||"svg",o={},l=e.style||{},a={...i==="svg"?Hi:{}};if(t){const y=yt(t,!1,!0);if(y){const x=["iconify"],M=["provider","prefix"];for(const N of M)y[N]&&x.push("iconify--"+y[N]);a.className=x.join(" ")}}for(let y in e){const x=e[y];if(x!==void 0)switch(y){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":a.ref=x;break;case"className":a[y]=(a[y]?a[y]+" ":"")+x;break;case"inline":case"hFlip":case"vFlip":s[y]=x===!0||x==="true"||x===1;break;case"flip":typeof x=="string"&&Di(s,x);break;case"color":o.color=x;break;case"rotate":typeof x=="string"?s[y]=Li(x):typeof x=="number"&&(s[y]=x);break;case"ariaHidden":case"aria-hidden":x!==!0&&x!=="true"&&delete a["aria-hidden"];break;default:r[y]===void 0&&(a[y]=x)}}const c=ri(n,s),u=c.attributes;if(s.inline&&(o.verticalAlign="-0.125em"),i==="svg"){a.style={...o,...l},Object.assign(a,u);let y=0,x=e.id;return typeof x=="string"&&(x=x.replace(/-/g,"_")),a.dangerouslySetInnerHTML={__html:Bi(li(c.body,x?()=>x+"ID"+y++:"iconifyReact"))},k.createElement("svg",a)}const{body:f,width:h,height:p}=n,g=i==="mask"||(i==="bg"?!1:f.indexOf("currentColor")!==-1),m=Ri(f,{...u,width:h+"",height:p+""});return a.style={...o,"--svg":Fi(m),width:zn(u.width),height:zn(u.height),...$i,...g?Gt:Ir,...l},k.createElement("span",a)};Tr(!0);ai("",gi);if(typeof document<"u"&&typeof window<"u"){const n=window;if(n.IconifyPreload!==void 0){const e=n.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Zs(r))&&console.error(t)}catch{console.error(t)}})}if(n.IconifyProviders!==void 0){const e=n.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const r="IconifyProviders["+t+"] is invalid.";try{const s=e[t];if(typeof s!="object"||!s||s.resources===void 0)continue;ci(t,s)||console.error(r)}catch{console.error(r)}}}}function Or(n){const[e,t]=k.useState(!!n.ssr),[r,s]=k.useState({});function i(p){if(p){const g=n.icon;if(typeof g=="object")return{name:"",data:g};const m=In(g);if(m)return{name:g,data:m}}return{name:""}}const[o,l]=k.useState(i(!!n.ssr));function a(){const p=r.callback;p&&(p(),s({}))}function c(p){if(JSON.stringify(o)!==JSON.stringify(p))return a(),l(p),!0}function u(){var p;const g=n.icon;if(typeof g=="object"){c({name:"",data:g});return}const m=In(g);if(c({name:g,data:m}))if(m===void 0){const y=Ni([g],u);s({callback:y})}else m&&((p=n.onLoad)===null||p===void 0||p.call(n,g))}k.useEffect(()=>(t(!0),a),[]),k.useEffect(()=>{e&&u()},[n.icon,e]);const{name:f,data:h}=o;return h?qi({...un,...h},n,f):n.children?n.children:n.fallback?n.fallback:k.createElement("span",{})}const Dr=k.forwardRef((n,e)=>Or({...n,_ref:e}));k.forwardRef((n,e)=>Or({inline:!0,...n,_ref:e}));const It=({icon:n,children:e,testId:t})=>d.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":t,children:[d.jsx(Dr,{icon:n,width:20,className:"text-default-500"}),d.jsx("span",{children:e})]}),Ki=({classes:n="",name:e,imageUrl:t,eventDate:r,eventTime:s,location:i,description:o,showImage:l=!1,showMoreButtonClassName:a,labels:c})=>{const[u,f]=k.useState(!1),[h,p]=k.useState(!1),g=k.useRef(null);return k.useEffect(()=>{const m=()=>{if(g.current){const y=g.current.scrollHeight>g.current.clientHeight;p(y)}};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[o]),d.jsxs(C.Card,{className:C.cn("border-0 shadow-none",n),"data-testid":"event-details-root",children:[d.jsxs(C.CardHeader,{className:"pt-2 pb-0 flex-col items-start space-y-2","data-testid":"event-details-header",children:[l&&t&&d.jsx("div",{className:"w-full aspect-[3/1] overflow-hidden rounded-xl","data-testid":"event-details-image-wrapper",children:d.jsx(C.Image,{alt:`Event image for ${e}`,className:"w-full h-full object-cover",src:t,"data-testid":"event-details-image"})}),d.jsx("h2",{className:"font-semibold text-xl text-gray-800","data-testid":"event-details-title",children:e})]}),d.jsxs(C.CardBody,{className:"py-3 space-y-3","data-testid":"event-details-body",children:[d.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:c.eventInformation}),d.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[r&&d.jsx(It,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:r}),s&&d.jsx(It,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:s}),i&&d.jsx(It,{icon:"solar:point-on-map-outline",testId:"event-details-location",children:i})]}),o&&d.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[d.jsx("p",{ref:g,className:C.cn("text-sm text-gray-700 leading-relaxed transition-all",!u&&"line-clamp-2"),"data-testid":"event-details-description",children:o}),(h||u)&&d.jsx("div",{className:"flex justify-end mt-1",children:d.jsx(J,{onPress:()=>f(!u),variant:"light",className:C.cn("text-primary",a),startContent:d.jsx(Dr,{icon:u?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:u?c.showLess||"Hide":c.showMore||"Show"})})]})]})]})},Ji={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Ui({languages:n,selectedLanguage:e,onLanguageChange:t,label:r}){return d.jsx("div",{className:"flex items-center",children:d.jsxs("div",{className:"relative flex items-center",children:[d.jsx(S.Globe,{className:"absolute left-3 w-5 h-5 pointer-events-none text-black"}),d.jsx(C.Select,{"data-testid":"language-select-desktop","aria-label":r,selectedKeys:e?[e]:[],onSelectionChange:s=>{const i=Array.from(s)[0]||e;t?.(i)},className:"min-w-40 hidden md:inline-flex",isDisabled:n.length===0,placeholder:r,startContent:d.jsx(S.Globe,{className:"w-5 h-5 text-black"}),children:n.map(s=>d.jsx(C.SelectItem,{textValue:s.label,"data-testid":`language-select-option-${s.code}`,children:s.label},s.code))}),d.jsx(C.Select,{"aria-label":r,"data-testid":"language-select-mobile",selectedKeys:e?[e]:[],onSelectionChange:s=>{const i=Array.from(s)[0]||e;t?.(i)},className:"min-w-20 inline-flex md:hidden",isDisabled:n.length===0,placeholder:e||"Language",children:n.map(s=>d.jsx(C.SelectItem,{className:"min-w-4",textValue:s.code.toUpperCase(),"data-testid":`language-select-option-mobile-${s.code}`,children:s.code.toUpperCase()},s.code))})]})})}function Wi({isLoggedIn:n,onLogin:e,onLogout:t,labels:r}){return n?d.jsxs(J,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:t,children:[d.jsx(S.User,{className:"inline w-5 h-5"}),d.jsx("span",{className:"hidden md:inline",children:r.logout})]}):d.jsxs(J,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:e,children:[d.jsx(S.User,{className:"inline w-5 h-5"}),d.jsx("span",{className:"hidden md:inline",children:r.login})]})}function _i({logo:n,languages:e=[],selectedLanguage:t,onLanguageChange:r,isLoggedIn:s,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:a,labels:c={},className:u}){const f={...Ji,...c};return d.jsxs("nav",{"data-testid":"navbar",className:C.cn("w-full px-4 md:px-8 py-4 bg-white border-b border-zinc-100 flex items-center justify-between",u),children:[d.jsx("div",{className:"flex items-center min-w-10",children:n&&d.jsx("a",{href:"/",className:"block",children:d.jsx("img",{"data-testid":"navbar-logo",src:n,alt:"Logo",className:"h-8 max-w-28 md:max-w-40"})})}),d.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||e.length>0)&&d.jsx(Ui,{languages:e,selectedLanguage:t,onLanguageChange:r,label:f.selectLanguage}),a&&d.jsx(Wi,{isLoggedIn:s,onLogin:i,onLogout:o,labels:f})]})]})}var Ot;const Gi=typeof document<"u"?(Ot=k.useInsertionEffect)!==null&&Ot!==void 0?Ot:k.useLayoutEffect:()=>{};function pn(n,e,t){let[r,s]=k.useState(n||e),i=k.useRef(r),o=k.useRef(n!==void 0),l=n!==void 0;k.useEffect(()=>{let f=o.current;f!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let a=l?n:r;Gi(()=>{i.current=a});let[,c]=k.useReducer(()=>({}),{}),u=k.useCallback((f,...h)=>{let p=typeof f=="function"?f(i.current):f;Object.is(i.current,p)||(i.current=p,s(p),c(),t?.(p,...h))},[t]);return[a,u]}function Zi(n){return d.jsx("svg",{...n,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:d.jsx(Re.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const Lr=k.forwardRef(({color:n="primary",stepsCount:e=3,defaultStep:t=0,label:r,onStepChange:s,currentStep:i,hideProgressBars:o=!1,stepClassName:l,className:a,...c},u)=>{const[f,h]=pn(i,t,s),p=k.useMemo(()=>{let g,m;const y=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(n){case"primary":g="[--step-color:var(--heroui-primary)]",m="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":g="[--step-color:var(--heroui-secondary)]",m="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":g="[--step-color:var(--heroui-success)]",m="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":g="[--step-color:var(--heroui-warning)]",m="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":g="[--step-color:var(--heroui-danger)]",m="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":g="[--step-color:var(--heroui-default)]",m="[--step-fg-color:var(--heroui-default-foreground)]";break;default:g="[--step-color:var(--heroui-primary)]",m="[--step-fg-color:var(--heroui-primary-foreground)]";break}return y.unshift(m),y.unshift(g),y},[n]);return d.jsxs("nav",{ref:u,"aria-label":"Progress",className:C.cn("flex max-w-fit items-center overflow-x-auto",a),"data-testid":"stepper-root",...c,children:[r&&d.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light w-full me-3","data-testid":"stepper-label",children:r}),d.jsx("ol",{className:C.cn("flex flex-row flex-nowrap gap-x-3",p,a),"data-testid":"stepper-list",children:Array.from({length:e})?.map((g,m)=>{const y=f===m?"active":f<m?"inactive":"complete";return d.jsx("li",{className:"relative flex w-full items-center pr-12","data-testid":`stepper-step-${m}`,children:d.jsxs("button",{"aria-current":y==="active"?"step":void 0,className:C.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",l),onClick:()=>h(m),"data-testid":`stepper-step-btn-${m}`,children:[d.jsx("div",{className:"h-full relative flex items-center",children:d.jsx(Re.LazyMotion,{features:Re.domAnimation,children:d.jsx(Re.m.div,{animate:y,className:"relative",children:d.jsx(Re.m.div,{animate:y,className:C.cn("border-medium text-large text-default-foreground relative flex h-[26px] w-[26px] items-center justify-center rounded-full font-semibold",{"shadow-lg":y==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:d.jsx("div",{className:"flex items-center justify-center",children:y==="complete"?d.jsx(Zi,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${m}`}):d.jsx("span",{})})})})})}),m<e-1&&!o&&d.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 left-[26px] w-[calc(100%-13px)] flex-none items-center",style:{"--idx":m},children:d.jsx("div",{className:C.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":m<f})})})]},m)},m)})})]})});Lr.displayName="Stepper";function Xi(){return d.jsxs("footer",{"data-testid":"footer",className:"fixed left-0 bottom-0 w-full text-left p-4 bg-white font-inter font-light text-base text-zinc-500",children:["Powered by Veevart ® ",new Date().getFullYear()]})}function $e(n){return typeof n=="string"?n:n.type}function pe({className:n}){return d.jsx("div",{className:`flex items-center h-6 ${n||""}`,children:d.jsx(C.Divider,{orientation:"vertical"})})}function le({icon:n,label:e,isActive:t=!1,isDisabled:r=!1,onClick:s,shortcut:i,iconSize:o=16,className:l}){const a=i?`${e} (${i})`:e;return d.jsx(C.Tooltip,{content:a,children:d.jsx(J,{size:"sm",radius:"sm",color:t?"primary":"default",variant:t?"solid":"bordered",isIconOnly:!0,isDisabled:r,onPress:s,"aria-label":e,className:l,children:d.jsx(n,{size:o})})})}const ie={bold:{execute:({editor:n})=>n.chain().focus().toggleBold().run(),canExecute:n=>n.can().chain().focus().toggleBold().run(),isActive:n=>n.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:n})=>n.chain().focus().toggleItalic().run(),canExecute:n=>n.can().chain().focus().toggleItalic().run(),isActive:n=>n.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:n})=>n.chain().focus().toggleStrike().run(),canExecute:n=>n.can().chain().focus().toggleStrike().run(),isActive:n=>n.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:n})=>n.chain().focus().toggleUnderline().run(),canExecute:n=>n.can().chain().focus().toggleUnderline().run(),isActive:n=>n.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:n})=>n.chain().focus().toggleCode().run(),canExecute:n=>n.can().chain().focus().toggleCode().run(),isActive:n=>n.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:n,config:e})=>{const t=e?.type==="textColor"?e.color:"";t?n.chain().focus().setColor(t).run():n.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:n=>n.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:n,config:e})=>{const t=e?.type==="highlight"?e.color:"";t?n.chain().focus().setHighlight({color:t}).run():n.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:n=>n.isActive("highlight"),label:"Highlight"},link:{execute:({editor:n,config:e})=>{const t=e?.type==="link"?e.href:"";if(t){const r=e?.type==="link"?e.target:void 0,s=e?.type==="link"?e.rel:void 0;n.chain().focus().setLink({href:t,target:r,rel:s}).run()}else n.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:n=>n.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:n})=>n.chain().focus().setParagraph().run(),canExecute:n=>n.can().chain().focus().setParagraph().run(),isActive:n=>n.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:n,config:e})=>{const t=e?.type==="heading"?e.level:1;n.chain().focus().toggleHeading({level:t}).run()},canExecute:(n,e)=>{const t=e?.type==="heading"?e.level:1;return n.can().chain().focus().toggleHeading({level:t}).run()},isActive:(n,e)=>e?.type==="heading"?n.isActive("heading",{level:e.level}):n.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:n})=>n.chain().focus().toggleBulletList().run(),canExecute:n=>n.can().chain().focus().toggleBulletList().run(),isActive:n=>n.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:n})=>n.chain().focus().toggleOrderedList().run(),canExecute:n=>n.can().chain().focus().toggleOrderedList().run(),isActive:n=>n.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:n})=>n.chain().focus().toggleTaskList().run(),canExecute:n=>n.can().chain().focus().toggleTaskList().run(),isActive:n=>n.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:n})=>n.chain().focus().toggleCodeBlock().run(),canExecute:n=>n.can().chain().focus().toggleCodeBlock().run(),isActive:n=>n.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:n})=>n.chain().focus().toggleBlockquote().run(),canExecute:n=>n.can().chain().focus().toggleBlockquote().run(),isActive:n=>n.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:n})=>n.chain().focus().setHorizontalRule().run(),canExecute:n=>n.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:n})=>n.chain().focus().setHardBreak().run(),canExecute:n=>n.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:n,config:e})=>{const t=e?.type==="textAlign"?e.alignment:"left";n.chain().focus().setTextAlign(t).run()},canExecute:()=>!0,isActive:(n,e)=>e?.type==="textAlign"?n.isActive({textAlign:e.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:n})=>n.chain().focus().unsetAllMarks().run(),canExecute:n=>n.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:n})=>n.chain().focus().clearNodes().run(),canExecute:n=>n.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:n})=>n.chain().focus().undo().run(),canExecute:n=>n.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:n})=>n.chain().focus().redo().run(),canExecute:n=>n.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Qi={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Yi({editor:n,levels:e=[1,2,3,4,5,6],isDisabled:t=!1}){const[,r]=k.useState(0);k.useEffect(()=>{const o=()=>r(l=>l+1);return n.on("selectionUpdate",o),n.on("transaction",o),()=>{n.off("selectionUpdate",o),n.off("transaction",o)}},[n]);const s=e.find(o=>n.isActive("heading",{level:o})),i=o=>{const l=Number(o),a=ie.heading;a&&a.execute({editor:n,config:{type:"heading",level:l}})};return d.jsxs(C.Dropdown,{children:[d.jsx(C.DropdownTrigger,{children:d.jsx(J,{size:"sm",radius:"sm",variant:s?"solid":"bordered",color:s?"primary":"default",isDisabled:t,startContent:d.jsx(S.Heading,{size:16}),"aria-label":"Select heading level",children:s?`H${s}`:"H"})}),d.jsx(C.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:s?new Set([String(s)]):new Set,onAction:i,children:e.map(o=>d.jsx(C.DropdownItem,{startContent:n.isActive("heading",{level:o})?d.jsx(S.Check,{size:16}):d.jsx("div",{className:"w-4"}),children:Qi[o]},o))})]})}const Dt={bulletList:{label:"Bullet List",icon:S.List},orderedList:{label:"Numbered List",icon:S.ListOrdered},taskList:{label:"Task List",icon:S.ListTodo}};function eo({editor:n,types:e=["bulletList","orderedList","taskList"],isDisabled:t=!1}){const[,r]=k.useState(0);k.useEffect(()=>{const l=()=>r(a=>a+1);return n.on("selectionUpdate",l),n.on("transaction",l),()=>{n.off("selectionUpdate",l),n.off("transaction",l)}},[n]);const s=e.find(l=>n.isActive(l)),i=s?Dt[s].icon:S.List,o=l=>{const c=ie[l];c&&c.execute({editor:n})};return d.jsxs(C.Dropdown,{children:[d.jsx(C.DropdownTrigger,{children:d.jsx(J,{size:"sm",radius:"sm",variant:s?"solid":"bordered",color:s?"primary":"default",isDisabled:t,isIconOnly:!0,"aria-label":"Select list type",children:d.jsx(i,{size:16})})}),d.jsx(C.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:s?new Set([s]):new Set,onAction:o,children:e.map(l=>{const a=Dt[l].icon;return d.jsx(C.DropdownItem,{startContent:d.jsx(a,{size:16}),children:Dt[l].label},l)})})]})}function to({colors:n,selectedColor:e,onColorSelect:t,columns:r=4}){return d.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:n.map(s=>{const i=e===s;return d.jsx("button",{type:"button",onClick:()=>t(s),className:`
2
2
  w-8 h-8 rounded-full border-2 cursor-pointer
3
3
  transition-all duration-200
4
4
  hover:scale-110 hover:shadow-md
5
5
  focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
6
6
  ${i?"border-primary ring-2 ring-primary ring-offset-2 scale-110":"border-divider"}
7
- `,style:{backgroundColor:s},"aria-label":`Select color ${s}`,title:s},s)})})}const Yi=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],eo=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Dt(n){return/^#([0-9A-F]{3}){1,2}$/i.test(n)}const H={min:50,max:200,step:10,default:100},zn={lineHeight:24,toolbarHeight:60},to={bold:S.Bold,italic:S.Italic,strike:S.Strikethrough,underline:S.Underline,code:S.Code,textColor:S.Palette,highlight:S.Highlighter,link:S.Link2,paragraph:S.FileText,heading:S.Heading,bulletList:S.List,orderedList:S.ListOrdered,taskList:S.ListTodo,codeBlock:S.CodeSquare,blockquote:S.Quote,horizontalRule:S.Minus,clearMarks:S.Eraser,clearNodes:S.Eraser,undo:S.Undo2,redo:S.Redo2,hardBreak:S.CornerDownLeft,textAlign:S.AlignLeft},no={left:S.AlignLeft,center:S.AlignCenter,right:S.AlignRight,justify:S.AlignJustify};function me(n){return to[n]}function ro({value:n,onChange:e,onApply:t,placeholder:r="#000000"}){const[s,i]=k.useState(""),o=c=>{const u=c.target.value;e(u),s&&i("")},l=()=>{if(!n){i("Please enter a color");return}if(!Dt(n)){i("Invalid hex color (e.g., #FF0000)");return}i(""),t(n)},a=c=>{c.key==="Enter"&&(c.preventDefault(),l())};return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx(A.Input,{type:"text",value:n,onChange:o,onKeyDown:a,placeholder:r,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!s,errorMessage:s,startContent:d.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:Dt(n)?n:"transparent"}})}),d.jsx(Z,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!n||!Dt(n),children:d.jsx(S.Check,{size:16})})]}),d.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function Bn({editor:n,type:e,allowCustomColor:t=!0,label:r,isDisabled:s=!1}){const[i,o]=k.useState(!1),[l,a]=k.useState(""),c=e==="textColor"?Yi:eo,u=m=>{const g=ie[e];g&&g.execute({editor:n,config:{type:e,color:m}}),o(!1),a("")},f=m=>{u(m)},h=()=>{const m=ie[e];m&&m.execute({editor:n,config:{type:e,color:""}}),o(!1)},p=e==="textColor"?n.isActive("textStyle"):n.isActive("highlight"),y=e==="textColor"?S.Palette:S.Highlighter;return d.jsxs(A.Popover,{isOpen:i,onOpenChange:o,placement:"bottom",showArrow:!0,children:[d.jsx(A.PopoverTrigger,{children:d.jsx(Z,{size:"sm",radius:"sm",variant:p?"solid":"bordered",color:p?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":r,children:d.jsx(y,{size:16})})}),d.jsx(A.PopoverContent,{className:"w-64",children:d.jsxs("div",{className:"px-2 py-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-semibold",children:r}),d.jsx(Z,{size:"sm",variant:"light",isIconOnly:!0,onPress:h,"aria-label":"Clear color",children:d.jsx(S.X,{size:16})})]}),d.jsx(Qi,{colors:c,onColorSelect:u}),t&&d.jsxs(d.Fragment,{children:[d.jsx(A.Divider,{}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),d.jsx(ro,{value:l,onChange:a,onApply:f})]})]})]})})]})}function so({zoom:n,onZoomChange:e,min:t=H.min,max:r=H.max,step:s=H.step}){const i=()=>{const f=Math.max(t,n-s);e(f)},o=()=>{const f=Math.min(r,n+s);e(f)},l=()=>{e(H.default)},a=n<=t,c=n>=r,u=n===H.default;return d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(A.Tooltip,{content:"Zoom out",children:d.jsx(Z,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:a,onPress:i,"aria-label":"Zoom out",children:d.jsx(S.ZoomOut,{size:16})})}),d.jsx(A.Tooltip,{content:u?"Zoom percentage":"Click to reset zoom",children:d.jsxs("button",{type:"button",onClick:l,disabled:u,className:`
7
+ `,style:{backgroundColor:s},"aria-label":`Select color ${s}`,title:s},s)})})}const no=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],ro=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Lt(n){return/^#([0-9A-F]{3}){1,2}$/i.test(n)}const H={min:50,max:200,step:10,default:100},Bn={lineHeight:24,toolbarHeight:60},so={bold:S.Bold,italic:S.Italic,strike:S.Strikethrough,underline:S.Underline,code:S.Code,textColor:S.Palette,highlight:S.Highlighter,link:S.Link2,paragraph:S.FileText,heading:S.Heading,bulletList:S.List,orderedList:S.ListOrdered,taskList:S.ListTodo,codeBlock:S.CodeSquare,blockquote:S.Quote,horizontalRule:S.Minus,clearMarks:S.Eraser,clearNodes:S.Eraser,undo:S.Undo2,redo:S.Redo2,hardBreak:S.CornerDownLeft,textAlign:S.AlignLeft},io={left:S.AlignLeft,center:S.AlignCenter,right:S.AlignRight,justify:S.AlignJustify};function me(n){return so[n]}function oo({value:n,onChange:e,onApply:t,placeholder:r="#000000"}){const[s,i]=k.useState(""),o=c=>{const u=c.target.value;e(u),s&&i("")},l=()=>{if(!n){i("Please enter a color");return}if(!Lt(n)){i("Invalid hex color (e.g., #FF0000)");return}i(""),t(n)},a=c=>{c.key==="Enter"&&(c.preventDefault(),l())};return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx(C.Input,{type:"text",value:n,onChange:o,onKeyDown:a,placeholder:r,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!s,errorMessage:s,startContent:d.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:Lt(n)?n:"transparent"}})}),d.jsx(J,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!n||!Lt(n),children:d.jsx(S.Check,{size:16})})]}),d.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function Hn({editor:n,type:e,allowCustomColor:t=!0,label:r,isDisabled:s=!1}){const[i,o]=k.useState(!1),[l,a]=k.useState(""),c=e==="textColor"?no:ro,u=m=>{const y=ie[e];y&&y.execute({editor:n,config:{type:e,color:m}}),o(!1),a("")},f=m=>{u(m)},h=()=>{const m=ie[e];m&&m.execute({editor:n,config:{type:e,color:""}}),o(!1)},p=e==="textColor"?n.isActive("textStyle"):n.isActive("highlight"),g=e==="textColor"?S.Palette:S.Highlighter;return d.jsxs(C.Popover,{isOpen:i,onOpenChange:o,placement:"bottom",showArrow:!0,children:[d.jsx(C.PopoverTrigger,{children:d.jsx(J,{size:"sm",radius:"sm",variant:p?"solid":"bordered",color:p?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":r,children:d.jsx(g,{size:16})})}),d.jsx(C.PopoverContent,{className:"w-64",children:d.jsxs("div",{className:"px-2 py-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-semibold",children:r}),d.jsx(J,{size:"sm",variant:"light",isIconOnly:!0,onPress:h,"aria-label":"Clear color",children:d.jsx(S.X,{size:16})})]}),d.jsx(to,{colors:c,onColorSelect:u}),t&&d.jsxs(d.Fragment,{children:[d.jsx(C.Divider,{}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),d.jsx(oo,{value:l,onChange:a,onApply:f})]})]})]})})]})}function lo({zoom:n,onZoomChange:e,min:t=H.min,max:r=H.max,step:s=H.step}){const i=()=>{const f=Math.max(t,n-s);e(f)},o=()=>{const f=Math.min(r,n+s);e(f)},l=()=>{e(H.default)},a=n<=t,c=n>=r,u=n===H.default;return d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(C.Tooltip,{content:"Zoom out",children:d.jsx(J,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:a,onPress:i,"aria-label":"Zoom out",children:d.jsx(S.ZoomOut,{size:16})})}),d.jsx(C.Tooltip,{content:u?"Zoom percentage":"Click to reset zoom",children:d.jsxs("button",{type:"button",onClick:l,disabled:u,className:`
8
8
  text-xs text-default-500 min-w-[3ch] text-center px-2
9
9
  ${u?"cursor-default":"cursor-pointer hover:text-primary"}
10
- `,"aria-label":`Zoom level ${n}%`,children:[n,"%"]})}),d.jsx(A.Tooltip,{content:"Zoom in",children:d.jsx(Z,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:c,onPress:o,"aria-label":"Zoom in",children:d.jsx(S.ZoomIn,{size:16})})})]})}function io({children:n,id:e,label:t,className:r,useButtonGroup:s=!0}){return s?d.jsx(A.ButtonGroup,{size:"sm",id:e,"aria-label":t,className:r,children:n}):d.jsx("div",{id:e,role:"group","aria-label":t,className:`flex items-center gap-2 ${r||""}`,children:n})}function Dr(n,e){const t=k.useMemo(()=>{if(!n)return{};const i={};return Array.from(new Set(e.map(l=>$e(l)))).forEach(l=>{const a=ie[l];if(a)try{const c=a.canExecute?.(n)??!0,u=a.isActive?.(n)??!1;i[l]={isActive:u,isDisabled:!c,canExecute:c}}catch(c){console.warn(`Extension not available for modifier: ${l}`,c),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[n,e]),[r,s]=k.useState(t);return k.useEffect(()=>{if(!n)return;const i=()=>{const o={};Array.from(new Set(e.map(a=>$e(a)))).forEach(a=>{const c=ie[a];if(c)try{const u=c.canExecute?.(n)??!0,f=c.isActive?.(n)??!1;o[a]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${a}`,u),o[a]={isActive:!1,isDisabled:!0,canExecute:!1}}}),s(o)};return n.on("selectionUpdate",i),n.on("transaction",i),()=>{n.off("selectionUpdate",i),n.off("transaction",i)}},[n,e,t]),r}function Lr(n,e){const t=k.useCallback((o,l)=>{if(!n)return;const a=ie[o];if(a)try{a.execute({editor:n,config:l}),e?.({type:"toggle",modifier:o})}catch(c){console.warn(`Failed to execute command for modifier: ${o}`,c)}},[n,e]),r=k.useCallback(o=>{t(o)},[t]),s=k.useCallback((o,l)=>{if(!n)return!1;const a=ie[o];try{return a?.canExecute?.(n,l)??!1}catch(c){return console.warn(`Failed to check canExecute for modifier: ${o}`,c),!1}},[n]),i=k.useCallback((o,l)=>{if(!n)return!1;const a=ie[o];try{return a?.isActive?.(n,l)??!1}catch(c){return console.warn(`Failed to check isActive for modifier: ${o}`,c),!1}},[n]);return{executeCommand:t,toggleModifier:r,canExecute:s,isActive:i}}function oo(n=H.default){const[e,t]=k.useState(n),r=k.useCallback((l=H.step)=>{t(a=>Math.min(H.max,a+l))},[]),s=k.useCallback((l=H.step)=>{t(a=>Math.max(H.min,a-l))},[]),i=k.useCallback(()=>{t(H.default)},[]),o=k.useCallback(l=>{const a=Math.max(H.min,Math.min(H.max,l));t(a)},[]);return{zoom:e,setZoom:o,zoomIn:r,zoomOut:s,resetZoom:i,isMinZoom:e<=H.min,isMaxZoom:e>=H.max,isDefaultZoom:e===H.default}}const lo=["bold","italic","strike","underline","code"];function ao({editor:n,modifiers:e,onToolbarAction:t}){const r=Dr(n,e),{toggleModifier:s}=Lr(n,t);if(!n)return null;const i=e.map(o=>$e(o)).filter(o=>lo.includes(o));return i.length===0?null:d.jsx(io,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=r[o],a=me(o);return d.jsx(le,{icon:a,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>s(o)},o)})})}function co({editor:n,modifiers:e,zoom:t=100,onZoomChange:r,sticky:s=!0,className:i,onToolbarAction:o}){const l=Dr(n,e),{toggleModifier:a,executeCommand:c}=Lr(n,o);if(!n)return null;const u=e.map(C=>$e(C)),f=u.some(C=>["bold","italic","strike","underline","code"].includes(C)),h=u.some(C=>["textColor","highlight"].includes(C)),p=u.includes("heading"),y=u.includes("textAlign"),m=u.some(C=>["bulletList","orderedList","taskList"].includes(C)),g=u.includes("blockquote"),x=u.includes("codeBlock"),w=u.includes("link"),N=u.includes("horizontalRule"),O=u.some(C=>["undo","redo"].includes(C)),P=t!==void 0&&r!==void 0,T=s?"sticky top-0 z-10":"";return d.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${T} ${i||""}`,children:d.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[f&&d.jsxs(d.Fragment,{children:[d.jsx(ao,{editor:n,modifiers:e,onToolbarAction:o}),(h||p||y||m||g||x||w||N||O||P)&&d.jsx(pe,{})]}),h&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[u.includes("textColor")&&d.jsx(Bn,{editor:n,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),u.includes("highlight")&&d.jsx(Bn,{editor:n,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(p||y||m||g||x||w||N||O||P)&&d.jsx(pe,{})]}),p&&d.jsxs(d.Fragment,{children:[d.jsx(Zi,{editor:n}),(y||m||g||x||w||N||O||P)&&d.jsx(pe,{})]}),y&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(C=>{const V=no[C],U=n.isActive({textAlign:C});return d.jsx(le,{icon:V,label:`Align ${C}`,isActive:U,onClick:()=>c("textAlign",{type:"textAlign",alignment:C})},C)})}),(m||g||x||w||N||O||P)&&d.jsx(pe,{})]}),m&&d.jsxs(d.Fragment,{children:[d.jsx(Xi,{editor:n,types:u.filter(C=>["bulletList","orderedList","taskList"].includes(C))}),(g||x||w||N||O||P)&&d.jsx(pe,{})]}),(g||x||w||N)&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[g&&d.jsx(le,{icon:me("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>a("blockquote")}),x&&d.jsx(le,{icon:me("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>a("codeBlock")}),w&&d.jsx(le,{icon:me("link"),label:"Link",isActive:l.link?.isActive,isDisabled:l.link?.isDisabled,onClick:()=>{const C=window.prompt("Enter URL:");C&&c("link",{type:"link",href:C})}}),N&&d.jsx(le,{icon:me("horizontalRule"),label:"Horizontal rule",onClick:()=>a("horizontalRule")})]}),(O||P)&&d.jsx(pe,{})]}),O&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[u.includes("undo")&&d.jsx(le,{icon:me("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>a("undo")}),u.includes("redo")&&d.jsx(le,{icon:me("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>a("redo")})]}),P&&d.jsx(pe,{})]}),P&&d.jsx(so,{zoom:t,onZoomChange:C=>{r?.(C),o?.({type:"zoom",modifier:`${C}%`})}})]})})}const uo=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,fo=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ho=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,po=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,mo=b.Mark.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["strong",b.mergeAttributes(this.options.HTMLAttributes,n),0]},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[b.markInputRule({find:uo,type:this.type}),b.markInputRule({find:ho,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:fo,type:this.type}),b.markPasteRule({find:po,type:this.type})]}}),go=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,yo=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,xo=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,bo=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ko=b.Mark.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",b.mergeAttributes(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)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[b.markInputRule({find:go,type:this.type}),b.markInputRule({find:xo,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:yo,type:this.type}),b.markPasteRule({find:bo,type:this.type})]}}),So=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Co=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ao=b.Mark.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",b.mergeAttributes(this.options.HTMLAttributes,n),0]},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[b.markInputRule({find:So,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:Co,type:this.type})]}}),To=/(^|[^`])`([^`]+)`(?!`)/,Eo=/(^|[^`])`([^`]+)`(?!`)/g,vo=b.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",b.mergeAttributes(this.options.HTMLAttributes,n),0]},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[b.markInputRule({find:To,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:Eo,type:this.type})]}}),Mo=n=>{if(!n.children.length)return;const e=n.querySelectorAll("span");e&&e.forEach(t=>{var r,s;const i=t.getAttribute("style"),o=(s=(r=t.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||s===void 0?void 0:s.getAttribute("style");t.setAttribute("style",`${o};${i}`)})},wo=b.Mark.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Mo(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(i=>!!i))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),No=b.Node.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]}`,b.mergeAttributes(this.options.HTMLAttributes,e),0]},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=>b.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),Io=b.Node.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Oo="listItem",Hn="textStyle",$n=/^\s*([-+*])\s$/,Do=b.Node.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",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Oo,this.editor.getAttributes(Hn)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=b.wrappingInputRule({find:$n,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=b.wrappingInputRule({find:$n,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Hn),editor:this.editor})),[n]}}),Lo="listItem",Vn="textStyle",qn=/^(\d+)\.\s$/,Ro=b.Node.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",b.mergeAttributes(this.options.HTMLAttributes,t),0]:["ol",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Lo,this.editor.getAttributes(Vn)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=b.wrappingInputRule({find:qn,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=b.wrappingInputRule({find:qn,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Vn)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Po=b.Node.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function Rr(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Rr(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Pr(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Pr(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class E{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new E(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new E(r,s)}cutByIndex(e,t){return e==t?E.empty:e==0&&t==this.content.length?this:new E(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new E(s,i)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Rr(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Pr(this,e,t,r)}findIndex(e){if(e==0)return Xe(0,e);if(e==this.size)return Xe(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Xe(t+1,i):Xe(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return E.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new E(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new E(t||e,r)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const Lt={index:0,offset:0};function Xe(n,e){return Lt.index=n,Lt.offset=e,Lt}function Gt(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Gt(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Gt(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}class G{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Gt(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return G.none;if(e instanceof G)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}}G.none=[];class jo extends Error{}class v{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Fr(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(jr(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return v.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new v(E.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new v(e,r,s)}}v.empty=new v(E.empty,0,0);function jr(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(jr(i.content,e-s-1,t-s-1)))}function Fr(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Fr(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Fo(n){return n.tag!=null}function zo(n){return n.style!=null}class lt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Fo(s))this.tags.push(s);else if(zo(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Jn(this,t,!1);return r.addAll(e,G.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Jn(this,t,!0);return r.addAll(e,G.none,t.from,t.to),v.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if($o(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Un(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Un(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new lt(e,lt.schemaRules(e)))}}const zr={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},Bo={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Br={ol:!0,ul:!0},Ve=1,Zt=2,Fe=4;function Kn(n,e,t){return e!=null?(e?Ve:0)|(e==="full"?Zt:0):n&&n.whitespace=="pre"?Ve|Zt:t&~Fe}class Qe{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=G.none,this.match=i||(o&Fe?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(E.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ve)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=E.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(E.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&&!zr.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Jn{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=Kn(null,t.preserveWhitespace,0)|(r?Fe:0);s?i=new Qe(s.type,s.attrs,G.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Qe(null,null,G.none,!0,null,o):i=new Qe(e.schema.topNodeType,null,G.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Zt?"full":this.localPreserveWS||(s.options&Ve)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
11
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Br.hasOwnProperty(o)&&this.parser.normalizeLists&&Ho(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Bo.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(zr.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
12
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=G.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Wn(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Kn(e,i,o.options);o.options&Fe&&o.content.length==0&&(l|=Fe);let a=G.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Wn(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Qe(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ve)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function Ho(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Br.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function $o(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Un(n){let e={};for(let t in n)e[t]=n[t];return e}function Wn(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class xt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Rt(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=rt(Rt(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&rt(Rt(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return rt(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=_n(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return _n(e.marks)}}function _n(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Rt(n){return n.document||window.document}const Gn=new WeakMap;function Vo(n){let e=Gn.get(n);return e===void 0&&Gn.set(n,e=qo(n)),e}function qo(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function rt(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Vo(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let h=f.indexOf(" ");h>0?a.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):f=="style"&&a.style?a.style.cssText=c[f]:a.setAttribute(f,c[f])}}for(let f=u;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:y}=rt(n,h,t,r);if(a.appendChild(p),y){if(l)throw new RangeError("Multiple content holes");l=y}}}return{dom:a,contentDOM:l}}const Hr=65535,$r=Math.pow(2,16);function Ko(n,e){return n+e*$r}function Zn(n){return n&Hr}function Jo(n){return(n-(n&Hr))/$r}const Vr=1,qr=2,st=4,Kr=8;class Xt{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Kr)>0}get deletedBefore(){return(this.delInfo&(Vr|st))>0}get deletedAfter(){return(this.delInfo&(qr|st))>0}get deletedAcross(){return(this.delInfo&st)>0}}class K{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&K.empty)return K.empty}recover(e){let t=0,r=Zn(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+Jo(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],f=a+c;if(e<=f){let h=c?e==a?-1:e==f?1:t:t,p=a+s+(h<0?0:u);if(r)return p;let y=e==(t<0?a:f)?null:Ko(l/3,e-a),m=e==a?qr:e==f?Vr:st;return(t<0?e!=a:e!=f)&&(m|=Kr),new Xt(p,m,y)}s+=u-c}return r?e+s:new Xt(e+s,0,null)}touches(e,t){let r=0,s=Zn(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new K(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?K.empty:new K(e<0?[0,-e,0]:[0,0,e])}}K.empty=new K([]);class at{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new at(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new at;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Xt(e,s,null)}}const Pt=Object.create(null);class ${getMap(){return K.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Pt[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Pt)throw new RangeError("Duplicate use of step JSON ID "+e);return Pt[e]=t,t.prototype.jsonID=e,t}}class R{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new R(e,null)}static fail(e){return new R(null,e)}static fromReplace(e,t,r,s){try{return R.ok(e.replace(t,r,s))}catch(i){if(i instanceof jo)return R.fail(i.message);throw i}}}function pn(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(pn(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return E.fromArray(r)}class ye extends ${constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new v(pn(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return R.fromReplace(e,this.from,this.to,i)}invert(){return new xe(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ye(t.pos,r.pos,this.mark)}merge(e){return e instanceof ye&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ye(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 ye(t.from,t.to,e.markFromJSON(t.mark))}}$.jsonID("addMark",ye);class xe extends ${constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new v(pn(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return R.fromReplace(e,this.from,this.to,r)}invert(){return new ye(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new xe(t.pos,r.pos,this.mark)}merge(e){return e instanceof xe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xe(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 xe(t.from,t.to,e.markFromJSON(t.mark))}}$.jsonID("removeMark",xe);class be extends ${constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return R.fromReplace(e,this.pos,this.pos+1,new v(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new be(this.pos,t.marks[s]);return new be(this.pos,this.mark)}}return new qe(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new be(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 be(t.pos,e.markFromJSON(t.mark))}}$.jsonID("addNodeMark",be);class qe extends ${constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return R.fromReplace(e,this.pos,this.pos+1,new v(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new be(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new qe(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 qe(t.pos,e.markFromJSON(t.mark))}}$.jsonID("removeNodeMark",qe);class se extends ${constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Qt(e,this.from,this.to)?R.fail("Structure replace would overwrite content"):R.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new K([this.from,this.to-this.from,this.slice.size])}invert(e){return new se(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new se(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof se)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?v.empty:new v(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new se(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?v.empty:new v(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new se(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 se(t.from,t.to,v.fromJSON(e,t.slice),!!t.structure)}}$.jsonID("replace",se);class we extends ${constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Qt(e,this.from,this.gapFrom)||Qt(e,this.gapTo,this.to)))return R.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return R.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?R.fromReplace(e,this.from,this.to,r):R.fail("Content does not fit in gap")}getMap(){return new K([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 we(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new we(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 we(t.from,t.to,t.gapFrom,t.gapTo,v.fromJSON(e,t.slice),t.insert,!!t.structure)}}$.jsonID("replaceAround",we);function Qt(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Jr(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let i=0;i<t.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(a,a,s);else{let f=c.contentMatchAt(a).findWrapping(s.firstChild.type);u=f&&c.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}class ze extends ${constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let s=t.type.create(r,null,t.marks);return R.fromReplace(e,this.pos,this.pos+1,new v(E.from(s),0,t.isLeaf?0:1))}getMap(){return K.empty}invert(e){return new ze(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 ze(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 ze(t.pos,t.attr,t.value)}}$.jsonID("attr",ze);class ct extends ${constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return R.ok(r)}getMap(){return K.empty}invert(e){return new ct(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 ct(t.attr,t.value)}}$.jsonID("docAttr",ct);let Ke=class extends Error{};Ke=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ke.prototype=Object.create(Error.prototype);Ke.prototype.constructor=Ke;Ke.prototype.name="TransformError";const jt=Object.create(null);class D{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Uo(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=v.empty){let r=t.content.lastChild,s=null;for(let l=0;l<t.openEnd;l++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?v.empty:t),l==0&&Yn(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Yn(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new I(e):ve(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=t<0?ve(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):ve(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new te(e.node(0))}static atStart(e){return ve(e,e,0,0,1)||new te(e)}static atEnd(e){return ve(e,e,e.content.size,e.childCount,-1)||new te(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=jt[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in jt)throw new RangeError("Duplicate use of selection JSON ID "+e);return jt[e]=t,t.prototype.jsonID=e,t}getBookmark(){return I.between(this.$anchor,this.$head).getBookmark()}}D.prototype.visible=!0;class Uo{constructor(e,t){this.$from=e,this.$to=t}}let Xn=!1;function Qn(n){!Xn&&!n.parent.inlineContent&&(Xn=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class I extends D{constructor(e,t=e){Qn(e),Qn(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return D.near(r);let s=e.resolve(t.map(this.anchor));return new I(s.parent.inlineContent?s:r,r)}replace(e,t=v.empty){if(super.replace(e,t),t==v.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof I&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bt(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 I(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let i=D.findFrom(t,r,!0)||D.findFrom(t,-r,!0);if(i)t=i.$head;else return D.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(D.findFrom(e,-r,!0)||D.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new I(e,t)}}D.jsonID("text",I);class bt{constructor(e,t){this.anchor=e,this.head=t}map(e){return new bt(e.map(this.anchor),e.map(this.head))}resolve(e){return I.between(e.resolve(this.anchor),e.resolve(this.head))}}class M extends D{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),i=e.resolve(s);return r?D.near(i):new M(i)}content(){return new v(E.from(this.node),0,0)}eq(e){return e instanceof M&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new mn(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new M(e.resolve(t.anchor))}static create(e,t){return new M(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}M.prototype.visible=!1;D.jsonID("node",M);class mn{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new bt(r,r):new mn(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&M.isSelectable(r)?new M(t):D.near(t)}}class te extends D{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=v.empty){if(t==v.empty){e.delete(0,e.doc.content.size);let r=D.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new te(e)}map(e){return new te(e)}eq(e){return e instanceof te}getBookmark(){return Wo}}D.jsonID("all",te);const Wo={map(){return this},resolve(n){return new te(n)}};function ve(n,e,t,r,s,i=!1){if(e.inlineContent)return I.create(n,t);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&M.isSelectable(l))return M.create(n,t-(s<0?l.nodeSize:0))}else{let a=ve(n,l,t+s,s<0?l.childCount:0,s,i);if(a)return a}t+=l.nodeSize*s}return null}function Yn(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof se||s instanceof we))return;let i=n.mapping.maps[r],o;i.forEach((l,a,c,u)=>{o==null&&(o=u)}),n.setSelection(D.near(n.doc.resolve(o),t))}function er(n,e){return!e||!n?n:n.bind(e)}class Ye{constructor(e,t,r){this.name=e,this.init=er(t.init,r),this.apply=er(t.apply,r)}}new Ye("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ye("selection",{init(n,e){return n.selection||D.atStart(e.doc)},apply(n){return n.selection}}),new Ye("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ye("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function Ur(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Ur(s,e,{})),t[r]=s}return t}class kt{constructor(e){this.spec=e,this.props={},e.props&&Ur(e.props,this,this.props),this.key=e.key?e.key.key:Wr("plugin")}getState(e){return e[this.key]}}const Ft=Object.create(null);function Wr(n){return n in Ft?n+"$"+ ++Ft[n]:(Ft[n]=0,n+"$")}class gn{constructor(e="key"){this.key=Wr(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const _o=/^```([a-z]+)?[\s\n]$/,Go=/^~~~([a-z]+)?[\s\n]$/,Zo=b.Node.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,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,i=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",b.mergeAttributes(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},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},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
10
+ `,"aria-label":`Zoom level ${n}%`,children:[n,"%"]})}),d.jsx(C.Tooltip,{content:"Zoom in",children:d.jsx(J,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:c,onPress:o,"aria-label":"Zoom in",children:d.jsx(S.ZoomIn,{size:16})})})]})}function ao({children:n,id:e,label:t,className:r,useButtonGroup:s=!0}){return s?d.jsx(C.ButtonGroup,{size:"sm",id:e,"aria-label":t,className:r,children:n}):d.jsx("div",{id:e,role:"group","aria-label":t,className:`flex items-center gap-2 ${r||""}`,children:n})}function Rr(n,e){const t=k.useMemo(()=>{if(!n)return{};const i={};return Array.from(new Set(e.map(l=>$e(l)))).forEach(l=>{const a=ie[l];if(a)try{const c=a.canExecute?.(n)??!0,u=a.isActive?.(n)??!1;i[l]={isActive:u,isDisabled:!c,canExecute:c}}catch(c){console.warn(`Extension not available for modifier: ${l}`,c),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[n,e]),[r,s]=k.useState(t);return k.useEffect(()=>{if(!n)return;const i=()=>{const o={};Array.from(new Set(e.map(a=>$e(a)))).forEach(a=>{const c=ie[a];if(c)try{const u=c.canExecute?.(n)??!0,f=c.isActive?.(n)??!1;o[a]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${a}`,u),o[a]={isActive:!1,isDisabled:!0,canExecute:!1}}}),s(o)};return n.on("selectionUpdate",i),n.on("transaction",i),()=>{n.off("selectionUpdate",i),n.off("transaction",i)}},[n,e,t]),r}function Pr(n,e){const t=k.useCallback((o,l)=>{if(!n)return;const a=ie[o];if(a)try{a.execute({editor:n,config:l}),e?.({type:"toggle",modifier:o})}catch(c){console.warn(`Failed to execute command for modifier: ${o}`,c)}},[n,e]),r=k.useCallback(o=>{t(o)},[t]),s=k.useCallback((o,l)=>{if(!n)return!1;const a=ie[o];try{return a?.canExecute?.(n,l)??!1}catch(c){return console.warn(`Failed to check canExecute for modifier: ${o}`,c),!1}},[n]),i=k.useCallback((o,l)=>{if(!n)return!1;const a=ie[o];try{return a?.isActive?.(n,l)??!1}catch(c){return console.warn(`Failed to check isActive for modifier: ${o}`,c),!1}},[n]);return{executeCommand:t,toggleModifier:r,canExecute:s,isActive:i}}function co(n=H.default){const[e,t]=k.useState(n),r=k.useCallback((l=H.step)=>{t(a=>Math.min(H.max,a+l))},[]),s=k.useCallback((l=H.step)=>{t(a=>Math.max(H.min,a-l))},[]),i=k.useCallback(()=>{t(H.default)},[]),o=k.useCallback(l=>{const a=Math.max(H.min,Math.min(H.max,l));t(a)},[]);return{zoom:e,setZoom:o,zoomIn:r,zoomOut:s,resetZoom:i,isMinZoom:e<=H.min,isMaxZoom:e>=H.max,isDefaultZoom:e===H.default}}const uo=["bold","italic","strike","underline","code"];function fo({editor:n,modifiers:e,onToolbarAction:t}){const r=Rr(n,e),{toggleModifier:s}=Pr(n,t);if(!n)return null;const i=e.map(o=>$e(o)).filter(o=>uo.includes(o));return i.length===0?null:d.jsx(ao,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=r[o],a=me(o);return d.jsx(le,{icon:a,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>s(o)},o)})})}function ho({editor:n,modifiers:e,zoom:t=100,onZoomChange:r,sticky:s=!0,className:i,onToolbarAction:o}){const l=Rr(n,e),{toggleModifier:a,executeCommand:c}=Pr(n,o);if(!n)return null;const u=e.map(A=>$e(A)),f=u.some(A=>["bold","italic","strike","underline","code"].includes(A)),h=u.some(A=>["textColor","highlight"].includes(A)),p=u.includes("heading"),g=u.includes("textAlign"),m=u.some(A=>["bulletList","orderedList","taskList"].includes(A)),y=u.includes("blockquote"),x=u.includes("codeBlock"),M=u.includes("link"),N=u.includes("horizontalRule"),O=u.some(A=>["undo","redo"].includes(A)),P=t!==void 0&&r!==void 0,T=s?"sticky top-0 z-10":"";return d.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${T} ${i||""}`,children:d.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[f&&d.jsxs(d.Fragment,{children:[d.jsx(fo,{editor:n,modifiers:e,onToolbarAction:o}),(h||p||g||m||y||x||M||N||O||P)&&d.jsx(pe,{})]}),h&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[u.includes("textColor")&&d.jsx(Hn,{editor:n,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),u.includes("highlight")&&d.jsx(Hn,{editor:n,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(p||g||m||y||x||M||N||O||P)&&d.jsx(pe,{})]}),p&&d.jsxs(d.Fragment,{children:[d.jsx(Yi,{editor:n}),(g||m||y||x||M||N||O||P)&&d.jsx(pe,{})]}),g&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(A=>{const V=io[A],W=n.isActive({textAlign:A});return d.jsx(le,{icon:V,label:`Align ${A}`,isActive:W,onClick:()=>c("textAlign",{type:"textAlign",alignment:A})},A)})}),(m||y||x||M||N||O||P)&&d.jsx(pe,{})]}),m&&d.jsxs(d.Fragment,{children:[d.jsx(eo,{editor:n,types:u.filter(A=>["bulletList","orderedList","taskList"].includes(A))}),(y||x||M||N||O||P)&&d.jsx(pe,{})]}),(y||x||M||N)&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[y&&d.jsx(le,{icon:me("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>a("blockquote")}),x&&d.jsx(le,{icon:me("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>a("codeBlock")}),M&&d.jsx(le,{icon:me("link"),label:"Link",isActive:l.link?.isActive,isDisabled:l.link?.isDisabled,onClick:()=>{const A=window.prompt("Enter URL:");A&&c("link",{type:"link",href:A})}}),N&&d.jsx(le,{icon:me("horizontalRule"),label:"Horizontal rule",onClick:()=>a("horizontalRule")})]}),(O||P)&&d.jsx(pe,{})]}),O&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[u.includes("undo")&&d.jsx(le,{icon:me("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>a("undo")}),u.includes("redo")&&d.jsx(le,{icon:me("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>a("redo")})]}),P&&d.jsx(pe,{})]}),P&&d.jsx(lo,{zoom:t,onZoomChange:A=>{r?.(A),o?.({type:"zoom",modifier:`${A}%`})}})]})})}const po=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,mo=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,go=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,yo=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,xo=b.Mark.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["strong",b.mergeAttributes(this.options.HTMLAttributes,n),0]},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[b.markInputRule({find:po,type:this.type}),b.markInputRule({find:go,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:mo,type:this.type}),b.markPasteRule({find:yo,type:this.type})]}}),bo=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ko=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Co=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,So=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ao=b.Mark.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",b.mergeAttributes(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)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[b.markInputRule({find:bo,type:this.type}),b.markInputRule({find:Co,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:ko,type:this.type}),b.markPasteRule({find:So,type:this.type})]}}),To=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,vo=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,wo=b.Mark.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",b.mergeAttributes(this.options.HTMLAttributes,n),0]},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[b.markInputRule({find:To,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:vo,type:this.type})]}}),Eo=/(^|[^`])`([^`]+)`(?!`)/,Mo=/(^|[^`])`([^`]+)`(?!`)/g,No=b.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",b.mergeAttributes(this.options.HTMLAttributes,n),0]},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[b.markInputRule({find:Eo,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:Mo,type:this.type})]}}),Io=n=>{if(!n.children.length)return;const e=n.querySelectorAll("span");e&&e.forEach(t=>{var r,s;const i=t.getAttribute("style"),o=(s=(r=t.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||s===void 0?void 0:s.getAttribute("style");t.setAttribute("style",`${o};${i}`)})},Oo=b.Mark.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Io(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(i=>!!i))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),Do=b.Node.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]}`,b.mergeAttributes(this.options.HTMLAttributes,e),0]},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=>b.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),Lo=b.Node.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ro="listItem",$n="textStyle",Vn=/^\s*([-+*])\s$/,Po=b.Node.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",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ro,this.editor.getAttributes($n)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=b.wrappingInputRule({find:Vn,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=b.wrappingInputRule({find:Vn,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes($n),editor:this.editor})),[n]}}),jo="listItem",qn="textStyle",Kn=/^(\d+)\.\s$/,Fo=b.Node.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",b.mergeAttributes(this.options.HTMLAttributes,t),0]:["ol",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(jo,this.editor.getAttributes(qn)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=b.wrappingInputRule({find:Kn,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=b.wrappingInputRule({find:Kn,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(qn)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),zo=b.Node.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",b.mergeAttributes(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function jr(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=jr(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Fr(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Fr(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class v{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new v(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new v(r,s)}cutByIndex(e,t){return e==t?v.empty:e==0&&t==this.content.length?this:new v(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new v(s,i)}addToStart(e){return new v([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new v(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return jr(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Fr(this,e,t,r)}findIndex(e){if(e==0)return Xe(0,e);if(e==this.size)return Xe(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Xe(t+1,i):Xe(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return v.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new v(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return v.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new v(t||e,r)}static from(e){if(!e)return v.empty;if(e instanceof v)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new v([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}v.empty=new v([],0);const Rt={index:0,offset:0};function Xe(n,e){return Rt.index=n,Rt.offset=e,Rt}function Zt(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Zt(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Zt(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}class Z{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zt(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Z.none;if(e instanceof Z)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}}Z.none=[];class Bo extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Br(this.content,e+this.openStart,t);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(zr(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 w.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(v.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new w(e,r,s)}}w.empty=new w(v.empty,0,0);function zr(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(zr(i.content,e-s-1,t-s-1)))}function Br(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Br(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Ho(n){return n.tag!=null}function $o(n){return n.style!=null}class lt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Ho(s))this.tags.push(s);else if($o(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Un(this,t,!1);return r.addAll(e,Z.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Un(this,t,!0);return r.addAll(e,Z.none,t.from,t.to),w.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(Ko(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Wn(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Wn(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new lt(e,lt.schemaRules(e)))}}const Hr={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},Vo={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},$r={ol:!0,ul:!0},Ve=1,Xt=2,Fe=4;function Jn(n,e,t){return e!=null?(e?Ve:0)|(e==="full"?Xt:0):n&&n.whitespace=="pre"?Ve|Xt:t&~Fe}class Qe{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Z.none,this.match=i||(o&Fe?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(v.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ve)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=v.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(v.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&&!Hr.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Un{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=Jn(null,t.preserveWhitespace,0)|(r?Fe:0);s?i=new Qe(s.type,s.attrs,Z.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Qe(null,null,Z.none,!0,null,o):i=new Qe(e.schema.topNodeType,null,Z.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Xt?"full":this.localPreserveWS||(s.options&Ve)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
11
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;$r.hasOwnProperty(o)&&this.parser.normalizeLists&&qo(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Vo.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Hr.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
12
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=Z.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):_n(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Jn(e,i,o.options);o.options&Fe&&o.content.length==0&&(l|=Fe);let a=Z.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):_n(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Qe(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ve)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function qo(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&$r.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Ko(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Wn(n){let e={};for(let t in n)e[t]=n[t];return e}function _n(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class xt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Pt(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=rt(Pt(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&rt(Pt(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return rt(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Gn(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Gn(e.marks)}}function Gn(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Pt(n){return n.document||window.document}const Zn=new WeakMap;function Jo(n){let e=Zn.get(n);return e===void 0&&Zn.set(n,e=Uo(n)),e}function Uo(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function rt(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Jo(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let h=f.indexOf(" ");h>0?a.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):f=="style"&&a.style?a.style.cssText=c[f]:a.setAttribute(f,c[f])}}for(let f=u;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:g}=rt(n,h,t,r);if(a.appendChild(p),g){if(l)throw new RangeError("Multiple content holes");l=g}}}return{dom:a,contentDOM:l}}const Vr=65535,qr=Math.pow(2,16);function Wo(n,e){return n+e*qr}function Xn(n){return n&Vr}function _o(n){return(n-(n&Vr))/qr}const Kr=1,Jr=2,st=4,Ur=8;class Qt{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ur)>0}get deletedBefore(){return(this.delInfo&(Kr|st))>0}get deletedAfter(){return(this.delInfo&(Jr|st))>0}get deletedAcross(){return(this.delInfo&st)>0}}class K{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&K.empty)return K.empty}recover(e){let t=0,r=Xn(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+_o(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],f=a+c;if(e<=f){let h=c?e==a?-1:e==f?1:t:t,p=a+s+(h<0?0:u);if(r)return p;let g=e==(t<0?a:f)?null:Wo(l/3,e-a),m=e==a?Jr:e==f?Kr:st;return(t<0?e!=a:e!=f)&&(m|=Ur),new Qt(p,m,g)}s+=u-c}return r?e+s:new Qt(e+s,0,null)}touches(e,t){let r=0,s=Xn(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new K(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?K.empty:new K(e<0?[0,-e,0]:[0,0,e])}}K.empty=new K([]);class at{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new at(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new at;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Qt(e,s,null)}}const jt=Object.create(null);class ${getMap(){return K.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=jt[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in jt)throw new RangeError("Duplicate use of step JSON ID "+e);return jt[e]=t,t.prototype.jsonID=e,t}}class R{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new R(e,null)}static fail(e){return new R(null,e)}static fromReplace(e,t,r,s){try{return R.ok(e.replace(t,r,s))}catch(i){if(i instanceof Bo)return R.fail(i.message);throw i}}}function mn(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(mn(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return v.fromArray(r)}class ye extends ${constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new w(mn(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return R.fromReplace(e,this.from,this.to,i)}invert(){return new xe(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ye(t.pos,r.pos,this.mark)}merge(e){return e instanceof ye&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ye(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 ye(t.from,t.to,e.markFromJSON(t.mark))}}$.jsonID("addMark",ye);class xe extends ${constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new w(mn(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return R.fromReplace(e,this.from,this.to,r)}invert(){return new ye(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new xe(t.pos,r.pos,this.mark)}merge(e){return e instanceof xe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xe(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 xe(t.from,t.to,e.markFromJSON(t.mark))}}$.jsonID("removeMark",xe);class be extends ${constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return R.fromReplace(e,this.pos,this.pos+1,new w(v.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new be(this.pos,t.marks[s]);return new be(this.pos,this.mark)}}return new qe(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new be(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 be(t.pos,e.markFromJSON(t.mark))}}$.jsonID("addNodeMark",be);class qe extends ${constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return R.fromReplace(e,this.pos,this.pos+1,new w(v.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new be(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new qe(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 qe(t.pos,e.markFromJSON(t.mark))}}$.jsonID("removeNodeMark",qe);class se extends ${constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Yt(e,this.from,this.to)?R.fail("Structure replace would overwrite content"):R.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new K([this.from,this.to-this.from,this.slice.size])}invert(e){return new se(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new se(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof se)||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?w.empty:new w(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new se(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?w.empty:new w(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new se(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 se(t.from,t.to,w.fromJSON(e,t.slice),!!t.structure)}}$.jsonID("replace",se);class Me extends ${constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Yt(e,this.from,this.gapFrom)||Yt(e,this.gapTo,this.to)))return R.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return R.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?R.fromReplace(e,this.from,this.to,r):R.fail("Content does not fit in gap")}getMap(){return new K([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 Me(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new Me(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 Me(t.from,t.to,t.gapFrom,t.gapTo,w.fromJSON(e,t.slice),t.insert,!!t.structure)}}$.jsonID("replaceAround",Me);function Yt(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Wr(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let i=0;i<t.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(a,a,s);else{let f=c.contentMatchAt(a).findWrapping(s.firstChild.type);u=f&&c.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}class ze extends ${constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return R.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let s=t.type.create(r,null,t.marks);return R.fromReplace(e,this.pos,this.pos+1,new w(v.from(s),0,t.isLeaf?0:1))}getMap(){return K.empty}invert(e){return new ze(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 ze(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 ze(t.pos,t.attr,t.value)}}$.jsonID("attr",ze);class ct extends ${constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return R.ok(r)}getMap(){return K.empty}invert(e){return new ct(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 ct(t.attr,t.value)}}$.jsonID("docAttr",ct);let Ke=class extends Error{};Ke=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ke.prototype=Object.create(Error.prototype);Ke.prototype.constructor=Ke;Ke.prototype.name="TransformError";const Ft=Object.create(null);class D{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Go(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=w.empty){let r=t.content.lastChild,s=null;for(let l=0;l<t.openEnd;l++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?w.empty:t),l==0&&er(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),er(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new I(e):we(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=t<0?we(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):we(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new te(e.node(0))}static atStart(e){return we(e,e,0,0,1)||new te(e)}static atEnd(e){return we(e,e,e.content.size,e.childCount,-1)||new te(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ft[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ft)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ft[e]=t,t.prototype.jsonID=e,t}getBookmark(){return I.between(this.$anchor,this.$head).getBookmark()}}D.prototype.visible=!0;class Go{constructor(e,t){this.$from=e,this.$to=t}}let Qn=!1;function Yn(n){!Qn&&!n.parent.inlineContent&&(Qn=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class I extends D{constructor(e,t=e){Yn(e),Yn(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return D.near(r);let s=e.resolve(t.map(this.anchor));return new I(s.parent.inlineContent?s:r,r)}replace(e,t=w.empty){if(super.replace(e,t),t==w.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof I&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bt(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 I(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let i=D.findFrom(t,r,!0)||D.findFrom(t,-r,!0);if(i)t=i.$head;else return D.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(D.findFrom(e,-r,!0)||D.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new I(e,t)}}D.jsonID("text",I);class bt{constructor(e,t){this.anchor=e,this.head=t}map(e){return new bt(e.map(this.anchor),e.map(this.head))}resolve(e){return I.between(e.resolve(this.anchor),e.resolve(this.head))}}class E extends D{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),i=e.resolve(s);return r?D.near(i):new E(i)}content(){return new w(v.from(this.node),0,0)}eq(e){return e instanceof E&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new gn(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new E(e.resolve(t.anchor))}static create(e,t){return new E(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}E.prototype.visible=!1;D.jsonID("node",E);class gn{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new bt(r,r):new gn(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&E.isSelectable(r)?new E(t):D.near(t)}}class te extends D{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=w.empty){if(t==w.empty){e.delete(0,e.doc.content.size);let r=D.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new te(e)}map(e){return new te(e)}eq(e){return e instanceof te}getBookmark(){return Zo}}D.jsonID("all",te);const Zo={map(){return this},resolve(n){return new te(n)}};function we(n,e,t,r,s,i=!1){if(e.inlineContent)return I.create(n,t);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&E.isSelectable(l))return E.create(n,t-(s<0?l.nodeSize:0))}else{let a=we(n,l,t+s,s<0?l.childCount:0,s,i);if(a)return a}t+=l.nodeSize*s}return null}function er(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof se||s instanceof Me))return;let i=n.mapping.maps[r],o;i.forEach((l,a,c,u)=>{o==null&&(o=u)}),n.setSelection(D.near(n.doc.resolve(o),t))}function tr(n,e){return!e||!n?n:n.bind(e)}class Ye{constructor(e,t,r){this.name=e,this.init=tr(t.init,r),this.apply=tr(t.apply,r)}}new Ye("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ye("selection",{init(n,e){return n.selection||D.atStart(e.doc)},apply(n){return n.selection}}),new Ye("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ye("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function _r(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=_r(s,e,{})),t[r]=s}return t}class kt{constructor(e){this.spec=e,this.props={},e.props&&_r(e.props,this,this.props),this.key=e.key?e.key.key:Gr("plugin")}getState(e){return e[this.key]}}const zt=Object.create(null);function Gr(n){return n in zt?n+"$"+ ++zt[n]:(zt[n]=0,n+"$")}class yn{constructor(e="key"){this.key=Gr(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Xo=/^```([a-z]+)?[\s\n]$/,Qo=/^~~~([a-z]+)?[\s\n]$/,Yo=b.Node.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,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,i=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",b.mergeAttributes(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},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},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
13
13
 
14
- `);return!i||!o?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:s,empty:i}=t;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(D.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[b.textblockTypeInputRule({find:_o,type:this.type,getAttributes:n=>({language:n[1]})}),b.textblockTypeInputRule({find:Go,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new kt({key:new gn("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s?.mode;if(!t||!i)return!1;const{tr:o,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
15
- `));return o.replaceSelectionWith(this.type.create({language:i},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(I.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),Xo=/^\s*>\s$/,Qo=b.Node.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",b.mergeAttributes(this.options.HTMLAttributes,n),0]},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[b.wrappingInputRule({find:Xo,type:this.type})]}}),Yo=b.Node.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",b.mergeAttributes(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!b.canInsertNode(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$from:r,$to:s}=t,i=n();return r.parentOffset===0?i.insertContentAt({from:Math.max(r.pos-1,0),to:s.pos},{type:this.name}):b.isNodeSelection(t)?i.insertContentAt(s.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:o,dispatch:l})=>{var a;if(l){const{$to:c}=o.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(I.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(M.create(o.doc,c.pos)):o.setSelection(I.create(o.doc,c.pos));else{const f=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();f&&(o.insert(u,f),o.setSelection(I.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[b.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),el=b.Node.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",b.mergeAttributes(this.options.HTMLAttributes,n)]},renderText(){return`
16
- `},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:i}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const f=a.filter(h=>l.includes(h.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var ut=200,F=function(){};F.prototype.append=function(e){return e.length?(e=F.from(e),!this.length&&e||e.length<ut&&this.leafAppend(e)||this.length<ut&&e.leafPrepend(this)||this.appendInner(e)):this};F.prototype.prepend=function(e){return e.length?F.from(e).append(this):this};F.prototype.appendInner=function(e){return new tl(this,e)};F.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?F.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};F.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};F.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};F.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},t,r),s};F.from=function(e){return e instanceof F?e:e&&e.length?new _r(e):F.empty};var _r=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=ut)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=ut)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(F);F.empty=new _r([]);var tl=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(F);const nl=500;class X{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,u.push(f);return}if(s){u.push(new Y(f.map));let p=f.step.map(s.slice(i)),y;p&&o.maybeStep(p).doc&&(y=o.mapping.maps[o.mapping.maps.length-1],c.push(new Y(y,void 0,void 0,c.length+u.length))),i--,y&&s.appendMap(y,i)}else o.maybeStep(f.step);if(f.selection)return l=s?f.selection.map(s.slice(i)):f.selection,a=new X(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new Y(e.mapping.maps[u],f,t),p;(p=a&&a.merge(h))&&(h=p,u?i.pop():l=l.slice(0,l.length-1)),i.push(h),t&&(o++,t=void 0),s||(a=h)}let c=o-r.depth;return c>sl&&(l=rl(l,c),o-=c),new X(l.append(i),o)}remapping(e,t){let r=new at;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new X(this.items.append(e.map(t=>new Y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},s);let a=t;this.items.forEach(h=>{let p=i.getMirror(--a);if(p==null)return;o=Math.min(o,p);let y=i.maps[p];if(h.step){let m=e.steps[p].invert(e.docs[p]),g=h.selection&&h.selection.map(i.slice(a+1,p));g&&l++,r.push(new Y(y,m,g))}else r.push(new Y(y))},s);let c=[];for(let h=t;h<o;h++)c.push(new Y(i.maps[h]));let u=this.items.slice(0,s).append(c).append(r),f=new X(u,l);return f.emptyItemCount()>nl&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&i++;let f=new Y(c.invert(),a,u),h,p=s.length-1;(h=s.length&&s[p].merge(f))?s[p]=h:s.push(f)}}else o.map&&r--},this.items.length,0),new X(F.from(s.reverse()),i)}}X.empty=new X(F.empty,0);function rl(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class Y{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Y(t.getMap().invert(),t,this.selection)}}}class ae{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const sl=20;function il(n,e,t,r){let s=t.getMeta(ke),i;if(s)return s.historyState;t.getMeta(al)&&(n=new ae(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(ke))return o.getMeta(ke).redo?new ae(n.done.addTransform(t,void 0,r,it(e)),n.undone,tr(t.mapping.maps),n.prevTime,n.prevComposition):new ae(n.done,n.undone.addTransform(t,void 0,r,it(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!ol(t,n.prevRanges)),c=o?zt(n.prevRanges,t.mapping):tr(t.mapping.maps);return new ae(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,it(e)),X.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new ae(n.done.rebased(t,i),n.undone.rebased(t,i),zt(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new ae(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),zt(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function ol(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(t=!0)}),t}function tr(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,o)=>e.push(i,o));return e}function zt(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),i=e.map(n[r+1],-1);s<=i&&t.push(s,i)}return t}function ll(n,e,t){let r=it(e),s=ke.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new ae(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(ke,{redo:t,historyState:a})}let Bt=!1,nr=null;function it(n){let e=n.plugins;if(nr!=e){Bt=!1,nr=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Bt=!0;break}}return Bt}const ke=new gn("history"),al=new gn("closeHistory");function cl(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new kt({key:ke,state:{init(){return new ae(X.empty,X.empty,null,0,-1)},apply(e,t,r){return il(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Zr:r=="historyRedo"?Xr:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Gr(n,e){return(t,r)=>{let s=ke.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=ll(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Zr=Gr(!1,!0),Xr=Gr(!0,!0),Pe=b.Extension.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Zr(n,e),redo:()=>({state:n,dispatch:e})=>Xr(n,e)}},addProseMirrorPlugins(){return[cl(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()}}}),ul=b.Node.create({name:"doc",topNode:!0,content:"block+"}),fl=b.Node.create({name:"text",group:"inline"});function dl(n={}){return new kt({view(e){return new hl(e,n)}})}class hl{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.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 y=p.getBoundingClientRect(),m=f?y.bottom:y.top;f&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:y.left,right:y.right,top:m-g,bottom:m+g}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,p=f.height/a.offsetHeight;c=f.left-a.scrollLeft*h,u=f.top-a.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!i){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Jr(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const pl=b.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[dl(this.options)]}});var de={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:"'"},ft={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ml=typeof navigator<"u"&&/Mac/.test(navigator.platform),gl=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var B=0;B<10;B++)de[48+B]=de[96+B]=String(B);for(var B=1;B<=24;B++)de[B+111]="F"+B;for(var B=65;B<=90;B++)de[B]=String.fromCharCode(B+32),ft[B]=String.fromCharCode(B);for(var Ht in de)ft.hasOwnProperty(Ht)||(ft[Ht]=de[Ht]);function yl(n){var e=ml&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||gl&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ft:de)[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 xl=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),bl=typeof navigator<"u"&&/Win/.test(navigator.platform);function kl(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))xl?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),o&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Sl(n){let e=Object.create(null);for(let t in n)e[kl(t)]=n[t];return e}function $t(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 Cl(n){let e=Sl(n);return function(t,r){let s=yl(r),i,o=e[$t(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[$t(s,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(bl&&r.ctrlKey&&r.altKey)&&(i=de[r.keyCode])&&i!=s){let l=e[$t(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Ae=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Qr=function(n,e,t,r){return t&&(rr(n,e,t,r,-1)||rr(n,e,t,r,1))},Al=/^(img|br|input|textarea|hr)$/i;function rr(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:dt(n))){let o=n.parentNode;if(!o||o.nodeType!=1||yn(n)||Al.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ae(n)+(s<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else n=o,e=s<0?dt(n):0}else return!1}}function dt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Tl(n,e,t){for(let r=e==0,s=e==dt(n);r||s;){if(n==t)return!0;let i=Ae(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==dt(n)}}function yn(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 Yr=function(n){return n.focusNode&&Qr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function es(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const ne=typeof navigator<"u"?navigator:null,sr=typeof document<"u"?document:null,he=ne&&ne.userAgent||"",Yt=/Edge\/(\d+)/.exec(he),ts=/MSIE \d/.exec(he),en=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(he),We=!!(ts||en||Yt),ns=ts?document.documentMode:en?+en[1]:Yt?+Yt[1]:0,St=!We&&/gecko\/(\d+)/i.test(he);St&&+(/Firefox\/(\d+)/.exec(he)||[0,0])[1];const tn=!We&&/Chrome\/(\d+)/.exec(he),oe=!!tn,rs=tn?+tn[1]:0,Te=!We&&!!ne&&/Apple Computer/.test(ne.vendor),xn=Te&&(/Mobile\/\w+/.test(he)||!!ne&&ne.maxTouchPoints>2),_=xn||(ne?/Mac/.test(ne.platform):!1),ss=ne?/Win/.test(ne.platform):!1,_e=/Android \d/.test(he),bn=!!sr&&"webkitFontSmoothing"in sr.documentElement.style,El=bn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function vl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),i=s&&s.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Yr(t)){for(a=o;s&&!s.node;)s=s.parent;let f=s.node;if(s&&f.isAtom&&M.isSelectable(f)&&s.parent&&!(f.isInline&&Tl(t.focusNode,t.focusOffset,s.dom))){let h=s.posBefore;c=new M(o==h?l:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=o,h=o;for(let p=0;p<t.rangeCount;p++){let y=t.getRangeAt(p);f=Math.min(f,n.docView.posFromDOM(y.startContainer,y.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(y.endContainer,y.endOffset,-1))}if(f<0)return null;[a,o]=h==n.state.selection.anchor?[h,f]:[f,h],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=os(n,u,l,f)}return c}function is(n){return n.editable?n.hasFocus():Il(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function kn(n,e=!1){let t=n.state.selection;if(Nl(n,t),!!is(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&oe){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Qr(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)wl(n);else{let{anchor:r,head:s}=t,i,o;ir&&!(t instanceof I)&&(t.$from.parent.inlineContent||(i=or(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=or(n,t.to))),n.docView.setSelection(r,s,n,e),ir&&(i&&lr(i),o&&lr(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Ml(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ir=Te||oe&&rs<63;function or(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Te&&s&&s.contentEditable=="false")return Vt(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Vt(s);if(i)return Vt(i)}}function Vt(n){return n.contentEditable="true",Te&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function lr(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Ml(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!is(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function wl(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Ae(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&We&&ns<=11&&(t.disabled=!0,t.disabled=!1)}function Nl(n,e){if(e instanceof M){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ar(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ar(n)}function ar(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function os(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||I.between(e,t,r)}function Il(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 nn(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&D.findFrom(i,e)}function ce(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function cr(n,e,t){let r=n.state.selection;if(r instanceof I)if(t.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=n.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return ce(n,new I(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=nn(n.state,e);return s&&s instanceof M?ce(n,s):!1}else if(!(_&&t.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?M.isSelectable(i)?ce(n,new M(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):bn?ce(n,new I(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof M&&r.node.isInline)return ce(n,new I(e>0?r.$to:r.$from));{let s=nn(n.state,e);return s?ce(n,s):!1}}}function ht(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Be(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ee(n,e){return e<0?Ol(n):Dl(n)}function Ol(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(St&&t.nodeType==1&&r<ht(t)&&Be(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Be(l,-1))s=t,i=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(ls(t))break;{let l=t.previousSibling;for(;l&&Be(l,-1);)s=t.parentNode,i=Ae(l),l=l.previousSibling;if(l)t=l,r=ht(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?rn(n,t,r):s&&rn(n,s,i)}function Dl(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=ht(t),i,o;for(;;)if(r<s){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Be(l,1))i=t,o=++r;else break}else{if(ls(t))break;{let l=t.nextSibling;for(;l&&Be(l,1);)i=l.parentNode,o=Ae(l)+1,l=l.nextSibling;if(l)t=l,r=0,s=ht(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&rn(n,i,o)}function ls(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ll(n,e){for(;n&&e==n.childNodes.length&&!yn(n);)e=Ae(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 Rl(n,e){for(;n&&!e&&!yn(n);)e=Ae(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 rn(n,e,t){if(e.nodeType!=3){let i,o;(o=Ll(e,t))?(e=o,t=0):(i=Rl(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Yr(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&kn(n)},50)}function ur(n,e){let t=n.state.doc.resolve(e);if(!(oe||ss)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function fr(n,e,t){let r=n.state.selection;if(r instanceof I&&!r.empty||t.indexOf("s")>-1||_&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=nn(n.state,e);if(o&&o instanceof M)return ce(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof te?D.near(o,e):D.findFrom(o,e);return l?ce(n,l):!1}return!1}function dr(n,e){if(!(n.state.selection instanceof I))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let o=n.state.tr;return e<0?o.delete(t.pos-i.nodeSize,t.pos):o.delete(t.pos,t.pos+i.nodeSize),n.dispatch(o),!0}return!1}function hr(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Pl(n){if(!Te||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;hr(n,r,"true"),setTimeout(()=>hr(n,r,"false"),20)}return!1}function jl(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Fl(n,e){let t=e.keyCode,r=jl(e);if(t==8||_&&t==72&&r=="c")return dr(n,-1)||Ee(n,-1);if(t==46&&!e.shiftKey||_&&t==68&&r=="c")return dr(n,1)||Ee(n,1);if(t==13||t==27)return!0;if(t==37||_&&t==66&&r=="c"){let s=t==37?ur(n,n.state.selection.from)=="ltr"?-1:1:-1;return cr(n,s,r)||Ee(n,s)}else if(t==39||_&&t==70&&r=="c"){let s=t==39?ur(n,n.state.selection.from)=="ltr"?1:-1:1;return cr(n,s,r)||Ee(n,s)}else{if(t==38||_&&t==80&&r=="c")return fr(n,-1,r)||Ee(n,-1);if(t==40||_&&t==78&&r=="c")return Pl(n)||fr(n,1,r)||Ee(n,1);if(r==(_?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function as(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||xt.fromSchema(n.state.schema),l=ps(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=hs[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let y=l.createElement(u[p]);for(;a.firstChild;)y.appendChild(a.firstChild);a.appendChild(y),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
14
+ `);return!i||!o?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:s,empty:i}=t;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(D.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[b.textblockTypeInputRule({find:Xo,type:this.type,getAttributes:n=>({language:n[1]})}),b.textblockTypeInputRule({find:Qo,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new kt({key:new yn("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s?.mode;if(!t||!i)return!1;const{tr:o,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
15
+ `));return o.replaceSelectionWith(this.type.create({language:i},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(I.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),el=/^\s*>\s$/,tl=b.Node.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",b.mergeAttributes(this.options.HTMLAttributes,n),0]},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[b.wrappingInputRule({find:el,type:this.type})]}}),nl=b.Node.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",b.mergeAttributes(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!b.canInsertNode(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$from:r,$to:s}=t,i=n();return r.parentOffset===0?i.insertContentAt({from:Math.max(r.pos-1,0),to:s.pos},{type:this.name}):b.isNodeSelection(t)?i.insertContentAt(s.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:o,dispatch:l})=>{var a;if(l){const{$to:c}=o.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(I.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(E.create(o.doc,c.pos)):o.setSelection(I.create(o.doc,c.pos));else{const f=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();f&&(o.insert(u,f),o.setSelection(I.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[b.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),rl=b.Node.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",b.mergeAttributes(this.options.HTMLAttributes,n)]},renderText(){return`
16
+ `},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:i}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const f=a.filter(h=>l.includes(h.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var ut=200,F=function(){};F.prototype.append=function(e){return e.length?(e=F.from(e),!this.length&&e||e.length<ut&&this.leafAppend(e)||this.length<ut&&e.leafPrepend(this)||this.appendInner(e)):this};F.prototype.prepend=function(e){return e.length?F.from(e).append(this):this};F.prototype.appendInner=function(e){return new sl(this,e)};F.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?F.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};F.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};F.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};F.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},t,r),s};F.from=function(e){return e instanceof F?e:e&&e.length?new Zr(e):F.empty};var Zr=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=ut)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=ut)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(F);F.empty=new Zr([]);var sl=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(F);const il=500;class X{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,u.push(f);return}if(s){u.push(new Y(f.map));let p=f.step.map(s.slice(i)),g;p&&o.maybeStep(p).doc&&(g=o.mapping.maps[o.mapping.maps.length-1],c.push(new Y(g,void 0,void 0,c.length+u.length))),i--,g&&s.appendMap(g,i)}else o.maybeStep(f.step);if(f.selection)return l=s?f.selection.map(s.slice(i)):f.selection,a=new X(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new Y(e.mapping.maps[u],f,t),p;(p=a&&a.merge(h))&&(h=p,u?i.pop():l=l.slice(0,l.length-1)),i.push(h),t&&(o++,t=void 0),s||(a=h)}let c=o-r.depth;return c>ll&&(l=ol(l,c),o-=c),new X(l.append(i),o)}remapping(e,t){let r=new at;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new X(this.items.append(e.map(t=>new Y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},s);let a=t;this.items.forEach(h=>{let p=i.getMirror(--a);if(p==null)return;o=Math.min(o,p);let g=i.maps[p];if(h.step){let m=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(i.slice(a+1,p));y&&l++,r.push(new Y(g,m,y))}else r.push(new Y(g))},s);let c=[];for(let h=t;h<o;h++)c.push(new Y(i.maps[h]));let u=this.items.slice(0,s).append(c).append(r),f=new X(u,l);return f.emptyItemCount()>il&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&i++;let f=new Y(c.invert(),a,u),h,p=s.length-1;(h=s.length&&s[p].merge(f))?s[p]=h:s.push(f)}}else o.map&&r--},this.items.length,0),new X(F.from(s.reverse()),i)}}X.empty=new X(F.empty,0);function ol(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class Y{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Y(t.getMap().invert(),t,this.selection)}}}class ae{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const ll=20;function al(n,e,t,r){let s=t.getMeta(ke),i;if(s)return s.historyState;t.getMeta(fl)&&(n=new ae(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(ke))return o.getMeta(ke).redo?new ae(n.done.addTransform(t,void 0,r,it(e)),n.undone,nr(t.mapping.maps),n.prevTime,n.prevComposition):new ae(n.done,n.undone.addTransform(t,void 0,r,it(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!cl(t,n.prevRanges)),c=o?Bt(n.prevRanges,t.mapping):nr(t.mapping.maps);return new ae(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,it(e)),X.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new ae(n.done.rebased(t,i),n.undone.rebased(t,i),Bt(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new ae(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Bt(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function cl(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(t=!0)}),t}function nr(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,o)=>e.push(i,o));return e}function Bt(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),i=e.map(n[r+1],-1);s<=i&&t.push(s,i)}return t}function ul(n,e,t){let r=it(e),s=ke.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new ae(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(ke,{redo:t,historyState:a})}let Ht=!1,rr=null;function it(n){let e=n.plugins;if(rr!=e){Ht=!1,rr=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ht=!0;break}}return Ht}const ke=new yn("history"),fl=new yn("closeHistory");function dl(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new kt({key:ke,state:{init(){return new ae(X.empty,X.empty,null,0,-1)},apply(e,t,r){return al(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Qr:r=="historyRedo"?Yr:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Xr(n,e){return(t,r)=>{let s=ke.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=ul(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Qr=Xr(!1,!0),Yr=Xr(!0,!0),Pe=b.Extension.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Qr(n,e),redo:()=>({state:n,dispatch:e})=>Yr(n,e)}},addProseMirrorPlugins(){return[dl(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()}}}),hl=b.Node.create({name:"doc",topNode:!0,content:"block+"}),pl=b.Node.create({name:"text",group:"inline"});function ml(n={}){return new kt({view(e){return new gl(e,n)}})}class gl{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.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 g=p.getBoundingClientRect(),m=f?g.bottom:g.top;f&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:g.left,right:g.right,top:m-y,bottom:m+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,p=f.height/a.offsetHeight;c=f.left-a.scrollLeft*h,u=f.top-a.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!i){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Wr(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const yl=b.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[ml(this.options)]}});var de={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:"'"},ft={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},xl=typeof navigator<"u"&&/Mac/.test(navigator.platform),bl=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var B=0;B<10;B++)de[48+B]=de[96+B]=String(B);for(var B=1;B<=24;B++)de[B+111]="F"+B;for(var B=65;B<=90;B++)de[B]=String.fromCharCode(B+32),ft[B]=String.fromCharCode(B);for(var $t in de)ft.hasOwnProperty($t)||(ft[$t]=de[$t]);function kl(n){var e=xl&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||bl&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ft:de)[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 Cl=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Sl=typeof navigator<"u"&&/Win/.test(navigator.platform);function Al(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Cl?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),o&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Tl(n){let e=Object.create(null);for(let t in n)e[Al(t)]=n[t];return e}function Vt(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 vl(n){let e=Tl(n);return function(t,r){let s=kl(r),i,o=e[Vt(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[Vt(s,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Sl&&r.ctrlKey&&r.altKey)&&(i=de[r.keyCode])&&i!=s){let l=e[Vt(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Ae=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},es=function(n,e,t,r){return t&&(sr(n,e,t,r,-1)||sr(n,e,t,r,1))},wl=/^(img|br|input|textarea|hr)$/i;function sr(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:dt(n))){let o=n.parentNode;if(!o||o.nodeType!=1||xn(n)||wl.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ae(n)+(s<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else n=o,e=s<0?dt(n):0}else return!1}}function dt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function El(n,e,t){for(let r=e==0,s=e==dt(n);r||s;){if(n==t)return!0;let i=Ae(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==dt(n)}}function xn(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 ts=function(n){return n.focusNode&&es(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function ns(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const ne=typeof navigator<"u"?navigator:null,ir=typeof document<"u"?document:null,he=ne&&ne.userAgent||"",en=/Edge\/(\d+)/.exec(he),rs=/MSIE \d/.exec(he),tn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(he),We=!!(rs||tn||en),ss=rs?document.documentMode:tn?+tn[1]:en?+en[1]:0,Ct=!We&&/gecko\/(\d+)/i.test(he);Ct&&+(/Firefox\/(\d+)/.exec(he)||[0,0])[1];const nn=!We&&/Chrome\/(\d+)/.exec(he),oe=!!nn,is=nn?+nn[1]:0,Te=!We&&!!ne&&/Apple Computer/.test(ne.vendor),bn=Te&&(/Mobile\/\w+/.test(he)||!!ne&&ne.maxTouchPoints>2),G=bn||(ne?/Mac/.test(ne.platform):!1),os=ne?/Win/.test(ne.platform):!1,_e=/Android \d/.test(he),kn=!!ir&&"webkitFontSmoothing"in ir.documentElement.style,Ml=kn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Nl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),i=s&&s.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(ts(t)){for(a=o;s&&!s.node;)s=s.parent;let f=s.node;if(s&&f.isAtom&&E.isSelectable(f)&&s.parent&&!(f.isInline&&El(t.focusNode,t.focusOffset,s.dom))){let h=s.posBefore;c=new E(o==h?l:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=o,h=o;for(let p=0;p<t.rangeCount;p++){let g=t.getRangeAt(p);f=Math.min(f,n.docView.posFromDOM(g.startContainer,g.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(g.endContainer,g.endOffset,-1))}if(f<0)return null;[a,o]=h==n.state.selection.anchor?[h,f]:[f,h],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=as(n,u,l,f)}return c}function ls(n){return n.editable?n.hasFocus():Ll(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Cn(n,e=!1){let t=n.state.selection;if(Dl(n,t),!!ls(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&oe){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&es(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Ol(n);else{let{anchor:r,head:s}=t,i,o;or&&!(t instanceof I)&&(t.$from.parent.inlineContent||(i=lr(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=lr(n,t.to))),n.docView.setSelection(r,s,n,e),or&&(i&&ar(i),o&&ar(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Il(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const or=Te||oe&&is<63;function lr(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Te&&s&&s.contentEditable=="false")return qt(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return qt(s);if(i)return qt(i)}}function qt(n){return n.contentEditable="true",Te&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function ar(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Il(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!ls(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ol(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Ae(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&We&&ss<=11&&(t.disabled=!0,t.disabled=!1)}function Dl(n,e){if(e instanceof E){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(cr(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else cr(n)}function cr(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function as(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||I.between(e,t,r)}function Ll(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 rn(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&D.findFrom(i,e)}function ce(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function ur(n,e,t){let r=n.state.selection;if(r instanceof I)if(t.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=n.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return ce(n,new I(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=rn(n.state,e);return s&&s instanceof E?ce(n,s):!1}else if(!(G&&t.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?E.isSelectable(i)?ce(n,new E(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):kn?ce(n,new I(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof E&&r.node.isInline)return ce(n,new I(e>0?r.$to:r.$from));{let s=rn(n.state,e);return s?ce(n,s):!1}}}function ht(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Be(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function ve(n,e){return e<0?Rl(n):Pl(n)}function Rl(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(Ct&&t.nodeType==1&&r<ht(t)&&Be(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Be(l,-1))s=t,i=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(cs(t))break;{let l=t.previousSibling;for(;l&&Be(l,-1);)s=t.parentNode,i=Ae(l),l=l.previousSibling;if(l)t=l,r=ht(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?sn(n,t,r):s&&sn(n,s,i)}function Pl(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=ht(t),i,o;for(;;)if(r<s){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Be(l,1))i=t,o=++r;else break}else{if(cs(t))break;{let l=t.nextSibling;for(;l&&Be(l,1);)i=l.parentNode,o=Ae(l)+1,l=l.nextSibling;if(l)t=l,r=0,s=ht(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&sn(n,i,o)}function cs(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function jl(n,e){for(;n&&e==n.childNodes.length&&!xn(n);)e=Ae(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 Fl(n,e){for(;n&&!e&&!xn(n);)e=Ae(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 sn(n,e,t){if(e.nodeType!=3){let i,o;(o=jl(e,t))?(e=o,t=0):(i=Fl(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(ts(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&Cn(n)},50)}function fr(n,e){let t=n.state.doc.resolve(e);if(!(oe||os)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function dr(n,e,t){let r=n.state.selection;if(r instanceof I&&!r.empty||t.indexOf("s")>-1||G&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=rn(n.state,e);if(o&&o instanceof E)return ce(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof te?D.near(o,e):D.findFrom(o,e);return l?ce(n,l):!1}return!1}function hr(n,e){if(!(n.state.selection instanceof I))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let o=n.state.tr;return e<0?o.delete(t.pos-i.nodeSize,t.pos):o.delete(t.pos,t.pos+i.nodeSize),n.dispatch(o),!0}return!1}function pr(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function zl(n){if(!Te||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;pr(n,r,"true"),setTimeout(()=>pr(n,r,"false"),20)}return!1}function Bl(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Hl(n,e){let t=e.keyCode,r=Bl(e);if(t==8||G&&t==72&&r=="c")return hr(n,-1)||ve(n,-1);if(t==46&&!e.shiftKey||G&&t==68&&r=="c")return hr(n,1)||ve(n,1);if(t==13||t==27)return!0;if(t==37||G&&t==66&&r=="c"){let s=t==37?fr(n,n.state.selection.from)=="ltr"?-1:1:-1;return ur(n,s,r)||ve(n,s)}else if(t==39||G&&t==70&&r=="c"){let s=t==39?fr(n,n.state.selection.from)=="ltr"?1:-1:1;return ur(n,s,r)||ve(n,s)}else{if(t==38||G&&t==80&&r=="c")return dr(n,-1,r)||ve(n,-1);if(t==40||G&&t==78&&r=="c")return zl(n)||dr(n,1,r)||ve(n,1);if(r==(G?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function us(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||xt.fromSchema(n.state.schema),l=gs(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=ms[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let g=l.createElement(u[p]);for(;a.firstChild;)g.appendChild(a.firstChild);a.appendChild(g),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
17
17
 
18
- `);return{dom:a,text:h,slice:e}}function cs(n,e,t,r,s){let i=s.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(r||i||!t);if(a){if(n.someProp("transformPastedText",h=>{e=h(e,i||r,n)}),i)return l=new v(E.from(n.state.schema.text(e.replace(/\r\n?/g,`
19
- `))),0,0),n.someProp("transformPasted",h=>{l=h(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",h=>h(e,s,r,n));if(f)l=f;else{let h=s.marks(),{schema:p}=n.state,y=xt.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(y.serializeNode(p.text(m,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=$l(t),bn&&Vl(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||lt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!zl.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=ql(pr(l,+u[1],+u[2]),u[4]);else if(l=v.maxOpen(Bl(l.content,s),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=pr(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const zl=/^(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 Bl(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,o=[];if(n.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&fs(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=ds(o[o.length-1],i.length));let u=us(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return E.from(o)}return n}function us(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,E.from(n));return n}function fs(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=fs(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(E.from(us(t,n,s+1))))}}function ds(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,ds(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(E.empty,!0);return n.copy(t.append(r))}function sn(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(i=0),s<r-1&&(l=sn(l,e,t,r,s+1,i)),s>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(E.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function pr(n,e,t){return e<n.openStart&&(n=new v(sn(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new v(sn(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const hs={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 mr=null;function ps(){return mr||(mr=document.implementation.createHTMLDocument("title"))}let qt=null;function Hl(n){let e=window.trustedTypes;return e?(qt||(qt=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),qt.createHTML(n)):n}function $l(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=ps().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&hs[r[1].toLowerCase()])&&(n=s.map(i=>"<"+i+">").join("")+n+s.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=Hl(n),s)for(let i=0;i<s.length;i++)t=t.querySelector(s[i])||t;return t}function Vl(n){let e=n.querySelectorAll(oe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function ql(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:s,openStart:i,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=E.from(a.create(r[l+1],s)),i++,o++}return new v(s,i,o)}const Q={},J={};function ue(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}J.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!gs(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(_e&&oe&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),xn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",s=>s(n,es(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Fl(n,t)?t.preventDefault():ue(n,"key")};J.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};J.keypress=(n,e)=>{let t=e;if(gs(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||_&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof I)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function Ct(n){return{left:n.clientX,top:n.clientY}}function Kl(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Sn(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,l=>o>i.depth?l(n,t,i.nodeAfter,i.before(o),s,!0):l(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function Ne(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function Jl(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&M.isSelectable(r)?(Ne(n,new M(t)),!0):!1}function Ul(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof M&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(M.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(Ne(n,M.create(n.state.doc,s)),!0):!1}function Wl(n,e,t,r,s){return Sn(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?Ul(n,t):Jl(n,t))}function _l(n,e,t,r){return Sn(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function Gl(n,e,t,r){return Sn(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||Zl(n,t,r)}function Zl(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Ne(n,I.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)Ne(n,I.create(r,l+1,l+1+o.content.size));else if(M.isSelectable(o))Ne(n,M.create(r,l));else continue;return!0}}function Cn(n){return pt(n)}const ms=_?"metaKey":"ctrlKey";Q.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Cn(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&Kl(t,n.input.lastClick)&&!t[ms]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button};let o=n.posAtCoords(Ct(t));o&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Xl(n,o,t,!!r)):(i=="doubleClick"?_l:Gl)(n,o.pos,o.inside,t)?t.preventDefault():ue(n,"pointer"))};class Xl{constructor(e,t,r,s){this.view=e,this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[ms],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,o=u.depth?u.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof M&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&St&&!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)),ue(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(Ct(e))),this.updateAllowDefault(e),this.allowDefault||!t?ue(this.view,"pointer"):Wl(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Te&&this.mightDrag&&!this.mightDrag.node.isAtom||oe&&!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)?(Ne(this.view,D.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ue(this.view,"pointer")}move(e){this.updateAllowDefault(e),ue(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)}}Q.touchstart=n=>{n.input.lastTouch=Date.now(),Cn(n),ue(n,"pointer")};Q.touchmove=n=>{n.input.lastTouch=Date.now(),ue(n,"pointer")};Q.contextmenu=n=>Cn(n);function gs(n,e){return n.composing?!0:Te&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Ql=_e?5e3:-1;J.compositionstart=J.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof I&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||oe&&ss&&Yl(n)))n.markCursor=n.state.storedMarks||t.marks(),pt(n,!0),n.markCursor=null;else if(pt(n,!e.selection.empty),St&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}ys(n,Ql)};function Yl(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}J.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++,ys(n,20))};function ys(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>pt(n),e))}function ea(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=ta());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function ta(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function pt(n,e=!1){if(!(_e&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),ea(n),e||n.docView&&n.docView.dirty){let t=vl(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function na(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Je=We&&ns<15||xn&&El<604;Q.copy=J.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=Je?null:t.clipboardData,o=r.content(),{dom:l,text:a}=as(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):na(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ra(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function sa(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?on(n,r.value,null,s,e):on(n,r.textContent,r.innerHTML,s,e)},50)}function on(n,e,t,r,s){let i=cs(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,i||v.empty)))return!0;if(!i)return!1;let o=ra(i),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function xs(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," "):""}J.paste=(n,e)=>{let t=e;if(n.composing&&!_e)return;let r=Je?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&on(n,xs(r),r.getData("text/html"),s,t)?t.preventDefault():sa(n,t)};class ia{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const oa=_?"altKey":"ctrlKey";function bs(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[oa]}Q.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(Ct(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof M?s.to-1:s.to))){if(r&&r.mightDrag)o=M.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(o=M.create(n.state.doc,f.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=as(n,l);(!t.dataTransfer.files.length||!oe||rs>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Je?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Je||t.dataTransfer.setData("text/plain",c),n.dragging=new ia(u,bs(n,t),o)};Q.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};J.dragover=J.dragenter=(n,e)=>e.preventDefault();J.drop=(n,e)=>{try{la(n,e,n.dragging)}finally{n.dragging=null}};function la(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Ct(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",p=>{i=p(i,n,!1)}):i=cs(n,xs(e.dataTransfer),Je?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&bs(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||v.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Jr(n.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=n.state.tr;if(o){let{node:p}=t;p?p.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(f))return;let h=a.doc.resolve(c);if(u&&M.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new M(h));else{let p=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((y,m,g,x)=>p=x),a.setSelection(os(n,h,a.doc.resolve(p)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}Q.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))};Q.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)};Q.beforeinput=(n,e)=>{if(oe&&_e&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,es(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in J)Q[n]=J[n];function Ue(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 mt{constructor(e,t){this.toDOM=e,this.spec=t||Se,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new ee(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof mt&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ue(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class fe{constructor(e,t){this.attrs=e,this.spec=t||Se}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new ee(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof fe&&Ue(this.attrs,e.attrs)&&Ue(this.spec,e.spec)}static is(e){return e.type instanceof fe}destroy(){}}class An{constructor(e,t){this.attrs=e,this.spec=t||Se}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new ee(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof An&&Ue(this.attrs,e.attrs)&&Ue(this.spec,e.spec)}destroy(){}}class ee{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new ee(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new ee(e,e,new mt(t,r))}static inline(e,t,r,s){return new ee(e,t,new fe(r,s))}static node(e,t,r,s){return new ee(e,t,new An(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof fe}get widget(){return this.type instanceof mt}}const Me=[],Se={};class j{constructor(e,t){this.local=e.length?e:Me,this.children=t.length?t:Me}static create(e,t){return t.length?gt(t,e,0,Se):q}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,s+l,i)}}map(e,t,r){return this==q||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Se)}mapInner(e,t,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?aa(this.children,o||[],e,t,r,s,i):o?new j(o.sort(Ce),Me):q}add(e,t){return t.length?this==q?j.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Ss(t,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,u,c+1):s.splice(i,0,a,a+l.nodeSize,gt(u,l,c+1,Se)),i+=3}});let o=ks(i?Cs(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new j(o.length?this.local.concat(o).sort(Ce):this.local,s||this.children)}remove(e){return e.length==0||this==q?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+t,a=r[i+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<a&&(e[u]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=q?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new j(s,r):q}forChild(e,t){if(this==q)return this;if(t.isLeaf)return j.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof fe){let c=Math.max(i,a.from)-i,u=Math.min(o,a.to)-i;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new j(s.sort(Ce),Me);return r?new ge([l,r]):l}return r||q}eq(e){if(this==e)return!0;if(!(e instanceof j)||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 Tn(this.localsInner(e))}localsInner(e){if(this==q)return Me;if(e.inlineContent||!this.local.some(fe.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof fe||t.push(this.local[r]);return t}forEachSet(e){e(this)}}j.empty=new j([],[]);j.removeOverlap=Tn;const q=j.empty;class ge{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,Se));return ge.from(r)}forChild(e,t){if(t.isLeaf)return j.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=q&&(i instanceof ge?r=r.concat(i.members):r.push(i))}return ge.from(r)}eq(e){if(!(e instanceof ge)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?Tn(r?t:t.sort(Ce)):Me}static from(e){switch(e.length){case 0:return q;case 1:return e[0];default:return new ge(e.every(t=>t instanceof j)?e:e.reduce((t,r)=>t.concat(r instanceof j?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function aa(n,e,t,r,s,i,o){let l=n.slice();for(let c=0,u=i;c<t.maps.length;c++){let f=0;t.maps[c].forEach((h,p,y,m)=>{let g=m-y-(p-h);for(let x=0;x<l.length;x+=3){let w=l[x+1];if(w<0||h>w+u-f)continue;let N=l[x]+u-f;p>=N?l[x+1]=h<=N?-2:-1:h>=u&&g&&(l[x]+=g,l[x+1]+=g)}f+=g}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+i),f=u-s;if(f<0||f>=r.content.size){a=!0;continue}let h=t.map(n[c+1]+i,-1),p=h-s,{index:y,offset:m}=r.content.findIndex(f),g=r.maybeChild(y);if(g&&m==f&&m+g.nodeSize==p){let x=l[c+2].mapInner(t,g,u+1,n[c]+i+1,o);x!=q?(l[c]=f,l[c+1]=p,l[c+2]=x):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=ca(l,n,e,t,s,i,o),u=gt(c,r,0,o);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new j(e.sort(Ce),l)}function ks(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new ee(s.from+e,s.to+e,s.type))}return t}function ca(n,e,t,r,s,i,o){function l(a,c){for(let u=0;u<a.local.length;u++){let f=a.local[u].map(r,s,c);f?t.push(f):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function Ss(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function Cs(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function gt(n,e,t,r){let s=[],i=!1;e.forEach((l,a)=>{let c=Ss(n,l,a+t);if(c){i=!0;let u=gt(c,l,t+a+1,r);u!=q&&s.push(a,a+l.nodeSize,u)}});let o=ks(i?Cs(n):n,-t).sort(Ce);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new j(o,s):q}function Ce(n,e){return n.from-e.from||n.to-e.to}function Tn(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),gr(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),gr(e,s,r.copy(i.from,r.to)));break}}}return e}function gr(n,e,t){for(;e<n.length&&Ce(t,n[e])>0;)e++;n.splice(e,0,t)}class L extends D{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return L.valid(r)?new L(r):D.near(r)}content(){return v.empty}eq(e){return e instanceof L&&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 L(e.resolve(t.pos))}getBookmark(){return new En(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!ua(e)||!fa(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&L.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let a=e.doc.resolve(s);if(L.valid(a))return a}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!M.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=o,s+=t;let l=e.doc.resolve(s);if(L.valid(l))return l}return null}}}L.prototype.visible=!1;L.findFrom=L.findGapCursorFrom;D.jsonID("gapcursor",L);class En{constructor(e){this.pos=e}map(e){return new En(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return L.valid(t)?new L(t):D.near(t)}}function As(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function ua(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||As(s.type))return!0;if(s.inlineContent)return!1}}return!0}function fa(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||As(s.type))return!0;if(s.inlineContent)return!1}}return!0}function da(){return new kt({props:{decorations:ga,createSelectionBetween(n,e,t){return e.pos==t.pos&&L.valid(t)?new L(t):null},handleClick:pa,handleKeyDown:ha,handleDOMEvents:{beforeinput:ma}}})}const ha=Cl({ArrowLeft:et("horiz",-1),ArrowRight:et("horiz",1),ArrowUp:et("vert",-1),ArrowDown:et("vert",1)});function et(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof I){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=L.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new L(c))),!0):!1}}function pa(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!L.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&M.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new L(r))),!0)}function ma(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof L))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=E.empty;for(let o=r.length-1;o>=0;o--)s=E.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new v(s,0,0));return i.setSelection(I.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function ga(n){if(!(n.selection instanceof L))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",j.create(n.doc,[ee.widget(n.selection.head,e,{key:"gapcursor"})])}const ya=b.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[da()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=b.callOrReturn(b.getExtensionField(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Le={bold:{category:"mark",extension:mo,priority:100},italic:{category:"mark",extension:ko,priority:100},strike:{category:"mark",extension:Ao,priority:100},underline:{category:"mark",extension:Is.Underline,priority:100},code:{category:"mark",extension:vo,priority:100},textColor:{category:"mark",extension:Os.Color,defaultOptions:{types:["textStyle"]},priority:90},highlight:{category:"mark",extension:Ds.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Ls.Link,defaultOptions:{openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:No,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Do,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Ro,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Rs.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Zo,priority:100},blockquote:{category:"node",extension:Qo,priority:100},horizontalRule:{category:"node",extension:Yo,priority:100},hardBreak:{category:"node",extension:el,priority:100},undo:{category:"extension",extension:Pe,priority:50},redo:{category:"extension",extension:Pe,priority:50},textAlign:{category:"extension",extension:js.TextAlign,defaultOptions:{types:["heading","paragraph","listItem"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:Pe,priority:50},clearNodes:{category:"extension",extension:Pe,priority:50}},xa=[ul,fl,Io,wo,Po,Ps.TaskItem,Pe,pl,ya];function ba(n){const e=[],t=new Set,r=new Set;xa.forEach(l=>{l&&(e.push(l),r.add(l.name),l.name==="history"&&(t.add("undo"),t.add("redo")))});const s=n.map(l=>$e(l)),i=new Set;return s.forEach(l=>{const a=Le[l];a?.requiredExtensions&&a.requiredExtensions.forEach(c=>{i.add(c)})}),i.forEach(l=>{if(t.has(l))return;const a=Le[l];if(!a||a.extension===null)return;const c=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(c),t.add(l)}),s.forEach(l=>{if(t.has(l))return;const a=Le[l];if(!a||a.extension===null){console.warn(`Extension not found or not installed for modifier: ${l}`);return}if(a.extension.name==="history"&&t.has("undo"))return;const c=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(c),t.add(l),(l==="undo"||l==="redo")&&(t.add("undo"),t.add("redo"))}),e.sort((l,a)=>{const c=Object.values(Le).find(p=>p?.extension?.name===l.name),u=Object.values(Le).find(p=>p?.extension?.name===a.name),f=c?.priority??100;return(u?.priority??100)-f})}const Ts={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},ka=({modifiers:n,zoom:e,onZoomChange:t,onToolbarAction:r})=>{const{editor:s}=an.useCurrentEditor();return d.jsx(co,{editor:s,modifiers:n,zoom:e,onZoomChange:t,onToolbarAction:r})},Sa=({showCharacterCount:n,showWordCount:e})=>{const{editor:t}=an.useCurrentEditor();if(!t||!n&&!e)return null;const r=t.getText(),s=r.length,i=r.split(/\s+/).filter(o=>o.length>0).length;return d.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[n&&d.jsxs("span",{children:[s," characters"]}),e&&d.jsxs("span",{children:[i," words"]})]})},ln=k.forwardRef((n,e)=>{const{minRows:t=10,maxRows:r=30,disableAutosize:s=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:a=Ts.full,variant:c="bordered",initialContent:u,content:f,onContentChange:h,onUpdate:p,onToolbarAction:y,isReadOnly:m=!1,isDisabled:g=!1,...x}=n,{zoom:w,setZoom:N}=oo(),O=zn.lineHeight,P=t*O,T=s?void 0:r*O,C=k.useMemo(()=>ba(a),[a]),{Component:V,label:U,shouldLabelBeOutside:W,getBaseProps:At,getLabelProps:Tt,getInputWrapperProps:Ge}=A.useInput({...x,variant:c,ref:e,isMultiline:!0}),Ze=U?d.jsx("label",{...Tt(),children:U}):null,z=k.useCallback(({editor:re})=>{const Et=re.getHTML(),Ms=re.getJSON(),vt=re.getText(),ws=vt.length,Ns=vt.split(/\s+/).filter(Mt=>Mt.length>0).length,vn={html:Et,json:Ms,text:vt,characters:ws,words:Ns};if(h?.(vn),p?.(vn),"onChange"in x&&typeof x.onChange=="function"){const Mt={target:{value:Et},currentTarget:{value:Et}};x.onChange(Mt)}},[h,p,x]);return d.jsxs(V,{...At(),children:[W?Ze:null,d.jsx("div",{...Ge(),className:A.cn(Ge().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:T?`${T+zn.toolbarHeight}px`:void 0,overflow:T?"auto":void 0},children:d.jsx(an.EditorProvider,{editable:!m&&!g,slotBefore:l?d.jsx(ka,{modifiers:a,zoom:w,onZoomChange:N,onToolbarAction:y}):void 0,slotAfter:d.jsx(Sa,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${P}px`,fontSize:`${w}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:C,content:f||u||n.defaultValue||"",onUpdate:z})})]})});ln.displayName="TipTapEditor";const Es=k.forwardRef((n,e)=>{const{adapter:t="tiptap",variant:r="bordered",...s}=n;return t==="tiptap"?d.jsx(ln,{...s,variant:r,ref:e}):(console.warn(`Adapter "${t}" is not supported. Using TipTap.`),d.jsx(ln,{...s,variant:r,ref:e}))});Es.displayName="RichTextArea";function Ca(n,e="en-US",t="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:2}).format(n)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${t} ${n.toFixed(2)}`}}const yr=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Aa={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount"},vs=({presetAmounts:n=yr,selectedDonation:e,defaultSelectedDonation:t=null,onChange:r,currency:s="USD",locale:i="en-US",showCustomAmount:o=!0,minCustomAmount:l=.5,maxCustomAmount:a=1e6,labels:c,mobileColumns:u=2,desktopColumns:f=3,isDisabled:h=!1,buttonVariant:p="bordered",buttonColor:y="default",inputVariant:m="bordered",className:g="",showCard:x=!0})=>{const w={...Aa,...c},N=Array.isArray(n)?n:yr,O={2:"grid-cols-2",3:"grid-cols-3"},P={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},T=`${O[u]} ${P[f]}`,[C,V]=hn(e,t,r),[U,W]=k.useState(""),At=k.useCallback(z=>{if(h)return;const re={amount:z.amount,isCustom:!1,presetId:z.id};V(re),W("")},[h,V]),Tt=k.useCallback(z=>{if(h)return;if(W(z!==void 0?String(z):""),z===void 0||isNaN(z)){V(null);return}V({amount:z,isCustom:!0})},[h,V]),Ge=k.useMemo(()=>({style:"currency",currency:s,currencyDisplay:"symbol"}),[s]),Ze=d.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[w.title&&d.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:w.title}),N.length>0&&d.jsx("div",{className:A.cn("grid gap-3",T),"data-testid":"donation-amounts-presets",children:N.map(z=>{const re=C!==null&&!C.isCustom&&C.presetId===z.id;return d.jsx(Z,{color:re?"primary":y,variant:re?"solid":p,className:"w-full",onPress:()=>At(z),isDisabled:h,"data-testid":`donation-amounts-preset-${z.id}`,children:z.label||Ca(z.amount,i,s)},z.id)})}),o&&d.jsx(A.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,variant:m,radius:"md",minValue:l,maxValue:a,step:.01,formatOptions:Ge,value:U!==""?parseFloat(U):void 0,onValueChange:Tt,isDisabled:h,"data-testid":"donation-amounts-custom-input"},C?.isCustom===!1?C.presetId:"custom")]});return x?d.jsx(A.Card,{className:A.cn("w-full",g),"data-testid":"donation-amounts-card",children:d.jsx(A.CardBody,{children:Ze})}):d.jsx("div",{className:A.cn("w-full",g),"data-testid":"donation-amounts-plain",children:Ze})};vs.displayName="DonationAmounts";const Ta=n=>{const e=Math.max(0,n),t=Math.floor(e/60).toString().padStart(2,"0"),r=(e%60).toString().padStart(2,"0");return`${t}:${r} minutes`},Ea=n=>{switch(n){case"warning":return S.Clock;case"error":return S.AlertCircle;case"success":return S.CheckCircle;default:return S.Clock}},va=n=>{switch(n){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Ma=k.forwardRef(({timeLeft:n,defaultTimeLeft:e=1200,onTimeChange:t,onExpire:r,variant:s="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:a,position:c="fixed",autoStart:u=!0,formatTime:f=Ta,className:h,...p},y)=>{const[m,g]=hn(n!==void 0?Math.max(0,n):void 0,Math.max(0,e),t),x=k.useRef(null),w=k.useRef(!1);k.useEffect(()=>()=>{x.current&&clearInterval(x.current)},[]),k.useEffect(()=>{if(!u||m<=0){x.current&&(clearInterval(x.current),x.current=null);return}return x.current=setInterval(()=>{g(T=>T<=1?(x.current&&(clearInterval(x.current),x.current=null),w.current||(w.current=!0,r?.()),0):T-1)},1e3),()=>{x.current&&(clearInterval(x.current),x.current=null)}},[u,m,g,r]),k.useEffect(()=>{m>0&&(w.current=!1)},[m]);const N=a||Ea(s),O=va(i),P={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return d.jsx("div",{ref:y,role:"banner","aria-live":"polite","aria-label":`${o} ${f(m)}`,"data-testid":"expire-cart-timer",className:A.cn("w-full text-white z-50",O,P[c],h),...p,children:d.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:d.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[d.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&d.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:d.jsx(N,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),d.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),d.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:d.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${f(m)}`,"data-testid":"expire-cart-timer-value",children:f(m)})})]})})})});Ma.displayName="ExpireCartTimer";function wa(n){return d.jsx("div",{className:"min-h-screen flex flex-col",children:d.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:d.jsx(A.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}function Na(n){return d.jsx("div",{className:"min-h-screen flex flex-col",children:d.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:d.jsx(A.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}exports.Button=Z;exports.ConfirmationPageTemplate=wa;exports.DonationAmounts=vs;exports.EventDetailsTemplate=Na;exports.Footer=_i;exports.HeroUIProvider=Hs;exports.Navbar=Ji;exports.RICH_TEXT_PRESETS=Ts;exports.RichTextArea=Es;exports.Stepper=Or;exports.colors=Kt;exports.spacing=Fs;exports.theme=Bs;exports.typography=zs;Object.keys(A).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(exports,n)&&Object.defineProperty(exports,n,{enumerable:!0,get:()=>A[n]})});
18
+ `);return{dom:a,text:h,slice:e}}function fs(n,e,t,r,s){let i=s.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(r||i||!t);if(a){if(n.someProp("transformPastedText",h=>{e=h(e,i||r,n)}),i)return l=new w(v.from(n.state.schema.text(e.replace(/\r\n?/g,`
19
+ `))),0,0),n.someProp("transformPasted",h=>{l=h(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",h=>h(e,s,r,n));if(f)l=f;else{let h=s.marks(),{schema:p}=n.state,g=xt.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=o.appendChild(document.createElement("p"));m&&y.appendChild(g.serializeNode(p.text(m,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=Kl(t),kn&&Jl(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||lt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!$l.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Ul(mr(l,+u[1],+u[2]),u[4]);else if(l=w.maxOpen(Vl(l.content,s),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=mr(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const $l=/^(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 Vl(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,o=[];if(n.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&hs(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=ps(o[o.length-1],i.length));let u=ds(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return v.from(o)}return n}function ds(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,v.from(n));return n}function hs(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=hs(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(v.from(ds(t,n,s+1))))}}function ps(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,ps(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(v.empty,!0);return n.copy(t.append(r))}function on(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(i=0),s<r-1&&(l=on(l,e,t,r,s+1,i)),s>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(v.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function mr(n,e,t){return e<n.openStart&&(n=new w(on(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new w(on(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const ms={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 gr=null;function gs(){return gr||(gr=document.implementation.createHTMLDocument("title"))}let Kt=null;function ql(n){let e=window.trustedTypes;return e?(Kt||(Kt=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Kt.createHTML(n)):n}function Kl(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=gs().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&ms[r[1].toLowerCase()])&&(n=s.map(i=>"<"+i+">").join("")+n+s.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=ql(n),s)for(let i=0;i<s.length;i++)t=t.querySelector(s[i])||t;return t}function Jl(n){let e=n.querySelectorAll(oe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Ul(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:s,openStart:i,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=v.from(a.create(r[l+1],s)),i++,o++}return new w(s,i,o)}const Q={},U={};function ue(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}U.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!xs(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(_e&&oe&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),bn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",s=>s(n,ns(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Hl(n,t)?t.preventDefault():ue(n,"key")};U.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};U.keypress=(n,e)=>{let t=e;if(xs(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||G&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof I)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function St(n){return{left:n.clientX,top:n.clientY}}function Wl(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Sn(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,l=>o>i.depth?l(n,t,i.nodeAfter,i.before(o),s,!0):l(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function Ne(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function _l(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(Ne(n,new E(t)),!0):!1}function Gl(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof E&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(E.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(Ne(n,E.create(n.state.doc,s)),!0):!1}function Zl(n,e,t,r,s){return Sn(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?Gl(n,t):_l(n,t))}function Xl(n,e,t,r){return Sn(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function Ql(n,e,t,r){return Sn(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||Yl(n,t,r)}function Yl(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Ne(n,I.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)Ne(n,I.create(r,l+1,l+1+o.content.size));else if(E.isSelectable(o))Ne(n,E.create(r,l));else continue;return!0}}function An(n){return pt(n)}const ys=G?"metaKey":"ctrlKey";Q.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=An(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&Wl(t,n.input.lastClick)&&!t[ys]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button};let o=n.posAtCoords(St(t));o&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new ea(n,o,t,!!r)):(i=="doubleClick"?Xl:Ql)(n,o.pos,o.inside,t)?t.preventDefault():ue(n,"pointer"))};class ea{constructor(e,t,r,s){this.view=e,this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[ys],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,o=u.depth?u.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof E&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ct&&!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)),ue(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(()=>Cn(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(St(e))),this.updateAllowDefault(e),this.allowDefault||!t?ue(this.view,"pointer"):Zl(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Te&&this.mightDrag&&!this.mightDrag.node.isAtom||oe&&!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)?(Ne(this.view,D.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ue(this.view,"pointer")}move(e){this.updateAllowDefault(e),ue(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)}}Q.touchstart=n=>{n.input.lastTouch=Date.now(),An(n),ue(n,"pointer")};Q.touchmove=n=>{n.input.lastTouch=Date.now(),ue(n,"pointer")};Q.contextmenu=n=>An(n);function xs(n,e){return n.composing?!0:Te&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const ta=_e?5e3:-1;U.compositionstart=U.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof I&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||oe&&os&&na(n)))n.markCursor=n.state.storedMarks||t.marks(),pt(n,!0),n.markCursor=null;else if(pt(n,!e.selection.empty),Ct&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}bs(n,ta)};function na(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}U.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++,bs(n,20))};function bs(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>pt(n),e))}function ra(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=sa());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function sa(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function pt(n,e=!1){if(!(_e&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),ra(n),e||n.docView&&n.docView.dirty){let t=Nl(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function ia(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Je=We&&ss<15||bn&&Ml<604;Q.copy=U.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=Je?null:t.clipboardData,o=r.content(),{dom:l,text:a}=us(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):ia(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function oa(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function la(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ln(n,r.value,null,s,e):ln(n,r.textContent,r.innerHTML,s,e)},50)}function ln(n,e,t,r,s){let i=fs(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,i||w.empty)))return!0;if(!i)return!1;let o=oa(i),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ks(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," "):""}U.paste=(n,e)=>{let t=e;if(n.composing&&!_e)return;let r=Je?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ln(n,ks(r),r.getData("text/html"),s,t)?t.preventDefault():la(n,t)};class aa{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const ca=G?"altKey":"ctrlKey";function Cs(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[ca]}Q.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(St(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof E?s.to-1:s.to))){if(r&&r.mightDrag)o=E.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(o=E.create(n.state.doc,f.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=us(n,l);(!t.dataTransfer.files.length||!oe||is>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Je?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Je||t.dataTransfer.setData("text/plain",c),n.dragging=new aa(u,Cs(n,t),o)};Q.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};U.dragover=U.dragenter=(n,e)=>e.preventDefault();U.drop=(n,e)=>{try{ua(n,e,n.dragging)}finally{n.dragging=null}};function ua(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(St(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",p=>{i=p(i,n,!1)}):i=fs(n,ks(e.dataTransfer),Je?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&Cs(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||w.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Wr(n.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=n.state.tr;if(o){let{node:p}=t;p?p.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(f))return;let h=a.doc.resolve(c);if(u&&E.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new E(h));else{let p=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((g,m,y,x)=>p=x),a.setSelection(as(n,h,a.doc.resolve(p)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}Q.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())&&Cn(n)},20))};Q.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)};Q.beforeinput=(n,e)=>{if(oe&&_e&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,ns(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in U)Q[n]=U[n];function Ue(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 mt{constructor(e,t){this.toDOM=e,this.spec=t||Ce,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new ee(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof mt&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ue(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class fe{constructor(e,t){this.attrs=e,this.spec=t||Ce}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new ee(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof fe&&Ue(this.attrs,e.attrs)&&Ue(this.spec,e.spec)}static is(e){return e.type instanceof fe}destroy(){}}class Tn{constructor(e,t){this.attrs=e,this.spec=t||Ce}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new ee(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof Tn&&Ue(this.attrs,e.attrs)&&Ue(this.spec,e.spec)}destroy(){}}class ee{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new ee(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new ee(e,e,new mt(t,r))}static inline(e,t,r,s){return new ee(e,t,new fe(r,s))}static node(e,t,r,s){return new ee(e,t,new Tn(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof fe}get widget(){return this.type instanceof mt}}const Ee=[],Ce={};class j{constructor(e,t){this.local=e.length?e:Ee,this.children=t.length?t:Ee}static create(e,t){return t.length?gt(t,e,0,Ce):q}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,s+l,i)}}map(e,t,r){return this==q||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Ce)}mapInner(e,t,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?fa(this.children,o||[],e,t,r,s,i):o?new j(o.sort(Se),Ee):q}add(e,t){return t.length?this==q?j.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=As(t,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,u,c+1):s.splice(i,0,a,a+l.nodeSize,gt(u,l,c+1,Ce)),i+=3}});let o=Ss(i?Ts(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new j(o.length?this.local.concat(o).sort(Se):this.local,s||this.children)}remove(e){return e.length==0||this==q?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+t,a=r[i+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<a&&(e[u]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=q?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new j(s,r):q}forChild(e,t){if(this==q)return this;if(t.isLeaf)return j.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof fe){let c=Math.max(i,a.from)-i,u=Math.min(o,a.to)-i;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new j(s.sort(Se),Ee);return r?new ge([l,r]):l}return r||q}eq(e){if(this==e)return!0;if(!(e instanceof j)||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 vn(this.localsInner(e))}localsInner(e){if(this==q)return Ee;if(e.inlineContent||!this.local.some(fe.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof fe||t.push(this.local[r]);return t}forEachSet(e){e(this)}}j.empty=new j([],[]);j.removeOverlap=vn;const q=j.empty;class ge{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,Ce));return ge.from(r)}forChild(e,t){if(t.isLeaf)return j.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=q&&(i instanceof ge?r=r.concat(i.members):r.push(i))}return ge.from(r)}eq(e){if(!(e instanceof ge)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?vn(r?t:t.sort(Se)):Ee}static from(e){switch(e.length){case 0:return q;case 1:return e[0];default:return new ge(e.every(t=>t instanceof j)?e:e.reduce((t,r)=>t.concat(r instanceof j?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function fa(n,e,t,r,s,i,o){let l=n.slice();for(let c=0,u=i;c<t.maps.length;c++){let f=0;t.maps[c].forEach((h,p,g,m)=>{let y=m-g-(p-h);for(let x=0;x<l.length;x+=3){let M=l[x+1];if(M<0||h>M+u-f)continue;let N=l[x]+u-f;p>=N?l[x+1]=h<=N?-2:-1:h>=u&&y&&(l[x]+=y,l[x+1]+=y)}f+=y}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+i),f=u-s;if(f<0||f>=r.content.size){a=!0;continue}let h=t.map(n[c+1]+i,-1),p=h-s,{index:g,offset:m}=r.content.findIndex(f),y=r.maybeChild(g);if(y&&m==f&&m+y.nodeSize==p){let x=l[c+2].mapInner(t,y,u+1,n[c]+i+1,o);x!=q?(l[c]=f,l[c+1]=p,l[c+2]=x):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=da(l,n,e,t,s,i,o),u=gt(c,r,0,o);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new j(e.sort(Se),l)}function Ss(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new ee(s.from+e,s.to+e,s.type))}return t}function da(n,e,t,r,s,i,o){function l(a,c){for(let u=0;u<a.local.length;u++){let f=a.local[u].map(r,s,c);f?t.push(f):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function As(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function Ts(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function gt(n,e,t,r){let s=[],i=!1;e.forEach((l,a)=>{let c=As(n,l,a+t);if(c){i=!0;let u=gt(c,l,t+a+1,r);u!=q&&s.push(a,a+l.nodeSize,u)}});let o=Ss(i?Ts(n):n,-t).sort(Se);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new j(o,s):q}function Se(n,e){return n.from-e.from||n.to-e.to}function vn(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),yr(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),yr(e,s,r.copy(i.from,r.to)));break}}}return e}function yr(n,e,t){for(;e<n.length&&Se(t,n[e])>0;)e++;n.splice(e,0,t)}class L extends D{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return L.valid(r)?new L(r):D.near(r)}content(){return w.empty}eq(e){return e instanceof L&&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 L(e.resolve(t.pos))}getBookmark(){return new wn(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!ha(e)||!pa(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&L.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let a=e.doc.resolve(s);if(L.valid(a))return a}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!E.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=o,s+=t;let l=e.doc.resolve(s);if(L.valid(l))return l}return null}}}L.prototype.visible=!1;L.findFrom=L.findGapCursorFrom;D.jsonID("gapcursor",L);class wn{constructor(e){this.pos=e}map(e){return new wn(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return L.valid(t)?new L(t):D.near(t)}}function vs(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function ha(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||vs(s.type))return!0;if(s.inlineContent)return!1}}return!0}function pa(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||vs(s.type))return!0;if(s.inlineContent)return!1}}return!0}function ma(){return new kt({props:{decorations:ba,createSelectionBetween(n,e,t){return e.pos==t.pos&&L.valid(t)?new L(t):null},handleClick:ya,handleKeyDown:ga,handleDOMEvents:{beforeinput:xa}}})}const ga=vl({ArrowLeft:et("horiz",-1),ArrowRight:et("horiz",1),ArrowUp:et("vert",-1),ArrowDown:et("vert",1)});function et(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof I){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=L.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new L(c))),!0):!1}}function ya(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!L.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&E.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new L(r))),!0)}function xa(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof L))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=v.empty;for(let o=r.length-1;o>=0;o--)s=v.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new w(s,0,0));return i.setSelection(I.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function ba(n){if(!(n.selection instanceof L))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",j.create(n.doc,[ee.widget(n.selection.head,e,{key:"gapcursor"})])}const ka=b.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[ma()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=b.callOrReturn(b.getExtensionField(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Le={bold:{category:"mark",extension:xo,priority:100},italic:{category:"mark",extension:Ao,priority:100},strike:{category:"mark",extension:wo,priority:100},underline:{category:"mark",extension:Ds.Underline,priority:100},code:{category:"mark",extension:No,priority:100},textColor:{category:"mark",extension:Ls.Color,defaultOptions:{types:["textStyle"]},priority:90},highlight:{category:"mark",extension:Rs.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Ps.Link,defaultOptions:{openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Do,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Po,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Fo,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:js.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Yo,priority:100},blockquote:{category:"node",extension:tl,priority:100},horizontalRule:{category:"node",extension:nl,priority:100},hardBreak:{category:"node",extension:rl,priority:100},undo:{category:"extension",extension:Pe,priority:50},redo:{category:"extension",extension:Pe,priority:50},textAlign:{category:"extension",extension:zs.TextAlign,defaultOptions:{types:["heading","paragraph","listItem"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:Pe,priority:50},clearNodes:{category:"extension",extension:Pe,priority:50}},Ca=[hl,pl,Lo,Oo,zo,Fs.TaskItem,Pe,yl,ka];function Sa(n){const e=[],t=new Set,r=new Set;Ca.forEach(l=>{l&&(e.push(l),r.add(l.name),l.name==="history"&&(t.add("undo"),t.add("redo")))});const s=n.map(l=>$e(l)),i=new Set;return s.forEach(l=>{const a=Le[l];a?.requiredExtensions&&a.requiredExtensions.forEach(c=>{i.add(c)})}),i.forEach(l=>{if(t.has(l))return;const a=Le[l];if(!a||a.extension===null)return;const c=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(c),t.add(l)}),s.forEach(l=>{if(t.has(l))return;const a=Le[l];if(!a||a.extension===null){console.warn(`Extension not found or not installed for modifier: ${l}`);return}if(a.extension.name==="history"&&t.has("undo"))return;const c=a.defaultOptions?a.extension.configure(a.defaultOptions):a.extension;e.push(c),t.add(l),(l==="undo"||l==="redo")&&(t.add("undo"),t.add("redo"))}),e.sort((l,a)=>{const c=Object.values(Le).find(p=>p?.extension?.name===l.name),u=Object.values(Le).find(p=>p?.extension?.name===a.name),f=c?.priority??100;return(u?.priority??100)-f})}const ws={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},Aa=({modifiers:n,zoom:e,onZoomChange:t,onToolbarAction:r})=>{const{editor:s}=cn.useCurrentEditor();return d.jsx(ho,{editor:s,modifiers:n,zoom:e,onZoomChange:t,onToolbarAction:r})},Ta=({showCharacterCount:n,showWordCount:e})=>{const{editor:t}=cn.useCurrentEditor();if(!t||!n&&!e)return null;const r=t.getText(),s=r.length,i=r.split(/\s+/).filter(o=>o.length>0).length;return d.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[n&&d.jsxs("span",{children:[s," characters"]}),e&&d.jsxs("span",{children:[i," words"]})]})},an=k.forwardRef((n,e)=>{const{minRows:t=10,maxRows:r=30,disableAutosize:s=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:a=ws.full,variant:c="bordered",initialContent:u,content:f,onContentChange:h,onUpdate:p,onToolbarAction:g,isReadOnly:m=!1,isDisabled:y=!1,...x}=n,{zoom:M,setZoom:N}=co(),O=Bn.lineHeight,P=t*O,T=s?void 0:r*O,A=k.useMemo(()=>Sa(a),[a]),{Component:V,label:W,shouldLabelBeOutside:_,getBaseProps:At,getLabelProps:Tt,getInputWrapperProps:Ge}=C.useInput({...x,variant:c,ref:e,isMultiline:!0}),Ze=W?d.jsx("label",{...Tt(),children:W}):null,z=k.useCallback(({editor:re})=>{const vt=re.getHTML(),Ns=re.getJSON(),wt=re.getText(),Is=wt.length,Os=wt.split(/\s+/).filter(Et=>Et.length>0).length,En={html:vt,json:Ns,text:wt,characters:Is,words:Os};if(h?.(En),p?.(En),"onChange"in x&&typeof x.onChange=="function"){const Et={target:{value:vt},currentTarget:{value:vt}};x.onChange(Et)}},[h,p,x]);return d.jsxs(V,{...At(),children:[_?Ze:null,d.jsx("div",{...Ge(),className:C.cn(Ge().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:T?`${T+Bn.toolbarHeight}px`:void 0,overflow:T?"auto":void 0},children:d.jsx(cn.EditorProvider,{editable:!m&&!y,slotBefore:l?d.jsx(Aa,{modifiers:a,zoom:M,onZoomChange:N,onToolbarAction:g}):void 0,slotAfter:d.jsx(Ta,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${P}px`,fontSize:`${M}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:A,content:f||u||n.defaultValue||"",onUpdate:z})})]})});an.displayName="TipTapEditor";const Es=k.forwardRef((n,e)=>{const{adapter:t="tiptap",variant:r="bordered",...s}=n;return t==="tiptap"?d.jsx(an,{...s,variant:r,ref:e}):(console.warn(`Adapter "${t}" is not supported. Using TipTap.`),d.jsx(an,{...s,variant:r,ref:e}))});Es.displayName="RichTextArea";function va(n,e="en-US",t="USD"){try{return new Intl.NumberFormat(e,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:2}).format(n)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${t} ${n.toFixed(2)}`}}const xr=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],wa={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount"},Ms=({presetAmounts:n=xr,selectedDonation:e,defaultSelectedDonation:t=null,onChange:r,currency:s="USD",locale:i="en-US",showCustomAmount:o=!0,minCustomAmount:l=.5,maxCustomAmount:a=1e6,labels:c,mobileColumns:u=2,desktopColumns:f=3,isDisabled:h=!1,buttonVariant:p="bordered",buttonColor:g="default",inputVariant:m="bordered",className:y="",showCard:x=!0})=>{const M={...wa,...c},N=Array.isArray(n)?n:xr,O={2:"grid-cols-2",3:"grid-cols-3"},P={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},T=`${O[u]} ${P[f]}`,[A,V]=pn(e,t,r),[W,_]=k.useState(""),At=k.useCallback(z=>{if(h)return;const re={amount:z.amount,isCustom:!1,presetId:z.id};V(re),_("")},[h,V]),Tt=k.useCallback(z=>{if(h)return;if(_(z!==void 0?String(z):""),z===void 0||isNaN(z)){V(null);return}V({amount:z,isCustom:!0})},[h,V]),Ge=k.useMemo(()=>({style:"currency",currency:s,currencyDisplay:"symbol"}),[s]),Ze=d.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[M.title&&d.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:M.title}),N.length>0&&d.jsx("div",{className:C.cn("grid gap-3",T),"data-testid":"donation-amounts-presets",children:N.map(z=>{const re=A!==null&&!A.isCustom&&A.presetId===z.id;return d.jsx(J,{color:re?"primary":g,variant:re?"solid":p,className:"w-full",onPress:()=>At(z),isDisabled:h,"data-testid":`donation-amounts-preset-${z.id}`,children:z.label||va(z.amount,i,s)},z.id)})}),o&&d.jsx(C.NumberInput,{placeholder:M.customAmountPlaceholder,"aria-label":M.customAmountAriaLabel,variant:m,radius:"md",minValue:l,maxValue:a,step:.01,formatOptions:Ge,value:W!==""?parseFloat(W):void 0,onValueChange:Tt,isDisabled:h,"data-testid":"donation-amounts-custom-input"},A?.isCustom===!1?A.presetId:"custom")]});return x?d.jsx(C.Card,{className:C.cn("w-full",y),"data-testid":"donation-amounts-card",children:d.jsx(C.CardBody,{children:Ze})}):d.jsx("div",{className:C.cn("w-full",y),"data-testid":"donation-amounts-plain",children:Ze})};Ms.displayName="DonationAmounts";const Ea=n=>{const e=Math.max(0,n),t=Math.floor(e/60).toString().padStart(2,"0"),r=(e%60).toString().padStart(2,"0");return`${t}:${r} minutes`},Ma=n=>{switch(n){case"warning":return S.Clock;case"error":return S.AlertCircle;case"success":return S.CheckCircle;default:return S.Clock}},Na=n=>{switch(n){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Ia=k.forwardRef(({timeLeft:n,defaultTimeLeft:e=1200,onTimeChange:t,onExpire:r,variant:s="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:a,position:c="fixed",autoStart:u=!0,formatTime:f=Ea,className:h,...p},g)=>{const[m,y]=pn(n!==void 0?Math.max(0,n):void 0,Math.max(0,e),t),x=k.useRef(null),M=k.useRef(!1);k.useEffect(()=>()=>{x.current&&clearInterval(x.current)},[]),k.useEffect(()=>{if(!u||m<=0){x.current&&(clearInterval(x.current),x.current=null);return}return x.current=setInterval(()=>{y(T=>T<=1?(x.current&&(clearInterval(x.current),x.current=null),M.current||(M.current=!0,r?.()),0):T-1)},1e3),()=>{x.current&&(clearInterval(x.current),x.current=null)}},[u,m,y,r]),k.useEffect(()=>{m>0&&(M.current=!1)},[m]);const N=a||Ma(s),O=Na(i),P={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return d.jsx("div",{ref:g,role:"banner","aria-live":"polite","aria-label":`${o} ${f(m)}`,"data-testid":"expire-cart-timer",className:C.cn("w-full text-white z-50",O,P[c],h),...p,children:d.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:d.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[d.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&d.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:d.jsx(N,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),d.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),d.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:d.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${f(m)}`,"data-testid":"expire-cart-timer-value",children:f(m)})})]})})})});Ia.displayName="ExpireCartTimer";function Oa(n){return d.jsx("div",{className:"min-h-screen flex flex-col",children:d.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:d.jsx(C.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}function Da(n){return d.jsx("div",{className:"min-h-screen flex flex-col",children:d.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:d.jsx(C.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}exports.Button=J;exports.ConfirmationPageTemplate=Oa;exports.DonationAmounts=Ms;exports.EventDetails=Ki;exports.EventDetailsTemplate=Da;exports.Footer=Xi;exports.HeroUIProvider=Vs;exports.Navbar=_i;exports.RICH_TEXT_PRESETS=ws;exports.RichTextArea=Es;exports.Stepper=Lr;exports.colors=Jt;exports.spacing=Bs;exports.theme=$s;exports.typography=Hs;Object.keys(C).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(exports,n)&&Object.defineProperty(exports,n,{enumerable:!0,get:()=>C[n]})});
20
20
  (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:none}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();