@veevarts/design-system 1.0.0-alpha.8 → 1.0.0-alpha.9

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.

Potentially problematic release.


This version of @veevarts/design-system might be problematic. Click here for more details.

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"),k=require("@heroui/react"),S=require("react"),C=require("lucide-react"),Le=require("framer-motion"),ln=require("@tiptap/react"),b=require("@tiptap/core"),Ns=require("@tiptap/extension-underline"),Is=require("@tiptap/extension-color"),Os=require("@tiptap/extension-highlight"),Ds=require("@tiptap/extension-link"),Ls=require("@tiptap/extension-task-list"),Rs=require("@tiptap/extension-task-item"),Ps=require("@tiptap/extension-text-align"),qt={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"}}},js={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem","4xl":"6rem","5xl":"8rem"},Fs={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"}},zs={colors:{primary:{50:"#fef5f1",100:"#fde8e0",200:"#fbd5c7",300:"#f7b79f",400:"#f18d68",500:qt.brand.primary,600:"#a83b11",700:"#8b2f0e",800:"#73260d",900:"#5f210c",DEFAULT:qt.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 Bs({children:n}){return d.jsx(k.HeroUIProvider,{children:n})}function Hs({color:n="primary",radius:e="full",...t}){return d.jsx(k.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 yr=Object.freeze({left:0,top:0,width:16,height:16}),it=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),an=Object.freeze({...yr,...it}),Kt=Object.freeze({...an,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 Kt)r in it?r in n&&!(r in t)&&(t[r]=it[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 xr(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:{},...yr};function Et(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function br(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!Et(n,Ks))return null;const t=e.icons;for(const s in t){const i=t[s];if(!s||typeof i.body!="string"||!Et(i,Kt))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]||!Et(i,Kt))return null}return e}const En=Object.create(null);function Js(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function Ne(n,e){const t=En[n]||(En[n]=Object.create(null));return t[e]||(t[e]=Js(n,e))}function kr(n,e){return br(e)?xr(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 Sr=/^[a-z0-9]+(-[a-z0-9]+)*$/,gt=(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&&!et(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&&!et(l)?null:l}if(t&&r===""){const l={provider:r,prefix:"",name:i};return e&&!et(l,t)?null:l}return null},et=(n,e)=>n?!!((e&&n.prefix===""||n.prefix)&&n.name):!1;let Be=!1;function Cr(n){return typeof n=="boolean"&&(Be=n),Be}function wn(n){const e=typeof n=="string"?gt(n,!0,Be):n;if(e){const t=Ne(e.provider,e.prefix),r=e.name;return t.icons[r]||(t.missing.has(r)?null:void 0)}}function Ws(n,e){const t=gt(n,!0,Be);if(!t)return!1;const r=Ne(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||""),Be&&!e&&!n.prefix){let s=!1;return br(n)&&(n.prefix="",xr(n,(i,o)=>{Ws(i,o)&&(s=!0)})),s}const t=n.prefix;if(!et({prefix:t,name:"a"}))return!1;const r=Ne(e,t);return!!kr(r,n)}const Ar=Object.freeze({width:null,height:null}),Tr=Object.freeze({...Ar,...it}),Gs=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Zs=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Nn(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={...an,...n},r={...Tr,...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=Nn(f,a/c)):(u=o==="auto"?a:o,f=l===null?Nn(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 Jt=Object.create(null);function oi(n,e){Jt[n]=e}function Ut(n){return Jt[n]||Jt[""]}function cn(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 un=Object.create(null),Ie=["https://api.simplesvg.com","https://api.unisvg.com"],tt=[];for(;Ie.length>0;)Ie.length===1||Math.random()>.5?tt.push(Ie.shift()):tt.push(Ie.pop());un[""]=cn({resources:["https://api.iconify.design"].concat(tt)});function li(n,e){const t=cn(e);return t===null?!1:(un[n]=t,!0)}function fn(n){return un[n]}const ai=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let In=ai();function ci(n,e){const t=fn(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=fn(n);if(e)return e.path}return"/"}const hi=(n,e,t)=>{if(!In){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;In(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]=Ne(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"?gt(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 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 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,A){A&&(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,A,V){const U=A!=="success";switch(h=h.filter(W=>W!==T),a){case"pending":break;case"failed":if(U||!n.dataAfterTimeout)return;break;default:return}if(A==="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 A={status:"pending",resource:T,callback:(V,U)=>{O(A,V,U)}};h.push(A),c++,f=setTimeout(P,n.rotate),t(T,e,A.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 On(){}const wt=Object.create(null);function Ci(n){if(!wt[n]){const e=fn(n);if(!e)return;const t=Mr(e),r={config:e,redundancy:t};wt[n]=r}return wt[n]}function Ai(n,e,t){let r,s;if(typeof n=="string"){const i=Ut(n);if(!i)return t(void 0,424),On;s=i.send;const o=Ci(n);o&&(r=o.redundancy)}else{const i=cn(n);if(i){r=Mr(i);const o=n.resources?n.resources[0]:"",l=Ut(o);l&&(s=l.send)}}return!r||!s?(t(void 0,424),On):r.query(e,s,t)().abort}function Dn(){}function Ti(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,mi(n)}))}function vi(n){const e=[],t=[];return n.forEach(r=>{(r.match(Sr)?e:t).push(r)}),{valid:e,invalid:t}}function Oe(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(!kr(n,t).length){r();return}}catch(s){console.error(s)}r(),Ti(n)}function Ln(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)){Ln(n.loadIcons(s,r,t),u=>{Oe(n,s,u)});return}if(i){s.forEach(u=>{const f=i(u,r,t);Ln(f,h=>{const p=h?{prefix:r,icons:{[u]:h}}:null;Oe(n,[u],p)})});return}const{valid:o,invalid:l}=vi(s);if(l.length&&Oe(n,l,null),!o.length)return;const a=r.match(Sr)?Ut(t):null;if(!a){Oe(n,o,null);return}a.prepare(t,r,o).forEach(u=>{Ai(t,u,f=>{Oe(n,u.icons,f)})})}))}const Ei=(n,e)=>{const t=bi(n,!0,Cr()),r=xi(t);if(!r.pending.length){let a=!0;return e&&setTimeout(()=>{a&&e(r.loaded,r.missing,r.pending,Dn)}),()=>{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(Ne(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=Ne(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?yi(e,r,i):Dn};function wi(n,e){const t={...n};for(const r in e){const s=e[r],i=typeof s;r in Ar?(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 Pe;function ji(){try{Pe=window.trustedTypes.createPolicy("iconify",{createHTML:n=>n})}catch{Pe=null}}function Fi(n){return Pe===void 0&&ji(),Pe?Pe.createHTML(n):n}const Er={...Tr,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"},Wt={backgroundColor:"currentColor"},wr={backgroundColor:"transparent"},Rn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Pn={WebkitMask:Wt,mask:Wt,background:wr};for(const n in Pn){const e=Pn[n];for(const t in Rn)e[n+t]=Rn[t]}const Hi={...Er,inline:!0};function jn(n){return n+(n.match(/^[-0-9.]+$/)?"px":"")}const $i=(n,e,t)=>{const r=e.inline?Hi:Er,s=wi(r,e),i=e.mode||"svg",o={},l=e.style||{},a={...i==="svg"?zi:{}};if(t){const g=gt(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"))},S.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:jn(u.width),height:jn(u.height),...Bi,...y?Wt:wr,...l},S.createElement("span",a)};Cr(!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 Nr(n){const[e,t]=S.useState(!!n.ssr),[r,s]=S.useState({});function i(p){if(p){const y=n.icon;if(typeof y=="object")return{name:"",data:y};const m=wn(y);if(m)return{name:y,data:m}}return{name:""}}const[o,l]=S.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=wn(y);if(c({name:y,data:m}))if(m===void 0){const g=Ei([y],u);s({callback:g})}else m&&((p=n.onLoad)===null||p===void 0||p.call(n,y))}S.useEffect(()=>(t(!0),a),[]),S.useEffect(()=>{e&&u()},[n.icon,e]);const{name:f,data:h}=o;return h?$i({...an,...h},n,f):n.children?n.children:n.fallback?n.fallback:S.createElement("span",{})}S.forwardRef((n,e)=>Nr({...n,_ref:e}));S.forwardRef((n,e)=>Nr({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(C.Globe,{className:"absolute left-3 w-5 h-5 pointer-events-none text-black"}),d.jsx(k.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(C.Globe,{className:"w-5 h-5 text-black"}),children:n.map(s=>d.jsx(k.SelectItem,{textValue:s.label,"data-testid":`language-select-option-${s.code}`,children:s.label},s.code))}),d.jsx(k.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(k.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(k.Button,{"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(C.User,{className:"inline w-5 h-5"}),d.jsx("span",{className:"hidden md:inline",children:r.logout})]}):d.jsxs(k.Button,{"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(C.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:k.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 Nt;const Ui=typeof document<"u"?(Nt=S.useInsertionEffect)!==null&&Nt!==void 0?Nt:S.useLayoutEffect:()=>{};function dn(n,e,t){let[r,s]=S.useState(n||e),i=S.useRef(r),o=S.useRef(n!==void 0),l=n!==void 0;S.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]=S.useReducer(()=>({}),{}),u=S.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(Le.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 Ir=S.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]=dn(i,t,s),p=S.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:k.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:k.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:k.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(Le.LazyMotion,{features:Le.domAnimation,children:d.jsx(Le.m.div,{animate:g,className:"relative",children:d.jsx(Le.m.div,{animate:g,className:k.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:k.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)})})]})});Ir.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 He(n){return typeof n=="string"?n:n.type}function he({className:n}){return d.jsx("div",{className:`flex items-center h-6 ${n||""}`,children:d.jsx(k.Divider,{orientation:"vertical"})})}function oe({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(k.Tooltip,{content:a,children:d.jsx(k.Button,{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 se={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]=S.useState(0);S.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=se.heading;a&&a.execute({editor:n,config:{type:"heading",level:l}})};return d.jsxs(k.Dropdown,{children:[d.jsx(k.DropdownTrigger,{children:d.jsx(k.Button,{size:"sm",radius:"sm",variant:s?"solid":"bordered",color:s?"primary":"default",isDisabled:t,startContent:d.jsx(C.Heading,{size:16}),"aria-label":"Select heading level",children:s?`H${s}`:"H"})}),d.jsx(k.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:s?new Set([String(s)]):new Set,onAction:i,children:e.map(o=>d.jsx(k.DropdownItem,{startContent:n.isActive("heading",{level:o})?d.jsx(C.Check,{size:16}):d.jsx("div",{className:"w-4"}),children:Gi[o]},o))})]})}const It={bulletList:{label:"Bullet List",icon:C.List},orderedList:{label:"Numbered List",icon:C.ListOrdered},taskList:{label:"Task List",icon:C.ListTodo}};function Xi({editor:n,types:e=["bulletList","orderedList","taskList"],isDisabled:t=!1}){const[,r]=S.useState(0);S.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?It[s].icon:C.List,o=l=>{const c=se[l];c&&c.execute({editor:n})};return d.jsxs(k.Dropdown,{children:[d.jsx(k.DropdownTrigger,{children:d.jsx(k.Button,{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(k.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:s?new Set([s]):new Set,onAction:o,children:e.map(l=>{const a=It[l].icon;return d.jsx(k.DropdownItem,{startContent:d.jsx(a,{size:16}),children:It[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"),k=require("@heroui/react"),S=require("react"),C=require("lucide-react"),Le=require("framer-motion"),ln=require("@tiptap/react"),b=require("@tiptap/core"),Ns=require("@tiptap/extension-underline"),Is=require("@tiptap/extension-color"),Os=require("@tiptap/extension-highlight"),Ds=require("@tiptap/extension-link"),Ls=require("@tiptap/extension-task-list"),Rs=require("@tiptap/extension-task-item"),Ps=require("@tiptap/extension-text-align"),qt={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"}}},js={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem","4xl":"6rem","5xl":"8rem"},Fs={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"}},zs={colors:{primary:{50:"#fef5f1",100:"#fde8e0",200:"#fbd5c7",300:"#f7b79f",400:"#f18d68",500:qt.brand.primary,600:"#a83b11",700:"#8b2f0e",800:"#73260d",900:"#5f210c",DEFAULT:qt.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 Bs({children:n}){return d.jsx(k.HeroUIProvider,{children:n})}function Hs({color:n="primary",radius:e="full",...t}){return d.jsx(k.Button,{color:n,radius:e,...t})}const $s={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Vs({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(C.Globe,{className:"absolute left-3 w-5 h-5 pointer-events-none text-black"}),d.jsx(k.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(C.Globe,{className:"w-5 h-5 text-black"}),children:n.map(s=>d.jsx(k.SelectItem,{textValue:s.label,"data-testid":`language-select-option-${s.code}`,children:s.label},s.code))}),d.jsx(k.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(k.SelectItem,{className:"min-w-4",textValue:s.code.toUpperCase(),"data-testid":`language-select-option-mobile-${s.code}`,children:s.code.toUpperCase()},s.code))})]})})}function qs({isLoggedIn:n,onLogin:e,onLogout:t,labels:r}){return n?d.jsxs(k.Button,{"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(C.User,{className:"inline w-5 h-5"}),d.jsx("span",{className:"hidden md:inline",children:r.logout})]}):d.jsxs(k.Button,{"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(C.User,{className:"inline w-5 h-5"}),d.jsx("span",{className:"hidden md:inline",children:r.login})]})}function Ks({logo:n,languages:e=[],selectedLanguage:t,onLanguageChange:r,isLoggedIn:s,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:a,labels:c={},className:u}){const f={...$s,...c};return d.jsxs("nav",{"data-testid":"navbar",className:k.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(Vs,{languages:e,selectedLanguage:t,onLanguageChange:r,label:f.selectLanguage}),a&&d.jsx(qs,{isLoggedIn:s,onLogin:i,onLogout:o,labels:f})]})]})}var Et;const Js=typeof document<"u"?(Et=S.useInsertionEffect)!==null&&Et!==void 0?Et:S.useLayoutEffect:()=>{};function an(n,e,t){let[r,s]=S.useState(n||e),i=S.useRef(r),o=S.useRef(n!==void 0),l=n!==void 0;S.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;Js(()=>{i.current=a});let[,c]=S.useReducer(()=>({}),{}),u=S.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 Us(n){return d.jsx("svg",{...n,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:d.jsx(Le.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 yr=S.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]=an(i,t,s),p=S.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:k.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:k.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:k.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(Le.LazyMotion,{features:Le.domAnimation,children:d.jsx(Le.m.div,{animate:g,className:"relative",children:d.jsx(Le.m.div,{animate:g,className:k.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(Us,{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:k.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)})})]})});yr.displayName="Stepper";function Ws(){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 Be(n){return typeof n=="string"?n:n.type}function he({className:n}){return d.jsx("div",{className:`flex items-center h-6 ${n||""}`,children:d.jsx(k.Divider,{orientation:"vertical"})})}function oe({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(k.Tooltip,{content:a,children:d.jsx(k.Button,{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 se={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"}},_s={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Gs({editor:n,levels:e=[1,2,3,4,5,6],isDisabled:t=!1}){const[,r]=S.useState(0);S.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=se.heading;a&&a.execute({editor:n,config:{type:"heading",level:l}})};return d.jsxs(k.Dropdown,{children:[d.jsx(k.DropdownTrigger,{children:d.jsx(k.Button,{size:"sm",radius:"sm",variant:s?"solid":"bordered",color:s?"primary":"default",isDisabled:t,startContent:d.jsx(C.Heading,{size:16}),"aria-label":"Select heading level",children:s?`H${s}`:"H"})}),d.jsx(k.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:s?new Set([String(s)]):new Set,onAction:i,children:e.map(o=>d.jsx(k.DropdownItem,{startContent:n.isActive("heading",{level:o})?d.jsx(C.Check,{size:16}):d.jsx("div",{className:"w-4"}),children:_s[o]},o))})]})}const wt={bulletList:{label:"Bullet List",icon:C.List},orderedList:{label:"Numbered List",icon:C.ListOrdered},taskList:{label:"Task List",icon:C.ListTodo}};function Zs({editor:n,types:e=["bulletList","orderedList","taskList"],isDisabled:t=!1}){const[,r]=S.useState(0);S.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?wt[s].icon:C.List,o=l=>{const c=se[l];c&&c.execute({editor:n})};return d.jsxs(k.Dropdown,{children:[d.jsx(k.DropdownTrigger,{children:d.jsx(k.Button,{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(k.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:s?new Set([s]):new Set,onAction:o,children:e.map(l=>{const a=wt[l].icon;return d.jsx(k.DropdownItem,{startContent:d.jsx(a,{size:16}),children:wt[l].label},l)})})]})}function Xs({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 Ot(n){return/^#([0-9A-F]{3}){1,2}$/i.test(n)}const H={min:50,max:200,step:10,default:100},Fn={lineHeight:24,toolbarHeight:60},to={bold:C.Bold,italic:C.Italic,strike:C.Strikethrough,underline:C.Underline,code:C.Code,textColor:C.Palette,highlight:C.Highlighter,link:C.Link2,paragraph:C.FileText,heading:C.Heading,bulletList:C.List,orderedList:C.ListOrdered,taskList:C.ListTodo,codeBlock:C.CodeSquare,blockquote:C.Quote,horizontalRule:C.Minus,clearMarks:C.Eraser,clearNodes:C.Eraser,undo:C.Undo2,redo:C.Redo2,hardBreak:C.CornerDownLeft,textAlign:C.AlignLeft},no={left:C.AlignLeft,center:C.AlignCenter,right:C.AlignRight,justify:C.AlignJustify};function pe(n){return to[n]}function ro({value:n,onChange:e,onApply:t,placeholder:r="#000000"}){const[s,i]=S.useState(""),o=c=>{const u=c.target.value;e(u),s&&i("")},l=()=>{if(!n){i("Please enter a color");return}if(!Ot(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(k.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:Ot(n)?n:"transparent"}})}),d.jsx(k.Button,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!n||!Ot(n),children:d.jsx(C.Check,{size:16})})]}),d.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function zn({editor:n,type:e,allowCustomColor:t=!0,label:r,isDisabled:s=!1}){const[i,o]=S.useState(!1),[l,a]=S.useState(""),c=e==="textColor"?Yi:eo,u=m=>{const g=se[e];g&&g.execute({editor:n,config:{type:e,color:m}}),o(!1),a("")},f=m=>{u(m)},h=()=>{const m=se[e];m&&m.execute({editor:n,config:{type:e,color:""}}),o(!1)},p=e==="textColor"?n.isActive("textStyle"):n.isActive("highlight"),y=e==="textColor"?C.Palette:C.Highlighter;return d.jsxs(k.Popover,{isOpen:i,onOpenChange:o,placement:"bottom",showArrow:!0,children:[d.jsx(k.PopoverTrigger,{children:d.jsx(k.Button,{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(k.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(k.Button,{size:"sm",variant:"light",isIconOnly:!0,onPress:h,"aria-label":"Clear color",children:d.jsx(C.X,{size:16})})]}),d.jsx(Qi,{colors:c,onColorSelect:u}),t&&d.jsxs(d.Fragment,{children:[d.jsx(k.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(k.Tooltip,{content:"Zoom out",children:d.jsx(k.Button,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:a,onPress:i,"aria-label":"Zoom out",children:d.jsx(C.ZoomOut,{size:16})})}),d.jsx(k.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 Qs=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Ys=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Nt(n){return/^#([0-9A-F]{3}){1,2}$/i.test(n)}const H={min:50,max:200,step:10,default:100},Mn={lineHeight:24,toolbarHeight:60},ei={bold:C.Bold,italic:C.Italic,strike:C.Strikethrough,underline:C.Underline,code:C.Code,textColor:C.Palette,highlight:C.Highlighter,link:C.Link2,paragraph:C.FileText,heading:C.Heading,bulletList:C.List,orderedList:C.ListOrdered,taskList:C.ListTodo,codeBlock:C.CodeSquare,blockquote:C.Quote,horizontalRule:C.Minus,clearMarks:C.Eraser,clearNodes:C.Eraser,undo:C.Undo2,redo:C.Redo2,hardBreak:C.CornerDownLeft,textAlign:C.AlignLeft},ti={left:C.AlignLeft,center:C.AlignCenter,right:C.AlignRight,justify:C.AlignJustify};function pe(n){return ei[n]}function ni({value:n,onChange:e,onApply:t,placeholder:r="#000000"}){const[s,i]=S.useState(""),o=c=>{const u=c.target.value;e(u),s&&i("")},l=()=>{if(!n){i("Please enter a color");return}if(!Nt(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(k.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:Nt(n)?n:"transparent"}})}),d.jsx(k.Button,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!n||!Nt(n),children:d.jsx(C.Check,{size:16})})]}),d.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function En({editor:n,type:e,allowCustomColor:t=!0,label:r,isDisabled:s=!1}){const[i,o]=S.useState(!1),[l,a]=S.useState(""),c=e==="textColor"?Qs:Ys,u=m=>{const g=se[e];g&&g.execute({editor:n,config:{type:e,color:m}}),o(!1),a("")},f=m=>{u(m)},h=()=>{const m=se[e];m&&m.execute({editor:n,config:{type:e,color:""}}),o(!1)},p=e==="textColor"?n.isActive("textStyle"):n.isActive("highlight"),y=e==="textColor"?C.Palette:C.Highlighter;return d.jsxs(k.Popover,{isOpen:i,onOpenChange:o,placement:"bottom",showArrow:!0,children:[d.jsx(k.PopoverTrigger,{children:d.jsx(k.Button,{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(k.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(k.Button,{size:"sm",variant:"light",isIconOnly:!0,onPress:h,"aria-label":"Clear color",children:d.jsx(C.X,{size:16})})]}),d.jsx(Xs,{colors:c,onColorSelect:u}),t&&d.jsxs(d.Fragment,{children:[d.jsx(k.Divider,{}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),d.jsx(ni,{value:l,onChange:a,onApply:f})]})]})]})})]})}function ri({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(k.Tooltip,{content:"Zoom out",children:d.jsx(k.Button,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:a,onPress:i,"aria-label":"Zoom out",children:d.jsx(C.ZoomOut,{size:16})})}),d.jsx(k.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(k.Tooltip,{content:"Zoom in",children:d.jsx(k.Button,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:c,onPress:o,"aria-label":"Zoom in",children:d.jsx(C.ZoomIn,{size:16})})})]})}function io({children:n,id:e,label:t,className:r,useButtonGroup:s=!0}){return s?d.jsx(k.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 Or(n,e){const t=S.useMemo(()=>{if(!n)return{};const i={};return Array.from(new Set(e.map(l=>He(l)))).forEach(l=>{const a=se[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]=S.useState(t);return S.useEffect(()=>{if(!n)return;const i=()=>{const o={};Array.from(new Set(e.map(a=>He(a)))).forEach(a=>{const c=se[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 Dr(n,e){const t=S.useCallback((o,l)=>{if(!n)return;const a=se[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=S.useCallback(o=>{t(o)},[t]),s=S.useCallback((o,l)=>{if(!n)return!1;const a=se[o];try{return a?.canExecute?.(n,l)??!1}catch(c){return console.warn(`Failed to check canExecute for modifier: ${o}`,c),!1}},[n]),i=S.useCallback((o,l)=>{if(!n)return!1;const a=se[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]=S.useState(n),r=S.useCallback((l=H.step)=>{t(a=>Math.min(H.max,a+l))},[]),s=S.useCallback((l=H.step)=>{t(a=>Math.max(H.min,a-l))},[]),i=S.useCallback(()=>{t(H.default)},[]),o=S.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=Or(n,e),{toggleModifier:s}=Dr(n,t);if(!n)return null;const i=e.map(o=>He(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=pe(o);return d.jsx(oe,{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=Or(n,e),{toggleModifier:a,executeCommand:c}=Dr(n,o);if(!n)return null;const u=e.map(A=>He(A)),f=u.some(A=>["bold","italic","strike","underline","code"].includes(A)),h=u.some(A=>["textColor","highlight"].includes(A)),p=u.includes("heading"),y=u.includes("textAlign"),m=u.some(A=>["bulletList","orderedList","taskList"].includes(A)),g=u.includes("blockquote"),x=u.includes("codeBlock"),w=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(ao,{editor:n,modifiers:e,onToolbarAction:o}),(h||p||y||m||g||x||w||N||O||P)&&d.jsx(he,{})]}),h&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[u.includes("textColor")&&d.jsx(zn,{editor:n,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),u.includes("highlight")&&d.jsx(zn,{editor:n,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(p||y||m||g||x||w||N||O||P)&&d.jsx(he,{})]}),p&&d.jsxs(d.Fragment,{children:[d.jsx(Zi,{editor:n}),(y||m||g||x||w||N||O||P)&&d.jsx(he,{})]}),y&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(A=>{const V=no[A],U=n.isActive({textAlign:A});return d.jsx(oe,{icon:V,label:`Align ${A}`,isActive:U,onClick:()=>c("textAlign",{type:"textAlign",alignment:A})},A)})}),(m||g||x||w||N||O||P)&&d.jsx(he,{})]}),m&&d.jsxs(d.Fragment,{children:[d.jsx(Xi,{editor:n,types:u.filter(A=>["bulletList","orderedList","taskList"].includes(A))}),(g||x||w||N||O||P)&&d.jsx(he,{})]}),(g||x||w||N)&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[g&&d.jsx(oe,{icon:pe("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>a("blockquote")}),x&&d.jsx(oe,{icon:pe("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>a("codeBlock")}),w&&d.jsx(oe,{icon:pe("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(oe,{icon:pe("horizontalRule"),label:"Horizontal rule",onClick:()=>a("horizontalRule")})]}),(O||P)&&d.jsx(he,{})]}),O&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[u.includes("undo")&&d.jsx(oe,{icon:pe("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>a("undo")}),u.includes("redo")&&d.jsx(oe,{icon:pe("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>a("redo")})]}),P&&d.jsx(he,{})]}),P&&d.jsx(so,{zoom:t,onZoomChange:A=>{r?.(A),o?.({type:"zoom",modifier:`${A}%`})}})]})})}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=/(^|[^`])`([^`]+)`(?!`)/,vo=/(^|[^`])`([^`]+)`(?!`)/g,Mo=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:vo,type:this.type})]}}),Eo=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&&Eo(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",Bn="textStyle",Hn=/^\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(Bn)).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:Hn,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=b.wrappingInputRule({find:Hn,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Bn),editor:this.editor})),[n]}}),Lo="listItem",$n="textStyle",Vn=/^(\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($n)).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:Vn,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:Vn,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes($n)}),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 Lr(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=Lr(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Rr(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=Rr(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 Lr(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Rr(this,e,t,r)}findIndex(e){if(e==0)return Ze(0,e);if(e==this.size)return Ze(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?Ze(t+1,i):Ze(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 Dt={index:0,offset:0};function Ze(n,e){return Dt.index=n,Dt.offset=e,Dt}function _t(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(!_t(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!_t(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&&_t(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 M{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=jr(this.content,e+this.openStart,t);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,t){return new M(Pr(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 M.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 M(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 M(e,r,s)}}M.empty=new M(v.empty,0,0);function Pr(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(Pr(i.content,e-s-1,t-s-1)))}function jr(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=jr(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 ot{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 Kn(this,t,!1);return r.addAll(e,G.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Kn(this,t,!0);return r.addAll(e,G.none,t.from,t.to),M.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=Jn(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=Jn(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ot(e,ot.schemaRules(e)))}}const Fr={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},zr={ol:!0,ul:!0},$e=1,Gt=2,je=4;function qn(n,e,t){return e!=null?(e?$e:0)|(e==="full"?Gt:0):n&&n.whitespace=="pre"?$e|Gt:t&~je}class Xe{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&je?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&$e)){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&&!Fr.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Kn{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=qn(null,t.preserveWhitespace,0)|(r?je:0);s?i=new Xe(s.type,s.attrs,G.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Xe(null,null,G.none,!0,null,o):i=new Xe(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&Gt?"full":this.localPreserveWS||(s.options&$e)>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;zr.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(Fr.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):Un(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=qn(e,i,o.options);o.options&je&&o.content.length==0&&(l|=je);let a=G.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Un(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Xe(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|=$e)}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&&zr.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 Jn(n){let e={};for(let t in n)e[t]=n[t];return e}function Un(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 yt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Lt(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}=nt(Lt(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&&nt(Lt(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return nt(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new yt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Wn(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Wn(e.marks)}}function Wn(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Lt(n){return n.document||window.document}const _n=new WeakMap;function Vo(n){let e=_n.get(n);return e===void 0&&_n.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 nt(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}=nt(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 Br=65535,Hr=Math.pow(2,16);function Ko(n,e){return n+e*Hr}function Gn(n){return n&Br}function Jo(n){return(n-(n&Br))/Hr}const $r=1,Vr=2,rt=4,qr=8;class Zt{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&qr)>0}get deletedBefore(){return(this.delInfo&($r|rt))>0}get deletedAfter(){return(this.delInfo&(Vr|rt))>0}get deletedAcross(){return(this.delInfo&rt)>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=Gn(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?Vr:e==f?$r:rt;return(t<0?e!=a:e!=f)&&(m|=qr),new Zt(p,m,y)}s+=u-c}return r?e+s:new Zt(e+s,0,null)}touches(e,t){let r=0,s=Gn(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 lt{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 lt(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 lt;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 Zt(e,s,null)}}const Rt=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=Rt[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 Rt)throw new RangeError("Duplicate use of step JSON ID "+e);return Rt[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 hn(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(hn(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return v.fromArray(r)}class ge 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 M(hn(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 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 ge(t.pos,r.pos,this.mark)}merge(e){return e instanceof ge&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ge(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 ge(t.from,t.to,e.markFromJSON(t.mark))}}$.jsonID("addMark",ge);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=new M(hn(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 ge(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:"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 ye(t.from,t.to,e.markFromJSON(t.mark))}}$.jsonID("removeMark",ye);class xe 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 M(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 xe(this.pos,t.marks[s]);return new xe(this.pos,this.mark)}}return new Ve(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xe(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 xe(t.pos,e.markFromJSON(t.mark))}}$.jsonID("addNodeMark",xe);class Ve 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 M(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 xe(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ve(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 Ve(t.pos,e.markFromJSON(t.mark))}}$.jsonID("removeNodeMark",Ve);class re 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&&Xt(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 re(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 re(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof re)||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?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new re(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?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new re(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 re(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}}$.jsonID("replace",re);class Ee 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&&(Xt(e,this.from,this.gapFrom)||Xt(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 Ee(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 Ee(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 Ee(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}}$.jsonID("replaceAround",Ee);function Xt(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 Kr(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 Fe 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 M(v.from(s),0,t.isLeaf?0:1))}getMap(){return K.empty}invert(e){return new Fe(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 Fe(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 Fe(t.pos,t.attr,t.value)}}$.jsonID("attr",Fe);class at 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 at(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 at(t.attr,t.value)}}$.jsonID("docAttr",at);let qe=class extends Error{};qe=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};qe.prototype=Object.create(Error.prototype);qe.prototype.constructor=qe;qe.prototype.name="TransformError";const Pt=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=M.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?M.empty:t),l==0&&Qn(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),Qn(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 ee(e.node(0))}static atStart(e){return ve(e,e,0,0,1)||new ee(e)}static atEnd(e){return ve(e,e,e.content.size,e.childCount,-1)||new ee(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Pt[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 Pt)throw new RangeError("Duplicate use of selection JSON ID "+e);return Pt[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 Zn=!1;function Xn(n){!Zn&&!n.parent.inlineContent&&(Zn=!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){Xn(e),Xn(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=M.empty){if(super.replace(e,t),t==M.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 xt(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 xt{constructor(e,t){this.anchor=e,this.head=t}map(e){return new xt(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 M(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 pn(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 pn{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new xt(r,r):new pn(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&E.isSelectable(r)?new E(t):D.near(t)}}class ee extends D{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=M.empty){if(t==M.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 ee(e)}map(e){return new ee(e)}eq(e){return e instanceof ee}getBookmark(){return Wo}}D.jsonID("all",ee);const Wo={map(){return this},resolve(n){return new ee(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&&E.isSelectable(l))return E.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 Qn(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof re||s instanceof Ee))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 Yn(n,e){return!e||!n?n:n.bind(e)}class Qe{constructor(e,t,r){this.name=e,this.init=Yn(t.init,r),this.apply=Yn(t.apply,r)}}new Qe("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Qe("selection",{init(n,e){return n.selection||D.atStart(e.doc)},apply(n){return n.selection}}),new Qe("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Qe("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function Jr(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Jr(s,e,{})),t[r]=s}return t}class bt{constructor(e){this.spec=e,this.props={},e.props&&Jr(e.props,this,this.props),this.key=e.key?e.key.key:Ur("plugin")}getState(e){return e[this.key]}}const jt=Object.create(null);function Ur(n){return n in jt?n+"$"+ ++jt[n]:(jt[n]=0,n+"$")}class mn{constructor(e="key"){this.key=Ur(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(k.Tooltip,{content:"Zoom in",children:d.jsx(k.Button,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:c,onPress:o,"aria-label":"Zoom in",children:d.jsx(C.ZoomIn,{size:16})})})]})}function si({children:n,id:e,label:t,className:r,useButtonGroup:s=!0}){return s?d.jsx(k.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 xr(n,e){const t=S.useMemo(()=>{if(!n)return{};const i={};return Array.from(new Set(e.map(l=>Be(l)))).forEach(l=>{const a=se[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]=S.useState(t);return S.useEffect(()=>{if(!n)return;const i=()=>{const o={};Array.from(new Set(e.map(a=>Be(a)))).forEach(a=>{const c=se[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 br(n,e){const t=S.useCallback((o,l)=>{if(!n)return;const a=se[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=S.useCallback(o=>{t(o)},[t]),s=S.useCallback((o,l)=>{if(!n)return!1;const a=se[o];try{return a?.canExecute?.(n,l)??!1}catch(c){return console.warn(`Failed to check canExecute for modifier: ${o}`,c),!1}},[n]),i=S.useCallback((o,l)=>{if(!n)return!1;const a=se[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 ii(n=H.default){const[e,t]=S.useState(n),r=S.useCallback((l=H.step)=>{t(a=>Math.min(H.max,a+l))},[]),s=S.useCallback((l=H.step)=>{t(a=>Math.max(H.min,a-l))},[]),i=S.useCallback(()=>{t(H.default)},[]),o=S.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 oi=["bold","italic","strike","underline","code"];function li({editor:n,modifiers:e,onToolbarAction:t}){const r=xr(n,e),{toggleModifier:s}=br(n,t);if(!n)return null;const i=e.map(o=>Be(o)).filter(o=>oi.includes(o));return i.length===0?null:d.jsx(si,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=r[o],a=pe(o);return d.jsx(oe,{icon:a,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>s(o)},o)})})}function ai({editor:n,modifiers:e,zoom:t=100,onZoomChange:r,sticky:s=!0,className:i,onToolbarAction:o}){const l=xr(n,e),{toggleModifier:a,executeCommand:c}=br(n,o);if(!n)return null;const u=e.map(A=>Be(A)),f=u.some(A=>["bold","italic","strike","underline","code"].includes(A)),h=u.some(A=>["textColor","highlight"].includes(A)),p=u.includes("heading"),y=u.includes("textAlign"),m=u.some(A=>["bulletList","orderedList","taskList"].includes(A)),g=u.includes("blockquote"),x=u.includes("codeBlock"),w=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(li,{editor:n,modifiers:e,onToolbarAction:o}),(h||p||y||m||g||x||w||N||O||P)&&d.jsx(he,{})]}),h&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[u.includes("textColor")&&d.jsx(En,{editor:n,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),u.includes("highlight")&&d.jsx(En,{editor:n,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(p||y||m||g||x||w||N||O||P)&&d.jsx(he,{})]}),p&&d.jsxs(d.Fragment,{children:[d.jsx(Gs,{editor:n}),(y||m||g||x||w||N||O||P)&&d.jsx(he,{})]}),y&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(A=>{const V=ti[A],U=n.isActive({textAlign:A});return d.jsx(oe,{icon:V,label:`Align ${A}`,isActive:U,onClick:()=>c("textAlign",{type:"textAlign",alignment:A})},A)})}),(m||g||x||w||N||O||P)&&d.jsx(he,{})]}),m&&d.jsxs(d.Fragment,{children:[d.jsx(Zs,{editor:n,types:u.filter(A=>["bulletList","orderedList","taskList"].includes(A))}),(g||x||w||N||O||P)&&d.jsx(he,{})]}),(g||x||w||N)&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[g&&d.jsx(oe,{icon:pe("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>a("blockquote")}),x&&d.jsx(oe,{icon:pe("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>a("codeBlock")}),w&&d.jsx(oe,{icon:pe("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(oe,{icon:pe("horizontalRule"),label:"Horizontal rule",onClick:()=>a("horizontalRule")})]}),(O||P)&&d.jsx(he,{})]}),O&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[u.includes("undo")&&d.jsx(oe,{icon:pe("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>a("undo")}),u.includes("redo")&&d.jsx(oe,{icon:pe("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>a("redo")})]}),P&&d.jsx(he,{})]}),P&&d.jsx(ri,{zoom:t,onZoomChange:A=>{r?.(A),o?.({type:"zoom",modifier:`${A}%`})}})]})})}const ci=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ui=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,fi=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,di=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,hi=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:ci,type:this.type}),b.markInputRule({find:fi,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:ui,type:this.type}),b.markPasteRule({find:di,type:this.type})]}}),pi=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,mi=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,gi=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,yi=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,xi=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:pi,type:this.type}),b.markInputRule({find:gi,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:mi,type:this.type}),b.markPasteRule({find:yi,type:this.type})]}}),bi=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,ki=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Si=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:bi,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:ki,type:this.type})]}}),Ci=/(^|[^`])`([^`]+)`(?!`)/,Ai=/(^|[^`])`([^`]+)`(?!`)/g,Ti=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:Ci,type:this.type})]},addPasteRules(){return[b.markPasteRule({find:Ai,type:this.type})]}}),vi=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}`)})},Mi=b.Mark.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&vi(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}}}}),Ei=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}}))}}),wi=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()}}}),Ni="listItem",wn="textStyle",Nn=/^\s*([-+*])\s$/,Ii=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(Ni,this.editor.getAttributes(wn)).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:Nn,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=b.wrappingInputRule({find:Nn,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(wn),editor:this.editor})),[n]}}),Oi="listItem",In="textStyle",On=/^(\d+)\.\s$/,Di=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(Oi,this.editor.getAttributes(In)).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:On,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:On,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(In)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Li=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 kr(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=kr(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Sr(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=Sr(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 kr(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Sr(this,e,t,r)}findIndex(e){if(e==0)return Ze(0,e);if(e==this.size)return Ze(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?Ze(t+1,i):Ze(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 It={index:0,offset:0};function Ze(n,e){return It.index=n,It.offset=e,It}function Kt(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(!Kt(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Kt(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&&Kt(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 Ri extends Error{}class M{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=Ar(this.content,e+this.openStart,t);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,t){return new M(Cr(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 M.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 M(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 M(e,r,s)}}M.empty=new M(v.empty,0,0);function Cr(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(Cr(i.content,e-s-1,t-s-1)))}function Ar(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=Ar(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Pi(n){return n.tag!=null}function ji(n){return n.style!=null}class it{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Pi(s))this.tags.push(s);else if(ji(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 Ln(this,t,!1);return r.addAll(e,G.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Ln(this,t,!0);return r.addAll(e,G.none,t.from,t.to),M.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(Bi(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=Rn(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=Rn(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new it(e,it.schemaRules(e)))}}const Tr={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},Fi={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},vr={ol:!0,ul:!0},He=1,Jt=2,Pe=4;function Dn(n,e,t){return e!=null?(e?He:0)|(e==="full"?Jt:0):n&&n.whitespace=="pre"?He|Jt:t&~Pe}class Xe{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&Pe?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&He)){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&&!Tr.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ln{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=Dn(null,t.preserveWhitespace,0)|(r?Pe:0);s?i=new Xe(s.type,s.attrs,G.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Xe(null,null,G.none,!0,null,o):i=new Xe(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&Jt?"full":this.localPreserveWS||(s.options&He)>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;vr.hasOwnProperty(o)&&this.parser.normalizeLists&&zi(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Fi.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(Tr.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):Pn(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=Dn(e,i,o.options);o.options&Pe&&o.content.length==0&&(l|=Pe);let a=G.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Pn(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Xe(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|=He)}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 zi(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&vr.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Bi(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Rn(n){let e={};for(let t in n)e[t]=n[t];return e}function Pn(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 gt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Ot(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}=et(Ot(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&&et(Ot(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return et(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new gt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=jn(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return jn(e.marks)}}function jn(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Ot(n){return n.document||window.document}const Fn=new WeakMap;function Hi(n){let e=Fn.get(n);return e===void 0&&Fn.set(n,e=$i(n)),e}function $i(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 et(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=Hi(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}=et(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 Mr=65535,Er=Math.pow(2,16);function Vi(n,e){return n+e*Er}function zn(n){return n&Mr}function qi(n){return(n-(n&Mr))/Er}const wr=1,Nr=2,tt=4,Ir=8;class Ut{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ir)>0}get deletedBefore(){return(this.delInfo&(wr|tt))>0}get deletedAfter(){return(this.delInfo&(Nr|tt))>0}get deletedAcross(){return(this.delInfo&tt)>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+qi(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:Vi(l/3,e-a),m=e==a?Nr:e==f?wr:tt;return(t<0?e!=a:e!=f)&&(m|=Ir),new Ut(p,m,y)}s+=u-c}return r?e+s:new Ut(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 ot{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 ot(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 ot;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 Ut(e,s,null)}}const Dt=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=Dt[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 Dt)throw new RangeError("Duplicate use of step JSON ID "+e);return Dt[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 Ri)return R.fail(i.message);throw i}}}function cn(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(cn(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return v.fromArray(r)}class ge 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 M(cn(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 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 ge(t.pos,r.pos,this.mark)}merge(e){return e instanceof ge&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ge(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 ge(t.from,t.to,e.markFromJSON(t.mark))}}$.jsonID("addMark",ge);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=new M(cn(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 ge(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:"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 ye(t.from,t.to,e.markFromJSON(t.mark))}}$.jsonID("removeMark",ye);class xe 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 M(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 xe(this.pos,t.marks[s]);return new xe(this.pos,this.mark)}}return new $e(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xe(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 xe(t.pos,e.markFromJSON(t.mark))}}$.jsonID("addNodeMark",xe);class $e 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 M(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 xe(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new $e(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 $e(t.pos,e.markFromJSON(t.mark))}}$.jsonID("removeNodeMark",$e);class re 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&&Wt(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 re(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 re(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof re)||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?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new re(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?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new re(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 re(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}}$.jsonID("replace",re);class Ee 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&&(Wt(e,this.from,this.gapFrom)||Wt(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 Ee(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 Ee(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 Ee(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}}$.jsonID("replaceAround",Ee);function Wt(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 Or(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 je 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 M(v.from(s),0,t.isLeaf?0:1))}getMap(){return K.empty}invert(e){return new je(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 je(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 je(t.pos,t.attr,t.value)}}$.jsonID("attr",je);class lt 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 lt(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 lt(t.attr,t.value)}}$.jsonID("docAttr",lt);let Ve=class extends Error{};Ve=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ve.prototype=Object.create(Error.prototype);Ve.prototype.constructor=Ve;Ve.prototype.name="TransformError";const Lt=Object.create(null);class D{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Ki(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=M.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?M.empty:t),l==0&&$n(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),$n(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 ee(e.node(0))}static atStart(e){return ve(e,e,0,0,1)||new ee(e)}static atEnd(e){return ve(e,e,e.content.size,e.childCount,-1)||new ee(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Lt[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 Lt)throw new RangeError("Duplicate use of selection JSON ID "+e);return Lt[e]=t,t.prototype.jsonID=e,t}getBookmark(){return I.between(this.$anchor,this.$head).getBookmark()}}D.prototype.visible=!0;class Ki{constructor(e,t){this.$from=e,this.$to=t}}let Bn=!1;function Hn(n){!Bn&&!n.parent.inlineContent&&(Bn=!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){Hn(e),Hn(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=M.empty){if(super.replace(e,t),t==M.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 yt(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 yt{constructor(e,t){this.anchor=e,this.head=t}map(e){return new yt(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 M(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 un(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 un{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new yt(r,r):new un(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&E.isSelectable(r)?new E(t):D.near(t)}}class ee extends D{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=M.empty){if(t==M.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 ee(e)}map(e){return new ee(e)}eq(e){return e instanceof ee}getBookmark(){return Ji}}D.jsonID("all",ee);const Ji={map(){return this},resolve(n){return new ee(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&&E.isSelectable(l))return E.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 $n(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof re||s instanceof Ee))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 Vn(n,e){return!e||!n?n:n.bind(e)}class Qe{constructor(e,t,r){this.name=e,this.init=Vn(t.init,r),this.apply=Vn(t.apply,r)}}new Qe("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Qe("selection",{init(n,e){return n.selection||D.atStart(e.doc)},apply(n){return n.selection}}),new Qe("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Qe("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function Dr(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Dr(s,e,{})),t[r]=s}return t}class xt{constructor(e){this.spec=e,this.props={},e.props&&Dr(e.props,this,this.props),this.key=e.key?e.key.key:Lr("plugin")}getState(e){return e[this.key]}}const Rt=Object.create(null);function Lr(n){return n in Rt?n+"$"+ ++Rt[n]:(Rt[n]=0,n+"$")}class fn{constructor(e="key"){this.key=Lr(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ui=/^```([a-z]+)?[\s\n]$/,Wi=/^~~~([a-z]+)?[\s\n]$/,_i=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 bt({key:new mn("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(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})]}}),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 ct=200,F=function(){};F.prototype.append=function(e){return e.length?(e=F.from(e),!this.length&&e||e.length<ct&&this.leafAppend(e)||this.length<ct&&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 Wr(e):F.empty};var Wr=(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<=ct)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=ct)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 Wr([]);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 Z{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 Q(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 Q(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 Z(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 Q(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 Z(l.append(i),o)}remapping(e,t){let r=new lt;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 Z(this.items.append(e.map(t=>new Q(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 Q(y,m,g))}else r.push(new Q(y))},s);let c=[];for(let h=t;h<o;h++)c.push(new Q(i.maps[h]));let u=this.items.slice(0,s).append(c).append(r),f=new Z(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 Q(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 Z(F.from(s.reverse()),i)}}Z.empty=new Z(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 Q{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 Q(t.getMap().invert(),t,this.selection)}}}class le{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(be),i;if(s)return s.historyState;t.getMeta(al)&&(n=new le(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(be))return o.getMeta(be).redo?new le(n.done.addTransform(t,void 0,r,st(e)),n.undone,er(t.mapping.maps),n.prevTime,n.prevComposition):new le(n.done,n.undone.addTransform(t,void 0,r,st(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?Ft(n.prevRanges,t.mapping):er(t.mapping.maps);return new le(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,st(e)),Z.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new le(n.done.rebased(t,i),n.undone.rebased(t,i),Ft(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new le(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ft(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 er(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 Ft(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=st(e),s=be.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 le(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(be,{redo:t,historyState:a})}let zt=!1,tr=null;function st(n){let e=n.plugins;if(tr!=e){zt=!1,tr=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){zt=!0;break}}return zt}const be=new mn("history"),al=new mn("closeHistory");function cl(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new bt({key:be,state:{init(){return new le(Z.empty,Z.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"?Gr:r=="historyRedo"?Zr:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function _r(n,e){return(t,r)=>{let s=be.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 Gr=_r(!1,!0),Zr=_r(!0,!0),Re=b.Extension.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Gr(n,e),redo:()=>({state:n,dispatch:e})=>Zr(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 bt({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=Kr(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 fe={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:"'"},ut={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++)fe[48+B]=fe[96+B]=String(B);for(var B=1;B<=24;B++)fe[B+111]="F"+B;for(var B=65;B<=90;B++)fe[B]=String.fromCharCode(B+32),ut[B]=String.fromCharCode(B);for(var Bt in fe)ut.hasOwnProperty(Bt)||(ut[Bt]=fe[Bt]);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?ut:fe)[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 Ht(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[Ht(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[Ht(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=fe[r.keyCode])&&i!=s){let l=e[Ht(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Ce=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Xr=function(n,e,t,r){return t&&(nr(n,e,t,r,-1)||nr(n,e,t,r,1))},Al=/^(img|br|input|textarea|hr)$/i;function nr(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:ft(n))){let o=n.parentNode;if(!o||o.nodeType!=1||gn(n)||Al.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ce(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?ft(n):0}else return!1}}function ft(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Tl(n,e,t){for(let r=e==0,s=e==ft(n);r||s;){if(n==t)return!0;let i=Ce(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==ft(n)}}function gn(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Qr=function(n){return n.focusNode&&Xr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Yr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const te=typeof navigator<"u"?navigator:null,rr=typeof document<"u"?document:null,de=te&&te.userAgent||"",Qt=/Edge\/(\d+)/.exec(de),es=/MSIE \d/.exec(de),Yt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(de),Ue=!!(es||Yt||Qt),ts=es?document.documentMode:Yt?+Yt[1]:Qt?+Qt[1]:0,kt=!Ue&&/gecko\/(\d+)/i.test(de);kt&&+(/Firefox\/(\d+)/.exec(de)||[0,0])[1];const en=!Ue&&/Chrome\/(\d+)/.exec(de),ie=!!en,ns=en?+en[1]:0,Ae=!Ue&&!!te&&/Apple Computer/.test(te.vendor),yn=Ae&&(/Mobile\/\w+/.test(de)||!!te&&te.maxTouchPoints>2),_=yn||(te?/Mac/.test(te.platform):!1),rs=te?/Win/.test(te.platform):!1,We=/Android \d/.test(de),xn=!!rr&&"webkitFontSmoothing"in rr.documentElement.style,vl=xn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ml(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(Qr(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&&Tl(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 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=is(n,u,l,f)}return c}function ss(n){return n.editable?n.hasFocus():Il(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function bn(n,e=!1){let t=n.state.selection;if(Nl(n,t),!!ss(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ie){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Xr(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;sr&&!(t instanceof I)&&(t.$from.parent.inlineContent||(i=ir(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=ir(n,t.to))),n.docView.setSelection(r,s,n,e),sr&&(i&&or(i),o&&or(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&El(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const sr=Ae||ie&&ns<63;function ir(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(Ae&&s&&s.contentEditable=="false")return $t(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return $t(s);if(i)return $t(i)}}function $t(n){return n.contentEditable="true",Ae&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function or(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function El(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(()=>{(!ss(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,Ce(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Ue&&ts<=11&&(t.disabled=!0,t.disabled=!1)}function Nl(n,e){if(e instanceof E){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(lr(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else lr(n)}function lr(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function is(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 tn(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 ae(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function ar(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 ae(n,new I(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=tn(n.state,e);return s&&s instanceof E?ae(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?E.isSelectable(i)?ae(n,new E(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):xn?ae(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 ae(n,new I(e>0?r.$to:r.$from));{let s=tn(n.state,e);return s?ae(n,s):!1}}}function dt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function ze(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Te(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(kt&&t.nodeType==1&&r<dt(t)&&ze(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(ze(l,-1))s=t,i=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(os(t))break;{let l=t.previousSibling;for(;l&&ze(l,-1);)s=t.parentNode,i=Ce(l),l=l.previousSibling;if(l)t=l,r=dt(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?nn(n,t,r):s&&nn(n,s,i)}function Dl(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=dt(t),i,o;for(;;)if(r<s){if(t.nodeType!=1)break;let l=t.childNodes[r];if(ze(l,1))i=t,o=++r;else break}else{if(os(t))break;{let l=t.nextSibling;for(;l&&ze(l,1);)i=l.parentNode,o=Ce(l)+1,l=l.nextSibling;if(l)t=l,r=0,s=dt(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&nn(n,i,o)}function os(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ll(n,e){for(;n&&e==n.childNodes.length&&!gn(n);)e=Ce(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&&!gn(n);)e=Ce(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 nn(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(Qr(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&&bn(n)},50)}function cr(n,e){let t=n.state.doc.resolve(e);if(!(ie||rs)&&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 ur(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=tn(n.state,e);if(o&&o instanceof E)return ae(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof ee?D.near(o,e):D.findFrom(o,e);return l?ae(n,l):!1}return!1}function fr(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 dr(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Pl(n){if(!Ae||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;dr(n,r,"true"),setTimeout(()=>dr(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 fr(n,-1)||Te(n,-1);if(t==46&&!e.shiftKey||_&&t==68&&r=="c")return fr(n,1)||Te(n,1);if(t==13||t==27)return!0;if(t==37||_&&t==66&&r=="c"){let s=t==37?cr(n,n.state.selection.from)=="ltr"?-1:1:-1;return ar(n,s,r)||Te(n,s)}else if(t==39||_&&t==70&&r=="c"){let s=t==39?cr(n,n.state.selection.from)=="ltr"?1:-1:1;return ar(n,s,r)||Te(n,s)}else{if(t==38||_&&t==80&&r=="c")return ur(n,-1,r)||Te(n,-1);if(t==40||_&&t==78&&r=="c")return Pl(n)||ur(n,1,r)||Te(n,1);if(r==(_?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function ls(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")||yt.fromSchema(n.state.schema),l=hs(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=ds[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:Ui,type:this.type,getAttributes:n=>({language:n[1]})}),b.textblockTypeInputRule({find:Wi,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new xt({key:new fn("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}}})]}}),Gi=/^\s*>\s$/,Zi=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:Gi,type:this.type})]}}),Xi=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})]}}),Qi=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 at=200,F=function(){};F.prototype.append=function(e){return e.length?(e=F.from(e),!this.length&&e||e.length<at&&this.leafAppend(e)||this.length<at&&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 Yi(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 Rr(e):F.empty};var Rr=(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<=at)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=at)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 Rr([]);var Yi=(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 eo=500;class Z{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 Q(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 Q(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 Z(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 Q(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>no&&(l=to(l,c),o-=c),new Z(l.append(i),o)}remapping(e,t){let r=new ot;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 Z(this.items.append(e.map(t=>new Q(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 Q(y,m,g))}else r.push(new Q(y))},s);let c=[];for(let h=t;h<o;h++)c.push(new Q(i.maps[h]));let u=this.items.slice(0,s).append(c).append(r),f=new Z(u,l);return f.emptyItemCount()>eo&&(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 Q(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 Z(F.from(s.reverse()),i)}}Z.empty=new Z(F.empty,0);function to(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class Q{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 Q(t.getMap().invert(),t,this.selection)}}}class le{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const no=20;function ro(n,e,t,r){let s=t.getMeta(be),i;if(s)return s.historyState;t.getMeta(oo)&&(n=new le(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(be))return o.getMeta(be).redo?new le(n.done.addTransform(t,void 0,r,nt(e)),n.undone,qn(t.mapping.maps),n.prevTime,n.prevComposition):new le(n.done,n.undone.addTransform(t,void 0,r,nt(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||!so(t,n.prevRanges)),c=o?Pt(n.prevRanges,t.mapping):qn(t.mapping.maps);return new le(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,nt(e)),Z.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new le(n.done.rebased(t,i),n.undone.rebased(t,i),Pt(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new le(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Pt(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function so(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 qn(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 Pt(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 io(n,e,t){let r=nt(e),s=be.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 le(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(be,{redo:t,historyState:a})}let jt=!1,Kn=null;function nt(n){let e=n.plugins;if(Kn!=e){jt=!1,Kn=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){jt=!0;break}}return jt}const be=new fn("history"),oo=new fn("closeHistory");function lo(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new xt({key:be,state:{init(){return new le(Z.empty,Z.empty,null,0,-1)},apply(e,t,r){return ro(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?jr:r=="historyRedo"?Fr:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Pr(n,e){return(t,r)=>{let s=be.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=io(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const jr=Pr(!1,!0),Fr=Pr(!0,!0),Re=b.Extension.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>jr(n,e),redo:()=>({state:n,dispatch:e})=>Fr(n,e)}},addProseMirrorPlugins(){return[lo(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()}}}),ao=b.Node.create({name:"doc",topNode:!0,content:"block+"}),co=b.Node.create({name:"text",group:"inline"});function uo(n={}){return new xt({view(e){return new fo(e,n)}})}class fo{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=Or(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 ho=b.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[uo(this.options)]}});var fe={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:"'"},ct={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},po=typeof navigator<"u"&&/Mac/.test(navigator.platform),mo=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var B=0;B<10;B++)fe[48+B]=fe[96+B]=String(B);for(var B=1;B<=24;B++)fe[B+111]="F"+B;for(var B=65;B<=90;B++)fe[B]=String.fromCharCode(B+32),ct[B]=String.fromCharCode(B);for(var Ft in fe)ct.hasOwnProperty(Ft)||(ct[Ft]=fe[Ft]);function go(n){var e=po&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||mo&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ct:fe)[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 yo=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),xo=typeof navigator<"u"&&/Win/.test(navigator.platform);function bo(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))yo?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 ko(n){let e=Object.create(null);for(let t in n)e[bo(t)]=n[t];return e}function zt(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 So(n){let e=ko(n);return function(t,r){let s=go(r),i,o=e[zt(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[zt(s,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(xo&&r.ctrlKey&&r.altKey)&&(i=fe[r.keyCode])&&i!=s){let l=e[zt(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Ce=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},zr=function(n,e,t,r){return t&&(Jn(n,e,t,r,-1)||Jn(n,e,t,r,1))},Co=/^(img|br|input|textarea|hr)$/i;function Jn(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:ut(n))){let o=n.parentNode;if(!o||o.nodeType!=1||dn(n)||Co.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ce(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?ut(n):0}else return!1}}function ut(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ao(n,e,t){for(let r=e==0,s=e==ut(n);r||s;){if(n==t)return!0;let i=Ce(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==ut(n)}}function dn(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 Br=function(n){return n.focusNode&&zr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Hr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const te=typeof navigator<"u"?navigator:null,Un=typeof document<"u"?document:null,de=te&&te.userAgent||"",_t=/Edge\/(\d+)/.exec(de),$r=/MSIE \d/.exec(de),Gt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(de),Ue=!!($r||Gt||_t),Vr=$r?document.documentMode:Gt?+Gt[1]:_t?+_t[1]:0,bt=!Ue&&/gecko\/(\d+)/i.test(de);bt&&+(/Firefox\/(\d+)/.exec(de)||[0,0])[1];const Zt=!Ue&&/Chrome\/(\d+)/.exec(de),ie=!!Zt,qr=Zt?+Zt[1]:0,Ae=!Ue&&!!te&&/Apple Computer/.test(te.vendor),hn=Ae&&(/Mobile\/\w+/.test(de)||!!te&&te.maxTouchPoints>2),_=hn||(te?/Mac/.test(te.platform):!1),Kr=te?/Win/.test(te.platform):!1,We=/Android \d/.test(de),pn=!!Un&&"webkitFontSmoothing"in Un.documentElement.style,To=pn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function vo(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(Br(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&&Ao(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 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=Ur(n,u,l,f)}return c}function Jr(n){return n.editable?n.hasFocus():No(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function mn(n,e=!1){let t=n.state.selection;if(wo(n,t),!!Jr(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ie){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&zr(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Eo(n);else{let{anchor:r,head:s}=t,i,o;Wn&&!(t instanceof I)&&(t.$from.parent.inlineContent||(i=_n(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=_n(n,t.to))),n.docView.setSelection(r,s,n,e),Wn&&(i&&Gn(i),o&&Gn(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Mo(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Wn=Ae||ie&&qr<63;function _n(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(Ae&&s&&s.contentEditable=="false")return Bt(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Bt(s);if(i)return Bt(i)}}function Bt(n){return n.contentEditable="true",Ae&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Gn(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Mo(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(()=>{(!Jr(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Eo(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Ce(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Ue&&Vr<=11&&(t.disabled=!0,t.disabled=!1)}function wo(n,e){if(e instanceof E){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Zn(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Zn(n)}function Zn(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ur(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||I.between(e,t,r)}function No(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 Xt(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 ae(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Xn(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 ae(n,new I(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=Xt(n.state,e);return s&&s instanceof E?ae(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?E.isSelectable(i)?ae(n,new E(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):pn?ae(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 ae(n,new I(e>0?r.$to:r.$from));{let s=Xt(n.state,e);return s?ae(n,s):!1}}}function ft(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Fe(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Te(n,e){return e<0?Io(n):Oo(n)}function Io(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(bt&&t.nodeType==1&&r<ft(t)&&Fe(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Fe(l,-1))s=t,i=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Wr(t))break;{let l=t.previousSibling;for(;l&&Fe(l,-1);)s=t.parentNode,i=Ce(l),l=l.previousSibling;if(l)t=l,r=ft(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Qt(n,t,r):s&&Qt(n,s,i)}function Oo(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=ft(t),i,o;for(;;)if(r<s){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Fe(l,1))i=t,o=++r;else break}else{if(Wr(t))break;{let l=t.nextSibling;for(;l&&Fe(l,1);)i=l.parentNode,o=Ce(l)+1,l=l.nextSibling;if(l)t=l,r=0,s=ft(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&Qt(n,i,o)}function Wr(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Do(n,e){for(;n&&e==n.childNodes.length&&!dn(n);)e=Ce(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 Lo(n,e){for(;n&&!e&&!dn(n);)e=Ce(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 Qt(n,e,t){if(e.nodeType!=3){let i,o;(o=Do(e,t))?(e=o,t=0):(i=Lo(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Br(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&&mn(n)},50)}function Qn(n,e){let t=n.state.doc.resolve(e);if(!(ie||Kr)&&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 Yn(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=Xt(n.state,e);if(o&&o instanceof E)return ae(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof ee?D.near(o,e):D.findFrom(o,e);return l?ae(n,l):!1}return!1}function er(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 tr(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Ro(n){if(!Ae||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;tr(n,r,"true"),setTimeout(()=>tr(n,r,"false"),20)}return!1}function Po(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function jo(n,e){let t=e.keyCode,r=Po(e);if(t==8||_&&t==72&&r=="c")return er(n,-1)||Te(n,-1);if(t==46&&!e.shiftKey||_&&t==68&&r=="c")return er(n,1)||Te(n,1);if(t==13||t==27)return!0;if(t==37||_&&t==66&&r=="c"){let s=t==37?Qn(n,n.state.selection.from)=="ltr"?-1:1:-1;return Xn(n,s,r)||Te(n,s)}else if(t==39||_&&t==70&&r=="c"){let s=t==39?Qn(n,n.state.selection.from)=="ltr"?1:-1:1;return Xn(n,s,r)||Te(n,s)}else{if(t==38||_&&t==80&&r=="c")return Yn(n,-1,r)||Te(n,-1);if(t==40||_&&t==78&&r=="c")return Ro(n)||Yn(n,1,r)||Te(n,1);if(r==(_?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function _r(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")||gt.fromSchema(n.state.schema),l=es(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=Yr[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,`
17
17
 
18
- `);return{dom:a,text:h,slice:e}}function as(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 M(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,y=yt.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),xn&&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")||ot.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(hr(l,+u[1],+u[2]),u[4]);else if(l=M.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=hr(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&&us(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=fs(o[o.length-1],i.length));let u=cs(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return v.from(o)}return n}function cs(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,v.from(n));return n}function us(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=us(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(cs(t,n,s+1))))}}function fs(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,fs(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(v.empty,!0);return n.copy(t.append(r))}function rn(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=rn(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 hr(n,e,t){return e<n.openStart&&(n=new M(rn(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new M(rn(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const ds={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 pr=null;function hs(){return pr||(pr=document.implementation.createHTMLDocument("title"))}let Vt=null;function Hl(n){let e=window.trustedTypes;return e?(Vt||(Vt=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Vt.createHTML(n)):n}function $l(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=hs().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&ds[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(ie?"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=v.from(a.create(r[l+1],s)),i++,o++}return new M(s,i,o)}const X={},J={};function ce(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,!ms(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(We&&ie&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),yn&&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,Yr(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Fl(n,t)?t.preventDefault():ce(n,"key")};J.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};J.keypress=(n,e)=>{let t=e;if(ms(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 St(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 kn(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 we(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&&E.isSelectable(r)?(we(n,new E(t)),!0):!1}function Ul(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?(we(n,E.create(n.state.doc,s)),!0):!1}function Wl(n,e,t,r,s){return kn(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 kn(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function Gl(n,e,t,r){return kn(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?(we(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)we(n,I.create(r,l+1,l+1+o.content.size));else if(E.isSelectable(o))we(n,E.create(r,l));else continue;return!0}}function Sn(n){return ht(n)}const ps=_?"metaKey":"ctrlKey";X.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Sn(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&Kl(t,n.input.lastClick)&&!t[ps]&&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 Xl(n,o,t,!!r)):(i=="doubleClick"?_l:Gl)(n,o.pos,o.inside,t)?t.preventDefault():ce(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[ps],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&&kt&&!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)),ce(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(()=>bn(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?ce(this.view,"pointer"):Wl(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ae&&this.mightDrag&&!this.mightDrag.node.isAtom||ie&&!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)?(we(this.view,D.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ce(this.view,"pointer")}move(e){this.updateAllowDefault(e),ce(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)}}X.touchstart=n=>{n.input.lastTouch=Date.now(),Sn(n),ce(n,"pointer")};X.touchmove=n=>{n.input.lastTouch=Date.now(),ce(n,"pointer")};X.contextmenu=n=>Sn(n);function ms(n,e){return n.composing?!0:Ae&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Ql=We?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)||ie&&rs&&Yl(n)))n.markCursor=n.state.storedMarks||t.marks(),ht(n,!0),n.markCursor=null;else if(ht(n,!e.selection.empty),kt&&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}gs(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++,gs(n,20))};function gs(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ht(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 ht(n,e=!1){if(!(We&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),ea(n),e||n.docView&&n.docView.dirty){let t=Ml(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 Ke=Ue&&ts<15||yn&&vl<604;X.copy=J.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=Ke?null:t.clipboardData,o=r.content(),{dom:l,text:a}=ls(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?sn(n,r.value,null,s,e):sn(n,r.textContent,r.innerHTML,s,e)},50)}function sn(n,e,t,r,s){let i=as(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,i||M.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 ys(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&&!We)return;let r=Ke?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&sn(n,ys(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 xs(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[oa]}X.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}=ls(n,l);(!t.dataTransfer.files.length||!ie||ns>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ke?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ke||t.dataTransfer.setData("text/plain",c),n.dragging=new ia(u,xs(n,t),o)};X.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(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=as(n,ys(e.dataTransfer),Ke?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&xs(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||M.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Kr(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((y,m,g,x)=>p=x),a.setSelection(is(n,h,a.doc.resolve(p)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}X.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())&&bn(n)},20))};X.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)};X.beforeinput=(n,e)=>{if(ie&&We&&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,Yr(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)X[n]=J[n];function Je(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 pt{constructor(e,t){this.toDOM=e,this.spec=t||ke,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 Y(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof pt&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Je(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ue{constructor(e,t){this.attrs=e,this.spec=t||ke}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 Y(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof ue&&Je(this.attrs,e.attrs)&&Je(this.spec,e.spec)}static is(e){return e.type instanceof ue}destroy(){}}class Cn{constructor(e,t){this.attrs=e,this.spec=t||ke}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 Y(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 Cn&&Je(this.attrs,e.attrs)&&Je(this.spec,e.spec)}destroy(){}}class Y{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Y(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 Y(e,e,new pt(t,r))}static inline(e,t,r,s){return new Y(e,t,new ue(r,s))}static node(e,t,r,s){return new Y(e,t,new Cn(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof ue}get widget(){return this.type instanceof pt}}const Me=[],ke={};class j{constructor(e,t){this.local=e.length?e:Me,this.children=t.length?t:Me}static create(e,t){return t.length?mt(t,e,0,ke):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||ke)}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(Se),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=ks(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,mt(u,l,c+1,ke)),i+=3}});let o=bs(i?Ss(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 ue){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),Me);return r?new me([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 An(this.localsInner(e))}localsInner(e){if(this==q)return Me;if(e.inlineContent||!this.local.some(ue.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ue||t.push(this.local[r]);return t}forEachSet(e){e(this)}}j.empty=new j([],[]);j.removeOverlap=An;const q=j.empty;class me{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,ke));return me.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 me?r=r.concat(i.members):r.push(i))}return me.from(r)}eq(e){if(!(e instanceof me)||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?An(r?t:t.sort(Se)):Me}static from(e){switch(e.length){case 0:return q;case 1:return e[0];default:return new me(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=mt(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 bs(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 Y(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 ks(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 Ss(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function mt(n,e,t,r){let s=[],i=!1;e.forEach((l,a)=>{let c=ks(n,l,a+t);if(c){i=!0;let u=mt(c,l,t+a+1,r);u!=q&&s.push(a,a+l.nodeSize,u)}});let o=bs(i?Ss(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 An(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),mr(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),mr(e,s,r.copy(i.from,r.to)));break}}}return e}function mr(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 M.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 Tn(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&&!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 Tn{constructor(e){this.pos=e}map(e){return new Tn(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return L.valid(t)?new L(t):D.near(t)}}function Cs(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||Cs(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||Cs(s.type))return!0;if(s.inlineContent)return!1}}return!0}function da(){return new bt({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:Ye("horiz",-1),ArrowRight:Ye("horiz",1),ArrowUp:Ye("vert",-1),ArrowDown:Ye("vert",1)});function Ye(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&&E.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=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 M(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,[Y.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}}}),De={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:Ns.Underline,priority:100},code:{category:"mark",extension:Mo,priority:100},textColor:{category:"mark",extension:Is.Color,defaultOptions:{types:["textStyle"]},priority:90},highlight:{category:"mark",extension:Os.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Ds.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:Ls.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:Re,priority:50},redo:{category:"extension",extension:Re,priority:50},textAlign:{category:"extension",extension:Ps.TextAlign,defaultOptions:{types:["heading","paragraph","listItem"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:Re,priority:50},clearNodes:{category:"extension",extension:Re,priority:50}},xa=[ul,fl,Io,wo,Po,Rs.TaskItem,Re,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=>He(l)),i=new Set;return s.forEach(l=>{const a=De[l];a?.requiredExtensions&&a.requiredExtensions.forEach(c=>{i.add(c)})}),i.forEach(l=>{if(t.has(l))return;const a=De[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=De[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(De).find(p=>p?.extension?.name===l.name),u=Object.values(De).find(p=>p?.extension?.name===a.name),f=c?.priority??100;return(u?.priority??100)-f})}const As={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}=ln.useCurrentEditor();return d.jsx(co,{editor:s,modifiers:n,zoom:e,onZoomChange:t,onToolbarAction:r})},Sa=({showCharacterCount:n,showWordCount:e})=>{const{editor:t}=ln.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"]})]})},on=S.forwardRef((n,e)=>{const{minRows:t=10,maxRows:r=30,disableAutosize:s=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:a=As.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=Fn.lineHeight,P=t*O,T=s?void 0:r*O,A=S.useMemo(()=>ba(a),[a]),{Component:V,label:U,shouldLabelBeOutside:W,getBaseProps:Ct,getLabelProps:At,getInputWrapperProps:_e}=k.useInput({...x,variant:c,ref:e,isMultiline:!0}),Ge=U?d.jsx("label",{...At(),children:U}):null,z=S.useCallback(({editor:ne})=>{const Tt=ne.getHTML(),Ms=ne.getJSON(),vt=ne.getText(),Es=vt.length,ws=vt.split(/\s+/).filter(Mt=>Mt.length>0).length,vn={html:Tt,json:Ms,text:vt,characters:Es,words:ws};if(h?.(vn),p?.(vn),"onChange"in x&&typeof x.onChange=="function"){const Mt={target:{value:Tt},currentTarget:{value:Tt}};x.onChange(Mt)}},[h,p,x]);return d.jsxs(V,{...Ct(),children:[W?Ge:null,d.jsx("div",{..._e(),className:k.cn(_e().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:T?`${T+Fn.toolbarHeight}px`:void 0,overflow:T?"auto":void 0},children:d.jsx(ln.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:A,content:f||u||n.defaultValue||"",onUpdate:z})})]})});on.displayName="TipTapEditor";const Ts=S.forwardRef((n,e)=>{const{adapter:t="tiptap",variant:r="bordered",...s}=n;return t==="tiptap"?d.jsx(on,{...s,variant:r,ref:e}):(console.warn(`Adapter "${t}" is not supported. Using TipTap.`),d.jsx(on,{...s,variant:r,ref:e}))});Ts.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 gr=[{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=gr,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:gr,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]=dn(e,t,r),[U,W]=S.useState(""),Ct=S.useCallback(z=>{if(h)return;const ne={amount:z.amount,isCustom:!1,presetId:z.id};V(ne),W("")},[h,V]),At=S.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]),_e=S.useMemo(()=>({style:"currency",currency:s,currencyDisplay:"symbol"}),[s]),Ge=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:k.cn("grid gap-3",T),"data-testid":"donation-amounts-presets",children:N.map(z=>{const ne=A!==null&&!A.isCustom&&A.presetId===z.id;return d.jsx(k.Button,{color:ne?"primary":y,variant:ne?"solid":p,className:"w-full",onPress:()=>Ct(z),isDisabled:h,"data-testid":`donation-amounts-preset-${z.id}`,children:z.label||Ca(z.amount,i,s)},z.id)})}),o&&d.jsx(k.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,variant:m,radius:"md",minValue:l,maxValue:a,step:.01,formatOptions:_e,value:U!==""?parseFloat(U):void 0,onValueChange:At,isDisabled:h,"data-testid":"donation-amounts-custom-input"},A?.isCustom===!1?A.presetId:"custom")]});return x?d.jsx(k.Card,{className:k.cn("w-full",g),"data-testid":"donation-amounts-card",children:d.jsx(k.CardBody,{children:Ge})}):d.jsx("div",{className:k.cn("w-full",g),"data-testid":"donation-amounts-plain",children:Ge})};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`},va=n=>{switch(n){case"warning":return C.Clock;case"error":return C.AlertCircle;case"success":return C.CheckCircle;default:return C.Clock}},Ma=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"}},Ea=S.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]=dn(n!==void 0?Math.max(0,n):void 0,Math.max(0,e),t),x=S.useRef(null),w=S.useRef(!1);S.useEffect(()=>()=>{x.current&&clearInterval(x.current)},[]),S.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]),S.useEffect(()=>{m>0&&(w.current=!1)},[m]);const N=a||va(s),O=Ma(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:k.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)})})]})})})});Ea.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(k.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(k.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=Hs;exports.ConfirmationPageTemplate=wa;exports.DonationAmounts=vs;exports.EventDetailsTemplate=Na;exports.Footer=_i;exports.HeroUIProvider=Bs;exports.Navbar=Ji;exports.RICH_TEXT_PRESETS=As;exports.RichTextArea=Ts;exports.Stepper=Ir;exports.colors=qt;exports.spacing=js;exports.theme=zs;exports.typography=Fs;Object.keys(k).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(exports,n)&&Object.defineProperty(exports,n,{enumerable:!0,get:()=>k[n]})});
18
+ `);return{dom:a,text:h,slice:e}}function Gr(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 M(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,y=gt.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=Ho(t),pn&&$o(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")||it.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Fo.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Vo(nr(l,+u[1],+u[2]),u[4]);else if(l=M.maxOpen(zo(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=nr(l,f,h)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const Fo=/^(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 zo(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&&Xr(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Qr(o[o.length-1],i.length));let u=Zr(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return v.from(o)}return n}function Zr(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,v.from(n));return n}function Xr(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=Xr(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(Zr(t,n,s+1))))}}function Qr(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Qr(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(v.empty,!0);return n.copy(t.append(r))}function Yt(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=Yt(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 nr(n,e,t){return e<n.openStart&&(n=new M(Yt(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new M(Yt(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Yr={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 rr=null;function es(){return rr||(rr=document.implementation.createHTMLDocument("title"))}let Ht=null;function Bo(n){let e=window.trustedTypes;return e?(Ht||(Ht=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Ht.createHTML(n)):n}function Ho(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=es().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&Yr[r[1].toLowerCase()])&&(n=s.map(i=>"<"+i+">").join("")+n+s.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=Bo(n),s)for(let i=0;i<s.length;i++)t=t.querySelector(s[i])||t;return t}function $o(n){let e=n.querySelectorAll(ie?"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 Vo(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 M(s,i,o)}const X={},J={};function ce(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,!ns(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(We&&ie&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),hn&&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,Hr(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||jo(n,t)?t.preventDefault():ce(n,"key")};J.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};J.keypress=(n,e)=>{let t=e;if(ns(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 kt(n){return{left:n.clientX,top:n.clientY}}function qo(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function gn(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 we(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 Ko(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(we(n,new E(t)),!0):!1}function Jo(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?(we(n,E.create(n.state.doc,s)),!0):!1}function Uo(n,e,t,r,s){return gn(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?Jo(n,t):Ko(n,t))}function Wo(n,e,t,r){return gn(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function _o(n,e,t,r){return gn(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||Go(n,t,r)}function Go(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(we(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)we(n,I.create(r,l+1,l+1+o.content.size));else if(E.isSelectable(o))we(n,E.create(r,l));else continue;return!0}}function yn(n){return dt(n)}const ts=_?"metaKey":"ctrlKey";X.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=yn(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&qo(t,n.input.lastClick)&&!t[ts]&&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(kt(t));o&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Zo(n,o,t,!!r)):(i=="doubleClick"?Wo:_o)(n,o.pos,o.inside,t)?t.preventDefault():ce(n,"pointer"))};class Zo{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[ts],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&&bt&&!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)),ce(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(()=>mn(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(kt(e))),this.updateAllowDefault(e),this.allowDefault||!t?ce(this.view,"pointer"):Uo(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ae&&this.mightDrag&&!this.mightDrag.node.isAtom||ie&&!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)?(we(this.view,D.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ce(this.view,"pointer")}move(e){this.updateAllowDefault(e),ce(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)}}X.touchstart=n=>{n.input.lastTouch=Date.now(),yn(n),ce(n,"pointer")};X.touchmove=n=>{n.input.lastTouch=Date.now(),ce(n,"pointer")};X.contextmenu=n=>yn(n);function ns(n,e){return n.composing?!0:Ae&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Xo=We?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)||ie&&Kr&&Qo(n)))n.markCursor=n.state.storedMarks||t.marks(),dt(n,!0),n.markCursor=null;else if(dt(n,!e.selection.empty),bt&&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}rs(n,Xo)};function Qo(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++,rs(n,20))};function rs(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>dt(n),e))}function Yo(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=el());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function el(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function dt(n,e=!1){if(!(We&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Yo(n),e||n.docView&&n.docView.dirty){let t=vo(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 tl(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 qe=Ue&&Vr<15||hn&&To<604;X.copy=J.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=qe?null:t.clipboardData,o=r.content(),{dom:l,text:a}=_r(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):tl(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function nl(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function rl(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?en(n,r.value,null,s,e):en(n,r.textContent,r.innerHTML,s,e)},50)}function en(n,e,t,r,s){let i=Gr(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,i||M.empty)))return!0;if(!i)return!1;let o=nl(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 ss(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&&!We)return;let r=qe?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&en(n,ss(r),r.getData("text/html"),s,t)?t.preventDefault():rl(n,t)};class sl{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const il=_?"altKey":"ctrlKey";function is(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[il]}X.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(kt(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}=_r(n,l);(!t.dataTransfer.files.length||!ie||qr>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(qe?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",qe||t.dataTransfer.setData("text/plain",c),n.dragging=new sl(u,is(n,t),o)};X.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{ol(n,e,n.dragging)}finally{n.dragging=null}};function ol(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(kt(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=Gr(n,ss(e.dataTransfer),qe?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&is(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||M.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Or(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((y,m,g,x)=>p=x),a.setSelection(Ur(n,h,a.doc.resolve(p)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}X.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())&&mn(n)},20))};X.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)};X.beforeinput=(n,e)=>{if(ie&&We&&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,Hr(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)X[n]=J[n];function Ke(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 ht{constructor(e,t){this.toDOM=e,this.spec=t||ke,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 Y(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ht&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ke(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ue{constructor(e,t){this.attrs=e,this.spec=t||ke}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 Y(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof ue&&Ke(this.attrs,e.attrs)&&Ke(this.spec,e.spec)}static is(e){return e.type instanceof ue}destroy(){}}class xn{constructor(e,t){this.attrs=e,this.spec=t||ke}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 Y(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 xn&&Ke(this.attrs,e.attrs)&&Ke(this.spec,e.spec)}destroy(){}}class Y{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Y(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 Y(e,e,new ht(t,r))}static inline(e,t,r,s){return new Y(e,t,new ue(r,s))}static node(e,t,r,s){return new Y(e,t,new xn(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof ue}get widget(){return this.type instanceof ht}}const Me=[],ke={};class j{constructor(e,t){this.local=e.length?e:Me,this.children=t.length?t:Me}static create(e,t){return t.length?pt(t,e,0,ke):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||ke)}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?ll(this.children,o||[],e,t,r,s,i):o?new j(o.sort(Se),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=ls(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,pt(u,l,c+1,ke)),i+=3}});let o=os(i?as(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 ue){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),Me);return r?new me([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 bn(this.localsInner(e))}localsInner(e){if(this==q)return Me;if(e.inlineContent||!this.local.some(ue.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ue||t.push(this.local[r]);return t}forEachSet(e){e(this)}}j.empty=new j([],[]);j.removeOverlap=bn;const q=j.empty;class me{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,ke));return me.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 me?r=r.concat(i.members):r.push(i))}return me.from(r)}eq(e){if(!(e instanceof me)||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?bn(r?t:t.sort(Se)):Me}static from(e){switch(e.length){case 0:return q;case 1:return e[0];default:return new me(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 ll(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=al(l,n,e,t,s,i,o),u=pt(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 os(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 Y(s.from+e,s.to+e,s.type))}return t}function al(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 ls(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 as(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function pt(n,e,t,r){let s=[],i=!1;e.forEach((l,a)=>{let c=ls(n,l,a+t);if(c){i=!0;let u=pt(c,l,t+a+1,r);u!=q&&s.push(a,a+l.nodeSize,u)}});let o=os(i?as(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 bn(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),sr(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),sr(e,s,r.copy(i.from,r.to)));break}}}return e}function sr(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 M.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 kn(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!cl(e)||!ul(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 kn{constructor(e){this.pos=e}map(e){return new kn(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return L.valid(t)?new L(t):D.near(t)}}function cs(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function cl(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||cs(s.type))return!0;if(s.inlineContent)return!1}}return!0}function ul(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||cs(s.type))return!0;if(s.inlineContent)return!1}}return!0}function fl(){return new xt({props:{decorations:ml,createSelectionBetween(n,e,t){return e.pos==t.pos&&L.valid(t)?new L(t):null},handleClick:hl,handleKeyDown:dl,handleDOMEvents:{beforeinput:pl}}})}const dl=So({ArrowLeft:Ye("horiz",-1),ArrowRight:Ye("horiz",1),ArrowUp:Ye("vert",-1),ArrowDown:Ye("vert",1)});function Ye(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 hl(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 pl(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 M(s,0,0));return i.setSelection(I.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function ml(n){if(!(n.selection instanceof L))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",j.create(n.doc,[Y.widget(n.selection.head,e,{key:"gapcursor"})])}const gl=b.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[fl()]},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}}}),Ie={bold:{category:"mark",extension:hi,priority:100},italic:{category:"mark",extension:xi,priority:100},strike:{category:"mark",extension:Si,priority:100},underline:{category:"mark",extension:Ns.Underline,priority:100},code:{category:"mark",extension:Ti,priority:100},textColor:{category:"mark",extension:Is.Color,defaultOptions:{types:["textStyle"]},priority:90},highlight:{category:"mark",extension:Os.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Ds.Link,defaultOptions:{openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Ei,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Ii,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Di,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Ls.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:_i,priority:100},blockquote:{category:"node",extension:Zi,priority:100},horizontalRule:{category:"node",extension:Xi,priority:100},hardBreak:{category:"node",extension:Qi,priority:100},undo:{category:"extension",extension:Re,priority:50},redo:{category:"extension",extension:Re,priority:50},textAlign:{category:"extension",extension:Ps.TextAlign,defaultOptions:{types:["heading","paragraph","listItem"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:Re,priority:50},clearNodes:{category:"extension",extension:Re,priority:50}},yl=[ao,co,wi,Mi,Li,Rs.TaskItem,Re,ho,gl];function xl(n){const e=[],t=new Set,r=new Set;yl.forEach(l=>{l&&(e.push(l),r.add(l.name),l.name==="history"&&(t.add("undo"),t.add("redo")))});const s=n.map(l=>Be(l)),i=new Set;return s.forEach(l=>{const a=Ie[l];a?.requiredExtensions&&a.requiredExtensions.forEach(c=>{i.add(c)})}),i.forEach(l=>{if(t.has(l))return;const a=Ie[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=Ie[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(Ie).find(p=>p?.extension?.name===l.name),u=Object.values(Ie).find(p=>p?.extension?.name===a.name),f=c?.priority??100;return(u?.priority??100)-f})}const us={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"]},bl=({modifiers:n,zoom:e,onZoomChange:t,onToolbarAction:r})=>{const{editor:s}=ln.useCurrentEditor();return d.jsx(ai,{editor:s,modifiers:n,zoom:e,onZoomChange:t,onToolbarAction:r})},kl=({showCharacterCount:n,showWordCount:e})=>{const{editor:t}=ln.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"]})]})},tn=S.forwardRef((n,e)=>{const{minRows:t=10,maxRows:r=30,disableAutosize:s=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:a=us.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}=ii(),O=Mn.lineHeight,P=t*O,T=s?void 0:r*O,A=S.useMemo(()=>xl(a),[a]),{Component:V,label:U,shouldLabelBeOutside:W,getBaseProps:Ct,getLabelProps:At,getInputWrapperProps:_e}=k.useInput({...x,variant:c,ref:e,isMultiline:!0}),Ge=U?d.jsx("label",{...At(),children:U}):null,z=S.useCallback(({editor:ne})=>{const Tt=ne.getHTML(),Ms=ne.getJSON(),vt=ne.getText(),Es=vt.length,ws=vt.split(/\s+/).filter(Mt=>Mt.length>0).length,vn={html:Tt,json:Ms,text:vt,characters:Es,words:ws};if(h?.(vn),p?.(vn),"onChange"in x&&typeof x.onChange=="function"){const Mt={target:{value:Tt},currentTarget:{value:Tt}};x.onChange(Mt)}},[h,p,x]);return d.jsxs(V,{...Ct(),children:[W?Ge:null,d.jsx("div",{..._e(),className:k.cn(_e().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:T?`${T+Mn.toolbarHeight}px`:void 0,overflow:T?"auto":void 0},children:d.jsx(ln.EditorProvider,{editable:!m&&!g,slotBefore:l?d.jsx(bl,{modifiers:a,zoom:w,onZoomChange:N,onToolbarAction:y}):void 0,slotAfter:d.jsx(kl,{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:A,content:f||u||n.defaultValue||"",onUpdate:z})})]})});tn.displayName="TipTapEditor";const fs=S.forwardRef((n,e)=>{const{adapter:t="tiptap",variant:r="bordered",...s}=n;return t==="tiptap"?d.jsx(tn,{...s,variant:r,ref:e}):(console.warn(`Adapter "${t}" is not supported. Using TipTap.`),d.jsx(tn,{...s,variant:r,ref:e}))});fs.displayName="RichTextArea";function Sl(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 ir=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Cl={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount"},ds=({presetAmounts:n=ir,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={...Cl,...c},N=Array.isArray(n)?n:ir,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]=an(e,t,r),[U,W]=S.useState(""),Ct=S.useCallback(z=>{if(h)return;const ne={amount:z.amount,isCustom:!1,presetId:z.id};V(ne),W("")},[h,V]),At=S.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]),_e=S.useMemo(()=>({style:"currency",currency:s,currencyDisplay:"symbol"}),[s]),Ge=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:k.cn("grid gap-3",T),"data-testid":"donation-amounts-presets",children:N.map(z=>{const ne=A!==null&&!A.isCustom&&A.presetId===z.id;return d.jsx(k.Button,{color:ne?"primary":y,variant:ne?"solid":p,className:"w-full",onPress:()=>Ct(z),isDisabled:h,"data-testid":`donation-amounts-preset-${z.id}`,children:z.label||Sl(z.amount,i,s)},z.id)})}),o&&d.jsx(k.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,variant:m,radius:"md",minValue:l,maxValue:a,step:.01,formatOptions:_e,value:U!==""?parseFloat(U):void 0,onValueChange:At,isDisabled:h,"data-testid":"donation-amounts-custom-input"},A?.isCustom===!1?A.presetId:"custom")]});return x?d.jsx(k.Card,{className:k.cn("w-full",g),"data-testid":"donation-amounts-card",children:d.jsx(k.CardBody,{children:Ge})}):d.jsx("div",{className:k.cn("w-full",g),"data-testid":"donation-amounts-plain",children:Ge})};ds.displayName="DonationAmounts";const Al=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`},Tl=n=>{switch(n){case"warning":return C.Clock;case"error":return C.AlertCircle;case"success":return C.CheckCircle;default:return C.Clock}},vl=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"}},Ml=S.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=Al,className:h,...p},y)=>{const[m,g]=an(n!==void 0?Math.max(0,n):void 0,Math.max(0,e),t),x=S.useRef(null),w=S.useRef(!1);S.useEffect(()=>()=>{x.current&&clearInterval(x.current)},[]),S.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]),S.useEffect(()=>{m>0&&(w.current=!1)},[m]);const N=a||Tl(s),O=vl(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:k.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)})})]})})})});Ml.displayName="ExpireCartTimer";function El(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 hs=Object.freeze({left:0,top:0,width:16,height:16}),mt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Sn=Object.freeze({...hs,...mt}),nn=Object.freeze({...Sn,body:"",hidden:!1});function wl(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 or(n,e){const t=wl(n,e);for(const r in nn)r in mt?r in n&&!(r in t)&&(t[r]=mt[r]):r in e?t[r]=e[r]:r in n&&(t[r]=n[r]);return t}function Nl(n,e,t){const r=n.icons,s=n.aliases||Object.create(null);let i={};function o(l){i=or(r[l]||s[l],i)}return o(e),t.forEach(o),or(n,i)}function ps(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=El(n);for(const s in r){const i=r[s];i&&(e(s,Nl(n,s,i)),t.push(s))}return t}const Il={provider:"",aliases:{},not_found:{},...hs};function $t(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function ms(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!$t(n,Il))return null;const t=e.icons;for(const s in t){const i=t[s];if(!s||typeof i.body!="string"||!$t(i,nn))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]||!$t(i,nn))return null}return e}const lr=Object.create(null);function Ol(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function Ne(n,e){const t=lr[n]||(lr[n]=Object.create(null));return t[e]||(t[e]=Ol(n,e))}function gs(n,e){return ms(e)?ps(e,(t,r)=>{r?n.icons[t]=r:n.missing.add(t)}):[]}function Dl(n,e,t){try{if(typeof t.body=="string")return n.icons[e]={...t},!0}catch{}return!1}const ys=/^[a-z0-9]+(-[a-z0-9]+)*$/,St=(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&&!rt(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&&!rt(l)?null:l}if(t&&r===""){const l={provider:r,prefix:"",name:i};return e&&!rt(l,t)?null:l}return null},rt=(n,e)=>n?!!((e&&n.prefix===""||n.prefix)&&n.name):!1;let Je=!1;function xs(n){return typeof n=="boolean"&&(Je=n),Je}function ar(n){const e=typeof n=="string"?St(n,!0,Je):n;if(e){const t=Ne(e.provider,e.prefix),r=e.name;return t.icons[r]||(t.missing.has(r)?null:void 0)}}function Ll(n,e){const t=St(n,!0,Je);if(!t)return!1;const r=Ne(t.provider,t.prefix);return e?Dl(r,t.name,e):(r.missing.add(t.name),!0)}function Rl(n,e){if(typeof n!="object")return!1;if(typeof e!="string"&&(e=n.provider||""),Je&&!e&&!n.prefix){let s=!1;return ms(n)&&(n.prefix="",ps(n,(i,o)=>{Ll(i,o)&&(s=!0)})),s}const t=n.prefix;if(!rt({prefix:t,name:"a"}))return!1;const r=Ne(e,t);return!!gs(r,n)}const bs=Object.freeze({width:null,height:null}),ks=Object.freeze({...bs,...mt}),Pl=/(-?[0-9.]*[0-9]+[0-9.]*)/g,jl=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function cr(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(Pl);if(r===null||!r.length)return n;const s=[];let i=r.shift(),o=jl.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 Fl(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 zl(n,e){return n?"<defs>"+n+"</defs>"+e:e}function Bl(n,e,t){const r=Fl(n);return zl(r.defs,e+r.content+t)}const Hl=n=>n==="unset"||n==="undefined"||n==="none";function $l(n,e){const t={...Sn,...n},r={...ks,...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=Bl(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=cr(f,a/c)):(u=o==="auto"?a:o,f=l===null?cr(u,c/a):l==="auto"?c:l);const h={},p=(m,g)=>{Hl(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 Vl=/\sid="(\S+)"/g,ql="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Kl=0;function Jl(n,e=ql){const t=[];let r;for(;r=Vl.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+(Kl++).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 rn=Object.create(null);function Ul(n,e){rn[n]=e}function sn(n){return rn[n]||rn[""]}function Cn(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 An=Object.create(null),Oe=["https://api.simplesvg.com","https://api.unisvg.com"],st=[];for(;Oe.length>0;)Oe.length===1||Math.random()>.5?st.push(Oe.shift()):st.push(Oe.pop());An[""]=Cn({resources:["https://api.iconify.design"].concat(st)});function Wl(n,e){const t=Cn(e);return t===null?!1:(An[n]=t,!0)}function Tn(n){return An[n]}const _l=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let ur=_l();function Gl(n,e){const t=Tn(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 Zl(n){return n===404}const Xl=(n,e,t)=>{const r=[],s=Gl(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 Ql(n){if(typeof n=="string"){const e=Tn(n);if(e)return e.path}return"/"}const Yl=(n,e,t)=>{if(!ur){t("abort",424);return}let r=Ql(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;ur(n+r).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{t(Zl(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)})},ea={prepare:Xl,send:Yl};function Ss(n,e){n.forEach(t=>{const r=t.loaderCallbacks;r&&(t.loaderCallbacks=r.filter(s=>s.id!==e))})}function ta(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||Ss([n],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let na=0;function ra(n,e,t){const r=na++,s=Ss.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 sa(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]=Ne(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 ia(n,e=!0,t=!1){const r=[];return n.forEach(s=>{const i=typeof s=="string"?St(s,e,t):s;i&&r.push(i)}),r}const oa={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function la(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 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,A){A&&(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,A,V){const U=A!=="success";switch(h=h.filter(W=>W!==T),a){case"pending":break;case"failed":if(U||!n.dataAfterTimeout)return;break;default:return}if(A==="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 A={status:"pending",resource:T,callback:(V,U)=>{O(A,V,U)}};h.push(A),c++,f=setTimeout(P,n.rotate),t(T,e,A.callback)}return setTimeout(P),x}function Cs(n){const e={...oa,...n};let t=[];function r(){t=t.filter(l=>l().status==="pending")}function s(l,a,c){const u=la(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 fr(){}const Vt=Object.create(null);function aa(n){if(!Vt[n]){const e=Tn(n);if(!e)return;const t=Cs(e),r={config:e,redundancy:t};Vt[n]=r}return Vt[n]}function ca(n,e,t){let r,s;if(typeof n=="string"){const i=sn(n);if(!i)return t(void 0,424),fr;s=i.send;const o=aa(n);o&&(r=o.redundancy)}else{const i=Cn(n);if(i){r=Cs(i);const o=n.resources?n.resources[0]:"",l=sn(o);l&&(s=l.send)}}return!r||!s?(t(void 0,424),fr):r.query(e,s,t)().abort}function dr(){}function ua(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,ta(n)}))}function fa(n){const e=[],t=[];return n.forEach(r=>{(r.match(ys)?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(!gs(n,t).length){r();return}}catch(s){console.error(s)}r(),ua(n)}function hr(n,e){n instanceof Promise?n.then(t=>{e(t)}).catch(()=>{e(null)}):e(n)}function da(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)){hr(n.loadIcons(s,r,t),u=>{De(n,s,u)});return}if(i){s.forEach(u=>{const f=i(u,r,t);hr(f,h=>{const p=h?{prefix:r,icons:{[u]:h}}:null;De(n,[u],p)})});return}const{valid:o,invalid:l}=fa(s);if(l.length&&De(n,l,null),!o.length)return;const a=r.match(ys)?sn(t):null;if(!a){De(n,o,null);return}a.prepare(t,r,o).forEach(u=>{ca(t,u,f=>{De(n,u.icons,f)})})}))}const ha=(n,e)=>{const t=ia(n,!0,xs()),r=sa(t);if(!r.pending.length){let a=!0;return e&&setTimeout(()=>{a&&e(r.loaded,r.missing,r.pending,dr)}),()=>{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(Ne(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=Ne(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&&da(a,c)}),e?ra(e,r,i):dr};function pa(n,e){const t={...n};for(const r in e){const s=e[r],i=typeof s;r in bs?(s===null||s&&(i==="string"||i==="number"))&&(t[r]=s):i===typeof t[r]&&(t[r]=r==="rotate"?s%4:s)}return t}const ma=/[\s,]+/;function ga(n,e){e.split(ma).forEach(t=>{switch(t.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0;break}})}function ya(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 xa(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 ba(n){return n.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ka(n){return"data:image/svg+xml,"+ba(n)}function Sa(n){return'url("'+ka(n)+'")'}let ze;function Ca(){try{ze=window.trustedTypes.createPolicy("iconify",{createHTML:n=>n})}catch{ze=null}}function Aa(n){return ze===void 0&&Ca(),ze?ze.createHTML(n):n}const As={...ks,inline:!1},Ta={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},va={display:"inline-block"},on={backgroundColor:"currentColor"},Ts={backgroundColor:"transparent"},pr={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},mr={WebkitMask:on,mask:on,background:Ts};for(const n in mr){const e=mr[n];for(const t in pr)e[n+t]=pr[t]}const Ma={...As,inline:!0};function gr(n){return n+(n.match(/^[-0-9.]+$/)?"px":"")}const Ea=(n,e,t)=>{const r=e.inline?Ma:As,s=pa(r,e),i=e.mode||"svg",o={},l=e.style||{},a={...i==="svg"?Ta:{}};if(t){const g=St(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"&&ga(s,x);break;case"color":o.color=x;break;case"rotate":typeof x=="string"?s[g]=ya(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=$l(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:Aa(Jl(c.body,x?()=>x+"ID"+g++:"iconifyReact"))},S.createElement("svg",a)}const{body:f,width:h,height:p}=n,y=i==="mask"||(i==="bg"?!1:f.indexOf("currentColor")!==-1),m=xa(f,{...u,width:h+"",height:p+""});return a.style={...o,"--svg":Sa(m),width:gr(u.width),height:gr(u.height),...va,...y?on:Ts,...l},S.createElement("span",a)};xs(!0);Ul("",ea);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"||!Rl(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;Wl(t,s)||console.error(r)}catch{console.error(r)}}}}function vs(n){const[e,t]=S.useState(!!n.ssr),[r,s]=S.useState({});function i(p){if(p){const y=n.icon;if(typeof y=="object")return{name:"",data:y};const m=ar(y);if(m)return{name:y,data:m}}return{name:""}}const[o,l]=S.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=ar(y);if(c({name:y,data:m}))if(m===void 0){const g=ha([y],u);s({callback:g})}else m&&((p=n.onLoad)===null||p===void 0||p.call(n,y))}S.useEffect(()=>(t(!0),a),[]),S.useEffect(()=>{e&&u()},[n.icon,e]);const{name:f,data:h}=o;return h?Ea({...Sn,...h},n,f):n.children?n.children:n.fallback?n.fallback:S.createElement("span",{})}S.forwardRef((n,e)=>vs({...n,_ref:e}));S.forwardRef((n,e)=>vs({inline:!0,...n,_ref:e}));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(k.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(k.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=Hs;exports.ConfirmationPageTemplate=wa;exports.DonationAmounts=ds;exports.EventDetailsTemplate=Na;exports.Footer=Ws;exports.HeroUIProvider=Bs;exports.Navbar=Ks;exports.RICH_TEXT_PRESETS=us;exports.RichTextArea=fs;exports.Stepper=yr;exports.colors=qt;exports.spacing=js;exports.theme=zs;exports.typography=Fs;Object.keys(k).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(exports,n)&&Object.defineProperty(exports,n,{enumerable:!0,get:()=>k[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)}})();