@valbuild/ui 0.30.0 → 0.32.0

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.
@@ -44,48 +44,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
44
44
  Copyright (c) 2018 Jed Watson.
45
45
  Licensed under the MIT License (MIT), see
46
46
  http://jedwatson.github.io/classnames
47
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],o=0;o<arguments.length;o++){var i=arguments[o];if(i){var l=typeof i;if(l==="string"||l==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var s=n.apply(null,i);s&&r.push(s)}}else if(l==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var a in i)t.call(i,a)&&i[a]&&r.push(a)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(p_);var VT=p_.exports;const id=$a(VT);function ee(){return ee=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ee.apply(this,arguments)}function HT(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function g_(...e){return t=>e.forEach(n=>HT(n,t))}function Xe(...e){return p.useCallback(g_(...e),e)}const $l=p.forwardRef((e,t)=>{const{children:n,...r}=e,o=p.Children.toArray(n),i=o.find(GT);if(i){const l=i.props.children,s=o.map(a=>a===i?p.Children.count(l)>1?p.Children.only(null):p.isValidElement(l)?l.props.children:null:a);return p.createElement(Oh,ee({},r,{ref:t}),p.isValidElement(l)?p.cloneElement(l,void 0,s):null)}return p.createElement(Oh,ee({},r,{ref:t}),n)});$l.displayName="Slot";const Oh=p.forwardRef((e,t)=>{const{children:n,...r}=e;return p.isValidElement(n)?p.cloneElement(n,{...YT(r,n.props),ref:t?g_(t,n.ref):n.ref}):p.Children.count(n)>1?p.Children.only(null):null});Oh.displayName="SlotClone";const KT=({children:e})=>p.createElement(p.Fragment,null,e);function GT(e){return p.isValidElement(e)&&e.type===KT}function YT(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...s)=>{i(...s),o(...s)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const XT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],De=XT.reduce((e,t)=>{const n=p.forwardRef((r,o)=>{const{asChild:i,...l}=r,s=i?$l:t;return p.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),p.createElement(s,ee({},l,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function QT(e,t){e&&Hr.flushSync(()=>e.dispatchEvent(t))}const $n=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{};function JT(e,t){return p.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Il=e=>{const{present:t,children:n}=e,r=ZT(t),o=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),i=Xe(r.ref,o.ref);return typeof n=="function"||r.isPresent?p.cloneElement(o,{ref:i}):null};Il.displayName="Presence";function ZT(e){const[t,n]=p.useState(),r=p.useRef({}),o=p.useRef(e),i=p.useRef("none"),l=e?"mounted":"unmounted",[s,a]=JT(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const u=cu(r.current);i.current=s==="mounted"?u:"none"},[s]),$n(()=>{const u=r.current,c=o.current;if(c!==e){const f=i.current,h=cu(u);e?a("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?a("UNMOUNT"):a(c&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,a]),$n(()=>{if(t){const u=d=>{const h=cu(r.current).includes(d.animationName);d.target===t&&h&&Hr.flushSync(()=>a("ANIMATION_END"))},c=d=>{d.target===t&&(i.current=cu(r.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else a("ANIMATION_END")},[t,a]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:p.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function cu(e){return(e==null?void 0:e.animationName)||"none"}function $i(e,t=[]){let n=[];function r(i,l){const s=p.createContext(l),a=n.length;n=[...n,l];function u(d){const{scope:f,children:h,...g}=d,m=(f==null?void 0:f[e][a])||s,S=p.useMemo(()=>g,Object.values(g));return p.createElement(m.Provider,{value:S},h)}function c(d,f){const h=(f==null?void 0:f[e][a])||s,g=p.useContext(h);if(g)return g;if(l!==void 0)return l;throw new Error(`\`${d}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,c]}const o=()=>{const i=n.map(l=>p.createContext(l));return function(s){const a=(s==null?void 0:s[e])||i;return p.useMemo(()=>({[`__scope${e}`]:{...s,[e]:a}}),[s,a])}};return o.scopeName=e,[r,qT(o,...t)]}function qT(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const l=r.reduce((s,{useScope:a,scopeName:u})=>{const d=a(i)[`__scope${u}`];return{...s,...d}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function Vt(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const eN=p.createContext(void 0);function bg(e){const t=p.useContext(eN);return e||t||"ltr"}function Ah(e,[t,n]){return Math.min(n,Math.max(t,e))}function He(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function tN(e,t){return p.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const m_="ScrollArea",[v_,v4]=$i(m_),[nN,Wn]=v_(m_),rN=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...l}=e,[s,a]=p.useState(null),[u,c]=p.useState(null),[d,f]=p.useState(null),[h,g]=p.useState(null),[m,S]=p.useState(null),[v,y]=p.useState(0),[_,w]=p.useState(0),[C,$]=p.useState(!1),[E,T]=p.useState(!1),M=Xe(t,j=>a(j)),R=bg(o);return p.createElement(nN,{scope:n,type:r,dir:R,scrollHideDelay:i,scrollArea:s,viewport:u,onViewportChange:c,content:d,onContentChange:f,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:$,scrollbarY:m,onScrollbarYChange:S,scrollbarYEnabled:E,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:w},p.createElement(De.div,ee({dir:R},l,{ref:M,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),oN="ScrollAreaViewport",iN=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,i=Wn(oN,n),l=p.useRef(null),s=Xe(t,l,i.onViewportChange);return p.createElement(p.Fragment,null,p.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),p.createElement(De.div,ee({"data-radix-scroll-area-viewport":""},o,{ref:s,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style}}),p.createElement("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),Kr="ScrollAreaScrollbar",y_=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Wn(Kr,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=o,s=e.orientation==="horizontal";return p.useEffect(()=>(s?i(!0):l(!0),()=>{s?i(!1):l(!1)}),[s,i,l]),o.type==="hover"?p.createElement(lN,ee({},r,{ref:t,forceMount:n})):o.type==="scroll"?p.createElement(sN,ee({},r,{ref:t,forceMount:n})):o.type==="auto"?p.createElement(x_,ee({},r,{ref:t,forceMount:n})):o.type==="always"?p.createElement(Rg,ee({},r,{ref:t})):null}),lN=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Wn(Kr,e.__scopeScrollArea),[i,l]=p.useState(!1);return p.useEffect(()=>{const s=o.scrollArea;let a=0;if(s){const u=()=>{window.clearTimeout(a),l(!0)},c=()=>{a=window.setTimeout(()=>l(!1),o.scrollHideDelay)};return s.addEventListener("pointerenter",u),s.addEventListener("pointerleave",c),()=>{window.clearTimeout(a),s.removeEventListener("pointerenter",u),s.removeEventListener("pointerleave",c)}}},[o.scrollArea,o.scrollHideDelay]),p.createElement(Il,{present:n||i},p.createElement(x_,ee({"data-state":i?"visible":"hidden"},r,{ref:t})))}),sN=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Wn(Kr,e.__scopeScrollArea),i=e.orientation==="horizontal",l=sd(()=>a("SCROLL_END"),100),[s,a]=tN("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(s==="idle"){const u=window.setTimeout(()=>a("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[s,o.scrollHideDelay,a]),p.useEffect(()=>{const u=o.viewport,c=i?"scrollLeft":"scrollTop";if(u){let d=u[c];const f=()=>{const h=u[c];d!==h&&(a("SCROLL"),l()),d=h};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[o.viewport,i,a,l]),p.createElement(Il,{present:n||s!=="hidden"},p.createElement(Rg,ee({"data-state":s==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:He(e.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:He(e.onPointerLeave,()=>a("POINTER_LEAVE"))})))}),x_=p.forwardRef((e,t)=>{const n=Wn(Kr,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,l]=p.useState(!1),s=e.orientation==="horizontal",a=sd(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,c=n.viewport.offsetHeight<n.viewport.scrollHeight;l(s?u:c)}},10);return kl(n.viewport,a),kl(n.content,a),p.createElement(Il,{present:r||i},p.createElement(Rg,ee({"data-state":i?"visible":"hidden"},o,{ref:t})))}),Rg=p.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=Wn(Kr,e.__scopeScrollArea),i=p.useRef(null),l=p.useRef(0),[s,a]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=C_(s.viewport,s.content),c={...r,sizes:s,onSizesChange:a,hasThumb:u>0&&u<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:f=>l.current=f};function d(f,h){return gN(f,l.current,s,h)}return n==="horizontal"?p.createElement(aN,ee({},c,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const f=o.viewport.scrollLeft,h=ry(f,s,o.dir);i.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollLeft=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollLeft=d(f,o.dir))}})):n==="vertical"?p.createElement(uN,ee({},c,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const f=o.viewport.scrollTop,h=ry(f,s);i.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollTop=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollTop=d(f))}})):null}),aN=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=Wn(Kr,e.__scopeScrollArea),[l,s]=p.useState(),a=p.useRef(null),u=Xe(t,a,i.onScrollbarXChange);return p.useEffect(()=>{a.current&&s(getComputedStyle(a.current))},[a]),p.createElement(w_,ee({"data-orientation":"horizontal"},o,{ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ld(n)+"px",...e.style},onThumbPointerDown:c=>e.onThumbPointerDown(c.x),onDragScroll:c=>e.onDragScroll(c.x),onWheelScroll:(c,d)=>{if(i.viewport){const f=i.viewport.scrollLeft+c.deltaX;e.onWheelScroll(f),$_(f,d)&&c.preventDefault()}},onResize:()=>{a.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:gc(l.paddingLeft),paddingEnd:gc(l.paddingRight)}})}}))}),uN=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=Wn(Kr,e.__scopeScrollArea),[l,s]=p.useState(),a=p.useRef(null),u=Xe(t,a,i.onScrollbarYChange);return p.useEffect(()=>{a.current&&s(getComputedStyle(a.current))},[a]),p.createElement(w_,ee({"data-orientation":"vertical"},o,{ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ld(n)+"px",...e.style},onThumbPointerDown:c=>e.onThumbPointerDown(c.y),onDragScroll:c=>e.onDragScroll(c.y),onWheelScroll:(c,d)=>{if(i.viewport){const f=i.viewport.scrollTop+c.deltaY;e.onWheelScroll(f),$_(f,d)&&c.preventDefault()}},onResize:()=>{a.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:gc(l.paddingTop),paddingEnd:gc(l.paddingBottom)}})}}))}),[cN,__]=v_(Kr),w_=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:s,onThumbPositionChange:a,onDragScroll:u,onWheelScroll:c,onResize:d,...f}=e,h=Wn(Kr,n),[g,m]=p.useState(null),S=Xe(t,M=>m(M)),v=p.useRef(null),y=p.useRef(""),_=h.viewport,w=r.content-r.viewport,C=Vt(c),$=Vt(a),E=sd(d,10);function T(M){if(v.current){const R=M.clientX-v.current.left,j=M.clientY-v.current.top;u({x:R,y:j})}}return p.useEffect(()=>{const M=R=>{const j=R.target;(g==null?void 0:g.contains(j))&&C(R,w)};return document.addEventListener("wheel",M,{passive:!1}),()=>document.removeEventListener("wheel",M,{passive:!1})},[_,g,w,C]),p.useEffect($,[r,$]),kl(g,E),kl(h.content,E),p.createElement(cN,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:Vt(i),onThumbPointerUp:Vt(l),onThumbPositionChange:$,onThumbPointerDown:Vt(s)},p.createElement(De.div,ee({},f,{ref:S,style:{position:"absolute",...f.style},onPointerDown:He(e.onPointerDown,M=>{M.button===0&&(M.target.setPointerCapture(M.pointerId),v.current=g.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),T(M))}),onPointerMove:He(e.onPointerMove,T),onPointerUp:He(e.onPointerUp,M=>{const R=M.target;R.hasPointerCapture(M.pointerId)&&R.releasePointerCapture(M.pointerId),document.body.style.webkitUserSelect=y.current,h.viewport&&(h.viewport.style.scrollBehavior=""),v.current=null})})))}),Mh="ScrollAreaThumb",dN=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=__(Mh,e.__scopeScrollArea);return p.createElement(Il,{present:n||o.hasThumb},p.createElement(fN,ee({ref:t},r)))}),fN=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=Wn(Mh,n),l=__(Mh,n),{onThumbPositionChange:s}=l,a=Xe(t,d=>l.onThumbChange(d)),u=p.useRef(),c=sd(()=>{u.current&&(u.current(),u.current=void 0)},100);return p.useEffect(()=>{const d=i.viewport;if(d){const f=()=>{if(c(),!u.current){const h=mN(d,s);u.current=h,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),p.createElement(De.div,ee({"data-state":l.hasThumb?"visible":"hidden"},o,{ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:He(e.onPointerDownCapture,d=>{const h=d.target.getBoundingClientRect(),g=d.clientX-h.left,m=d.clientY-h.top;l.onThumbPointerDown({x:g,y:m})}),onPointerUp:He(e.onPointerUp,l.onThumbPointerUp)}))}),S_="ScrollAreaCorner",hN=p.forwardRef((e,t)=>{const n=Wn(S_,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.createElement(pN,ee({},e,{ref:t})):null}),pN=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Wn(S_,n),[i,l]=p.useState(0),[s,a]=p.useState(0),u=!!(i&&s);return kl(o.scrollbarX,()=>{var c;const d=((c=o.scrollbarX)===null||c===void 0?void 0:c.offsetHeight)||0;o.onCornerHeightChange(d),a(d)}),kl(o.scrollbarY,()=>{var c;const d=((c=o.scrollbarY)===null||c===void 0?void 0:c.offsetWidth)||0;o.onCornerWidthChange(d),l(d)}),u?p.createElement(De.div,ee({},r,{ref:t,style:{width:i,height:s,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function gc(e){return e?parseInt(e,10):0}function C_(e,t){const n=e/t;return isNaN(n)?0:n}function ld(e){const t=C_(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function gN(e,t,n,r="ltr"){const o=ld(n),i=o/2,l=t||i,s=o-l,a=n.scrollbar.paddingStart+l,u=n.scrollbar.size-n.scrollbar.paddingEnd-s,c=n.content-n.viewport,d=r==="ltr"?[0,c]:[c*-1,0];return E_([a,u],d)(e)}function ry(e,t,n="ltr"){const r=ld(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,l=t.content-t.viewport,s=i-r,a=n==="ltr"?[0,l]:[l*-1,0],u=Ah(e,a);return E_([0,l],[0,s])(u)}function E_(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function $_(e,t){return e>0&&e<t}const mN=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},l=n.left!==i.left,s=n.top!==i.top;(l||s)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function sd(e,t){const n=Vt(e),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function kl(e,t){const n=Vt(t);$n(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const k_=rN,vN=iN,yN=hN;function T_(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=T_(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function xN(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=T_(e))&&(r&&(r+=" "),r+=t);return r}const Pg="-";function _N(e){const t=SN(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;function o(l){const s=l.split(Pg);return s[0]===""&&s.length!==1&&s.shift(),N_(s,t)||wN(l)}function i(l,s){const a=n[l]||[];return s&&r[l]?[...a,...r[l]]:a}return{getClassGroupId:o,getConflictingClassGroupIds:i}}function N_(e,t){var l;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?N_(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Pg);return(l=t.validators.find(({validator:s})=>s(i)))==null?void 0:l.classGroupId}const oy=/^\[(.+)\]$/;function wN(e){if(oy.test(e)){const t=oy.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function SN(e){const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return EN(Object.entries(e.classGroups),n).forEach(([i,l])=>{Dh(l,r,i,t)}),r}function Dh(e,t,n,r){e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:iy(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(CN(o)){Dh(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,l])=>{Dh(l,iy(t,i),n,r)})})}function iy(e,t){let n=e;return t.split(Pg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function CN(e){return e.isThemeGetter}function EN(e,t){return t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([l,s])=>[t+l,s])):i);return[n,o]}):e}function $N(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;function o(i,l){n.set(i,l),t++,t>e&&(t=0,r=n,n=new Map)}return{get(i){let l=n.get(i);if(l!==void 0)return l;if((l=r.get(i))!==void 0)return o(i,l),l},set(i,l){n.has(i)?n.set(i,l):o(i,l)}}}const b_="!";function kN(e){const t=e.separator,n=t.length===1,r=t[0],o=t.length;return function(l){const s=[];let a=0,u=0,c;for(let m=0;m<l.length;m++){let S=l[m];if(a===0){if(S===r&&(n||l.slice(m,m+o)===t)){s.push(l.slice(u,m)),u=m+o;continue}if(S==="/"){c=m;continue}}S==="["?a++:S==="]"&&a--}const d=s.length===0?l:l.substring(u),f=d.startsWith(b_),h=f?d.substring(1):d,g=c&&c>u?c-u:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:g}}}function TN(e){if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t}function NN(e){return{cache:$N(e.cacheSize),splitModifiers:kN(e),..._N(e)}}const bN=/\s+/;function RN(e,t){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=new Set;return e.trim().split(bN).map(l=>{const{modifiers:s,hasImportantModifier:a,baseClassName:u,maybePostfixModifierPosition:c}=n(l);let d=r(c?u.substring(0,c):u),f=!!c;if(!d){if(!c)return{isTailwindClass:!1,originalClassName:l};if(d=r(u),!d)return{isTailwindClass:!1,originalClassName:l};f=!1}const h=TN(s).join(":");return{isTailwindClass:!0,modifierId:a?h+b_:h,classGroupId:d,originalClassName:l,hasPostfixModifier:f}}).reverse().filter(l=>{if(!l.isTailwindClass)return!0;const{modifierId:s,classGroupId:a,hasPostfixModifier:u}=l,c=s+a;return i.has(c)?!1:(i.add(c),o(a,u).forEach(d=>i.add(s+d)),!0)}).reverse().map(l=>l.originalClassName).join(" ")}function PN(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=R_(t))&&(r&&(r+=" "),r+=n);return r}function R_(e){if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=R_(e[r]))&&(n&&(n+=" "),n+=t);return n}function ON(e,...t){let n,r,o,i=l;function l(a){const u=t.reduce((c,d)=>d(c),e());return n=NN(u),r=n.cache.get,o=n.cache.set,i=s,s(a)}function s(a){const u=r(a);if(u)return u;const c=RN(a,n);return o(a,c),c}return function(){return i(PN.apply(null,arguments))}}function We(e){const t=n=>n[e]||[];return t.isThemeGetter=!0,t}const P_=/^\[(?:([a-z-]+):)?(.+)\]$/i,AN=/^\d+\/\d+$/,MN=new Set(["px","full","screen"]),DN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,LN=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,IN=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function Hn(e){return qo(e)||MN.has(e)||AN.test(e)}function to(e){return jl(e,"length",KN)}function qo(e){return!!e&&!Number.isNaN(Number(e))}function du(e){return jl(e,"number",qo)}function us(e){return!!e&&Number.isInteger(Number(e))}function zN(e){return e.endsWith("%")&&qo(e.slice(0,-1))}function ve(e){return P_.test(e)}function no(e){return DN.test(e)}const FN=new Set(["length","size","percentage"]);function BN(e){return jl(e,FN,O_)}function WN(e){return jl(e,"position",O_)}const UN=new Set(["image","url"]);function VN(e){return jl(e,UN,YN)}function HN(e){return jl(e,"",GN)}function cs(){return!0}function jl(e,t,n){const r=P_.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1}function KN(e){return LN.test(e)}function O_(){return!1}function GN(e){return IN.test(e)}function YN(e){return jN.test(e)}function XN(){const e=We("colors"),t=We("spacing"),n=We("blur"),r=We("brightness"),o=We("borderColor"),i=We("borderRadius"),l=We("borderSpacing"),s=We("borderWidth"),a=We("contrast"),u=We("grayscale"),c=We("hueRotate"),d=We("invert"),f=We("gap"),h=We("gradientColorStops"),g=We("gradientColorStopPositions"),m=We("inset"),S=We("margin"),v=We("opacity"),y=We("padding"),_=We("saturate"),w=We("scale"),C=We("sepia"),$=We("skew"),E=We("space"),T=We("translate"),M=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",ve,t],F=()=>[ve,t],ae=()=>["",Hn,to],H=()=>["auto",qo,ve],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],P=()=>["solid","dashed","dotted","double","none"],O=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],k=()=>["start","end","center","between","around","evenly","stretch"],I=()=>["","0",ve],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[qo,du],te=()=>[qo,ve];return{cacheSize:500,separator:":",theme:{colors:[cs],spacing:[Hn,to],blur:["none","",no,ve],brightness:V(),borderColor:[e],borderRadius:["none","","full",no,ve],borderSpacing:F(),borderWidth:ae(),contrast:V(),grayscale:I(),hueRotate:te(),invert:I(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[zN,to],inset:j(),margin:j(),opacity:V(),padding:F(),saturate:V(),scale:V(),sepia:I(),skew:te(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",ve]}],container:["container"],columns:[{columns:[no]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...X(),ve]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",us,ve]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ve]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",us,ve]}],"grid-cols":[{"grid-cols":[cs]}],"col-start-end":[{col:["auto",{span:["full",us,ve]},ve]}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":[cs]}],"row-start-end":[{row:["auto",{span:[us,ve]},ve]}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ve]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ve]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...k()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...k(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...k(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",ve,t]}],"min-w":[{"min-w":["min","max","fit",ve,Hn]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[no]},no,ve]}],h:[{h:[ve,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",Hn,ve]}],"max-h":[{"max-h":[ve,t,"min","max","fit"]}],"font-size":[{text:["base",no,to]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",du]}],"font-family":[{font:[cs]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ve]}],"line-clamp":[{"line-clamp":["none",qo,du]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Hn,ve]}],"list-image":[{"list-image":["none",ve]}],"list-style-type":[{list:["none","disc","decimal",ve]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...P(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Hn,to]}],"underline-offset":[{"underline-offset":["auto",Hn,ve]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...X(),WN]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BN]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VN]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...P(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:P()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...P()]}],"outline-offset":[{"outline-offset":[Hn,ve]}],"outline-w":[{outline:[Hn,to]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Hn,to]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",no,HN]}],"shadow-color":[{shadow:[cs]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":O()}],"bg-blend":[{"bg-blend":O()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",no,ve]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[_]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ve]}],duration:[{duration:te()}],ease:[{ease:["linear","in","out","in-out",ve]}],delay:[{delay:te()}],animate:[{animate:["none","spin","ping","pulse","bounce",ve]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[us,ve]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ve]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ve]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ve]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Hn,to,du]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const QN=ON(XN);function ot(...e){return QN(xN(e))}const As=p.forwardRef(({className:e,children:t,...n},r)=>x.jsxs(k_,{ref:r,className:ot("relative overflow-hidden",e),...n,children:[x.jsx(vN,{className:"h-full w-full rounded-[inherit]",children:t}),x.jsx(A_,{}),x.jsx(yN,{})]}));As.displayName=k_.displayName;const A_=p.forwardRef(({className:e,orientation:t="vertical",...n},r)=>x.jsx(y_,{ref:r,orientation:t,className:ot("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:x.jsx(dN,{className:ot("relative rounded-full bg-border",t==="vertical"&&"flex-1")})}));A_.displayName=y_.displayName;function Ms({children:e}){const t=p.useRef(null),n=p.useRef(null),r=p.useRef(!1),o=p.useRef(0),i=p.useRef(null),l=p.useRef(0),s=()=>{r.current=!1,i.current=null,o.current=0,l.current=0},a=S=>{S.preventDefault();const v=i.current==="left"?t:n;if(v.current&&r.current){const y=i.current==="left"?S.screenX-o.current:o.current-S.screenX;v.current.style.width=`${Math.max(l.current+y,150)}px`}},u=S=>v=>{if(v.target){const _=S==="left"?t:S==="right"?n:null;r.current=!0,_&&_.current&&(o.current=v.screenX,i.current=S,_.current&&(l.current=_.current.offsetWidth))}},[c,d,f,h,g,m]=p.Children.toArray(e);return p.useEffect(()=>(document.addEventListener("mouseup",s),document.addEventListener("mousemove",a),()=>{document.removeEventListener("mouseup",s),document.removeEventListener("mousemove",a)}),[]),x.jsxs("div",{className:"flex h-screen",children:[x.jsxs("div",{ref:t,className:"relative border-r border-border",style:{width:300},children:[x.jsxs(Ms.Column,{children:[c,x.jsx(As,{style:{height:"calc(100vh - 50px)"},children:d})]}),x.jsx("div",{className:"absolute inset-y-0 right-0 cursor-col-resize w-[1px] hover:w-[3px] h-full hover:bg-border",onMouseDown:u("left")})]}),x.jsx("div",{className:id("",{"w-full":!g&&!m}),children:x.jsxs(Ms.Column,{children:[f,x.jsx(As,{style:{height:"calc(100vh - 50px)"},children:h})]})}),g||m&&x.jsxs("div",{ref:n,className:"relative h-screen border-l border-border",style:{width:300},children:[x.jsxs(Ms.Column,{children:[g,x.jsx(As,{style:{height:"calc(100vh - 50px)"},children:m})]}),x.jsx("div",{onMouseDown:u("right"),className:"absolute inset-y-0 left-0 cursor-col-resize w-[1px] bg-border hover:w-[3px] hover:bg-border"})]})]})}Ms.Column=({children:e})=>{const[t,n]=p.Children.toArray(e);return x.jsxs("div",{className:"flex flex-col",children:[x.jsx("div",{className:"flex items-center border-b border-border",children:t}),n]})};const JN=({className:e})=>x.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 9 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[x.jsxs("g",{clipPath:"url(#clip0_1225_1638)",children:[x.jsx("rect",{y:"0.5",width:"9",height:"9"}),x.jsx("path",{d:"M0 7L8.5 5",stroke:"currentColor"}),x.jsx("circle",{cx:"3",cy:"3.5",r:"1",fill:"currentColor"})]}),x.jsx("rect",{x:"0.5",y:"1",width:"8",height:"8",stroke:"currentColor"}),x.jsx("defs",{children:x.jsx("clipPath",{id:"clip0_1225_1638",children:x.jsx("rect",{y:"0.5",width:"9",height:"9",fill:"white"})})})]}),M_=JN,ZN=({className:e})=>x.jsxs("svg",{width:"9",height:"10",viewBox:"0 0 9 10",className:e,fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[x.jsxs("g",{clipPath:"url(#clip0_1222_1618)",children:[x.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 1.5H0V0.5H9V1.5Z",fill:"currentColor"}),x.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 9.5H0V8.5H9V9.5Z",fill:"currentColor"})]}),x.jsx("defs",{children:x.jsx("clipPath",{id:"clip0_1222_1618",children:x.jsx("rect",{width:"9",height:"9",fill:"white",transform:"translate(0 0.5)"})})})]}),qN=ZN,eb=({className:e})=>x.jsx("svg",{width:"9",height:"10",viewBox:"0 0 9 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:e,children:x.jsx("g",{clipPath:"url(#clip0_1229_1625)",children:x.jsx("path",{d:"M0.0145513 0.5H8.98545L9 3.18569H8.57074C8.43007 2.2276 8.02749 1.57948 7.36298 1.24133C6.98949 1.05491 6.43169 0.953035 5.68957 0.935694V7.94581C5.68957 8.43569 5.78416 8.76084 5.97332 8.92124C6.16734 9.08165 6.5675 9.16185 7.17381 9.16185V9.5H1.86257V9.16185C2.44462 9.16185 2.83023 9.08165 3.0194 8.92124C3.21342 8.7565 3.31043 8.43136 3.31043 7.94581V0.935694C2.58286 0.953035 2.02506 1.05491 1.63703 1.24133C0.92401 1.58815 0.521423 2.23627 0.429264 3.18569H0L0.0145513 0.5Z"})})}),tb=eb;function D_({children:e,rootPath:t}){return x.jsx("div",{className:"flex flex-col w-full py-2 text-xs",children:p.Children.map(e,n=>p.cloneElement(n,{paths:[t]}))})}D_.Node=({children:e,paths:t=[],path:n,level:r=1,type:o,setActivePath:i})=>{const l=r*30,s=o==="string"?x.jsx(tb,{}):o==="image"?x.jsx(M_,{className:"h-[9px] w-[9px]"}):x.jsx(qN,{});return x.jsxs("div",{className:"w-full",children:[x.jsx("button",{className:"flex justify-between w-full group py-2 text-xs font-[400] shrink-0",onClick:()=>{i&&i(n)},style:{paddingLeft:l},children:x.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s,x.jsx("p",{children:n})]})}),e&&x.jsx(x.Fragment,{children:p.Children.map(e,a=>p.cloneElement(a,{level:r+1,paths:[...t,n]}))})]})};const nb=/^data:(image\/(png|jpeg|jpg|gif|webp|bmp|tiff|ico|svg\+xml));base64,/;function Og(e){const t=nb.exec(e);if(t&&t[1])return t[1]}function Ag(e){return e==="image/svg+xml"?"svg":e==="image/vnd.microsoft.icon"?"ico":e.startsWith("image/")?e.slice(6):e}var ln={},D={};let ad={},L_={},ca={},Ds={},Lh={},fl={},Mg={},Ih={},da={},fa={},go={},Dg={},Lg={},I_={},j_={},z_={},F_={},B_={},W_={},U_={},mc={},V_={},H_={},K_={},G_={},Y_={},X_={},Q_={},J_={},Z_={},Ig={},jg={},jh={},q_={},ew={},tw={};function U(e){let t=new URLSearchParams;t.append("code",e);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Gr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",rb=Gr&&"documentMode"in document?document.documentMode:null,Wt=Gr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),bo=Gr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),vc=Gr&&"InputEvent"in window&&!rb?"getTargetRanges"in new window.InputEvent("input"):!1,zg=Gr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ud=Gr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,ob=Gr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Fg=Gr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ob,cd=zg||ud||Fg?" ":"​",ib=bo?" ":cd,lb=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,sb=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,oi={bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},ab={directionless:1,unmergeable:2},ly={center:2,end:6,justify:4,left:1,right:3,start:5},ub={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},cb={normal:0,segmented:2,token:1},db={0:"normal",2:"segmented",1:"token"},zh=!1,Bg=0;function fb(e){Bg=e.timeStamp}function hf(e,t,n){return t.__lexicalLineBreak===e||e[`__lexicalKey_${n._key}`]!==void 0}function hb(e){return e.getEditorState().read(()=>{let t=Ke();return t!==null?t.clone():null})}function nw(e,t,n){zh=!0;let r=100<performance.now()-Bg;try{kn(e,()=>{let o=Ke()||hb(e);var i=new Map,l=e.getRootElement(),s=e._editorState,a=e._blockCursorElement;let u=!1,c="";for(var d=0;d<t.length;d++){var f=t[d],h=f.type,g=f.target,m=Ma(g,s);if(!(m===null&&g!==l||Ve(m))){if(h==="characterData"){if(f=r&&Q(m))e:{f=o,h=g;var S=m;if(de(f)){var v=f.anchor.getNode();if(v.is(S)&&f.format!==v.getFormat()){f=!1;break e}}f=h.nodeType===3&&S.isAttached()}f&&(S=Cr(e._window),h=f=null,S!==null&&S.anchorNode===g&&(f=S.anchorOffset,h=S.focusOffset),g=g.nodeValue,g!==null&&Gg(m,g,f,h,!1))}else if(h==="childList"){for(u=!0,h=f.addedNodes,S=0;S<h.length;S++){v=h[S];var y=uw(v),_=v.parentNode;_==null||v===a||y!==null||v.nodeName==="BR"&&hf(v,_,e)||(bo&&(y=v.innerText||v.nodeValue)&&(c+=y),_.removeChild(v))}if(f=f.removedNodes,h=f.length,0<h){for(S=0,v=0;v<h;v++)_=f[v],(_.nodeName==="BR"&&hf(_,g,e)||a===_)&&(g.appendChild(_),S++);h!==S&&(g===l&&(m=s._nodeMap.get("root")),i.set(g,m))}}}}if(0<i.size)for(let[w,C]of i)if(B(C))for(i=C.getChildrenKeys(),l=w.firstChild,s=0;s<i.length;s++)a=e.getElementByKey(i[s]),a!==null&&(l==null?(w.appendChild(a),l=a):l!==a&&w.replaceChild(a,l),l=l.nextSibling);else Q(C)&&C.markDirty();if(i=n.takeRecords(),0<i.length){for(l=0;l<i.length;l++)for(a=i[l],s=a.addedNodes,a=a.target,d=0;d<s.length;d++)m=s[d],g=m.parentNode,g==null||m.nodeName!=="BR"||hf(m,a,e)||g.removeChild(m);n.takeRecords()}o!==null&&(u&&(o.dirty=!0,vr(o)),bo&&hw(e)&&o.insertRawText(c))})}finally{zh=!1}}function rw(e){let t=e._observer;if(t!==null){let n=t.takeRecords();nw(e,n,t)}}function ow(e){Bg===0&&fd(e).addEventListener("textInput",fb,!0),e._observer=new MutationObserver((t,n)=>{nw(e,t,n)})}function sy(e,t){let n=e.__mode,r=e.__format;e=e.__style;let o=t.__mode,i=t.__format;return t=t.__style,(n===null||n===o)&&(r===null||r===i)&&(e===null||e===t)}function ay(e,t){let n=e.mergeWithSibling(t),r=et()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function iw(e){if(e.__text===""&&e.isSimpleText()&&!e.isUnmergeable())e.remove();else{for(var t;(t=e.getPreviousSibling())!==null&&Q(t)&&t.isSimpleText()&&!t.isUnmergeable();)if(t.__text==="")t.remove();else{sy(t,e)&&(e=ay(t,e));break}for(var n;(n=e.getNextSibling())!==null&&Q(n)&&n.isSimpleText()&&!n.isUnmergeable();)if(n.__text==="")n.remove();else{sy(e,n)&&ay(e,n);break}}}function Wg(e){return uy(e.anchor),uy(e.focus),e}function uy(e){for(;e.type==="element";){var t=e.getNode(),n=e.offset;if(n===t.getChildrenSize()?(t=t.getChildAtIndex(n-1),n=!0):(t=t.getChildAtIndex(n),n=!1),Q(t)){e.set(t.__key,n?t.getTextContentSize():0,"text");break}else if(!B(t))break;e.set(t.__key,n?t.getChildrenSize():0,"element")}}let pb=1,gb=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function Ug(e){let t=document.activeElement;if(t===null)return!1;let n=t.nodeName;return Ve(Ma(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&t.__lexicalEditor==null)}function Aa(e,t,n){let r=e.getRootElement();try{return r!==null&&r.contains(t)&&r.contains(n)&&t!==null&&!Ug(t)&&Vg(t)===e}catch{return!1}}function Vg(e){for(;e!=null;){let t=e.__lexicalEditor;if(t!=null)return t;e=dd(e)}return null}function Fh(e){return e.isToken()||e.isSegmented()}function yc(e){for(;e!=null;){if(e.nodeType===3)return e;e=e.firstChild}return null}function lw(e,t,n){return t=oi[t],e&t&&(n===null||!(n&t))?e^t:n===null||n&t?e|t:e}function sw(e){return Q(e)||ma(e)||Ve(e)}function aw(e,t){if(t!=null)e.__key=t;else{Zt(),99<va&&U(14),t=et();var n=Er(),r=""+pb++;n._nodeMap.set(r,e),B(e)?t._dirtyElements.set(r,!0):t._dirtyLeaves.add(r),t._cloneNotNeeded.add(r),t._dirtyType=1,e.__key=r}}function ii(e){var t=e.getParent();if(t!==null){let o=e.getWritable();t=t.getWritable();var n=e.getPreviousSibling();if(e=e.getNextSibling(),n===null)if(e!==null){var r=e.getWritable();t.__first=e.__key,r.__prev=null}else t.__first=null;else{if(r=n.getWritable(),e!==null){let i=e.getWritable();i.__prev=r.__key,r.__next=i.__key}else r.__next=null;o.__prev=null}e===null?n!==null?(e=n.getWritable(),t.__last=n.__key,e.__next=null):t.__last=null:(e=e.getWritable(),n!==null?(n=n.getWritable(),n.__next=e.__key,e.__prev=n.__key):e.__prev=null,o.__next=null),t.__size--,o.__parent=null}}function xc(e){99<va&&U(14);var t=e.getLatest(),n=t.__parent,r=Er();let o=et(),i=r._nodeMap;if(r=o._dirtyElements,n!==null)e:for(;n!==null;){if(r.has(n))break e;let l=i.get(n);if(l===void 0)break;r.set(n,!1),n=l.__parent}t=t.__key,o._dirtyType=1,B(e)?r.set(t,!0):o._dirtyLeaves.add(t)}function Mt(e){Zt();var t=et();let n=t._compositionKey;e!==n&&(t._compositionKey=e,n!==null&&(t=$t(n),t!==null&&t.getWritable()),e!==null&&(e=$t(e),e!==null&&e.getWritable()))}function mo(){return Ul()?null:et()._compositionKey}function $t(e,t){return e=(t||Er())._nodeMap.get(e),e===void 0?null:e}function uw(e,t){let n=et();return e=e[`__lexicalKey_${n._key}`],e!==void 0?$t(e,t):null}function Ma(e,t){for(;e!=null;){let n=uw(e,t);if(n!==null)return n;e=dd(e)}return null}function cw(e){let t=Object.assign({},e._decorators);return e._pendingDecorators=t}function cy(e){return e.read(()=>Sr().getTextContent())}function mb(e,t){kn(e,()=>{var n=Er();if(!n.isEmpty())if(t==="root")Sr().markDirty();else{n=n._nodeMap;for(let[,r]of n)r.markDirty()}},e._pendingEditorState===null?{tag:"history-merge"}:void 0)}function Sr(){return Er()._nodeMap.get("root")}function vr(e){Zt();let t=Er();e!==null&&(e.dirty=!0,e._cachedNodes=null),t._selection=e}function tl(e){var t=et(),n;e:{for(n=e;n!=null;){let r=n[`__lexicalKey_${t._key}`];if(r!==void 0){n=r;break e}n=dd(n)}n=null}return n===null?(t=t.getRootElement(),e===t?$t("root"):null):$t(n)}function dw(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Hg(e){let t=[];for(;e!==null;)t.push(e),e=e._parentEditor;return t}function fw(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Kg(e,t,n){if(t=Cr(t._window),t!==null){var r=t.anchorNode,{anchorOffset:o,focusOffset:i}=t;if(r!==null&&(t=r.nodeType===3?r.nodeValue:null,r=Ma(r),t!==null&&Q(r))){if(t===cd&&n){let l=n.length;t=n,i=o=l}t!==null&&Gg(r,t,o,i,e)}}}function Gg(e,t,n,r,o){let i=e;if(i.isAttached()&&(o||!i.isDirty())){let u=i.isComposing(),c=t;if((u||o)&&t[t.length-1]===cd&&(c=t.slice(0,-1)),t=i.getTextContent(),o||c!==t)if(c==="")if(Mt(null),zg||ud||Fg)i.remove();else{let d=et();setTimeout(()=>{d.update(()=>{i.isAttached()&&i.remove()})},20)}else{o=i.getParent(),t=Wl();var l=i.getTextContentSize(),s=mo(),a=i.getKey();i.isToken()||s!==null&&a===s&&!u||de(t)&&(o!==null&&!o.canInsertTextBefore()&&t.anchor.offset===0||t.anchor.key===e.__key&&t.anchor.offset===0&&!i.canInsertTextBefore()||t.focus.key===e.__key&&t.focus.offset===l&&!i.canInsertTextAfter())?i.markDirty():(e=Ke(),de(e)&&n!==null&&r!==null&&(e.setTextNodeRange(i,n,i,r),i.isSegmented()&&(n=i.getTextContent(),n=Ct(n),i.replace(n),i=n)),i.setTextContent(c))}}}function vb(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;e=e.anchor.offset;let n=t.getParentOrThrow(),r=t.isToken();return e===0?((e=!t.canInsertTextBefore()||!n.canInsertTextBefore()||r)||(t=t.getPreviousSibling(),e=(Q(t)||B(t)&&t.isInline())&&!t.canInsertTextAfter()),e):e===t.getTextContentSize()?!t.canInsertTextAfter()||!n.canInsertTextAfter()||r:!1}function Ls(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];return r!==void 0?r:(e=e[t],typeof e=="string"?(e=e.split(" "),n[t]=e):e)}function Yg(e,t,n,r,o){n.size!==0&&(n=r.__type,r=r.__key,t=t.get(n),t===void 0&&U(33,n),n=t.klass,t=e.get(n),t===void 0&&(t=new Map,e.set(n,t)),e=t.get(r),n=e==="destroyed"&&o==="created",(e===void 0||n)&&t.set(r,n?"updated":o))}function dy(e,t,n){let r=e.getParent(),o=n;return r!==null&&(t&&n===0?(o=e.getIndexWithinParent(),e=r):t||n!==e.getChildrenSize()||(o=e.getIndexWithinParent()+1,e=r)),e.getChildAtIndex(t?o-1:o)}function Bh(e,t){var n=e.offset;return e.type==="element"?(e=e.getNode(),dy(e,t,n)):(e=e.getNode(),t&&n===0||!t&&n===e.getTextContentSize()?(n=t?e.getPreviousSibling():e.getNextSibling(),n===null?dy(e.getParentOrThrow(),t,e.getIndexWithinParent()+(t?0:1)):n):null)}function hw(e){return e=(e=fd(e).event)&&e.inputType,e==="insertFromPaste"||e==="insertFromPasteAsQuotation"}function _c(e){return!en(e)&&!e.isLastChild()&&!e.isInline()}function wc(e,t){return e=e._keyToDOMMap.get(t),e===void 0&&U(75,t),e}function dd(e){return e=e.assignedSlot||e.parentElement,e!==null&&e.nodeType===11?e.host:e}function Sc(e,t){for(e=e.getParent();e!==null;){if(e.is(t))return!0;e=e.getParent()}return!1}function fd(e){return e=e._window,e===null&&U(78),e}function pw(e){for(e=e.getParentOrThrow();e!==null&&!Zn(e);)e=e.getParentOrThrow();return e}function Zn(e){return en(e)||B(e)&&e.isShadowRoot()}function gw(e){return e=e.constructor.clone(e),aw(e,null),e}function Da(e){var t=et();let n=e.constructor.getType();return t=t._nodes.get(n),t===void 0&&U(97),t=t.replace,t!==null?(t=t(e),t instanceof e.constructor||U(98),t):e}function pf(e,t){e=e.getParent(),!en(e)||B(t)||Ve(t)||U(99)}function gf(e){return(Ve(e)||B(e)&&!e.canBeEmpty())&&!e.isInline()}function Wh(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null,t=e.parentElement,t!==null&&t.removeChild(e)}function Cr(e){return Gr?(e||window).getSelection():null}function mw(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),Zn(e)&&U(102);let r=l=>{const s=l.getParentOrThrow(),a=Zn(s),u=l!==n||a?gw(l):l;if(a)return l.insertAfter(u),[l,u,u];const[c,d,f]=r(s);return l=l.getNextSiblings(),f.append(u,...l),[c,d,u]},[o,i]=r(n);return[o,i]}function Cc(e,t){for(;e!==Sr()&&e!=null;){if(t(e))return e;e=e.getParent()}return null}function yb(e){let t=[],n=[e];for(;0<n.length;){let r=n.pop();r===void 0&&U(112),B(r)&&n.unshift(...r.getChildren()),r!==e&&t.push(r)}return t}function hd(e){return e.nodeType===1}function vw(e,t,n,r,o,i){for(e=e.getFirstChild();e!==null;){let l=e.__key;e.__parent===t&&(B(e)&&vw(e,l,n,r,o,i),n.has(l)||i.delete(l),o.push(l)),e=e.getNextSibling()}}function xb(e,t,n,r){e=e._nodeMap,t=t._nodeMap;let o=[];for(let[i]of r){let l=t.get(i);l===void 0||l.isAttached()||(B(l)&&vw(l,i,e,t,o,r),e.has(i)||r.delete(i),o.push(i))}for(let i of o)t.delete(i);for(let i of n)r=t.get(i),r===void 0||r.isAttached()||(e.has(i)||n.delete(i),t.delete(i))}let gt="",Jt="",Or="",Ro,Ht,ha,yw=!1,Xg=!1,pd,Iu=null,Uh,Vh,hi,Po,Hh,pa;function ju(e,t){let n=hi.get(e);if(t!==null){let r=Yh(e);r.parentNode===t&&t.removeChild(r)}Po.has(e)||Ht._keyToDOMMap.delete(e),B(n)&&(e=Ec(n,hi),Kh(e,0,e.length-1,null)),n!==void 0&&Yg(pa,ha,pd,n,"destroyed")}function Kh(e,t,n,r){for(;t<=n;++t){let o=e[t];o!==void 0&&ju(o,r)}}function Ho(e,t){e.setProperty("text-align",t)}function xw(e,t){var n=Ro.theme.indent;if(typeof n=="string"){let r=e.classList.contains(n);0<t&&!r?e.classList.add(n):1>t&&r&&e.classList.remove(n)}n=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||"40px",e.style.setProperty("padding-inline-start",t===0?"":`calc(${t} * ${n})`)}function _w(e,t){e=e.style,t===0?Ho(e,""):t===1?Ho(e,"left"):t===2?Ho(e,"center"):t===3?Ho(e,"right"):t===4?Ho(e,"justify"):t===5?Ho(e,"start"):t===6&&Ho(e,"end")}function zu(e,t,n){let r=Po.get(e);r===void 0&&U(60);let o=r.createDOM(Ro,Ht);var i=Ht._keyToDOMMap;if(o["__lexicalKey_"+Ht._key]=e,i.set(e,o),Q(r)?o.setAttribute("data-lexical-text","true"):Ve(r)&&o.setAttribute("data-lexical-decorator","true"),B(r)){if(e=r.__indent,i=r.__size,e!==0&&xw(o,e),i!==0){--i,e=Ec(r,Po);var l=Jt;Jt="",Gh(e,r,0,i,o,null),Sw(r,o),Jt=l}e=r.__format,e!==0&&_w(o,e),r.isInline()||ww(null,r,o),_c(r)&&(gt+=`
48
-
49
- `,Or+=`
50
-
51
- `)}else i=r.getTextContent(),Ve(r)?(l=r.decorate(Ht,Ro),l!==null&&Cw(e,l),o.contentEditable="false"):Q(r)&&(r.isDirectionless()||(Jt+=i)),gt+=i,Or+=i;return t!==null&&(n!=null?t.insertBefore(o,n):(n=t.__lexicalLineBreak,n!=null?t.insertBefore(o,n):t.appendChild(o))),Yg(pa,ha,pd,r,"created"),o}function Gh(e,t,n,r,o,i){let l=gt;for(gt="";n<=r;++n)zu(e[n],o,i);_c(t)&&(gt+=`
52
-
53
- `),o.__lexicalTextContent=gt,gt=l+gt}function fy(e,t){return e=t.get(e),ma(e)||Ve(e)&&e.isInline()}function ww(e,t,n){e=e!==null&&(e.__size===0||fy(e.__last,hi)),t=t.__size===0||fy(t.__last,Po),e?t||(t=n.__lexicalLineBreak,t!=null&&n.removeChild(t),n.__lexicalLineBreak=null):t&&(t=document.createElement("br"),n.__lexicalLineBreak=t,n.appendChild(t))}function Sw(e,t){var n=t.__lexicalDir;if(t.__lexicalDirTextContent!==Jt||n!==Iu){let i=Jt==="";if(i)var r=Iu;else r=Jt,r=lb.test(r)?"rtl":sb.test(r)?"ltr":null;if(r!==n){let l=t.classList,s=Ro.theme;var o=n!==null?s[n]:void 0;let a=r!==null?s[r]:void 0;o!==void 0&&(typeof o=="string"&&(o=o.split(" "),o=s[n]=o),l.remove(...o)),r===null||i&&r==="ltr"?t.removeAttribute("dir"):(a!==void 0&&(typeof a=="string"&&(n=a.split(" "),a=s[r]=n),a!==void 0&&l.add(...a)),t.dir=r),Xg||(e.getWritable().__dir=r)}Iu=r,t.__lexicalDirTextContent=Jt,t.__lexicalDir=r}}function Ec(e,t){let n=[];for(e=e.__first;e!==null;){let r=t.get(e);r===void 0&&U(101),n.push(e),e=r.__next}return n}function _s(e,t){var n=hi.get(e),r=Po.get(e);n!==void 0&&r!==void 0||U(61);var o=yw||Vh.has(e)||Uh.has(e);let i=wc(Ht,e);if(n===r&&!o)return B(n)?(r=i.__lexicalTextContent,r!==void 0&&(gt+=r,Or+=r),r=i.__lexicalDirTextContent,r!==void 0&&(Jt+=r)):(r=n.getTextContent(),Q(n)&&!n.isDirectionless()&&(Jt+=r),Or+=r,gt+=r),i;if(n!==r&&o&&Yg(pa,ha,pd,r,"updated"),r.updateDOM(n,i,Ro))return r=zu(e,null,null),t===null&&U(62),t.replaceChild(r,i),ju(e,null),r;if(B(n)&&B(r)){if(e=r.__indent,e!==n.__indent&&xw(i,e),e=r.__format,e!==n.__format&&_w(i,e),o){e=r,o=Jt,Jt="",t=gt;var l=n.__size,s=e.__size;if(gt="",l===1&&s===1){var a=n.__first,u=e.__first;if(a===u)_s(a,i);else{var c=Yh(a);u=zu(u,null,null),i.replaceChild(u,c),ju(a,null)}}else{u=Ec(n,hi);var d=Ec(e,Po);if(l===0)s!==0&&Gh(d,e,0,s-1,i,null);else if(s===0)l!==0&&(a=i.__lexicalLineBreak==null,Kh(u,0,l-1,a?null:i),a&&(i.textContent=""));else{var f=u;u=d,d=l-1,l=s-1;let g=i.firstChild,m=0;for(s=0;m<=d&&s<=l;){var h=f[m];let S=u[s];if(h===S)g=mf(_s(S,i)),m++,s++;else{a===void 0&&(a=new Set(f)),c===void 0&&(c=new Set(u));let v=c.has(h),y=a.has(S);v?(y?(h=wc(Ht,S),h===g?g=mf(_s(S,i)):(g!=null?i.insertBefore(h,g):i.appendChild(h),_s(S,i)),m++):zu(S,i,g),s++):(g=mf(Yh(h)),ju(h,i),m++)}}a=m>d,c=s>l,a&&!c?(a=u[l+1],a=a===void 0?null:Ht.getElementByKey(a),Gh(u,e,s,l,i,a)):c&&!a&&Kh(f,m,d,i)}}_c(e)&&(gt+=`
54
-
55
- `),i.__lexicalTextContent=gt,gt=t+gt,Sw(e,i),Jt=o,en(r)||r.isInline()||ww(n,r,i)}_c(r)&&(gt+=`
56
-
57
- `,Or+=`
58
-
59
- `)}else n=r.getTextContent(),Ve(r)?(o=r.decorate(Ht,Ro),o!==null&&Cw(e,o)):Q(r)&&!r.isDirectionless()&&(Jt+=n),gt+=n,Or+=n;return!Xg&&en(r)&&r.__cachedText!==Or&&(r=r.getWritable(),r.__cachedText=Or),i}function Cw(e,t){let n=Ht._pendingDecorators,r=Ht._decorators;if(n===null){if(r[e]===t)return;n=cw(Ht)}n[e]=t}function mf(e){return e=e.nextSibling,e!==null&&e===Ht._blockCursorElement&&(e=e.nextSibling),e}function Yh(e){let t=Hh.get(e);return t===void 0&&U(75,e),t}let Tr=Object.freeze({}),Xh=[["keydown",Tb],["pointerdown",wb],["compositionstart",$b],["compositionend",kb],["input",Eb],["click",_b],["cut",Tr],["copy",Tr],["dragstart",Tr],["dragover",Tr],["dragend",Tr],["paste",Tr],["focus",Tr],["blur",Tr],["drop",Tr]];vc&&Xh.push(["beforeinput",(e,t)=>Cb(e,t)]);let ga=0,Ew=0,$w=0,Wi=null,Is=0,Qh=!1,Jh=!1,js=!1,ws=!1,kw=[0,"",0,"root",0];function Tw(e,t,n,r,o){let i=e.anchor,l=e.focus,s=i.getNode();var a=et();let u=Cr(a._window),c=u!==null?u.anchorNode:null,d=i.key;a=a.getElementByKey(d);let f=n.length;return d!==l.key||!Q(s)||(!o&&(!vc||$w<r+50)||s.isDirty()&&2>f||dw(n))&&i.offset!==l.offset&&!s.isComposing()||Fh(s)||s.isDirty()&&1<f||(o||!vc)&&a!==null&&!s.isComposing()&&c!==yc(a)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||s.getFormat()!==e.format||s.getStyle()!==e.style||vb(e,s)}function hy(e,t){return e!==null&&e.nodeValue!==null&&e.nodeType===3&&t!==0&&t!==e.nodeValue.length}function py(e,t,n){let{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:l}=e;Qh&&(Qh=!1,hy(r,o)&&hy(i,l))||kn(t,()=>{if(!n)vr(null);else if(Aa(t,r,i)){var s=Ke();if(de(s)){var a=s.anchor,u=a.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);var c=fd(t).event;c=c?c.timeStamp:performance.now();let[d,f,h,g,m]=kw;c<m+200&&a.offset===h&&a.key===g?(s.format=d,s.style=f):a.type==="text"?(s.format=u.getFormat(),s.style=u.getStyle()):a.type==="element"&&(s.format=0,s.style="")}else{a=255,u=!1,c=s.getNodes();let d=c.length;for(let f=0;f<d;f++){let h=c[f];if(Q(h)&&(u=!0,a&=h.getFormat(),a===0))break}s.format=u?a:0}}Y(t,ad,void 0)}})}function _b(e,t){kn(t,()=>{let n=Ke();var r=Cr(t._window);let o=Wl();if(r)if(de(n)){let l=n.anchor;var i=l.getNode();l.type==="element"&&l.offset===0&&n.isCollapsed()&&!en(i)&&Sr().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&o!==null&&n.is(o)?(r.removeAllRanges(),n.dirty=!0):e.detail!==3||n.isCollapsed()||(r=n.focus.getNode(),i!==r&&(B(i)?i.select(0):i.getParentOrThrow().select(0)))}else e.pointerType==="touch"&&(i=r.anchorNode,i!==null&&(i=i.nodeType,i===1||i===3))&&(r=Jg(o,r,t),vr(r));Y(t,L_,e)})}function wb(e,t){let n=e.target;e=e.pointerType,n instanceof Node&&e!=="touch"&&kn(t,()=>{Ve(Ma(n))||(Jh=!0)})}function Nw(e){return e.getTargetRanges?(e=e.getTargetRanges(),e.length===0?null:e[0]):null}function Sb(e,t){return e!==t||B(e)||B(t)||!e.isToken()||!t.isToken()}function Cb(e,t){let n=e.inputType,r=Nw(e);n==="deleteCompositionText"||bo&&hw(t)||n!=="insertCompositionText"&&kn(t,()=>{let o=Ke();if(n==="deleteContentBackward"){if(o===null){var i=Wl();if(!de(i))return;vr(i.clone())}if(de(o)){Ew===229&&e.timeStamp<ga+30&&t.isComposing()&&o.anchor.key===o.focus.key?(Mt(null),ga=0,setTimeout(()=>{kn(t,()=>{Mt(null)})},30),de(o)&&(i=o.anchor.getNode(),i.markDirty(),o.format=i.getFormat(),o.style=i.getStyle())):(e.preventDefault(),Y(t,ca,!0));return}}if(de(o)){i=e.data,Wi!==null&&Kg(!1,t,Wi),o.dirty&&Wi===null||!o.isCollapsed()||en(o.anchor.getNode())||r===null||o.applyDOMRange(r),Wi=null;var l=o.focus,s=o.anchor.getNode();if(l=l.getNode(),n==="insertText"||n==="insertTranspose")i===`
60
- `?(e.preventDefault(),Y(t,Ds,!1)):i===`
61
-
62
- `?(e.preventDefault(),Y(t,Lh,void 0)):i==null&&e.dataTransfer?(i=e.dataTransfer.getData("text/plain"),e.preventDefault(),o.insertRawText(i)):i!=null&&Tw(o,r,i,e.timeStamp,!0)?(e.preventDefault(),Y(t,fl,i)):Wi=i,$w=e.timeStamp;else switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Y(t,fl,e);break;case"insertFromComposition":Mt(null),Y(t,fl,e);break;case"insertLineBreak":Mt(null),Y(t,Ds,!1);break;case"insertParagraph":Mt(null),js&&!ud?(js=!1,Y(t,Ds,!1)):Y(t,Lh,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Y(t,Mg,e);break;case"deleteByComposition":Sb(s,l)&&Y(t,Ih,e);break;case"deleteByDrag":case"deleteByCut":Y(t,Ih,e);break;case"deleteContent":Y(t,ca,!1);break;case"deleteWordBackward":Y(t,da,!0);break;case"deleteWordForward":Y(t,da,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Y(t,fa,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Y(t,fa,!1);break;case"formatStrikeThrough":Y(t,go,"strikethrough");break;case"formatBold":Y(t,go,"bold");break;case"formatItalic":Y(t,go,"italic");break;case"formatUnderline":Y(t,go,"underline");break;case"historyUndo":Y(t,Dg,void 0);break;case"historyRedo":Y(t,Lg,void 0)}}})}function Eb(e,t){e.stopPropagation(),kn(t,()=>{var n=Ke(),r=e.data,o=Nw(e);if(r!=null&&de(n)&&Tw(n,o,r,e.timeStamp,!1)){ws&&(Zh(t,r),ws=!1);var i=n.anchor,l=i.getNode();if(o=Cr(t._window),o===null)return;let s=i.offset;(i=vc&&!n.isCollapsed()&&Q(l)&&o.anchorNode!==null)&&(l=l.getTextContent().slice(0,s)+r+l.getTextContent().slice(s+n.focus.offset),o=o.anchorNode,i=l===(o.nodeType===3?o.nodeValue:null)),i||Y(t,fl,r),r=r.length,bo&&1<r&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=r),zg||ud||Fg||!t.isComposing()||(ga=0,Mt(null))}else Kg(!1,t,r!==null?r:void 0),ws&&(Zh(t,r||void 0),ws=!1);Zt(),n=et(),rw(n)}),Wi=null}function $b(e,t){kn(t,()=>{let n=Ke();if(de(n)&&!t.isComposing()){let r=n.anchor,o=n.anchor.getNode();Mt(r.key),(e.timeStamp<ga+30||r.type==="element"||!n.isCollapsed()||o.getFormat()!==n.format||o.getStyle()!==n.style)&&Y(t,fl,ib)}})}function Zh(e,t){var n=e._compositionKey;if(Mt(null),n!==null&&t!=null){if(t===""){t=$t(n),e=yc(e.getElementByKey(n)),e!==null&&e.nodeValue!==null&&Q(t)&&Gg(t,e.nodeValue,null,null,!0);return}if(t[t.length-1]===`
63
- `&&(n=Ke(),de(n))){t=n.focus,n.anchor.set(t.key,t.offset,t.type),Y(e,mc,null);return}}Kg(!0,e,t)}function kb(e,t){bo?ws=!0:kn(t,()=>{Zh(t,e.data)})}function Tb(e,t){if(ga=e.timeStamp,Ew=e.keyCode,!t.isComposing()){var{keyCode:n,shiftKey:r,ctrlKey:o,metaKey:i,altKey:l}=e;if(!Y(t,I_,e)){if(n!==39||o||i||l)if(n!==39||l||r||!o&&!i)if(n!==37||o||i||l)if(n!==37||l||r||!o&&!i)if(n!==38||o||i)if(n!==40||o||i)if(n===13&&r)js=!0,Y(t,mc,e);else if(n===32)Y(t,V_,e);else if(Wt&&o&&n===79)e.preventDefault(),js=!0,Y(t,Ds,!0);else if(n!==13||r){var s=Wt?l||i?!1:n===8||n===72&&o:o||l||i?!1:n===8;s?n===8?Y(t,H_,e):(e.preventDefault(),Y(t,ca,!0)):n===27?Y(t,K_,e):(s=Wt?r||l||i?!1:n===46||n===68&&o:o||l||i?!1:n===46,s?n===46?Y(t,G_,e):(e.preventDefault(),Y(t,ca,!1)):n===8&&(Wt?l:o)?(e.preventDefault(),Y(t,da,!0)):n===46&&(Wt?l:o)?(e.preventDefault(),Y(t,da,!1)):Wt&&i&&n===8?(e.preventDefault(),Y(t,fa,!0)):Wt&&i&&n===46?(e.preventDefault(),Y(t,fa,!1)):n===66&&!l&&(Wt?i:o)?(e.preventDefault(),Y(t,go,"bold")):n===85&&!l&&(Wt?i:o)?(e.preventDefault(),Y(t,go,"underline")):n===73&&!l&&(Wt?i:o)?(e.preventDefault(),Y(t,go,"italic")):n!==9||l||o||i?n===90&&!r&&(Wt?i:o)?(e.preventDefault(),Y(t,Dg,void 0)):(s=Wt?n===90&&i&&r:n===89&&o||n===90&&o&&r,s?(e.preventDefault(),Y(t,Lg,void 0)):Bl(t._editorState._selection)?(s=r?!1:n===67?Wt?i:o:!1,s?(e.preventDefault(),Y(t,Ig,e)):(s=r?!1:n===88?Wt?i:o:!1,s?(e.preventDefault(),Y(t,jg,e)):n===65&&(Wt?i:o)&&(e.preventDefault(),Y(t,jh,e)))):!bo&&n===65&&(Wt?i:o)&&(e.preventDefault(),Y(t,jh,e))):Y(t,Y_,e))}else js=!1,Y(t,mc,e);else Y(t,U_,e);else Y(t,W_,e);else Y(t,B_,e);else Y(t,F_,e);else Y(t,z_,e);else Y(t,j_,e);(o||r||l||i)&&Y(t,tw,e)}}}function bw(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}let hl=new Map;function Rw(e){e=e.target;let t=Cr(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t!==null){var n=Vg(t.anchorNode);if(n!==null){Jh&&(Jh=!1,kn(n,()=>{var l=Wl(),s=t.anchorNode;s!==null&&(s=s.nodeType,s===1||s===3)&&(l=Jg(l,t,n),vr(l))})),e=Hg(n),e=e[e.length-1];var r=e._key,o=hl.get(r),i=o||e;i!==n&&py(t,i,!1),py(t,n,!0),n!==e?hl.set(r,n):o&&hl.delete(r)}}}function Nb(e,t){Is===0&&e.ownerDocument.addEventListener("selectionchange",Rw),Is++,e.__lexicalEditor=t;let n=bw(e);for(let r=0;r<Xh.length;r++){let[o,i]=Xh[r],l=typeof i=="function"?s=>{s._lexicalHandled!==!0&&(s._lexicalHandled=!0,t.isEditable()&&i(s,t))}:s=>{if(s._lexicalHandled!==!0&&(s._lexicalHandled=!0,t.isEditable()))switch(o){case"cut":return Y(t,jg,s);case"copy":return Y(t,Ig,s);case"paste":return Y(t,Mg,s);case"dragstart":return Y(t,Q_,s);case"dragover":return Y(t,J_,s);case"dragend":return Y(t,Z_,s);case"focus":return Y(t,q_,s);case"blur":return Y(t,ew,s);case"drop":return Y(t,X_,s)}};e.addEventListener(o,l),n.push(()=>{e.removeEventListener(o,l)})}}function qh(e,t,n){Zt();var r=e.__key;let o=e.getParent();if(o!==null){var i=Ke();if(de(i)&&B(e)){var{anchor:l,focus:s}=i,a=l.getNode(),u=s.getNode();Sc(a,e)&&l.set(e.__key,0,"element"),Sc(u,e)&&s.set(e.__key,0,"element")}if(a=i,u=!1,de(a)&&t){i=a.anchor;let c=a.focus;i.key===r&&(kc(i,e,o,e.getPreviousSibling(),e.getNextSibling()),u=!0),c.key===r&&(kc(c,e,o,e.getPreviousSibling(),e.getNextSibling()),u=!0)}else Bl(a)&&t&&e.isSelected()&&e.selectPrevious();de(a)&&t&&!u?(r=e.getIndexWithinParent(),ii(e),$c(a,o,r,-1)):ii(e),n||Zn(o)||o.canBeEmpty()||!o.isEmpty()||qh(o,t),t&&en(o)&&o.isEmpty()&&o.selectEnd()}}class La{static getType(){U(64,this.name)}static clone(){U(65,this.name)}constructor(t){this.__type=this.constructor.getType(),this.__next=this.__prev=this.__parent=null,aw(this,t)}getType(){return this.__type}isAttached(){for(var t=this.__key;t!==null;){if(t==="root")return!0;if(t=$t(t),t===null)break;t=t.__parent}return!1}isSelected(t){if(t=t||Ke(),t==null)return!1;let n=t.getNodes().some(r=>r.__key===this.__key);return Q(this)?n:de(t)&&t.anchor.type==="element"&&t.focus.type==="element"&&t.anchor.key===t.focus.key&&t.anchor.offset===t.focus.offset?!1:n}getKey(){return this.__key}getIndexWithinParent(){var t=this.getParent();if(t===null)return-1;t=t.getFirstChild();let n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:$t(t)}getParentOrThrow(){let t=this.getParent();return t===null&&U(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(Zn(n))return t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&U(67,this.__key),t}getParents(){let t=[],n=this.getParent();for(;n!==null;)t.push(n),n=n.getParent();return t}getParentKeys(){let t=[],n=this.getParent();for(;n!==null;)t.push(n.__key),n=n.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:$t(t)}getPreviousSiblings(){let t=[];var n=this.getParent();if(n===null)return t;for(n=n.getFirstChild();n!==null&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:$t(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=this.getParents();var r=t.getParents();B(this)&&n.unshift(this),B(t)&&r.unshift(t),t=n.length;var o=r.length;if(t===0||o===0||n[t-1]!==r[o-1])return null;for(r=new Set(r),o=0;o<t;o++){let i=n[o];if(r.has(i))return i}return null}is(t){return t==null?!1:this.__key===t.__key}isBefore(t){if(this===t)return!1;if(t.isParentOf(this))return!0;if(this.isParentOf(t))return!1;var n=this.getCommonAncestor(t);let r=this;for(;;){var o=r.getParentOrThrow();if(o===n){o=r.getIndexWithinParent();break}r=o}for(r=t;;){if(t=r.getParentOrThrow(),t===n){n=r.getIndexWithinParent();break}r=t}return o<n}isParentOf(t){let n=this.__key;if(n===t.__key)return!1;for(;t!==null;){if(t.__key===n)return!0;t=t.getParent()}return!1}getNodesBetween(t){let n=this.isBefore(t),r=[],o=new Set;for(var i=this;;){var l=i.__key;if(o.has(l)||(o.add(l),r.push(i)),i===t)break;if(l=B(i)?n?i.getFirstChild():i.getLastChild():null,l!==null)i=l;else if(l=n?i.getNextSibling():i.getPreviousSibling(),l!==null)i=l;else{if(i=i.getParentOrThrow(),o.has(i.__key)||r.push(i),i===t)break;l=i;do l===null&&U(68),i=n?l.getNextSibling():l.getPreviousSibling(),l=l.getParent(),l!==null&&(i!==null||o.has(l.__key)||r.push(l));while(i===null)}}return n||r.reverse(),r}isDirty(){let t=et()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){let t=$t(this.__key);return t===null&&U(113),t}getWritable(){Zt();var t=Er(),n=et();t=t._nodeMap;let r=this.__key,o=this.getLatest(),i=o.__parent;n=n._cloneNotNeeded;var l=Ke();return l!==null&&(l._cachedNodes=null),n.has(r)?(xc(o),o):(l=o.constructor.clone(o),l.__parent=i,l.__next=o.__next,l.__prev=o.__prev,B(o)&&B(l)?(l.__first=o.__first,l.__last=o.__last,l.__size=o.__size,l.__indent=o.__indent,l.__format=o.__format,l.__dir=o.__dir):Q(o)&&Q(l)&&(l.__format=o.__format,l.__style=o.__style,l.__mode=o.__mode,l.__detail=o.__detail),n.add(r),l.__key=r,xc(l),t.set(r,l),l)}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){U(70)}updateDOM(){U(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){U(72)}static importJSON(){U(18,this.name)}static transform(){return null}remove(t){qh(this,!0,t)}replace(t,n){Zt();var r=Ke();r!==null&&(r=r.clone()),pf(this,t);let o=this.getLatest(),i=this.__key,l=t.__key,s=t.getWritable();t=this.getParentOrThrow().getWritable();let a=t.__size;ii(s);let u=o.getPreviousSibling(),c=o.getNextSibling(),d=o.__prev,f=o.__next,h=o.__parent;return qh(o,!1,!0),u===null?t.__first=l:u.getWritable().__next=l,s.__prev=d,c===null?t.__last=l:c.getWritable().__prev=l,s.__next=f,s.__parent=h,t.__size=a,n&&this.getChildren().forEach(g=>{s.append(g)}),de(r)&&(vr(r),n=r.anchor,r=r.focus,n.key===i&&vy(n,s),r.key===i&&vy(r,s)),mo()===i&&Mt(l),s}insertAfter(t,n=!0){Zt(),pf(this,t);var r=this.getWritable();let o=t.getWritable();var i=o.getParent();let l=Ke();var s=!1,a=!1;if(i!==null){var u=t.getIndexWithinParent();ii(o),de(l)&&(a=i.__key,s=l.anchor,i=l.focus,s=s.type==="element"&&s.key===a&&s.offset===u+1,a=i.type==="element"&&i.key===a&&i.offset===u+1)}i=this.getNextSibling(),u=this.getParentOrThrow().getWritable();let c=o.__key,d=r.__next;return i===null?u.__last=c:i.getWritable().__prev=c,u.__size++,r.__next=c,o.__next=d,o.__prev=r.__key,o.__parent=r.__parent,n&&de(l)&&(n=this.getIndexWithinParent(),$c(l,u,n+1),r=u.__key,s&&l.anchor.set(r,n+2,"element"),a&&l.focus.set(r,n+2,"element")),t}insertBefore(t,n=!0){Zt(),pf(this,t);var r=this.getWritable();let o=t.getWritable(),i=o.__key;ii(o);let l=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),a=r.__prev,u=this.getIndexWithinParent();return l===null?s.__first=i:l.getWritable().__next=i,s.__size++,r.__prev=i,o.__prev=a,o.__next=r.__key,o.__parent=r.__parent,r=Ke(),n&&de(r)&&(n=this.getParentOrThrow(),$c(r,n,u)),t}isParentRequired(){return!1}createParentElementNode(){return pi()}selectPrevious(t,n){Zt();let r=this.getPreviousSibling(),o=this.getParentOrThrow();return r===null?o.select(0,0):B(r)?r.select():Q(r)?r.select(t,n):(t=r.getIndexWithinParent()+1,o.select(t,t))}selectNext(t,n){Zt();let r=this.getNextSibling(),o=this.getParentOrThrow();return r===null?o.select():B(r)?r.select(0,0):Q(r)?r.select(t,n):(t=r.getIndexWithinParent(),o.select(t,t))}markDirty(){this.getWritable()}}class zl extends La{static getType(){return"linebreak"}static clone(t){return new zl(t.__key)}constructor(t){super(t)}getTextContent(){return`
64
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:t=>{let n=t.parentElement,r,o;return n!==null&&((r=n.firstChild)===t||r.nextSibling===t&&r.nodeType===3&&(r.textContent||"").match(/^( |\t|\r?\n)+$/)!==null)&&((o=n.lastChild)===t||o.previousSibling===t&&o.nodeType===3&&(o.textContent||"").match(/^( |\t|\r?\n)+$/)!==null)?null:{conversion:bb,priority:0}}}}static importJSON(){return Tl()}exportJSON(){return{type:"linebreak",version:1}}}function bb(){return{node:Tl()}}function Tl(){return Da(new zl)}function ma(e){return e instanceof zl}function vf(e,t){return t&16?"code":t&128?"mark":t&32?"sub":t&64?"sup":null}function yf(e,t){return t&1?"strong":t&2?"em":"span"}function xf(e,t,n,r,o){e=r.classList,r=Ls(o,"base"),r!==void 0&&e.add(...r),r=Ls(o,"underlineStrikethrough");let i=!1,l=t&8&&t&4;var s=n&8&&n&4;r!==void 0&&(s?(i=!0,l||e.add(...r)):l&&e.remove(...r));for(let a in oi)s=oi[a],r=Ls(o,a),r!==void 0&&(n&s?!i||a!=="underline"&&a!=="strikethrough"?(!(t&s)||l&&a==="underline"||a==="strikethrough")&&e.add(...r):t&s&&e.remove(...r):t&s&&e.remove(...r))}function _f(e,t,n){let r=t.firstChild;if(n=n.isComposing(),e+=n?cd:"",r==null)t.textContent=e;else if(t=r.nodeValue,t!==e)if(n||bo){n=t.length;let o=e.length,i=0,l=0;for(;i<n&&i<o&&t[i]===e[i];)i++;for(;l+i<n&&l+i<o&&t[n-l-1]===e[o-l-1];)l++;e=[i,n-i-l,e.slice(i,o-l)];let[s,a,u]=e;a!==0&&r.deleteData(s,a),r.insertData(s,u)}else r.nodeValue=e}function fu(e,t){return t=document.createElement(t),t.appendChild(e),t}class ki extends La{static getType(){return"text"}static clone(t){return new ki(t.__text,t.__key)}constructor(t,n){super(n),this.__text=t,this.__format=0,this.__style="",this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let t=this.getLatest();return db[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===mo()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return(this.getLatest().__detail&1)!==0}isUnmergeable(){return(this.getLatest().__detail&2)!==0}hasFormat(t){return t=oi[t],(this.getFormat()&t)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){let r=this.getLatest().__format;return lw(r,t,n)}createDOM(t){var n=this.__format,r=vf(this,n);let o=yf(this,n),i=document.createElement(r===null?o:r),l=i;return this.hasFormat("code")&&i.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(o),i.appendChild(l)),r=l,_f(this.__text,r,this),t=t.theme.text,t!==void 0&&xf(o,0,n,r,t),n=this.__style,n!==""&&(i.style.cssText=n),i}updateDOM(t,n,r){let o=this.__text;var i=t.__format,l=this.__format,s=vf(this,i);let a=vf(this,l);var u=yf(this,i);let c=yf(this,l);return(s===null?u:s)!==(a===null?c:a)?!0:s===a&&u!==c?(i=n.firstChild,i==null&&U(48),t=s=document.createElement(c),_f(o,t,this),r=r.theme.text,r!==void 0&&xf(c,0,l,t,r),n.replaceChild(s,i),!1):(u=n,a!==null&&s!==null&&(u=n.firstChild,u==null&&U(49)),_f(o,u,this),r=r.theme.text,r!==void 0&&i!==l&&xf(c,i,l,u,r),l=this.__style,t.__style!==l&&(n.style.cssText=l),!1)}static importDOM(){return{"#text":()=>({conversion:Ob,priority:0}),b:()=>({conversion:Pb,priority:0}),code:()=>({conversion:ro,priority:0}),em:()=>({conversion:ro,priority:0}),i:()=>({conversion:ro,priority:0}),s:()=>({conversion:ro,priority:0}),span:()=>({conversion:Rb,priority:0}),strong:()=>({conversion:ro,priority:0}),sub:()=>({conversion:ro,priority:0}),sup:()=>({conversion:ro,priority:0}),u:()=>({conversion:ro,priority:0})}}static importJSON(t){let n=Ct(t.text);return n.setFormat(t.format),n.setDetail(t.detail),n.setMode(t.mode),n.setStyle(t.style),n}exportDOM(t){return{element:t}=super.exportDOM(t),t!==null&&hd(t)||U(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=fu(t,"b")),this.hasFormat("italic")&&(t=fu(t,"i")),this.hasFormat("strikethrough")&&(t=fu(t,"s")),this.hasFormat("underline")&&(t=fu(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(t){let n=this.getWritable();return n.__format=typeof t=="string"?oi[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?ab[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){return t=oi[t],this.setFormat(this.getFormat()^t)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){if(t=cb[t],this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(t){if(this.__text===t)return this;let n=this.getWritable();return n.__text=t,n}select(t,n){Zt();let r=Ke();var o=this.getTextContent();let i=this.__key;if(typeof o=="string"?(o=o.length,t===void 0&&(t=o),n===void 0&&(n=o)):n=t=0,de(r))o=mo(),o!==r.anchor.key&&o!==r.focus.key||Mt(i),r.setTextNodeRange(this,t,this,n);else return Aw(i,t,i,n,"text","text");return r}spliceText(t,n,r,o){let i=this.getWritable(),l=i.__text,s=r.length,a=t;0>a&&(a=s+a,0>a&&(a=0));let u=Ke();return o&&de(u)&&(t+=s,u.setTextNodeRange(i,t,i,t)),n=l.slice(0,a)+r+l.slice(a+n),i.__text=n,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Zt();var n=this.getLatest(),r=n.getTextContent(),o=n.__key,i=mo(),l=new Set(t);t=[];for(var s=r.length,a="",u=0;u<s;u++)a!==""&&l.has(u)&&(t.push(a),a=""),a+=r[u];if(a!==""&&t.push(a),l=t.length,l===0)return[];if(t[0]===r)return[n];var c=t[0];r=n.getParentOrThrow(),u=n.getFormat();let d=n.getStyle(),f=n.__detail;s=!1,n.isSegmented()?(a=Ct(c),a.__format=u,a.__style=d,a.__detail=f,s=!0):(a=n.getWritable(),a.__text=c),n=Ke(),a=[a],c=c.length;for(let m=1;m<l;m++){var h=t[m],g=h.length;h=Ct(h).getWritable(),h.__format=u,h.__style=d,h.__detail=f;let S=h.__key;if(g=c+g,de(n)){let v=n.anchor,y=n.focus;v.key===o&&v.type==="text"&&v.offset>c&&v.offset<=g&&(v.key=S,v.offset-=c,n.dirty=!0),y.key===o&&y.type==="text"&&y.offset>c&&y.offset<=g&&(y.key=S,y.offset-=c,n.dirty=!0)}i===o&&Mt(S),c=g,a.push(h)}return o=this.getPreviousSibling(),i=this.getNextSibling(),o!==null&&xc(o),i!==null&&xc(i),o=r.getWritable(),i=this.getIndexWithinParent(),s?(o.splice(i,0,a),this.remove()):o.splice(i,1,a),de(n)&&$c(n,r,i,l-1),a}mergeWithSibling(t){var n=t===this.getPreviousSibling();n||t===this.getNextSibling()||U(50);var r=this.__key;let o=t.__key,i=this.__text,l=i.length;mo()===o&&Mt(r);let s=Ke();if(de(s)){let a=s.anchor,u=s.focus;a!==null&&a.key===o&&(Ey(a,n,r,t,l),s.dirty=!0),u!==null&&u.key===o&&(Ey(u,n,r,t,l),s.dirty=!0)}return r=t.__text,this.setTextContent(n?r+i:i+r),n=this.getWritable(),t.remove(),n}isTextEntity(){return!1}}function Rb(e){let t=e.style.fontWeight==="700",n=e.style.textDecoration==="line-through",r=e.style.fontStyle==="italic",o=e.style.textDecoration==="underline",i=e.style.verticalAlign;return{forChild:l=>(Q(l)&&(t&&l.toggleFormat("bold"),n&&l.toggleFormat("strikethrough"),r&&l.toggleFormat("italic"),o&&l.toggleFormat("underline"),i==="sub"&&l.toggleFormat("subscript"),i==="super"&&l.toggleFormat("superscript")),l),node:null}}function Pb(e){let t=e.style.fontWeight==="normal";return{forChild:n=>(Q(n)&&!t&&n.toggleFormat("bold"),n),node:null}}let gy=new WeakMap;function Ob(e){e.parentElement===null&&U(129);for(var t=e.textContent||"",n,r=e.parentNode,o=[e];r!==null&&(n=gy.get(r))===void 0&&!(r.nodeName==="PRE"||r.nodeType===1&&r.style.whiteSpace.startsWith("pre"));)o.push(r),r=r.parentNode;for(n=n===void 0?r:n,r=0;r<o.length;r++)gy.set(o[r],n);if(n!==null){for(t=t.split(/(\r?\n|\t)/),e=[],o=t.length,n=0;n<o;n++)r=t[n],r===`
65
- `||r===`\r
66
- `?e.push(Tl()):r===" "?e.push(gd()):r!==""&&e.push(Ct(r));return{node:e}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){for(o=e,n=!0;o!==null&&(o=my(o,!1))!==null;)if(r=o.textContent||"",0<r.length){/[ \t\n]$/.test(r)&&(t=t.slice(1)),n=!1;break}n&&(t=t.slice(1))}if(t[t.length-1]===" "){for(o=!0;e!==null&&(e=my(e,!0))!==null;)if(0<(e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length){o=!1;break}o&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:Ct(t)}}let Ab=new RegExp(/^(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 my(e,t){for(;;){for(var n=void 0;(n=t?e.nextSibling:e.previousSibling)===null;)if(e=e.parentElement,e===null)return null;if(e=n,e.nodeType===1&&(n=e.style.display,n===""&&e.nodeName.match(Ab)===null||n!==""&&!n.startsWith("inline")))return null;for(;(n=t?e.firstChild:e.lastChild)!==null;)e=n;if(e.nodeType===3)return e;if(e.nodeName==="BR")return null}}let Mb={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function ro(e){let t=Mb[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:n=>(Q(n)&&!n.hasFormat(t)&&n.toggleFormat(t),n),node:null}}function Ct(e=""){return Da(new ki(e))}function Q(e){return e instanceof ki}class Fl extends ki{static getType(){return"tab"}static clone(t){let n=new Fl(t.__key);return n.__text=t.__text,n.__format=t.__format,n.__style=t.__style,n}constructor(t){super(" ",t),this.__detail=2}static importDOM(){return null}static importJSON(t){let n=gd();return n.setFormat(t.format),n.setStyle(t.style),n}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(){U(126)}setDetail(){U(127)}setMode(){U(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function gd(){return Da(new Fl)}class yr{constructor(t,n,r){this._selection=null,this.key=t,this.offset=n,this.type=r}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){let n=this.getNode(),r=t.getNode(),o=this.offset;if(t=t.offset,B(n)){var i=n.getDescendantByIndex(o);n=i??n}return B(r)&&(i=r.getDescendantByIndex(t),r=i??r),n===r?o<t:n.isBefore(r)}getNode(){let t=$t(this.key);return t===null&&U(20),t}set(t,n,r){let o=this._selection,i=this.key;this.key=t,this.offset=n,this.type=r,Ul()||(mo()===i&&Mt(t),o!==null&&(o._cachedNodes=null,o.dirty=!0))}}function wf(e,t){let n=t.__key,r=e.offset,o="element";if(Q(t))o="text",t=t.getTextContentSize(),r>t&&(r=t);else if(!B(t)){var i=t.getNextSibling();Q(i)?(n=i.__key,r=0,o="text"):(i=t.getParent())&&(n=i.__key,r=t.getIndexWithinParent()+1)}e.set(n,r,o)}function vy(e,t){if(B(t)){let n=t.getLastDescendant();B(n)||Q(n)?wf(e,n):wf(e,t)}else wf(e,t)}function yy(e,t,n,r){let o=e.getNode(),i=o.getChildAtIndex(e.offset),l=Ct(),s=en(o)?pi().append(l):l;l.setFormat(n),l.setStyle(r),i===null?o.append(s):(i.insertBefore(s),t.type==="element"&&t.key===e.key&&t.offset!==e.offset&&t.set(t.key,t.offset+1,"element")),e.is(t)&&t.set(l.__key,0,"text"),e.set(l.__key,0,"text")}function ao(e,t,n,r){e.key=t,e.offset=n,e.type=r}class md{constructor(t){this.dirty=!1,this._nodes=t,this._cachedNodes=null}is(t){if(!Bl(t))return!1;let n=this._nodes,r=t._nodes;return n.size===r.size&&Array.from(n).every(o=>r.has(o))}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new md(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(t,n){let r=this.getNodes(),o=r.length;var i=r[o-1];if(Q(i))i=i.select();else{let l=i.getIndexWithinParent()+1;i=i.getParentOrThrow().select(l,l)}for(i.insertNodes(t,n),t=0;t<o;t++)r[t].remove();return!0}getNodes(){var t=this._cachedNodes;if(t!==null)return t;var n=this._nodes;t=[];for(let r of n)n=$t(r),n!==null&&t.push(n);return Ul()||(this._cachedNodes=t),t}getTextContent(){let t=this.getNodes(),n="";for(let r=0;r<t.length;r++)n+=t[r].getTextContent();return n}}function de(e){return e instanceof Ti}function ep(e){let[t,,n]=Dw(e);e=n.getChildren();let r=e.length;var o=e[0].getChildren().length;let i=Array(r);for(var l=0;l<r;l++)i[l]=Array(o);for(o=0;o<r;o++){l=e[o].getChildren();let s=0;for(let a=0;a<l.length;a++){for(;i[o][s];)s++;let u=l[a],c=u.__rowSpan||1,d=u.__colSpan||1;for(let f=0;f<c;f++)for(let h=0;h<d;h++)i[o+f][s+h]=u;if(t===u)return{colSpan:d,columnIndex:s,rowIndex:o,rowSpan:c};s+=d}}return null}class vd{constructor(t,n,r){this.gridKey=t,this.anchor=n,this.focus=r,this.dirty=!1,this._cachedNodes=null,n._selection=this,r._selection=this}is(t){return Qg(t)?this.gridKey===t.gridKey&&this.anchor.is(t.anchor)&&this.focus.is(t.focus):!1}set(t,n,r){this.dirty=!0,this.gridKey=t,this.anchor.key=n,this.focus.key=r,this._cachedNodes=null}clone(){return new vd(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return Fu(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(t,n){let r=this.focus.getNode();return Wg(r.select(0,r.getChildrenSize())).insertNodes(t,n)}getShape(){var t=$t(this.anchor.key);if(Mn(t)||U(103),t=ep(t),t===null)throw Error("getCellRect: expected to find AnchorNode");var n=$t(this.focus.key);Mn(n)||U(104);let r=ep(n);if(r===null)throw Error("getCellRect: expected to find focusCellNode");n=Math.min(t.columnIndex,r.columnIndex);let o=Math.max(t.columnIndex,r.columnIndex),i=Math.min(t.rowIndex,r.rowIndex);return t=Math.max(t.rowIndex,r.rowIndex),{fromX:Math.min(n,o),fromY:Math.min(i,t),toX:Math.max(n,o),toY:Math.max(i,t)}}getNodes(){function t(S){let{cell:v,startColumn:y,startRow:_}=S;a=Math.min(a,y),u=Math.min(u,_),c=Math.max(c,y+v.__colSpan-1),d=Math.max(d,_+v.__rowSpan-1)}var n=this._cachedNodes;if(n!==null)return n;var r=this.anchor.getNode();n=this.focus.getNode(),r=Cc(r,Mn);var o=Cc(n,Mn);Mn(r)||U(103),Mn(o)||U(104),n=r.getParent(),ya(n)||U(105),n=n.getParent(),tm(n)||U(106);let[i,l,s]=Mw(n,r,o),a=Math.min(l.startColumn,s.startColumn),u=Math.min(l.startRow,s.startRow),c=Math.max(l.startColumn+l.cell.__colSpan-1,s.startColumn+s.cell.__colSpan-1),d=Math.max(l.startRow+l.cell.__rowSpan-1,s.startRow+s.cell.__rowSpan-1);r=a,o=u;for(var f=a,h=u;a<r||u<o||c>f||d>h;){if(a<r){var g=h-o;--r;for(var m=0;m<=g;m++)t(i[o+m][r])}if(u<o)for(g=f-r,--o,m=0;m<=g;m++)t(i[o][r+m]);if(c>f)for(g=h-o,f+=1,m=0;m<=g;m++)t(i[o+m][f]);if(d>h)for(g=f-r,h+=1,m=0;m<=g;m++)t(i[h][r+m])}for(n=[n],r=null,o=u;o<=d;o++)for(f=a;f<=c;f++)({cell:h}=i[o][f]),g=h.getParent(),ya(g)||U(107),g!==r&&n.push(g),n.push(h,...yb(h)),r=g;return Ul()||(this._cachedNodes=n),n}getTextContent(){let t=this.getNodes(),n="";for(let r=0;r<t.length;r++)n+=t[r].getTextContent();return n}}function Qg(e){return e instanceof vd}class Ti{constructor(t,n,r,o){this.anchor=t,this.focus=n,this.dirty=!1,this.format=r,this.style=o,this._cachedNodes=null,t._selection=this,n._selection=this}is(t){return de(t)?this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var t=this._cachedNodes;if(t!==null)return t;t=this.anchor;var n=this.focus,r=t.isBefore(n),o=r?t:n;r=r?n:t,t=o.getNode(),n=r.getNode();let i=o.offset;return o=r.offset,B(t)&&(r=t.getDescendantByIndex(i),t=r??t),B(n)&&(r=n.getDescendantByIndex(o),r!==null&&r!==t&&n.getChildAtIndex(o)===r&&(r=r.getPreviousSibling()),n=r??n),t=t.is(n)?B(t)&&0<t.getChildrenSize()?[]:[t]:t.getNodesBetween(n),Ul()||(this._cachedNodes=t),t}setTextNodeRange(t,n,r,o){ao(this.anchor,t.__key,n,"text"),ao(this.focus,r.__key,o,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let n=t[0],r=t[t.length-1],o=this.anchor,i=this.focus,l=o.isBefore(i),[s,a]=Fu(this),u="",c=!0;for(let d=0;d<t.length;d++){let f=t[d];if(B(f)&&!f.isInline())c||(u+=`
67
- `),c=!f.isEmpty();else if(c=!1,Q(f)){let h=f.getTextContent();f===n?f===r?(o.type!=="element"||i.type!=="element"||i.offset===o.offset)&&(h=s<a?h.slice(s,a):h.slice(a,s)):h=l?h.slice(s):h.slice(a):f===r&&(h=l?h.slice(0,a):h.slice(0,s)),u+=h}else!Ve(f)&&!ma(f)||f===r&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(t){let n=et(),r=n.getEditorState()._selection;if(t=Ow(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,r),t!==null){var[o,i]=t;ao(this.anchor,o.key,o.offset,o.type),ao(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}}clone(){let t=this.anchor,n=this.focus;return new Ti(new yr(t.key,t.offset,t.type),new yr(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=lw(this.format,t,null),this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){return(this.format&oi[t])!==0}insertRawText(t){t=t.split(/(\r?\n|\t)/);let n=[],r=t.length;for(let o=0;o<r;o++){let i=t[o];i===`
68
- `||i===`\r
69
- `?n.push(Tl()):i===" "?n.push(gd()):n.push(Ct(i))}this.insertNodes(n)}insertText(t){var n=this.anchor,r=this.focus,o=this.isCollapsed()||n.isBefore(r),i=this.format,l=this.style;o&&n.type==="element"?yy(n,r,i,l):o||r.type!=="element"||yy(r,n,i,l);var s=this.getNodes(),a=s.length,u=o?r:n;r=(o?n:r).offset;var c=u.offset;n=s[0],Q(n)||U(26),o=n.getTextContent().length;var d=n.getParentOrThrow(),f=s[a-1];if(this.isCollapsed()&&r===o&&(n.isSegmented()||n.isToken()||!n.canInsertTextAfter()||!d.canInsertTextAfter()&&n.getNextSibling()===null)){var h=n.getNextSibling();if(Q(h)&&h.canInsertTextBefore()&&!Fh(h)||(h=Ct(),h.setFormat(i),d.canInsertTextAfter()?n.insertAfter(h):d.insertAfter(h)),h.select(0,0),n=h,t!==""){this.insertText(t);return}}else if(this.isCollapsed()&&r===0&&(n.isSegmented()||n.isToken()||!n.canInsertTextBefore()||!d.canInsertTextBefore()&&n.getPreviousSibling()===null)){if(h=n.getPreviousSibling(),(!Q(h)||Fh(h))&&(h=Ct(),h.setFormat(i),d.canInsertTextBefore()?n.insertBefore(h):d.insertBefore(h)),h.select(),n=h,t!==""){this.insertText(t);return}}else if(n.isSegmented()&&r!==o)d=Ct(n.getTextContent()),d.setFormat(i),n.replace(d),n=d;else if(!(this.isCollapsed()||t===""||(h=f.getParent(),d.canInsertTextBefore()&&d.canInsertTextAfter()&&(!B(h)||h.canInsertTextBefore()&&h.canInsertTextAfter())))){this.insertText(""),Pw(this.anchor,this.focus,null),this.insertText(t);return}if(a===1)if(n.isToken())t=Ct(t),t.select(),n.replace(t);else{if(s=n.getFormat(),a=n.getStyle(),r===c&&(s!==i||a!==l))if(n.getTextContent()==="")n.setFormat(i),n.setStyle(l);else{s=Ct(t),s.setFormat(i),s.setStyle(l),s.select(),r===0?n.insertBefore(s,!1):([a]=n.splitText(r),a.insertAfter(s,!1)),s.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length);return}n=n.spliceText(r,c-r,t,!0),n.getTextContent()===""?n.remove():this.anchor.type==="text"&&(n.isComposing()?this.anchor.offset-=t.length:(this.format=s,this.style=a))}else{if(i=new Set([...n.getParentKeys(),...f.getParentKeys()]),h=B(n)?n:n.getParentOrThrow(),l=B(f)?f:f.getParentOrThrow(),d=f,!h.is(l)&&l.isInline())do d=l,l=l.getParentOrThrow();while(l.isInline());if(u.type==="text"&&(c!==0||f.getTextContent()==="")||u.type==="element"&&f.getIndexWithinParent()<c)if(Q(f)&&!f.isToken()&&c!==f.getTextContentSize()){if(f.isSegmented()){var g=Ct(f.getTextContent());f.replace(g),f=g}en(u.getNode())||(f=f.spliceText(0,c,"")),i.add(f.__key)}else u=f.getParentOrThrow(),u.canBeEmpty()||u.getChildrenSize()!==1?f.remove():u.remove();else i.add(f.__key);for(u=l.getChildren(),c=new Set(s),f=h.is(l),h=h.isInline()&&n.getNextSibling()===null?h:n,g=u.length-1;0<=g;g--){let m=u[g];if(m.is(n)||B(m)&&m.isParentOf(n))break;m.isAttached()&&(!c.has(m)||m.is(d)?f||h.insertAfter(m,!1):m.remove())}if(!f)for(u=l,c=null;u!==null;)l=u.getChildren(),f=l.length,(f===0||l[f-1].is(c))&&(i.delete(u.__key),c=u),u=u.getParent();for(n.isToken()?r===o?n.select():(t=Ct(t),t.select(),n.replace(t)):(n=n.spliceText(r,o-r,t,!0),n.getTextContent()===""?n.remove():n.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length)),t=1;t<a;t++)n=s[t],i.has(n.__key)||n.remove()}}removeText(){this.insertText("")}formatText(t){if(this.isCollapsed())this.toggleFormat(t),Mt(null);else{var n=this.getNodes(),r=[];for(var o of n)Q(o)&&r.push(o);var i=r.length;if(i===0)this.toggleFormat(t),Mt(null);else{o=this.anchor;var l=this.focus,s=this.isBackward();n=s?l:o,o=s?o:l;var a=0,u=r[0];if(l=n.type==="element"?0:n.offset,n.type==="text"&&l===u.getTextContentSize()&&(a=1,u=r[1],l=0),u!=null){s=u.getFormatFlags(t,null);var c=i-1,d=r[c];if(i=o.type==="text"?o.offset:d.getTextContentSize(),u.is(d))l!==i&&(l===0&&i===u.getTextContentSize()?u.setFormat(s):(t=u.splitText(l,i),t=l===0?t[0]:t[1],t.setFormat(s),n.type==="text"&&n.set(t.__key,0,"text"),o.type==="text"&&o.set(t.__key,i-l,"text")),this.format=s);else{l!==0&&([,u]=u.splitText(l),l=0),u.setFormat(s);var f=d.getFormatFlags(t,s);for(0<i&&(i!==d.getTextContentSize()&&([d]=d.splitText(i)),d.setFormat(f)),a+=1;a<c;a++){let h=r[a];if(!h.isToken()){let g=h.getFormatFlags(t,f);h.setFormat(g)}}n.type==="text"&&n.set(u.__key,l,"text"),o.type==="text"&&o.set(d.__key,i,"text"),this.format=s|f}}}}}insertNodes(t,n){if(!this.isCollapsed()){var r=this.isBackward()?this.anchor:this.focus,o=r.getNode().getNextSibling();if(o=o?o.getKey():null,r=(r=r.getNode().getPreviousSibling())?r.getKey():null,this.removeText(),this.isCollapsed()&&this.focus.type==="element"){if(this.focus.key===o&&this.focus.offset===0){var i=Ct();this.focus.getNode().insertBefore(i)}else this.focus.key===r&&this.focus.offset===this.focus.getNode().getChildrenSize()&&(i=Ct(),this.focus.getNode().insertAfter(i));i&&(this.focus.set(i.__key,0,"text"),this.anchor.set(i.__key,0,"text"))}}i=this.anchor,r=i.offset;var l=i.getNode();o=l,i.type==="element"&&(i=i.getNode(),o=i.getChildAtIndex(r-1),o=o===null?i:o),i=[];var s=l.getNextSiblings(),a=Zn(l)?null:l.getTopLevelElementOrThrow();if(Q(l))if(o=l.getTextContent().length,r===0&&o!==0)o=l.getPreviousSibling(),o=o!==null?o:l.getParentOrThrow(),i.push(l);else if(r===o)o=l;else{if(l.isToken())return!1;[o,l]=l.splitText(r),i.push(l)}l=o,i.push(...s),s=t[0];var u=!1,c=null;for(let g=0;g<t.length;g++){var d=t[g];if(Zn(o)||Ve(o)||!B(d)||d.isInline())u&&!B(d)&&!Ve(d)&&Zn(o.getParent())&&U(28);else{if(d.is(s)){if(B(o)&&o.isEmpty()&&o.canReplaceWith(d)){o.replace(d),o=d,u=!0;continue}if(u=d.getFirstDescendant(),sw(u)){for(var f=u.getParentOrThrow();f.isInline();)f=f.getParentOrThrow();if(c=f.getChildren(),u=c.length,B(o)){var h=o.getFirstChild();for(let m=0;m<u;m++){let S=c[m];h===null?o.append(S):h.insertAfter(S),h=S}}else{for(h=u-1;0<=h;h--)o.insertAfter(c[h]);o=o.getParentOrThrow()}if(c=c[u-1],f.remove(),u=!0,f.is(d))continue}}Q(o)&&(a===null&&U(27),o=a)}u=!1,B(o)&&!o.isInline()?(c=d,Ve(d)&&!d.isInline()?o=t.length===1&&o.canBeEmpty()&&o.isEmpty()?o.insertBefore(d,!1):o.insertAfter(d,!1):B(d)?(d.canBeEmpty()||!d.isEmpty())&&(en(o)?(f=o.getChildAtIndex(r),f!==null?f.insertBefore(d):o.append(d),o=d):d.isInline()?(o.append(d),o=d):o=o.insertAfter(d,!1)):(f=o.getFirstChild(),f!==null?f.insertBefore(d):o.append(d),o=d)):!B(d)||B(d)&&d.isInline()||Ve(o)&&!o.isInline()?(c=d,de(this)&&Ve(d)&&(B(o)||Q(o))&&!d.isInline()?(Q(o)?(f=o.getParentOrThrow(),[o]=o.splitText(r),o=o.getIndexWithinParent()+1):(f=o,o=r),[,o]=mw(f,o),o=o.insertBefore(d)):o=o.insertAfter(d,!1)):(d=o.getParentOrThrow(),ma(o)&&o.remove(),o=d,g--)}if(n&&(Q(l)?l.select():(t=o.getPreviousSibling(),Q(t)?t.select():(t=o.getIndexWithinParent(),o.getParentOrThrow().select(t,t)))),B(o)){if(t=Q(c)?c:B(c)&&c.isInline()?c.getLastDescendant():o.getLastDescendant(),n||(t===null?o.select():Q(t)?t.getTextContent()===""?t.selectPrevious():t.select():t.selectNext()),i.length!==0)for(n=o,t=i.length-1;0<=t;t--)r=i[t],a=r.getParentOrThrow(),!B(o)||tp(r)||Ve(r)&&(!r.isInline()||r.isIsolated())?B(o)||tp(r)?B(r)&&!r.canInsertAfter(o)?(l=a.constructor.clone(a),B(l)||U(29),l.append(r),o.insertAfter(l)):o.insertAfter(r):(o.insertBefore(r),o=r):(n===o?o.append(r):o.insertBefore(r),o=r),a.isEmpty()&&!a.canBeEmpty()&&a.remove()}else n||(Q(o)?o.select():(n=o.getParentOrThrow(),t=o.getIndexWithinParent()+1,n.select(t,t)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var t=this.anchor,n=t.offset,r=[];if(t.type==="text"){var o=t.getNode(),i=o.getNextSiblings().reverse(),l=o.getParentOrThrow(),s=l.isInline(),a=s?l.getTextContentSize():o.getTextContentSize();n===0?i.push(o):(s&&(r=l.getNextSiblings()),n===a||s&&n===o.getTextContentSize()||([,o]=o.splitText(n),i.push(o)))}else{if(l=t.getNode(),Zn(l)){i=pi(),r=l.getChildAtIndex(n),i.select(),r!==null?r.insertBefore(i,!1):l.append(i);return}i=l.getChildren().slice(n).reverse()}if(o=i.length,n===0&&0<o&&l.isInline()){if(r=l.getParentOrThrow(),i=r.insertNewAfter(this,!1),B(i))for(r=r.getChildren(),l=0;l<r.length;l++)i.append(r[l])}else if(s=l.insertNewAfter(this,!1),s===null)this.insertLineBreak();else if(B(s))if(a=l.getFirstChild(),n===0&&(l.is(t.getNode())||a&&a.is(t.getNode()))&&0<o)l.insertBefore(s);else{if(l=null,n=r.length,t=s.getParentOrThrow(),0<n)for(a=0;a<n;a++)t.append(r[a]);if(o!==0)for(r=0;r<o;r++)n=i[r],l===null?s.append(n):l.insertBefore(n),l=n;s.canBeEmpty()||s.getChildrenSize()!==0?s.selectStart():(s.selectPrevious(),s.remove())}}insertLineBreak(t){let n=Tl();var r=this.anchor;r.type==="element"&&(r=r.getNode(),en(r)&&this.insertParagraph()),t?this.insertNodes([n],!0):this.insertNodes([n])&&n.selectNext(0,0)}getCharacterOffsets(){return Fu(this)}extract(){var t=this.getNodes(),n=t.length,r=n-1,o=this.anchor;let i=this.focus;var l=t[0];let s=t[r],[a,u]=Fu(this);return n===0?[]:n===1?Q(l)&&!this.isCollapsed()?(t=a>u?u:a,r=l.splitText(t,a>u?a:u),t=t===0?r[0]:r[1],t!=null?[t]:[]):[l]:(n=o.isBefore(i),Q(l)&&(o=n?a:u,o===l.getTextContentSize()?t.shift():o!==0&&([,l]=l.splitText(o),t[0]=l)),Q(s)&&(l=s.getTextContent().length,n=n?u:a,n===0?t.pop():n!==l&&([s]=s.splitText(n),t[r]=s)),t)}modify(t,n,r){var o=this.focus,i=this.anchor,l=t==="move",s=Bh(o,n);if(Ve(s)&&!s.isIsolated())l&&s.isKeyboardSelectable()?(n=np(),n.add(s.__key),vr(n)):(t=n?s.getPreviousSibling():s.getNextSibling(),Q(t)?(s=t.__key,n=n?t.getTextContent().length:0,o.set(s,n,"text"),l&&i.set(s,n,"text")):(r=s.getParentOrThrow(),B(t)?(r=t.__key,s=n?t.getChildrenSize():0):(s=s.getIndexWithinParent(),r=r.__key,n||s++),o.set(r,s,"element"),l&&i.set(r,s,"element")));else if(i=et(),o=Cr(i._window)){var a=i._blockCursorElement,u=i._rootElement;if(u===null||a===null||!B(s)||s.isInline()||s.canBeEmpty()||Wh(a,i,u),o.modify(t,n?"backward":"forward",r),0<o.rangeCount&&(s=o.getRangeAt(0),i=this.anchor.getNode(),i=en(i)?i:pw(i),this.applyDOMRange(s),this.dirty=!0,!l)){for(l=this.getNodes(),t=[],r=!1,a=0;a<l.length;a++)u=l[a],Sc(u,i)?t.push(u):r=!0;r&&0<t.length&&(n?(n=t[0],B(n)?n.selectStart():n.getParentOrThrow().selectStart()):(n=t[t.length-1],B(n)?n.selectEnd():n.getParentOrThrow().selectEnd())),(o.anchorNode!==s.startContainer||o.anchorOffset!==s.startOffset)&&(n=this.focus,l=this.anchor,o=l.key,s=l.offset,i=l.type,ao(l,n.key,n.offset,n.type),ao(n,o,s,i),this._cachedNodes=null)}}}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){var r=this.anchor,o=this.focus,i=r.getNode();if(!t&&(r.type==="element"&&B(i)&&r.offset===i.getChildrenSize()||r.type==="text"&&r.offset===i.getTextContentSize())){var l=i.getParent();if(l=i.getNextSibling()||(l===null?null:l.getNextSibling()),B(l)&&l.isShadowRoot())return}if(l=Bh(o,t),Ve(l)&&!l.isIsolated()){l.isKeyboardSelectable()&&B(i)&&i.getChildrenSize()===0?(i.remove(),t=np(),t.add(l.__key),vr(t)):(l.remove(),et().dispatchCommand(ad,void 0));return}if(!t&&B(l)&&B(i)&&i.isEmpty()){i.remove(),l.selectStart();return}if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&r.offset===0&&(r.type==="element"?r.getNode():r.getNode().getParentOrThrow()).collapseAtStart(this))return}else{if(l=o.type==="text"?o.getNode():null,i=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){if(r=o.offset,o=l.getTextContentSize(),l.is(i)||t&&r!==o||!t&&r!==0){_y(l,t,r);return}}else if(i!==null&&i.isSegmented()&&(r=r.offset,o=i.getTextContentSize(),i.is(l)||t&&r!==0||!t&&r!==o)){_y(i,t,r);return}if(i=this.anchor,l=this.focus,r=i.getNode(),o=l.getNode(),r===o&&i.type==="text"&&l.type==="text"){var s=i.offset,a=l.offset;let u=s<a;o=u?s:a,a=u?a:s,s=a-1,o!==s&&(r=r.getTextContent().slice(o,a),dw(r)||(t?l.offset=s:i.offset=s))}}}this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0&&(t=this.anchor.getNode(),t.isEmpty()&&en(t.getParent())&&t.getIndexWithinParent()===0&&t.collapseAtStart(this))}deleteLine(t){this.isCollapsed()&&(this.anchor.type==="text"&&this.modify("extend",t,"lineboundary"),(t?this.focus:this.anchor).offset===0&&this.modify("extend",t,"character")),this.removeText()}deleteWord(t){this.isCollapsed()&&this.modify("extend",t,"word"),this.removeText()}}function Bl(e){return e instanceof md}function xy(e){let t=e.offset;return e.type==="text"?t:(e=e.getNode(),t===e.getChildrenSize()?e.getTextContent().length:0)}function Fu(e){let t=e.anchor;return e=e.focus,t.type==="element"&&e.type==="element"&&t.key===e.key&&t.offset===e.offset?[0,0]:[xy(t),xy(e)]}function _y(e,t,n){let r=e.getTextContent().split(/(?=\s)/g),o=r.length,i=0,l=0;for(let s=0;s<o;s++){let a=r[s],u=s===o-1;if(l=i,i+=a.length,t&&i===n||i>n||u){r.splice(s,1),u&&(l=void 0);break}}t=r.join("").trim(),t===""?e.remove():(e.setTextContent(t),e.select(l,l))}function wy(e,t,n,r){var o=t;if(e.nodeType===1){let s=!1;var i=e.childNodes,l=i.length;o===l&&(s=!0,o=l-1);let a=i[o];if(l=!1,a===r._blockCursorElement?(a=i[o+1],l=!0):r._blockCursorElement!==null&&o--,r=tl(a),Q(r))o=s?r.getTextContentSize():0;else{if(i=tl(e),i===null)return null;if(B(i)?(e=i.getChildAtIndex(o),(t=B(e))&&(t=e.getParent(),t=n===null||t===null||!t.canBeEmpty()||t!==n.getNode()),t&&(n=s?e.getLastDescendant():e.getFirstDescendant(),n===null?(i=e,o=0):(e=n,i=B(e)?e:e.getParentOrThrow())),Q(e)?(r=e,i=null,o=s?e.getTextContentSize():0):e!==i&&s&&!l&&o++):(o=i.getIndexWithinParent(),o=t===0&&Ve(i)&&tl(e)===i?o:o+1,i=i.getParentOrThrow()),B(i))return new yr(i.__key,o,"element")}}else r=tl(e);return Q(r)?new yr(r.__key,o,"text"):null}function Sy(e,t,n){var r=e.offset,o=e.getNode();r===0?(r=o.getPreviousSibling(),o=o.getParent(),t?(n||!t)&&r===null&&B(o)&&o.isInline()&&(t=o.getPreviousSibling(),Q(t)&&(e.key=t.__key,e.offset=t.getTextContent().length)):B(r)&&!n&&r.isInline()?(e.key=r.__key,e.offset=r.getChildrenSize(),e.type="element"):Q(r)&&(e.key=r.__key,e.offset=r.getTextContent().length)):r===o.getTextContent().length&&(r=o.getNextSibling(),o=o.getParent(),t&&B(r)&&r.isInline()?(e.key=r.__key,e.offset=0,e.type="element"):(n||t)&&r===null&&B(o)&&o.isInline()&&!o.canInsertTextAfter()&&(t=o.getNextSibling(),Q(t)&&(e.key=t.__key,e.offset=0)))}function Pw(e,t,n){if(e.type==="text"&&t.type==="text"){var r=e.isBefore(t);let o=e.is(t);Sy(e,r,o),Sy(t,!r,o),o&&(t.key=e.key,t.offset=e.offset,t.type=e.type),r=et(),r.isComposing()&&r._compositionKey!==e.key&&de(n)&&(r=n.anchor,n=n.focus,ao(e,r.key,r.offset,r.type),ao(t,n.key,n.offset,n.type))}}function Ow(e,t,n,r,o,i){return e===null||n===null||!Aa(o,e,n)||(t=wy(e,t,de(i)?i.anchor:null,o),t===null)||(r=wy(n,r,de(i)?i.focus:null,o),r===null||t.type==="element"&&r.type==="element"&&(e=tl(e),n=tl(n),Ve(e)&&Ve(n)))?null:(Pw(t,r,i),[t,r])}function tp(e){return B(e)&&!e.isInline()}function Aw(e,t,n,r,o,i){let l=Er();return e=new Ti(new yr(e,t,o),new yr(n,r,i),0,""),e.dirty=!0,l._selection=e}function np(){return new md(new Set)}function Db(e){let t=e.getEditorState()._selection,n=Cr(e._window);return Bl(t)||Qg(t)?t.clone():Jg(t,n,e)}function Jg(e,t,n){var r=n._window;if(r===null)return null;var o=r.event,i=o?o.type:void 0;r=i==="selectionchange",o=!zh&&(r||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let l;if(!de(e)||o){if(t===null)return null;if(o=t.anchorNode,i=t.focusNode,l=t.anchorOffset,t=t.focusOffset,r&&de(e)&&!Aa(n,o,i))return e.clone()}else return e.clone();if(n=Ow(o,l,i,t,n,e),n===null)return null;let[s,a]=n;return new Ti(s,a,de(e)?e.format:0,de(e)?e.style:"")}function Ke(){return Er()._selection}function Wl(){return et()._editorState._selection}function $c(e,t,n,r=1){var o=e.anchor,i=e.focus,l=o.getNode(),s=i.getNode();if(t.is(l)||t.is(s)){if(l=t.__key,e.isCollapsed())t=o.offset,(n<=t&&0<r||n<t&&0>r)&&(n=Math.max(0,t+r),o.set(l,n,"element"),i.set(l,n,"element"),Cy(e));else{let u=e.isBackward();s=u?i:o;var a=s.getNode();o=u?o:i,i=o.getNode(),t.is(a)&&(a=s.offset,(n<=a&&0<r||n<a&&0>r)&&s.set(l,Math.max(0,a+r),"element")),t.is(i)&&(t=o.offset,(n<=t&&0<r||n<t&&0>r)&&o.set(l,Math.max(0,t+r),"element"))}Cy(e)}}function Cy(e){var t=e.anchor,n=t.offset;let r=e.focus;var o=r.offset,i=t.getNode(),l=r.getNode();if(e.isCollapsed())B(i)&&(l=i.getChildrenSize(),l=(o=n>=l)?i.getChildAtIndex(l-1):i.getChildAtIndex(n),Q(l)&&(n=0,o&&(n=l.getTextContentSize()),t.set(l.__key,n,"text"),r.set(l.__key,n,"text")));else{if(B(i)){let s=i.getChildrenSize();n=(e=n>=s)?i.getChildAtIndex(s-1):i.getChildAtIndex(n),Q(n)&&(i=0,e&&(i=n.getTextContentSize()),t.set(n.__key,i,"text"))}B(l)&&(n=l.getChildrenSize(),o=(t=o>=n)?l.getChildAtIndex(n-1):l.getChildAtIndex(o),Q(o)&&(l=0,t&&(l=o.getTextContentSize()),r.set(o.__key,l,"text")))}}function Lb(e,t){if(t=t.getEditorState()._selection,e=e._selection,de(e)){var n=e.anchor;let r=e.focus,o;n.type==="text"&&(o=n.getNode(),o.selectionTransform(t,e)),r.type==="text"&&(n=r.getNode(),o!==n&&n.selectionTransform(t,e))}}function kc(e,t,n,r,o){let i=null,l=0,s=null;r!==null?(i=r.__key,Q(r)?(l=r.getTextContentSize(),s="text"):B(r)&&(l=r.getChildrenSize(),s="element")):o!==null&&(i=o.__key,Q(o)?s="text":B(o)&&(s="element")),i!==null&&s!==null?e.set(i,l,s):(l=t.getIndexWithinParent(),l===-1&&(l=n.getChildrenSize()),e.set(n.__key,l,"element"))}function Ey(e,t,n,r,o){e.type==="text"?(e.key=n,t||(e.offset+=o)):e.offset>r.getIndexWithinParent()&&--e.offset}function Mw(e,t,n){let r=[],o=null,i=null;e=e.getChildren();for(let c=0;c<e.length;c++){var l=e[c];ya(l)||U(108);var s=l.getChildren();l=0;for(let d of s){for(Mn(d)||U(109);r[c]!==void 0&&r[c][l]!==void 0;)l++;s=c;var a=l,u=d;let f={cell:u,startColumn:a,startRow:s},h=u.__rowSpan,g=u.__colSpan;for(let m=0;m<h;m++){r[s+m]===void 0&&(r[s+m]=[]);for(let S=0;S<g;S++)r[s+m][a+S]=f}t.is(u)&&(o=f),n.is(u)&&(i=f),l+=d.__colSpan}}return o===null&&U(110),i===null&&U(111),[r,o,i]}function Dw(e){e instanceof em||(e instanceof La?(e=Cc(e,Mn),Mn(e)||U(114)):(e=Cc(e.getNode(),Mn),Mn(e)||U(114)));let t=e.getParent();ya(t)||U(115);let n=t.getParent();return tm(n)||U(116),[e,t,n]}let kt=null,Tt=null,pn=!1,Sf=!1,va=0,$y={characterData:!0,childList:!0,subtree:!0};function Ul(){return pn||kt!==null&&kt._readOnly}function Zt(){pn&&U(13)}function Er(){return kt===null&&U(15),kt}function et(){return Tt===null&&U(16),Tt}function ky(e,t,n){var r=t.__type;let o=e._nodes.get(r);for(o===void 0&&U(30,r),e=n.get(r),e===void 0&&(e=Array.from(o.transforms),n.set(r,e)),n=e.length,r=0;r<n&&(e[r](t),t.isAttached());r++);}function Ib(e,t){t=t._dirtyLeaves,e=e._nodeMap;for(let n of t)t=e.get(n),Q(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&iw(t)}function jb(e,t){let n=t._dirtyLeaves,r=t._dirtyElements;e=e._nodeMap;let o=mo(),i=new Map;var l=n;let s=l.size;for(var a=r,u=a.size;0<s||0<u;){if(0<s){t._dirtyLeaves=new Set;for(let c of l)l=e.get(c),Q(l)&&l.isAttached()&&l.isSimpleText()&&!l.isUnmergeable()&&iw(l),l!==void 0&&l!==void 0&&l.__key!==o&&l.isAttached()&&ky(t,l,i),n.add(c);if(l=t._dirtyLeaves,s=l.size,0<s){va++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map;for(let c of a)a=c[0],u=c[1],(a==="root"||u)&&(l=e.get(a),l!==void 0&&l!==void 0&&l.__key!==o&&l.isAttached()&&ky(t,l,i),r.set(a,u));l=t._dirtyLeaves,s=l.size,a=t._dirtyElements,u=a.size,va++}t._dirtyLeaves=n,t._dirtyElements=r}function Zg(e,t){var n=e.type,r=t.get(n);if(r===void 0&&U(17,n),n=r.klass,e.type!==n.getType()&&U(18,n.name),n=n.importJSON(e),e=e.children,B(n)&&Array.isArray(e))for(r=0;r<e.length;r++){let o=Zg(e[r],t);n.append(o)}return n}function Ty(e,t){let n=kt,r=pn,o=Tt;kt=e,pn=!0,Tt=null;try{return t()}finally{kt=n,pn=r,Tt=o}}function li(e,t){let n=e._pendingEditorState,r=e._rootElement,o=e._headless||r===null;if(n!==null){var i=e._editorState,l=i._selection,s=n._selection,a=e._dirtyType!==0,u=kt,c=pn,d=Tt,f=e._updating,h=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=n,!o&&a&&h!==null){Tt=e,kt=n,pn=!1,e._updating=!0;try{let Te=e._dirtyType,ft=e._dirtyElements,ht=e._dirtyLeaves;h.disconnect();var m=Te,S=ft,v=ht;Jt=Or=gt="",yw=m===2,Iu=null,Ht=e,Ro=e._config,ha=e._nodes,pd=Ht._listeners.mutation,Uh=S,Vh=v,hi=i._nodeMap,Po=n._nodeMap,Xg=n._readOnly,Hh=new Map(e._keyToDOMMap);let _t=new Map;pa=_t,_s("root",null),pa=Hh=Ro=Po=hi=Vh=Uh=ha=Ht=void 0,g=_t}catch(Te){if(Te instanceof Error&&e._onError(Te),Sf)throw Te;zw(e,null,r,n),ow(e),e._dirtyType=2,Sf=!0,li(e,i),Sf=!1;return}finally{h.observe(r,$y),e._updating=f,kt=u,pn=c,Tt=d}}n._readOnly||(n._readOnly=!0);var y=e._dirtyLeaves,_=e._dirtyElements,w=e._normalizedNodes,C=e._updateTags,$=e._deferred;a&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set);var E=e._decorators,T=e._pendingDecorators||E,M=n._nodeMap,R;for(R in T)M.has(R)||(T===E&&(T=cw(e)),delete T[R]);var j=o?null:Cr(e._window);if(e._editable&&j!==null&&(a||s===null||s.dirty)){Tt=e,kt=n;try{if(h!==null&&h.disconnect(),a||s===null||s.dirty){let Te=e._blockCursorElement;Te!==null&&Wh(Te,e,r);e:{let ft=j.anchorNode,ht=j.focusNode,_t=j.anchorOffset,gn=j.focusOffset,It=document.activeElement;if(!(C.has("collaboration")&&It!==r||It!==null&&Ug(It)))if(de(s)){var F=s.anchor,ae=s.focus,H=F.key,X=ae.key,P=wc(e,H),O=wc(e,X),k=F.offset,I=ae.offset,L=s.format,V=s.style,te=s.isCollapsed(),ye=P,fe=O,Oe=!1;if(F.type==="text"){ye=yc(P);let wt=F.getNode();Oe=wt.getFormat()!==L||wt.getStyle()!==V}else de(l)&&l.anchor.type==="text"&&(Oe=!0);if(ae.type==="text"&&(fe=yc(O)),ye!==null&&fe!==null){if(te&&(l===null||Oe||de(l)&&(l.format!==L||l.style!==V))){var be=performance.now();kw=[L,V,k,H,be]}if(_t===k&&gn===I&&ft===ye&&ht===fe&&(j.type!=="Range"||!te)&&(It!==null&&r.contains(It)||r.focus({preventScroll:!0}),F.type!=="element"))break e;try{j.setBaseAndExtent(ye,k,fe,I)}catch{}if(!C.has("skip-scroll-into-view")&&s.isCollapsed()&&r!==null&&r===document.activeElement){let wt=s instanceof Ti&&s.anchor.type==="element"?ye.childNodes[k]||null:0<j.rangeCount?j.getRangeAt(0):null;if(wt!==null){let Ot;if(wt instanceof Text){let zt=document.createRange();zt.selectNode(wt),Ot=zt.getBoundingClientRect()}else Ot=wt.getBoundingClientRect();let or=r.ownerDocument,jt=or.defaultView;if(jt!==null)for(var{top:Z,bottom:ke}=Ot,ce,_e,me=r;me!==null;){let zt=me===or.body;if(zt)ce=0,_e=fd(e).innerHeight;else{let Wo=me.getBoundingClientRect();ce=Wo.top,_e=Wo.bottom}let ir=0;if(Z<ce?ir=-(ce-Z):ke>_e&&(ir=ke-_e),ir!==0)if(zt)jt.scrollBy(0,ir);else{let Wo=me.scrollTop;me.scrollTop+=ir;let Wa=me.scrollTop-Wo;Z-=Wa,ke-=Wa}if(zt)break;me=dd(me)}}}Qh=!0}}else l!==null&&Aa(e,ft,ht)&&j.removeAllRanges()}}e:{let Te=e._blockCursorElement;if(de(s)&&s.isCollapsed()&&s.anchor.type==="element"&&r.contains(document.activeElement)){let ft=s.anchor,ht=ft.getNode(),_t=ft.offset,gn=ht.getChildrenSize(),It=!1,wt=null;if(_t===gn){let Ot=ht.getChildAtIndex(_t-1);gf(Ot)&&(It=!0)}else{let Ot=ht.getChildAtIndex(_t);if(gf(Ot)){let or=Ot.getPreviousSibling();(or===null||gf(or))&&(It=!0,wt=e.getElementByKey(Ot.__key))}}if(It){let Ot=e.getElementByKey(ht.__key);if(Te===null){let or=e._config.theme,jt=document.createElement("div");jt.contentEditable="false",jt.setAttribute("data-lexical-cursor","true");let zt=or.blockCursor;if(zt!==void 0){if(typeof zt=="string"){let ir=zt.split(" ");zt=or.blockCursor=ir}zt!==void 0&&jt.classList.add(...zt)}e._blockCursorElement=Te=jt}r.style.caretColor="transparent",wt===null?Ot.appendChild(Te):Ot.insertBefore(Te,wt);break e}}Te!==null&&Wh(Te,e,r)}h!==null&&h.observe(r,$y)}finally{Tt=d,kt=u}}if(g!==null){var $e=g;let Te=Array.from(e._listeners.mutation),ft=Te.length;for(let ht=0;ht<ft;ht++){let[_t,gn]=Te[ht],It=$e.get(gn);It!==void 0&&_t(It,{dirtyLeaves:y,prevEditorState:i,updateTags:C})}}de(s)||s===null||l!==null&&l.is(s)||e.dispatchCommand(ad,void 0);var Be=e._pendingDecorators;Be!==null&&(e._decorators=Be,e._pendingDecorators=null,zs("decorator",e,!0,Be));var Pt=cy(t||i),sn=cy(n);if(Pt!==sn&&zs("textcontent",e,!0,sn),zs("update",e,!0,{dirtyElements:_,dirtyLeaves:y,editorState:n,normalizedNodes:w,prevEditorState:t||i,tags:C}),e._deferred=[],$.length!==0){let Te=e._updating;e._updating=!0;try{for(let ft=0;ft<$.length;ft++)$[ft]()}finally{e._updating=Te}}var Rn=e._updates;if(Rn.length!==0){let Te=Rn.shift();if(Te){let[ft,ht]=Te;Lw(e,ft,ht)}}}}function zs(e,t,n,...r){let o=t._updating;t._updating=n;try{let i=Array.from(t._listeners[e]);for(e=0;e<i.length;e++)i[e].apply(null,r)}finally{t._updating=o}}function Y(e,t,n){if(e._updating===!1||Tt!==e){let i=!1;return e.update(()=>{i=Y(e,t,n)}),i}let r=Hg(e);for(let i=4;0<=i;i--)for(let l=0;l<r.length;l++){var o=r[l]._commands.get(t);if(o!==void 0&&(o=o[i],o!==void 0)){o=Array.from(o);let s=o.length;for(let a=0;a<s;a++)if(o[a](n,e)===!0)return!0}}return!1}function Ny(e,t){let n=e._updates;for(t=t||!1;n.length!==0;){var r=n.shift();if(r){let[o,i]=r,l;i!==void 0&&(r=i.onUpdate,l=i.tag,i.skipTransforms&&(t=!0),r&&e._deferred.push(r),l&&e._updateTags.add(l)),o()}}return t}function Lw(e,t,n){let r=e._updateTags;var o,i=o=!1;if(n!==void 0){var l=n.onUpdate;o=n.tag,o!=null&&r.add(o),o=n.skipTransforms||!1,i=n.discrete||!1}l&&e._deferred.push(l),n=e._editorState,l=e._pendingEditorState;let s=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=new yd(new Map((l||n)._nodeMap)),s=!0),l._flushSync=i,i=kt;let a=pn,u=Tt,c=e._updating;kt=l,pn=!1,e._updating=!0,Tt=e;try{s&&(e._headless?n._selection!=null&&(l._selection=n._selection.clone()):l._selection=Db(e));let d=e._compositionKey;t(),o=Ny(e,o),Lb(l,e),e._dirtyType!==0&&(o?Ib(l,e):jb(l,e),Ny(e),xb(n,l,e._dirtyLeaves,e._dirtyElements)),d!==e._compositionKey&&(l._flushSync=!0);let f=l._selection;if(de(f)){let h=l._nodeMap,g=f.focus.key;h.get(f.anchor.key)!==void 0&&h.get(g)!==void 0||U(19)}else Bl(f)&&f._nodes.size===0&&(l._selection=null)}catch(d){d instanceof Error&&e._onError(d),e._pendingEditorState=n,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),li(e);return}finally{kt=i,pn=a,Tt=u,e._updating=c,va=0}e._dirtyType!==0||zb(l,e)?l._flushSync?(l._flushSync=!1,li(e)):s&&gb(()=>{li(e)}):(l._flushSync=!1,s&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function kn(e,t,n){e._updating?e._updates.push([t,n]):Lw(e,t,n)}class Iw extends La{constructor(t){super(t)}decorate(){U(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Ve(e){return e instanceof Iw}class Ni extends La{constructor(t){super(t),this.__last=this.__first=null,this.__indent=this.__format=this.__size=0,this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let t=this.getFormat();return ub[t]||""}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=et()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(Q(n)&&t.push(n),B(n)){let r=n.getAllTextNodes();t.push(...r)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;t!==null;){if(B(t)){let n=t.getFirstChild();if(n!==null){t=n;continue}}break}return t}getLastDescendant(){let t=this.getLastChild();for(;t!==null;){if(B(t)){let n=t.getLastChild();if(n!==null){t=n;continue}}break}return t}getDescendantByIndex(t){let n=this.getChildren(),r=n.length;return t>=r?(t=n[r-1],B(t)&&t.getLastDescendant()||t||null):(t=n[t],B(t)&&t.getFirstDescendant()||t||null)}getFirstChild(){let t=this.getLatest().__first;return t===null?null:$t(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&U(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:$t(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&U(96,this.__key),t}getChildAtIndex(t){var n=this.getChildrenSize();let r;if(t<n/2){for(r=this.getFirstChild(),n=0;r!==null&&n<=t;){if(n===t)return r;r=r.getNextSibling(),n++}return null}for(r=this.getLastChild(),--n;r!==null&&n>=t;){if(n===t)return r;r=r.getPreviousSibling(),n--}return null}getTextContent(){let t="",n=this.getChildren(),r=n.length;for(let o=0;o<r;o++){let i=n[o];t+=i.getTextContent(),B(i)&&o!==r-1&&!i.isInline()&&(t+=`
70
-
71
- `)}return t}getTextContentSize(){let t=0,n=this.getChildren(),r=n.length;for(let o=0;o<r;o++){let i=n[o];t+=i.getTextContentSize(),B(i)&&o!==r-1&&!i.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}hasFormat(t){return t!==""?(t=ly[t],(this.getFormat()&t)!==0):!1}select(t,n){Zt();let r=Ke(),o=t,i=n;var l=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){if(t=this.getFirstChild(),Q(t)||B(t))return t.select(0,0)}else if(!(t!==void 0&&t!==l||n!==void 0&&n!==l)&&(t=this.getLastChild(),Q(t)||B(t)))return t.select()}if(o===void 0&&(o=l),i===void 0&&(i=l),l=this.__key,de(r))r.anchor.set(l,o,"element"),r.focus.set(l,i,"element"),r.dirty=!0;else return Aw(l,o,l,i,"element","element");return r}selectStart(){let t=this.getFirstDescendant();return B(t)||Q(t)?t.select(0,0):t!==null?t.selectPrevious():this.select(0,0)}selectEnd(){let t=this.getLastDescendant();return B(t)||Q(t)?t.select():t!==null?t.selectNext():this.select()}clear(){let t=this.getWritable();return this.getChildren().forEach(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?ly[t]:0,this}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,r){let o=r.length,i=this.getChildrenSize(),l=this.getWritable(),s=l.__key;var a=[],u=[];let c=this.getChildAtIndex(t+n),d=null,f=i-n+o;if(t!==0)if(t===i)d=this.getLastChild();else{var h=this.getChildAtIndex(t);h!==null&&(d=h.getPreviousSibling())}if(0<n){var g=d===null?this.getFirstChild():d.getNextSibling();for(h=0;h<n;h++){g===null&&U(100);var m=g.getNextSibling(),S=g.__key;g=g.getWritable(),ii(g),u.push(S),g=m}}for(h=d,m=0;m<o;m++){S=r[m],h!==null&&S.is(h)&&(d=h=h.getPreviousSibling()),g=S.getWritable(),g.__parent===s&&f--,ii(g);let v=S.__key;h===null?(l.__first=v,g.__prev=null):(h=h.getWritable(),h.__next=v,g.__prev=h.__key),S.__key===s&&U(76),g.__parent=s,a.push(v),h=S}if(t+n===i?h!==null&&(h.getWritable().__next=null,l.__last=h.__key):c!==null&&(t=c.getWritable(),h!==null?(n=h.getWritable(),t.__prev=h.__key,n.__next=c.__key):t.__prev=null),l.__size=f,u.length&&(t=Ke(),de(t))){u=new Set(u),a=new Set(a);let{anchor:v,focus:y}=t;by(v,u,a)&&kc(v,v.getNode(),this,d,c),by(y,u,a)&&kc(y,y.getNode(),this,d,c),f!==0||this.canBeEmpty()||Zn(this)||this.remove()}return l}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function B(e){return e instanceof Ni}function by(e,t,n){for(e=e.getNode();e;){let r=e.__key;if(t.has(r)&&!n.has(r))return!0;e=e.getParent()}return!1}class Vl extends Ni{static getType(){return"root"}static clone(){return new Vl}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){U(51)}getTextContent(){let t=this.__cachedText;return!Ul()&&et()._dirtyType!==0||t===null?super.getTextContent():t}remove(){U(52)}replace(){U(53)}insertBefore(){U(54)}insertAfter(){U(55)}updateDOM(){return!1}append(...t){for(let n=0;n<t.length;n++){let r=t[n];B(r)||Ve(r)||U(56)}return super.append(...t)}static importJSON(t){let n=Sr();return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function en(e){return e instanceof Vl}function zb(e,t){if(t=t.getEditorState()._selection,e=e._selection,e!==null){if(e.dirty||!e.is(t))return!0}else if(t!==null)return!0;return!1}function qg(){return new yd(new Map([["root",new Vl]]))}function jw(e){let t=e.exportJSON();var n=e.constructor;t.type!==n.getType()&&U(130,n.name);let r=t.children;if(B(e))for(Array.isArray(r)||U(59,n.name),e=e.getChildren(),n=0;n<e.length;n++){let o=jw(e[n]);r.push(o)}return t}class yd{constructor(t,n){this._nodeMap=t,this._selection=n||null,this._readOnly=this._flushSync=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t){return Ty(this,t)}clone(t){return t=new yd(this._nodeMap,t===void 0?this._selection:t),t._readOnly=!0,t}toJSON(){return Ty(this,()=>({root:jw(Sr())}))}}class Hl extends Ni{static getType(){return"paragraph"}static clone(t){return new Hl(t.__key)}createDOM(t){let n=document.createElement("p");return t=Ls(t.theme,"paragraph"),t!==void 0&&n.classList.add(...t),n}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Fb,priority:0})}}exportDOM(t){if({element:t}=super.exportDOM(t),t&&hd(t)){this.isEmpty()&&t.append(document.createElement("br"));var n=this.getFormatType();t.style.textAlign=n,(n=this.getDirection())&&(t.dir=n),n=this.getIndent(),0<n&&(t.style.textIndent=`${20*n}px`)}return{element:t}}static importJSON(t){let n=pi();return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(t,n){t=pi();let r=this.getDirection();return t.setDirection(r),this.insertAfter(t,n),t}collapseAtStart(){let t=this.getChildren();if(t.length===0||Q(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Fb(e){let t=pi();return e.style&&(t.setFormat(e.style.textAlign),e=parseInt(e.style.textIndent,10)/20,0<e&&t.setIndent(e)),{node:t}}function pi(){return Da(new Hl)}function zw(e,t,n,r){let o=e._keyToDOMMap;o.clear(),e._editorState=qg(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null,r=e._observer,r!==null&&(r.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",o.set("root",n))}function Bb(e){let t=new Map,n=new Set;return e.forEach(r=>{if(r=r.klass.importDOM!=null?r.klass.importDOM.bind(r.klass):null,r!=null&&!n.has(r)){n.add(r);var o=r();o!==null&&Object.keys(o).forEach(i=>{let l=t.get(i);l===void 0&&(l=[],t.set(i,l)),l.push(o[i])})}}),t}class Wb{constructor(t,n,r,o,i,l,s){this._parentEditor=n,this._rootElement=null,this._editorState=t,this._compositionKey=this._pendingEditorState=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=o,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=fw(),this._onError=i,this._htmlConversions=l,this._editable=s,this._headless=n!==null&&n._headless,this._blockCursorElement=this._window=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,r){r===void 0&&U(35);let o=this._commands;o.has(t)||o.set(t,[new Set,new Set,new Set,new Set,new Set]);let i=o.get(t);i===void 0&&U(36,String(t));let l=i[r];return l.add(n),()=>{l.delete(n),i.every(s=>s.size===0)&&o.delete(t)}}registerMutationListener(t,n){this._nodes.get(t.getType())===void 0&&U(37,t.name);let r=this._listeners.mutation;return r.set(n,t),()=>{r.delete(n)}}registerNodeTransformToKlass(t,n){var r=t.getType();return r=this._nodes.get(r),r===void 0&&U(37,t.name),r.transforms.add(n),r}registerNodeTransform(t,n){var r=this.registerNodeTransformToKlass(t,n);let o=[r];return r=r.replaceWithKlass,r!=null&&(r=this.registerNodeTransformToKlass(r,n),o.push(r)),mb(this,t.getType()),()=>{o.forEach(i=>i.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Y(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let l=Ls(this._config.theme,"root");var r=this._pendingEditorState||this._editorState;if(this._rootElement=t,zw(this,n,t,r),n!==null){if(!this._config.disableEvents){Is!==0&&(Is--,Is===0&&n.ownerDocument.removeEventListener("selectionchange",Rw));var o=n.__lexicalEditor;if(o!=null){if(o._parentEditor!==null){var i=Hg(o);i=i[i.length-1]._key,hl.get(i)===o&&hl.delete(i)}else hl.delete(o._key);n.__lexicalEditor=null}for(o=bw(n),i=0;i<o.length;i++)o[i]();n.__lexicalEventHandles=[]}l!=null&&n.classList.remove(...l)}t!==null?(r=(r=t.ownerDocument)&&r.defaultView||null,o=t.style,o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=r,this._dirtyType=2,ow(this),this._updateTags.add("history-merge"),li(this),this._config.disableEvents||Nb(t,this),l!=null&&t.classList.add(...l)):(this._editorState=r,this._window=this._pendingEditorState=null),zs("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&U(38),rw(this);let r=this._pendingEditorState,o=this._updateTags;n=n!==void 0?n.tag:null,r===null||r.isEmpty()||(n!=null&&o.add(n),li(this)),this._pendingEditorState=t,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,n!=null&&o.add(n),li(this)}parseEditorState(t,n){t=typeof t=="string"?JSON.parse(t):t;let r=qg(),o=kt,i=pn,l=Tt,s=this._dirtyElements,a=this._dirtyLeaves,u=this._cloneNotNeeded,c=this._dirtyType;this._dirtyElements=new Map,this._dirtyLeaves=new Set,this._cloneNotNeeded=new Set,this._dirtyType=0,kt=r,pn=!1,Tt=this;try{Zg(t.root,this._nodes),n&&n(),r._readOnly=!0}catch(d){d instanceof Error&&this._onError(d)}finally{this._dirtyElements=s,this._dirtyLeaves=a,this._cloneNotNeeded=u,this._dirtyType=c,kt=o,pn=i,Tt=l}return r}update(t,n){kn(this,t,n)}focus(t,n={}){let r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),kn(this,()=>{let o=Ke(),i=Sr();o!==null?o.dirty=!0:i.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?i.selectStart():i.selectEnd())},{onUpdate:()=>{r.removeAttribute("autocapitalize"),t&&t()},tag:"focus"}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){var t=this._rootElement;t!==null&&t.blur(),t=Cr(this._window),t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,zs("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}}class em extends Ni{constructor(t,n){super(n),this.__colSpan=t,this.__rowSpan=1}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan,rowSpan:this.__rowSpan}}getColSpan(){return this.__colSpan}setColSpan(t){return this.getWritable().__colSpan=t,this}getRowSpan(){return this.__rowSpan}setRowSpan(t){return this.getWritable().__rowSpan=t,this}}function Mn(e){return e instanceof em}class Fw extends Ni{}function tm(e){return e instanceof Fw}class Bw extends Ni{}function ya(e){return e instanceof Bw}D.$addUpdateTag=function(e){Zt(),et()._updateTags.add(e)};D.$applyNodeReplacement=Da;D.$copyNode=gw;D.$createLineBreakNode=Tl;D.$createNodeSelection=np;D.$createParagraphNode=pi;D.$createRangeSelection=function(){let e=new yr("root",0,"element"),t=new yr("root",0,"element");return new Ti(e,t,0,"")};D.$createTabNode=gd;D.$createTextNode=Ct;D.$getAdjacentNode=Bh;D.$getNearestNodeFromDOMNode=Ma;D.$getNearestRootOrShadowRoot=pw;D.$getNodeByKey=$t;D.$getPreviousSelection=Wl;D.$getRoot=Sr;D.$getSelection=Ke;D.$getTextContent=function(){let e=Ke();return e===null?"":e.getTextContent()};D.$hasAncestor=Sc;D.$hasUpdateTag=function(e){return et()._updateTags.has(e)};D.$insertNodes=function(e,t){let n=Ke()||Wl();return n===null&&(n=Sr().selectEnd()),n.insertNodes(e,t)};D.$isBlockElementNode=tp;D.$isDecoratorNode=Ve;D.$isElementNode=B;D.$isInlineElementOrDecoratorNode=function(e){return B(e)&&e.isInline()||Ve(e)&&e.isInline()};D.$isLeafNode=sw;D.$isLineBreakNode=ma;D.$isNodeSelection=Bl;D.$isParagraphNode=function(e){return e instanceof Hl};D.$isRangeSelection=de;D.$isRootNode=en;D.$isRootOrShadowRoot=Zn;D.$isTabNode=function(e){return e instanceof Fl};D.$isTextNode=Q;D.$nodesOfType=function(e){var t=Er();let n=t._readOnly,r=e.getType();t=t._nodeMap;let o=[];for(let[,i]of t)i instanceof e&&i.__type===r&&(n||i.isAttached())&&o.push(i);return o};D.$normalizeSelection__EXPERIMENTAL=Wg;D.$parseSerializedNode=function(e){return Zg(e,et()._nodes)};D.$selectAll=function(){var e=Sr();e=e.select(0,e.getChildrenSize()),vr(Wg(e))};D.$setCompositionKey=Mt;D.$setSelection=vr;D.$splitNode=mw;D.BLUR_COMMAND=ew;D.CAN_REDO_COMMAND={};D.CAN_UNDO_COMMAND={};D.CLEAR_EDITOR_COMMAND={};D.CLEAR_HISTORY_COMMAND={};D.CLICK_COMMAND=L_;D.COMMAND_PRIORITY_CRITICAL=4;D.COMMAND_PRIORITY_EDITOR=0;D.COMMAND_PRIORITY_HIGH=3;D.COMMAND_PRIORITY_LOW=1;D.COMMAND_PRIORITY_NORMAL=2;D.CONTROLLED_TEXT_INSERTION_COMMAND=fl;D.COPY_COMMAND=Ig;D.CUT_COMMAND=jg;D.DELETE_CHARACTER_COMMAND=ca;D.DELETE_LINE_COMMAND=fa;D.DELETE_WORD_COMMAND=da;D.DEPRECATED_$computeGridMap=Mw;D.DEPRECATED_$createGridSelection=function(){let e=new yr("root",0,"element"),t=new yr("root",0,"element");return new vd("root",e,t)};D.DEPRECATED_$getGridCellNodeRect=ep;D.DEPRECATED_$getNodeTriplet=Dw;D.DEPRECATED_$isGridCellNode=Mn;D.DEPRECATED_$isGridNode=tm;D.DEPRECATED_$isGridRowNode=ya;D.DEPRECATED_$isGridSelection=Qg;D.DEPRECATED_GridCellNode=em;D.DEPRECATED_GridNode=Fw;D.DEPRECATED_GridRowNode=Bw;D.DRAGEND_COMMAND=Z_;D.DRAGOVER_COMMAND=J_;D.DRAGSTART_COMMAND=Q_;D.DROP_COMMAND=X_;D.DecoratorNode=Iw;D.ElementNode=Ni;D.FOCUS_COMMAND=q_;D.FORMAT_ELEMENT_COMMAND={};D.FORMAT_TEXT_COMMAND=go;D.INDENT_CONTENT_COMMAND={};D.INSERT_LINE_BREAK_COMMAND=Ds;D.INSERT_PARAGRAPH_COMMAND=Lh;D.INSERT_TAB_COMMAND={};D.KEY_ARROW_DOWN_COMMAND=U_;D.KEY_ARROW_LEFT_COMMAND=F_;D.KEY_ARROW_RIGHT_COMMAND=j_;D.KEY_ARROW_UP_COMMAND=W_;D.KEY_BACKSPACE_COMMAND=H_;D.KEY_DELETE_COMMAND=G_;D.KEY_DOWN_COMMAND=I_;D.KEY_ENTER_COMMAND=mc;D.KEY_ESCAPE_COMMAND=K_;D.KEY_MODIFIER_COMMAND=tw;D.KEY_SPACE_COMMAND=V_;D.KEY_TAB_COMMAND=Y_;D.LineBreakNode=zl;D.MOVE_TO_END=z_;D.MOVE_TO_START=B_;D.OUTDENT_CONTENT_COMMAND={};D.PASTE_COMMAND=Mg;D.ParagraphNode=Hl;D.REDO_COMMAND=Lg;D.REMOVE_TEXT_COMMAND=Ih;D.RootNode=Vl;D.SELECTION_CHANGE_COMMAND=ad;D.SELECT_ALL_COMMAND=jh;D.TabNode=Fl;D.TextNode=ki;D.UNDO_COMMAND=Dg;D.createCommand=function(){return{}};D.createEditor=function(e){var t=e||{},n=Tt,r=t.theme||{};let o=e===void 0?n:t.parentEditor||null,i=t.disableEvents||!1,l=qg(),s=t.namespace||(o!==null?o._config.namespace:fw()),a=t.editorState,u=[Vl,ki,zl,Fl,Hl,...t.nodes||[]],c=t.onError;if(t=t.editable!==void 0?t.editable:!0,e===void 0&&n!==null)e=n._nodes;else for(e=new Map,n=0;n<u.length;n++){let f=u[n],h=null;var d=null;typeof f!="function"&&(d=f,f=d.replace,h=d.with,d=d.withKlass?d.withKlass:null);let g=f.getType(),m=f.transform(),S=new Set;m!==null&&S.add(m),e.set(g,{klass:f,replace:h,replaceWithKlass:d,transforms:S})}return r=new Wb(l,o,e,{disableEvents:i,namespace:s,theme:r},c||console.error,Bb(e),t),a!==void 0&&(r._pendingEditorState=a,r._dirtyType=2),r};D.getNearestEditorFromDOMNode=Vg;D.isHTMLAnchorElement=function(e){return hd(e)&&e.tagName==="A"};D.isHTMLElement=hd;D.isSelectionCapturedInDecoratorInput=Ug;D.isSelectionWithinEditor=Aa;const Ub=D;var ge=Ub,dt={},Rt={},ne=ge;let Tc=new Map;function Ry(e){for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function Py(e){let t=e.parentNode;if(t==null)throw Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function Ww(e){let t={};e=e.split(";");for(let n of e)if(n!==""){let[r,o]=n.split(/:([^]+)/);t[r.trim()]=o.trim()}return t}function Nc(e){let t=Tc.get(e);return t===void 0&&(t=Ww(e),Tc.set(e,t)),t}function Vb(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Ai(e,t){var n=Nc("getStyle"in e?e.getStyle():e.style);t=Object.entries(t).reduce((r,[o,i])=>(i===null?delete r[o]:r[o]=i,r),{...n}),n=Vb(t),e.setStyle(n),Tc.set(n,t)}function Uw(e,t){var n=e.getNodes(),r=n.length;if(ne.DEPRECATED_$isGridSelection(e)){for(var o=ne.$createRangeSelection(),i=o.anchor,l=o.focus,s=0;s<r;s++){var a=n[s];ne.DEPRECATED_$isGridCellNode(a)&&(i.set(a.getKey(),0,"element"),l.set(a.getKey(),a.getChildrenSize(),"element"),Uw(ne.$normalizeSelection__EXPERIMENTAL(o),t))}ne.$setSelection(e)}else if(--r,o=n[0],i=n[r],e.isCollapsed())Ai(e,t);else{var u=e.anchor,c=e.focus;s=o.getTextContent().length,a=c.offset;var d=u.offset,f=u.isBefore(c);l=f?d:a,e=f?a:d;var h=f?u.type:c.type,g=f?c.type:u.type;if(u=f?c.key:u.key,ne.$isTextNode(o)&&l===s&&(c=o.getNextSibling(),ne.$isTextNode(c)&&(l=d=0,o=c)),n.length===1)ne.$isTextNode(o)&&(l=h==="element"?0:d>a?a:d,e=g==="element"?s:d>a?d:a,l!==e&&(l===0&&e===s?(Ai(o,t),o.select(l,e)):(n=o.splitText(l,e),n=l===0?n[0]:n[1],Ai(n,t),n.select(0,e-l))));else for(ne.$isTextNode(o)&&l<o.getTextContentSize()&&(l!==0&&(o=o.splitText(l)[1]),Ai(o,t)),ne.$isTextNode(i)&&(l=i.getTextContent().length,i.__key!==u&&e!==0&&(e=l),e!==l&&([i]=i.splitText(e)),e!==0&&Ai(i,t)),e=1;e<r;e++)l=n[e],s=l.getKey(),ne.$isTextNode(l)&&s!==o.getKey()&&s!==i.getKey()&&!l.isToken()&&Ai(l,t)}}function Hb(e){for(;e!==null&&!ne.$isRootOrShadowRoot(e);){let t=e.getLatest(),n=e.getParent();t.getChildrenSize()===0&&e.remove(!0),e=n}}function Cf(e,t,n,r,o=null){if(t.length!==0){var i=t[0],l=new Map,s=[];i=ne.$isElementNode(i)?i:i.getParentOrThrow(),i.isInline()&&(i=i.getParentOrThrow());for(var a=!1;i!==null;){var u=i.getPreviousSibling();if(u!==null){i=u,a=!0;break}if(i=i.getParentOrThrow(),ne.$isRootOrShadowRoot(i))break}u=new Set;for(var c=0;c<n;c++){var d=t[c];ne.$isElementNode(d)&&d.getChildrenSize()===0&&u.add(d.getKey())}var f=new Set;for(c=0;c<n;c++){d=t[c];var h=d.getParent();if(h!==null&&h.isInline()&&(h=h.getParent()),h!==null&&ne.$isLeafNode(d)&&!f.has(d.getKey())){if(d=h.getKey(),l.get(d)===void 0){let g=r();g.setFormat(h.getFormatType()),g.setIndent(h.getIndent()),s.push(g),l.set(d,g),h.getChildren().forEach(m=>{g.append(m),f.add(m.getKey()),ne.$isElementNode(m)&&m.getChildrenKeys().forEach(S=>f.add(S))}),Hb(h)}}else u.has(d.getKey())&&(h=r(),h.setFormat(d.getFormatType()),h.setIndent(d.getIndent()),s.push(h),d.remove(!0))}if(o!==null)for(t=0;t<s.length;t++)o.append(s[t]);if(t=null,ne.$isRootOrShadowRoot(i))if(a)if(o!==null)i.insertAfter(o);else for(o=s.length-1;0<=o;o--)i.insertAfter(s[o]);else if(a=i.getFirstChild(),ne.$isElementNode(a)&&(i=a),a===null)if(o)i.append(o);else for(o=0;o<s.length;o++)a=s[o],i.append(a),t=a;else if(o!==null)a.insertBefore(o);else for(i=0;i<s.length;i++)o=s[i],a.insertBefore(o),t=o;else if(o)i.insertAfter(o);else for(o=s.length-1;0<=o;o--)a=s[o],i.insertAfter(a),t=a;s=ne.$getPreviousSelection(),ne.$isRangeSelection(s)&&s.anchor.getNode().isAttached()&&s.focus.getNode().isAttached()?ne.$setSelection(s.clone()):t!==null?t.selectEnd():e.dirty=!0}}function Vw(e,t,n,r){e.modify(t?"extend":"move",n,r)}function Hw(e){return e=e.anchor.getNode(),(ne.$isRootNode(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}Rt.$addNodeStyle=function(e){e=e.getStyle();let t=Ww(e);Tc.set(e,t)};Rt.$cloneWithProperties=function(e){let t=e.constructor.clone(e);return t.__parent=e.__parent,t.__next=e.__next,t.__prev=e.__prev,ne.$isElementNode(e)&&ne.$isElementNode(t)?(t.__first=e.__first,t.__last=e.__last,t.__size=e.__size,t.__format=e.__format,t.__indent=e.__indent,t.__dir=e.__dir,t):(ne.$isTextNode(e)&&ne.$isTextNode(t)&&(t.__format=e.__format,t.__style=e.__style,t.__mode=e.__mode,t.__detail=e.__detail),t)};Rt.$getSelectionStyleValueForProperty=function(e,t,n=""){let r=null,o=e.getNodes();var i=e.anchor,l=e.focus,s=e.isBackward();let a=s?l.offset:i.offset;if(i=s?l.getNode():i.getNode(),e.style!==""&&(e=Nc(e.style),e!==null&&t in e))return e[t];for(e=0;e<o.length;e++){var u=o[e];if((e===0||a!==0||!u.is(i))&&ne.$isTextNode(u)){if(l=t,s=n,u=u.getStyle(),u=Nc(u),l=u!==null&&u[l]||s,r===null)r=l;else if(r!==l){r="";break}}}return r===null?n:r};Rt.$isAtNodeEnd=function(e){return e.type==="text"?e.offset===e.getNode().getTextContentSize():e.offset===e.getNode().getChildrenSize()};Rt.$isParentElementRTL=Hw;Rt.$moveCaretSelection=Vw;Rt.$moveCharacter=function(e,t,n){let r=Hw(e);Vw(e,t,n?!r:r,"character")};Rt.$patchStyleText=Uw;Rt.$selectAll=function(e){let t=e.anchor;e=e.focus;var n=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();let r=n.getFirstDescendant();n=n.getLastDescendant();let o="element",i="element",l=0;ne.$isTextNode(r)?o="text":ne.$isElementNode(r)||r===null||(r=r.getParentOrThrow()),ne.$isTextNode(n)?(i="text",l=n.getTextContentSize()):ne.$isElementNode(n)||n===null||(n=n.getParentOrThrow()),r&&n&&(t.set(r.getKey(),0,o),e.set(n.getKey(),l,i))};Rt.$setBlocksType=function(e,t){if(e.anchor.key==="root"){t=t();var n=ne.$getRoot();(e=n.getFirstChild())?e.replace(t,!0):n.append(t)}else for(n=e.getNodes(),e=e.anchor.getNode().getParentOrThrow(),n.indexOf(e)===-1&&n.push(e),e.isInline()&&(e=e.getParentOrThrow(),n.indexOf(e)===-1&&n.push(e)),e=0;e<n.length;e++){let i=n[e];var r=i;if(!ne.$isElementNode(r)||ne.$isRootOrShadowRoot(r))r=!1;else{var o=r.getFirstChild();o=o===null||ne.$isLineBreakNode(o)||ne.$isTextNode(o)||o.isInline(),r=!r.isInline()&&r.canBeEmpty()!==!1&&o}r&&(r=t(),r.setFormat(i.getFormatType()),r.setIndent(i.getIndent()),i.replace(r,!0))}};Rt.$shouldOverrideDefaultCharacterSelection=function(e,t){return e=ne.$getAdjacentNode(e.focus,t),ne.$isDecoratorNode(e)&&!e.isIsolated()||ne.$isElementNode(e)&&!e.isInline()&&!e.canBeEmpty()};Rt.$sliceSelectedTextNodeContent=function(e,t){if(t.isSelected()&&!t.isSegmented()&&!t.isToken()&&(ne.$isRangeSelection(e)||ne.DEPRECATED_$isGridSelection(e))){var n=e.anchor.getNode(),r=e.focus.getNode(),o=t.is(n),i=t.is(r);if(o||i){o=e.isBackward();let[l,s]=e.getCharacterOffsets();e=n.is(r),i=t.is(o?r:n),r=t.is(o?n:r),n=0;let a;e?(n=l>s?s:l,a=l>s?l:s):i?(n=o?s:l,a=void 0):r&&(o=o?l:s,n=0,a=o),t.__text=t.__text.slice(n,a)}}return t};Rt.$wrapNodes=function(e,t,n=null){var r=e.getNodes();let o=r.length;var i=e.anchor;if(o===0||o===1&&i.type==="element"&&i.getNode().getChildrenSize()===0){e=i.type==="text"?i.getNode().getParentOrThrow():i.getNode(),r=e.getChildren();let s=t();s.setFormat(e.getFormatType()),s.setIndent(e.getIndent()),r.forEach(a=>s.append(a)),n&&(s=n.append(s)),e.replace(s)}else{i=null;var l=[];for(let s=0;s<o;s++){let a=r[s];ne.$isRootOrShadowRoot(a)?(Cf(e,l,l.length,t,n),l=[],i=a):i===null||i!==null&&ne.$hasAncestor(a,i)?l.push(a):(Cf(e,l,l.length,t,n),l=[a])}Cf(e,l,l.length,t,n)}};Rt.createDOMRange=function(e,t,n,r,o){let i=t.getKey(),l=r.getKey(),s=document.createRange(),a=e.getElementByKey(i);if(e=e.getElementByKey(l),ne.$isTextNode(t)&&(a=Ry(a)),ne.$isTextNode(r)&&(e=Ry(e)),t===void 0||r===void 0||a===null||e===null)return null;a.nodeName==="BR"&&([a,n]=Py(a)),e.nodeName==="BR"&&([e,o]=Py(e)),t=a.firstChild,a===e&&t!=null&&t.nodeName==="BR"&&n===0&&o===0&&(o=1);try{s.setStart(a,n),s.setEnd(e,o)}catch{return null}return!s.collapsed||n===o&&i===l||(s.setStart(e,o),s.setEnd(a,n)),s};Rt.createRectsFromDOMRange=function(e,t){var n=e.getRootElement();if(n===null)return[];e=n.getBoundingClientRect(),n=getComputedStyle(n),n=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight),t=Array.from(t.getClientRects());let r=t.length;t.sort((i,l)=>{let s=i.top-l.top;return 3>=Math.abs(s)?i.left-l.left:s});let o;for(let i=0;i<r;i++){let l=t[i],s=l.width+n===e.width;o&&o.top<=l.top&&o.top+o.height>l.top&&o.left+o.width>l.left||s?(t.splice(i--,1),r--):o=l}return t};Rt.getStyleObjectFromCSS=Nc;Rt.trimTextContentFromAnchor=function(e,t,n){let r=t.getNode();if(ne.$isElementNode(r)){var o=r.getDescendantByIndex(t.offset);o!==null&&(r=o)}for(;0<n&&r!==null;){var i=r.getPreviousSibling(),l=0;if(i===null){o=r.getParentOrThrow();for(var s=o.getPreviousSibling();s===null;){if(o=o.getParent(),o===null){i=null;break}s=o.getPreviousSibling()}o!==null&&(l=o.isInline()?0:2,i=ne.$isElementNode(s)?s.getLastDescendant():s)}if(s=r.getTextContent(),s===""&&ne.$isElementNode(r)&&!r.isInline()&&(s=`
72
-
73
- `),o=s.length,!ne.$isTextNode(r)||n>=o)s=r.getParent(),r.remove(),s==null||s.getChildrenSize()!==0||ne.$isRootNode(s)||s.remove(),n-=o+l,r=i;else{let a=r.getKey();l=e.getEditorState().read(()=>{const c=ne.$getNodeByKey(a);return ne.$isTextNode(c)&&c.isSimpleText()?c.getTextContent():null}),i=o-n;let u=s.slice(0,i);l!==null&&l!==s?(n=ne.$getPreviousSelection(),o=r,r.isSimpleText()?r.setTextContent(l):(o=ne.$createTextNode(l),r.replace(o)),ne.$isRangeSelection(n)&&n.isCollapsed()&&(n=n.anchor.offset,o.select(n,n))):r.isSimpleText()?(l=t.key===a,s=t.offset,s<n&&(s=o),n=l?s-n:0,o=l?s:i,l&&n===0?([n]=r.splitText(n,o),n.remove()):([,n]=r.splitText(n,o),n.remove())):(n=ne.$createTextNode(u),r.replace(n)),n=0}}};const Kb=Rt;var Oo=Kb,Gb=Oo,at=ge;function Yb(e){let t=new URLSearchParams;t.append("code",e);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Kw(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function Gw(e,t){for(;e!==at.$getRoot()&&e!=null;){if(t(e))return e;e=e.getParent()}return null}dt.$splitNode=at.$splitNode;dt.isHTMLAnchorElement=at.isHTMLAnchorElement;dt.isHTMLElement=at.isHTMLElement;dt.$dfs=function(e,t){let n=[];e=(e||at.$getRoot()).getLatest(),t=t||(at.$isElementNode(e)?e.getLastDescendant():e);for(var r=e,o=0;(r=r.getParent())!==null;)o++;for(r=o;e!==null&&!e.is(t);)if(n.push({depth:r,node:e}),at.$isElementNode(e)&&0<e.getChildrenSize())e=e.getFirstChild(),r++;else for(o=null;o===null&&e!==null;)o=e.getNextSibling(),o===null?(e=e.getParent(),r--):e=o;return e!==null&&e.is(t)&&n.push({depth:r,node:e}),n};dt.$filter=function(e,t){let n=[];for(let r=0;r<e.length;r++){let o=t(e[r]);o!==null&&n.push(o)}return n};dt.$findMatchingParent=Gw;dt.$getNearestBlockElementAncestorOrThrow=function(e){let t=Gw(e,n=>at.$isElementNode(n)&&!n.isInline());return at.$isElementNode(t)||Yb(4,e.__key),t};dt.$getNearestNodeOfType=function(e,t){for(;e!=null;){if(e instanceof t)return e;e=e.getParent()}return null};dt.$insertFirst=function(e,t){let n=e.getFirstChild();n!==null?n.insertBefore(t):e.append(t)};dt.$insertNodeToNearestRoot=function(e){var t=at.$getSelection()||at.$getPreviousSelection();if(at.$isRangeSelection(t)){var{focus:n}=t;if(t=n.getNode(),n=n.offset,at.$isRootOrShadowRoot(t))n=t.getChildAtIndex(n),n==null?t.append(e):n.insertBefore(e),e.selectNext();else{let r,o;at.$isTextNode(t)?(r=t.getParentOrThrow(),o=t.getIndexWithinParent(),0<n&&(o+=1,t.splitText(n))):(r=t,o=n),[,t]=at.$splitNode(r,o),t.insertBefore(e),t.selectStart()}}else at.$isNodeSelection(t)||at.DEPRECATED_$isGridSelection(t)?(t=t.getNodes(),t[t.length-1].getTopLevelElementOrThrow().insertAfter(e)):at.$getRoot().append(e),t=at.$createParagraphNode(),e.insertAfter(t),t.select();return e.getLatest()};dt.$restoreEditorState=function(e,t){let n=new Map,r=e._pendingEditorState;for(let[o,i]of t._nodeMap){let l=Gb.$cloneWithProperties(i);at.$isTextNode(l)&&(l.__text=i.__text),n.set(o,l)}r&&(r._nodeMap=n),e._dirtyType=2,e=t._selection,at.$setSelection(e===null?null:e.clone())};dt.$wrapNodeInElement=function(e,t){return t=t(),e.replace(t),t.append(e),t};dt.addClassNamesToElement=function(e,...t){t.forEach(n=>{typeof n=="string"&&(n=n.split(" ").filter(r=>r!==""),e.classList.add(...n))})};dt.isMimeType=Kw;dt.mediaFileReader=function(e,t){let n=e[Symbol.iterator]();return new Promise((r,o)=>{let i=[],l=()=>{const{done:s,value:a}=n.next();if(s)return r(i);const u=new FileReader;u.addEventListener("error",o),u.addEventListener("load",()=>{const c=u.result;typeof c=="string"&&i.push({file:a,result:c}),l()}),Kw(a,t)?u.readAsDataURL(a):l()};l()})};dt.mergeRegister=function(...e){return()=>{e.forEach(t=>t())}};dt.objectKlassEquals=function(e,t){return e!==null?Object.getPrototypeOf(e).constructor.name===t.name:!1};dt.registerNestedElementResolver=function(e,t,n,r){return e.registerNodeTransform(t,o=>{e:{for(var i=o.getChildren(),l=0;l<i.length;l++)if(i[l]instanceof t){i=null;break e}for(i=o;i!==null;)if(l=i,i=i.getParent(),i instanceof t){i={child:l,parent:i};break e}i=null}if(i!==null){const{child:s,parent:a}=i;if(s.is(o)){if(r(a,o),o=s.getNextSiblings(),i=o.length,a.insertAfter(s),i!==0){l=n(a),s.insertAfter(l);for(let u=0;u<i;u++)l.append(o[u])}a.canBeEmpty()||a.getChildrenSize()!==0||a.remove()}}})};dt.removeClassNamesFromElement=function(e,...t){t.forEach(n=>{typeof n=="string"&&e.classList.remove(...n.split(" "))})};const Xb=dt;var Nt=Xb,Ne=ge,Ao=Nt;function Nl(e){let t=new URLSearchParams;t.append("code",e);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Yw(e){let t=1;for(e=e.getParent();e!=null;){if(Ze(e)){if(e=e.getParent(),xe(e)){t++,e=e.getParent();continue}Nl(40)}break}return t}function rp(e){e=e.getParent(),xe(e)||Nl(40);let t=e;for(;t!==null;)t=t.getParent(),xe(t)&&(e=t);return e}function Xw(e){let t=[];e=e.getChildren().filter(Ze);for(let n=0;n<e.length;n++){let r=e[n],o=r.getFirstChild();xe(o)?t=t.concat(Xw(o)):t.push(r)}return t}function ar(e){return Ze(e)&&xe(e.getFirstChild())}function Qb(e){for(;e.getNextSibling()==null&&e.getPreviousSibling()==null;){let t=e.getParent();if(t==null||!Ze(e)&&!xe(e))break;e=t}e.remove()}function Oy(e){return Sn().append(e)}function Qw(e,t){return Ze(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function gi(e,t){e.splice(e.getChildrenSize(),0,t)}function Ay(e,t){if(xe(e))return e;let n=e.getPreviousSibling(),r=e.getNextSibling(),o=Sn();return o.setFormat(e.getFormatType()),o.setIndent(e.getIndent()),gi(o,e.getChildren()),xe(n)&&t===n.getListType()?(n.append(o),e.remove(),xe(r)&&t===r.getListType()&&(gi(n,r.getChildren()),r.remove()),n):xe(r)&&t===r.getListType()?(r.getFirstChildOrThrow().insertBefore(o),e.remove(),r):(t=tn(t),t.append(o),e.replace(t),Xt(t),t)}function Jw(e,t){var n=e.getLastChild();let r=t.getFirstChild();n&&r&&ar(n)&&ar(r)&&(Jw(n.getFirstChild(),r.getFirstChild()),r.remove()),n=t.getChildren(),0<n.length&&(e.append(...n),Xt(e)),t.remove()}function Xt(e,t){if(e=t||e.getChildren(),e!==void 0)for(t=0;t<e.length;t++){let i=e[t];if(Ze(i)){let l=i.getValue();var n=i,r=n.getParent(),o=1;for(r!=null&&(xe(r)?o=r.getStart():Nl(44)),n=n.getPreviousSiblings(),r=0;r<n.length;r++){let s=n[r];Ze(s)&&!xe(s.getFirstChild())&&o++}l!==o&&i.setValue(o)}}}function Jb(e){if(!ar(e)){var t=e.getParent(),n=t?t.getParent():void 0,r=n?n.getParent():void 0;if(xe(r)&&Ze(n)&&xe(t)){var o=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(o))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{var l=t.getListType();o=Sn();let s=tn(l);o.append(s),e.getPreviousSiblings().forEach(a=>s.append(a)),i=Sn(),l=tn(l),i.append(l),gi(l,e.getNextSiblings()),n.insertBefore(o),n.insertAfter(i),n.replace(e)}Xt(t),Xt(r)}}}let xd=class Zw extends Ne.ElementNode{static getType(){return"listitem"}static clone(t){return new Zw(t.__value,t.__checked,t.__key)}constructor(t,n,r){super(r),this.__value=t===void 0?1:t,this.__checked=n}createDOM(t){let n=document.createElement("li"),r=this.getParent();return xe(r)&&r.getListType()==="check"&&Dy(n,this,null),n.value=this.__value,My(n,t.theme,this),n}updateDOM(t,n,r){let o=this.getParent();return xe(o)&&o.getListType()==="check"&&Dy(n,this,t),n.value=this.__value,My(n,r.theme,this),!1}static transform(){return t=>{let n=t.getParent();xe(n)&&(Xt(n),n.getListType()!=="check"&&t.getChecked()!=null&&t.setChecked(void 0))}}static importDOM(){return{li:()=>({conversion:Zb,priority:0})}}static importJSON(t){let n=Sn();return n.setChecked(t.checked),n.setValue(t.value),n.setFormat(t.format),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...t){for(let n=0;n<t.length;n++){let r=t[n];if(Ne.$isElementNode(r)&&this.canMergeWith(r)){let o=r.getChildren();this.append(...o),r.remove()}else super.append(r)}return this}replace(t,n){if(Ze(t))return super.replace(t);this.setIndent(0);let r=this.getParentOrThrow();if(!xe(r))return t;if(r.__first===this.getKey())r.insertBefore(t);else if(r.__last===this.getKey())r.insertAfter(t);else{let o=tn(r.getListType()),i=this.getNextSibling();for(;i;){let l=i;i=i.getNextSibling(),o.append(l)}r.insertAfter(t),t.insertAfter(o)}return n&&this.getChildren().forEach(o=>{t.append(o)}),this.remove(),r.getChildrenSize()===0&&r.remove(),t}insertAfter(t,n=!0){var r=this.getParentOrThrow();xe(r)||Nl(39);var o=this.getNextSiblings();if(Ze(t))return n=super.insertAfter(t,n),t=t.getParentOrThrow(),xe(t)&&Xt(t),n;if(xe(t)){for(r=t,t=t.getChildren(),o=t.length-1;0<=o;o--)r=t[o],this.insertAfter(r,n);return r}if(r.insertAfter(t,n),o.length!==0){let i=tn(r.getListType());o.forEach(l=>i.append(l)),t.insertAfter(i,n)}return t}remove(t){let n=this.getPreviousSibling(),r=this.getNextSibling();super.remove(t),n&&r&&ar(n)&&ar(r)?(Jw(n.getFirstChild(),r.getFirstChild()),r.remove()):r&&(t=r.getParent(),xe(t)&&Xt(t))}insertNewAfter(t,n=!0){return t=Sn(this.__checked==null?void 0:!1),this.insertAfter(t,n),t}collapseAtStart(t){let n=Ne.$createParagraphNode();this.getChildren().forEach(l=>n.append(l));var r=this.getParentOrThrow(),o=r.getParentOrThrow();let i=Ze(o);return r.getChildrenSize()===1?i?(r.remove(),o.select()):(r.insertBefore(n),r.remove(),r=t.anchor,t=t.focus,o=n.getKey(),r.type==="element"&&r.getNode().is(this)&&r.set(o,r.offset,"element"),t.type==="element"&&t.getNode().is(this)&&t.set(o,t.offset,"element")):(r.insertBefore(n),this.remove()),!0}getValue(){return this.getLatest().__value}setValue(t){this.getWritable().__value=t}getChecked(){return this.getLatest().__checked}setChecked(t){this.getWritable().__checked=t}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var t=this.getParent();if(t===null)return this.getLatest().__indent;t=t.getParentOrThrow();let n=0;for(;Ze(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(t){typeof t=="number"&&-1<t||Nl(117);let n=this.getIndent();for(;n!==t;)if(n<t){e:{var r=new Set;if(ar(this)||r.has(this.getKey()))break e;let s=this.getParent();var o=this.getNextSibling(),i=this.getPreviousSibling();if(ar(o)&&ar(i)){if(i=i.getFirstChild(),xe(i)){i.append(this);var l=o.getFirstChild();xe(l)&&(l=l.getChildren(),gi(i,l),o.remove(),r.add(o.getKey())),Xt(i)}}else ar(o)?(o=o.getFirstChild(),xe(o)&&(r=o.getFirstChild(),r!==null&&r.insertBefore(this),Xt(o))):ar(i)?(o=i.getFirstChild(),xe(o)&&(o.append(this),Xt(o))):xe(s)&&(r=Sn(),l=tn(s.getListType()),r.append(l),l.append(this),i?i.insertAfter(r):o?o.insertBefore(r):s.append(r),Xt(l));xe(s)&&Xt(s)}n++}else Jb(this),n--;return this}insertBefore(t){if(Ze(t)){let n=this.getParentOrThrow();if(xe(n)){let r=this.getNextSiblings();Xt(n,r)}}return super.insertBefore(t)}canInsertAfter(t){return Ze(t)}canReplaceWith(t){return Ze(t)}canMergeWith(t){return Ne.$isParagraphNode(t)||Ze(t)}extractWithChild(t,n){if(!Ne.$isRangeSelection(n))return!1;t=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(t)&&this.isParentOf(r)&&this.getTextContent().length===n.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return tn("bullet")}};function My(e,t,n){let r=[],o=[];var i=(t=t.list)?t.listitem:void 0;if(t&&t.nested)var l=t.nested.listitem;if(i!==void 0&&(i=i.split(" "),r.push(...i)),t){i=n.getParent(),i=xe(i)&&i.getListType()==="check";let s=n.getChecked();i&&!s||o.push(t.listitemUnchecked),i&&s||o.push(t.listitemChecked),i&&r.push(s?t.listitemChecked:t.listitemUnchecked)}l!==void 0&&(l=l.split(" "),n.getChildren().some(s=>xe(s))?r.push(...l):o.push(...l)),0<o.length&&Ao.removeClassNamesFromElement(e,...o),0<r.length&&Ao.addClassNamesToElement(e,...r)}function Dy(e,t,n){xe(t.getFirstChild())?(e.removeAttribute("role"),e.removeAttribute("tabIndex"),e.removeAttribute("aria-checked")):(e.setAttribute("role","checkbox"),e.setAttribute("tabIndex","-1"),n&&t.__checked===n.__checked||e.setAttribute("aria-checked",t.getChecked()?"true":"false"))}function Zb(e){return e=Ao.isHTMLElement(e)&&e.getAttribute("aria-checked")==="true",{node:Sn(e)}}function Sn(e){return Ne.$applyNodeReplacement(new xd(void 0,e))}function Ze(e){return e instanceof xd}let nm=class qw extends Ne.ElementNode{static getType(){return"list"}static clone(t){return new qw(t.__listType||jy[t.__tag],t.__start,t.__key)}constructor(t,n,r){super(r),this.__listType=t=jy[t]||t,this.__tag=t==="number"?"ol":"ul",this.__start=n}getTag(){return this.__tag}setListType(t){let n=this.getWritable();n.__listType=t,n.__tag=t==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(t){let n=document.createElement(this.__tag);return this.__start!==1&&n.setAttribute("start",String(this.__start)),n.__lexicalListType=this.__listType,Ly(n,t.theme,this),n}updateDOM(t,n,r){return t.__tag!==this.__tag?!0:(Ly(n,r.theme,this),!1)}static importDOM(){return{ol:()=>({conversion:Iy,priority:0}),ul:()=>({conversion:Iy,priority:0})}}static importJSON(t){let n=tn(t.listType,t.start);return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportDOM(t){return{element:t}=super.exportDOM(t),t&&Ao.isHTMLElement(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...t){for(let r=0;r<t.length;r++){var n=t[r];if(Ze(n))super.append(n);else{let o=Sn();xe(n)||Ne.$isElementNode(n)&&(n=Ne.$createTextNode(n.getTextContent())),o.append(n),super.append(o)}}return Xt(this),this}extractWithChild(t){return Ze(t)}};function Ly(e,t,n){let r=[],o=[];var i=t.list;if(i!==void 0){let s=i[`${n.__tag}Depth`]||[];t=Yw(n)-1;let a=t%s.length;var l=s[a];let u=i[n.__tag],c;if(i=i.nested,i!==void 0&&i.list&&(c=i.list),u!==void 0&&r.push(u),l!==void 0)for(l=l.split(" "),r.push(...l),l=0;l<s.length;l++)l!==a&&o.push(n.__tag+l);c!==void 0&&(n=c.split(" "),1<t?r.push(...n):o.push(...n))}0<o.length&&Ao.removeClassNamesFromElement(e,...o),0<r.length&&Ao.addClassNamesToElement(e,...r)}function qb(e){let t=[];for(let r=0;r<e.length;r++){var n=e[r];Ze(n)?(t.push(n),n=n.getChildren(),1<n.length&&n.forEach(o=>{xe(o)&&t.push(Oy(o))})):t.push(Oy(n))}return t}function Iy(e){let t=e.nodeName.toLowerCase(),n=null;return t==="ol"?n=tn("number",e.start):t==="ul"&&(n=Ao.isHTMLElement(e)&&e.getAttribute("__lexicallisttype")==="check"?tn("check"):tn("bullet")),{after:qb,node:n}}let jy={ol:"number",ul:"bullet"};function tn(e,t=1){return Ne.$applyNodeReplacement(new nm(e,t))}function xe(e){return e instanceof nm}let e2=Ne.createCommand("INSERT_UNORDERED_LIST_COMMAND"),t2=Ne.createCommand("INSERT_ORDERED_LIST_COMMAND"),n2=Ne.createCommand("INSERT_CHECK_LIST_COMMAND"),r2=Ne.createCommand("REMOVE_LIST_COMMAND");ln.$createListItemNode=Sn;ln.$createListNode=tn;ln.$getListDepth=Yw;ln.$handleListInsertParagraph=function(){var e=Ne.$getSelection();if(!Ne.$isRangeSelection(e)||!e.isCollapsed()||(e=e.anchor.getNode(),!Ze(e)||e.getChildrenSize()!==0))return!1;var t=rp(e),n=e.getParent();xe(n)||Nl(40);let r=n.getParent(),o;if(Ne.$isRootOrShadowRoot(r))o=Ne.$createParagraphNode(),t.insertAfter(o);else if(Ze(r))o=Sn(),r.insertAfter(o);else return!1;if(o.select(),t=e.getNextSiblings(),0<t.length){let i=tn(n.getListType());Ne.$isParagraphNode(o)?o.insertAfter(i):(n=Sn(),n.append(i),o.insertAfter(n)),t.forEach(l=>{l.remove(),i.append(l)})}return Qb(e),!0};ln.$isListItemNode=Ze;ln.$isListNode=xe;ln.INSERT_CHECK_LIST_COMMAND=n2;ln.INSERT_ORDERED_LIST_COMMAND=t2;ln.INSERT_UNORDERED_LIST_COMMAND=e2;ln.ListItemNode=xd;ln.ListNode=nm;ln.REMOVE_LIST_COMMAND=r2;ln.insertList=function(e,t){e.update(()=>{var n=Ne.$getSelection();if(Ne.$isRangeSelection(n)||Ne.DEPRECATED_$isGridSelection(n)){var r=n.getNodes();n=n.anchor.getNode();var o=n.getParent();if(Qw(n,r))r=tn(t),Ne.$isRootOrShadowRoot(o)?(n.replace(r),o=Sn(),Ne.$isElementNode(n)&&(o.setFormat(n.getFormatType()),o.setIndent(n.getIndent())),r.append(o)):Ze(n)&&(n=n.getParentOrThrow(),gi(r,n.getChildren()),n.replace(r));else for(n=new Set,o=0;o<r.length;o++){var i=r[o];if(Ne.$isElementNode(i)&&i.isEmpty()&&!n.has(i.getKey()))Ay(i,t);else if(Ne.$isLeafNode(i))for(i=i.getParent();i!=null;){let s=i.getKey();if(xe(i)){if(!n.has(s)){var l=tn(t);gi(l,i.getChildren()),i.replace(l),Xt(l),n.add(s)}break}else{if(l=i.getParent(),Ne.$isRootOrShadowRoot(l)&&!n.has(s)){n.add(s),Ay(i,t);break}i=l}}}}})};ln.removeList=function(e){e.update(()=>{let t=Ne.$getSelection();if(Ne.$isRangeSelection(t)){var n=new Set,r=t.getNodes(),o=t.anchor.getNode();if(Qw(o,r))n.add(rp(o));else for(o=0;o<r.length;o++){var i=r[o];Ne.$isLeafNode(i)&&(i=Ao.$getNearestNodeOfType(i,xd),i!=null&&n.add(rp(i)))}for(let l of n){n=l,r=Xw(l);for(let s of r)r=Ne.$createParagraphNode(),gi(r,s.getChildren()),n.insertAfter(r),n=r,s.__key===t.anchor.key&&t.anchor.set(r.getKey(),0,"element"),s.__key===t.focus.key&&t.focus.set(r.getKey(),0,"element"),s.remove();l.remove()}}})};const o2=ln;var fo=o2,eS={},_d={},tS=p;function i2(e){let t=new URLSearchParams;t.append("code",e);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let nS=tS.createContext(null);_d.LexicalComposerContext=nS;_d.createLexicalComposerContext=function(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}};_d.useLexicalComposerContext=function(){let e=tS.useContext(nS);return e==null&&i2(8),e};const l2=_d;var rr=l2,zy=rr,Ss=ge,bc=p;let rS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var s2=rS?bc.useLayoutEffect:bc.useEffect;let hu={tag:"history-merge"};function a2(e,t){if(t!==null){if(t===void 0)e.update(()=>{var n=Ss.$getRoot();if(n.isEmpty()){let r=Ss.$createParagraphNode();n.append(r),n=rS?document.activeElement:null,(Ss.$getSelection()!==null||n!==null&&n===e.getRootElement())&&r.select()}},hu);else if(t!==null)switch(typeof t){case"string":let n=e.parseEditorState(t);e.setEditorState(n,hu);break;case"object":e.setEditorState(t,hu);break;case"function":e.update(()=>{Ss.$getRoot().isEmpty()&&t(e)},hu)}}}eS.LexicalComposer=function({initialConfig:e,children:t}){let n=bc.useMemo(()=>{const{theme:r,namespace:o,editor__DEPRECATED:i,nodes:l,onError:s,editorState:a}=e,u=zy.createLexicalComposerContext(null,r);let c=i||null;if(c===null){const d=Ss.createEditor({editable:e.editable,namespace:o,nodes:l,onError:f=>s(f,d),theme:r});a2(d,a),c=d}return[c,u]},[]);return s2(()=>{let r=e.editable,[o]=n;o.setEditable(r!==void 0?r:!0)},[]),bc.createElement(zy.LexicalComposerContext.Provider,{value:n},t)};const u2=eS;var c2=u2,Fs=p;function op(e,t){return op=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},op(e,t)}function d2(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,op(e,t)}function f2(e,t){return e===void 0&&(e=[]),t===void 0&&(t=[]),e.length!==t.length||e.some(function(n,r){return!Object.is(n,t[r])})}var Fy={error:null},h2=function(e){function t(){for(var r,o=arguments.length,i=Array(o),l=0;l<o;l++)i[l]=arguments[l];return r=e.call.apply(e,[this].concat(i))||this,r.state=Fy,r.resetErrorBoundary=function(){for(var s,a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];r.props.onReset==null||(s=r.props).onReset.apply(s,u),r.reset()},r}d2(t,e),t.getDerivedStateFromError=function(r){return{error:r}};var n=t.prototype;return n.reset=function(){this.setState(Fy)},n.componentDidCatch=function(r,o){var i,l;(i=(l=this.props).onError)==null||i.call(l,r,o)},n.componentDidUpdate=function(r,o){var i=this.props.resetKeys;if(this.state.error!==null&&o.error!==null&&f2(r.resetKeys,i)){var l,s;(l=(s=this.props).onResetKeysChange)==null||l.call(s,r.resetKeys,i),this.reset()}},n.render=function(){var r=this.state.error,o=this.props,i=o.fallbackRender,l=o.FallbackComponent;if(o=o.fallback,r!==null){if(r={error:r,resetErrorBoundary:this.resetErrorBoundary},Fs.isValidElement(o))return o;if(typeof i=="function")return i(r);if(l)return Fs.createElement(l,r);throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},t}(Fs.Component),p2=function({children:e,onError:t}){return Fs.createElement(h2,{fallback:Fs.createElement("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"}},"An error was thrown."),onError:t},e)};const g2=p2;var m2=g2;const v2=$a(m2);var rm={},om={},y2=Nt,ze=ge;function x2(e,t,n,r,o){if(e===null||n.size===0&&r.size===0&&!o)return 0;var i=t._selection,l=e._selection;if(o)return 1;if(!(ze.$isRangeSelection(i)&&ze.$isRangeSelection(l)&&l.isCollapsed()&&i.isCollapsed()))return 0;o=t._nodeMap;let s=[];for(let a of n)n=o.get(a),n!==void 0&&s.push(n);for(let[a,u]of r)u&&(r=o.get(a),r===void 0||ze.$isRootNode(r)||s.push(r));return s.length===0?0:1<s.length?(r=t._nodeMap,t=r.get(i.anchor.key),l=r.get(l.anchor.key),t&&l&&!e._nodeMap.has(t.__key)&&ze.$isTextNode(t)&&t.__text.length===1&&i.anchor.offset===1?2:0):(t=s[0],e=e._nodeMap.get(t.__key),!ze.$isTextNode(e)||!ze.$isTextNode(t)||e.__mode!==t.__mode||(e=e.__text,t=t.__text,e===t)||(i=i.anchor,l=l.anchor,i.key!==l.key||i.type!=="text")?0:(i=i.offset,l=l.offset,e=t.length-e.length,e===1&&l===i-1?2:e===-1&&l===i+1?3:e===-1&&l===i?4:0))}function _2(e,t){let n=Date.now(),r=0;return(o,i,l,s,a,u)=>{let c=Date.now();if(u.has("historic"))return r=0,n=c,2;let d=x2(o,i,s,a,e.isComposing()),f=(()=>{var h=l===null||l.editor===e,g=u.has("history-push");if(!g&&h&&u.has("history-merge"))return 0;if(o===null)return 1;var m=i._selection;if(!(0<s.size||0<a.size))return m!==null?0:2;if(g===!1&&d!==0&&d===r&&c<n+t&&h)return 0;if(s.size===1){{g=Array.from(s)[0],h=o._nodeMap.get(g),g=i._nodeMap.get(g),m=o._selection;let S=i._selection,v=!1;ze.$isRangeSelection(m)&&ze.$isRangeSelection(S)&&(v=m.anchor.type==="element"&&m.focus.type==="element"&&S.anchor.type==="text"&&S.focus.type==="text"),h=!v&&ze.$isTextNode(h)&&ze.$isTextNode(g)?h.__type===g.__type&&h.__text===g.__text&&h.__mode===g.__mode&&h.__detail===g.__detail&&h.__style===g.__style&&h.__format===g.__format&&h.__parent===g.__parent:!1}if(h)return 0}return 1})();return n=c,r=d,f}}om.createEmptyHistoryState=function(){return{current:null,redoStack:[],undoStack:[]}};om.registerHistory=function(e,t,n){let r=_2(e,n);n=({editorState:l,prevEditorState:s,dirtyLeaves:a,dirtyElements:u,tags:c})=>{const d=t.current,f=t.redoStack,h=t.undoStack,g=d===null?null:d.editorState;if(d===null||l!==g){if(s=r(s,l,d,a,u,c),s===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(ze.CAN_REDO_COMMAND,!1)),d!==null&&(h.push({...d}),e.dispatchCommand(ze.CAN_UNDO_COMMAND,!0));else if(s===2)return;t.current={editor:e,editorState:l}}};let o=y2.mergeRegister(e.registerCommand(ze.UNDO_COMMAND,()=>{let l=t.redoStack,s=t.undoStack;if(s.length!==0){let a=t.current,u=s.pop();a!==null&&(l.push(a),e.dispatchCommand(ze.CAN_REDO_COMMAND,!0)),s.length===0&&e.dispatchCommand(ze.CAN_UNDO_COMMAND,!1),t.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:"historic"})}return!0},ze.COMMAND_PRIORITY_EDITOR),e.registerCommand(ze.REDO_COMMAND,()=>{let l=t.redoStack;var s=t.undoStack;if(l.length!==0){let a=t.current;a!==null&&(s.push(a),e.dispatchCommand(ze.CAN_UNDO_COMMAND,!0)),s=l.pop(),l.length===0&&e.dispatchCommand(ze.CAN_REDO_COMMAND,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}return!0},ze.COMMAND_PRIORITY_EDITOR),e.registerCommand(ze.CLEAR_EDITOR_COMMAND,()=>(t.undoStack=[],t.redoStack=[],t.current=null,!1),ze.COMMAND_PRIORITY_EDITOR),e.registerCommand(ze.CLEAR_HISTORY_COMMAND,()=>(t.undoStack=[],t.redoStack=[],t.current=null,e.dispatchCommand(ze.CAN_REDO_COMMAND,!1),e.dispatchCommand(ze.CAN_UNDO_COMMAND,!1),!0),ze.COMMAND_PRIORITY_EDITOR),e.registerUpdateListener(n)),i=e.registerUpdateListener(n);return()=>{o(),i()}};const w2=om;var S2=w2,C2=rr,ip=S2,By=p;function E2(e,t,n=1e3){let r=By.useMemo(()=>t||ip.createEmptyHistoryState(),[t]);By.useEffect(()=>ip.registerHistory(e,r,n),[n,e,r])}rm.createEmptyHistoryState=ip.createEmptyHistoryState;rm.HistoryPlugin=function({externalHistoryState:e}){let[t]=C2.useLexicalComposerContext();return E2(t,e),null};const $2=rm;var k2=$2,oS={},T2=rr,Bs=p,N2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Bs.useLayoutEffect:Bs.useEffect;function b2(e){let[t]=T2.useLexicalComposerContext(),n=Bs.useMemo(()=>e(t),[t,e]),r=Bs.useRef(n.initialValueFn()),[o,i]=Bs.useState(r.current);return N2(()=>{let{initialValueFn:l,subscribe:s}=n,a=l();return r.current!==a&&(r.current=a,i(a)),s(u=>{r.current=u,i(u)})},[n,e]),o}function R2(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}var P2=function(){return b2(R2)};const O2=P2;var A2=O2,Fo={},Qt=ge;function im(e,t=!0){return e?!1:(e=iS(),t&&(e=e.trim()),e==="")}function iS(){return Qt.$getRoot().getTextContent()}function lS(e){if(!im(e,!1))return!1;e=Qt.$getRoot().getChildren();let t=e.length;if(1<t)return!1;for(let r=0;r<t;r++){var n=e[r];if(Qt.$isDecoratorNode(n))return!1;if(Qt.$isElementNode(n)){if(!Qt.$isParagraphNode(n)||n.__indent!==0)return!1;n=n.getChildren();let o=n.length;for(let i=0;i<o;i++)if(!Qt.$isTextNode(n[r]))return!1}}return!0}Fo.$canShowPlaceholder=lS;Fo.$canShowPlaceholderCurry=function(e){return()=>lS(e)};Fo.$findTextIntersectionFromCharacters=function(e,t){var n=e.getFirstChild();e=0;e:for(;n!==null;){if(Qt.$isElementNode(n)){var r=n.getFirstChild();if(r!==null){n=r;continue}}else if(Qt.$isTextNode(n)){if(r=n.getTextContentSize(),e+r>t)return{node:n,offset:t-e};e+=r}if(r=n.getNextSibling(),r!==null)n=r;else{for(n=n.getParent();n!==null;){if(r=n.getNextSibling(),r!==null){n=r;continue e}n=n.getParent()}break}}return null};Fo.$isRootTextContentEmpty=im;Fo.$isRootTextContentEmptyCurry=function(e,t){return()=>im(e,t)};Fo.$rootTextContent=iS;Fo.registerLexicalTextEntity=function(e,t,n,r){let o=l=>{const s=Qt.$createTextNode(l.getTextContent());s.setFormat(l.getFormat()),l.replace(s)},i=e.registerNodeTransform(Qt.TextNode,l=>{if(l.isSimpleText()){var s=l.getPreviousSibling(),a=l.getTextContent(),u=l;if(Qt.$isTextNode(s)){var c=s.getTextContent(),d=t(c+a);if(s instanceof n){if(d===null||s.getLatest().__mode!==0){o(s);return}if(d=d.end-c.length,0<d){u=a.slice(0,d),u=c+u,s.select(),s.setTextContent(u),d===a.length?l.remove():(s=a.slice(d),l.setTextContent(s));return}}else if(d===null||d.start<c.length)return}for(;;){if(l=t(a),a=d=l===null?"":a.slice(l.end),d===""){if(c=u.getNextSibling(),Qt.$isTextNode(c)){if(d=u.getTextContent()+c.getTextContent(),d=t(d),d===null){c instanceof n?o(c):c.markDirty();break}else if(d.start!==0)break}}else if(c=t(d),c!==null&&c.start===0)break;if(l===null)break;if(l.start===0&&Qt.$isTextNode(s)&&s.isTextEntity())continue;let f;if(l.start===0?[f,u]=u.splitText(l.end):[,f,u]=u.splitText(l.start,l.end),l=r(f),l.setFormat(f.getFormat()),f.replace(l),u==null)break}}});return e=e.registerNodeTransform(n,l=>{var s=l.getTextContent();const a=t(s);a===null||a.start!==0?o(l):s.length>a.end?l.splitText(a.end):(s=l.getPreviousSibling(),Qt.$isTextNode(s)&&s.isTextEntity()&&(o(s),o(l)),s=l.getNextSibling(),Qt.$isTextNode(s)&&s.isTextEntity()&&(o(s),l instanceof n&&o(l)))}),[i,e]};const M2=Fo;var D2=M2,sS={},pu=ge;sS.registerDragonSupport=function(e){let t=window.location.origin,n=r=>{if(r.origin===t){var o=e.getRootElement();if(document.activeElement===o&&(o=r.data,typeof o=="string")){try{var i=JSON.parse(o)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"&&(i=i.payload)&&i.functionId==="makeChanges"&&(i=i.args)){const[l,s,a,u,c]=i;e.update(()=>{const d=pu.$getSelection();if(pu.$isRangeSelection(d)){var f=d.anchor;let h=f.getNode(),g=0,m=0;pu.$isTextNode(h)&&0<=l&&0<=s&&(g=l,m=l+s,d.setTextNodeRange(h,g,h,m)),(g!==m||a!=="")&&(d.insertRawText(a),h=f.getNode()),pu.$isTextNode(h)&&(g=u,m=u+c,f=h.getTextContentSize(),g=g>f?f:g,m=m>f?f:m,d.setTextNodeRange(h,g,h,m)),r.stopImmediatePropagation()}})}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}};const L2=sS;var I2=L2,$r={},Yr={},lm={},Wy=Oo,j2=Nt,nl=ge;function aS(e,t,n,r=null){let o=r!=null?t.isSelected(r):!0,i=nl.$isElementNode(t)&&t.excludeFromCopy("html");var l=t;r!==null&&(l=Wy.$cloneWithProperties(t),l=nl.$isTextNode(l)&&r!=null?Wy.$sliceSelectedTextNodeContent(r,l):l);let s=nl.$isElementNode(l)?l.getChildren():[],{element:a,after:u}=l.exportDOM(e);if(!a)return!1;let c=document.createDocumentFragment();for(let d=0;d<s.length;d++){let f=s[d],h=aS(e,f,c,r);!o&&nl.$isElementNode(t)&&h&&t.extractWithChild(f,r,"html")&&(o=!0)}return o&&!i?(j2.isHTMLElement(a)&&a.append(c),n.append(a),u&&(e=u.call(l,a))&&a.replaceWith(e)):n.append(c),o}let uS=new Set(["STYLE","SCRIPT"]);function cS(e,t,n=new Map,r){let o=[];if(uS.has(e.nodeName))return o;let i=null;var l,{nodeName:s}=e,a=t._htmlConversions.get(s.toLowerCase());if(s=null,a!==void 0)for(l of a)a=l(e),a!==null&&(s===null||s.priority<a.priority)&&(s=a);if(s=(l=s!==null?s.conversion:null)?l(e):null,l=null,s!==null){if(l=s.after,a=s.node,i=Array.isArray(a)?a[a.length-1]:a,i!==null){for(var[,u]of n)if(i=u(i,r),!i)break;i&&o.push(...Array.isArray(a)?a:[i])}s.forChild!=null&&n.set(e.nodeName,s.forChild)}for(e=e.childNodes,r=[],u=0;u<e.length;u++)r.push(...cS(e[u],t,new Map(n),i));return l!=null&&(r=l(r)),i==null?o=o.concat(r):nl.$isElementNode(i)&&i.append(...r),o}lm.$generateHtmlFromNodes=function(e,t){if(typeof document>"u"||typeof window>"u")throw Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),r=nl.$getRoot().getChildren();for(let o=0;o<r.length;o++)aS(e,r[o],n,t);return n.innerHTML};lm.$generateNodesFromDOM=function(e,t){t=t.body?t.body.childNodes:[];let n=[];for(let o=0;o<t.length;o++){var r=t[o];uS.has(r.nodeName)||(r=cS(r,e),r!==null&&(n=n.concat(r)))}return n};const z2=lm;var F2=z2,dS=F2,lp=Oo,pl=Nt,ue=ge;function Ar(e){let t=new URLSearchParams;t.append("code",e);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let fS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hS(e){let t=ue.$getSelection();if(t==null)throw Error("Expected valid LexicalSelection");return ue.$isRangeSelection(t)&&t.isCollapsed()||t.getNodes().length===0?"":dS.$generateHtmlFromNodes(e,t)}function pS(e){let t=ue.$getSelection();if(t==null)throw Error("Expected valid LexicalSelection");return ue.$isRangeSelection(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(mS(e,t))}function sp(e,t,n){(ue.DEPRECATED_$isGridSelection(n)||pl.$findMatchingParent(n.anchor.getNode(),r=>ue.DEPRECATED_$isGridCellNode(r))!==null&&pl.$findMatchingParent(n.focus.getNode(),r=>ue.DEPRECATED_$isGridCellNode(r))!==null)&&t.length===1&&ue.DEPRECATED_$isGridNode(t[0])?W2(t,n,!1,e):B2(t,n)}function B2(e,t){let n=[],r=null;for(let o=0;o<e.length;o++){let i=e[o],l=ue.$isLineBreakNode(i);if(l||ue.$isDecoratorNode(i)&&i.isInline()||ue.$isElementNode(i)&&i.isInline()||ue.$isTextNode(i)||i.isParentRequired()){if(r===null&&(r=i.createParentElementNode(),n.push(r),l))continue;r!==null&&r.append(i)}else n.push(i),r=null}ue.$isRangeSelection(t)?t.insertNodes(n):ue.DEPRECATED_$isGridSelection(t)&&(e=t.anchor.getNode(),ue.DEPRECATED_$isGridCellNode(e)||Ar(41),e.append(...n))}function W2(e,t,n,r){e.length===1&&ue.DEPRECATED_$isGridNode(e[0])||Ar(42);var o=e[0];e=o.getChildren(),n=o.getFirstChildOrThrow().getChildrenSize();var i=o.getChildrenSize(),l=pl.$findMatchingParent(t.anchor.getNode(),h=>ue.DEPRECATED_$isGridCellNode(h));t=(o=l&&pl.$findMatchingParent(l,h=>ue.DEPRECATED_$isGridRowNode(h)))&&pl.$findMatchingParent(o,h=>ue.DEPRECATED_$isGridNode(h)),ue.DEPRECATED_$isGridCellNode(l)&&ue.DEPRECATED_$isGridRowNode(o)&&ue.DEPRECATED_$isGridNode(t)||Ar(43);var s=o.getIndexWithinParent(),a=Math.min(t.getChildrenSize()-1,s+i-1);i=l.getIndexWithinParent(),l=Math.min(o.getChildrenSize()-1,i+n-1),n=Math.min(i,l),o=Math.min(s,a),i=Math.max(i,l),s=Math.max(s,a),a=t.getChildren(),l=0;let u,c;for(let h=o;h<=s;h++){var d=a[h];ue.DEPRECATED_$isGridRowNode(d)||Ar(24);var f=e[l];ue.DEPRECATED_$isGridRowNode(f)||Ar(24),d=d.getChildren(),f=f.getChildren();let g=0;for(let m=n;m<=i;m++){let S=d[m];ue.DEPRECATED_$isGridCellNode(S)||Ar(25);let v=f[g];ue.DEPRECATED_$isGridCellNode(v)||Ar(25),h===o&&m===n?u=S.getKey():h===s&&m===i&&(c=S.getKey());let y=S.getChildren();v.getChildren().forEach(_=>{ue.$isTextNode(_)&&ue.$createParagraphNode().append(_),S.append(_)}),y.forEach(_=>_.remove()),g++}l++}u&&c&&(e=ue.DEPRECATED_$createGridSelection(),e.set(t.getKey(),u,c),ue.$setSelection(e),r.dispatchCommand(ue.SELECTION_CHANGE_COMMAND,void 0))}function gS(e,t,n,r=[]){let o=t!=null?n.isSelected(t):!0,i=ue.$isElementNode(n)&&n.excludeFromCopy("html");var l=n;if(t!==null){var s=lp.$cloneWithProperties(n);l=s=ue.$isTextNode(s)&&t!=null?lp.$sliceSelectedTextNodeContent(t,s):s}let a=ue.$isElementNode(l)?l.getChildren():[];var u=l;s=u.exportJSON();var c=u.constructor;s.type!==c.getType()&&Ar(58,c.name);let d=s.children;for(ue.$isElementNode(u)&&(Array.isArray(d)||Ar(59,c.name)),ue.$isTextNode(l)&&(l=l.__text,0<l.length?s.text=l:o=!1),l=0;l<a.length;l++)u=a[l],c=gS(e,t,u,s.children),!o&&ue.$isElementNode(n)&&c&&n.extractWithChild(u,t,"clone")&&(o=!0);if(o&&!i)r.push(s);else if(Array.isArray(s.children))for(e=0;e<s.children.length;e++)r.push(s.children[e]);return o}function mS(e,t){let n=[],r=ue.$getRoot().getChildren();for(let o=0;o<r.length;o++)gS(e,t,r[o],n);return{namespace:e._config.namespace,nodes:n}}function vS(e){let t=[];for(let n=0;n<e.length;n++){let r=ue.$parseSerializedNode(e[n]);ue.$isTextNode(r)&&lp.$addNodeStyle(r),t.push(r)}return t}let Mi=null;function Uy(e,t){var n=fS?(e._window||window).getSelection():null;if(!n)return!1;var r=n.anchorNode;if(n=n.focusNode,r!==null&&n!==null&&!ue.isSelectionWithinEditor(e,r,n)||(t.preventDefault(),t=t.clipboardData,r=ue.$getSelection(),t===null||r===null))return!1;n=hS(e),e=pS(e);let o="";return r!==null&&(o=r.getTextContent()),n!==null&&t.setData("text/html",n),e!==null&&t.setData("application/x-lexical-editor",e),t.setData("text/plain",o),!0}Yr.$generateJSONFromSelectedNodes=mS;Yr.$generateNodesFromSerializedNodes=vS;Yr.$getHtmlContent=hS;Yr.$getLexicalContent=pS;Yr.$insertDataTransferForPlainText=function(e,t){e=e.getData("text/plain")||e.getData("text/uri-list"),e!=null&&t.insertRawText(e)};Yr.$insertDataTransferForRichText=function(e,t,n){var r=e.getData("application/x-lexical-editor");if(r)try{let l=JSON.parse(r);if(l.namespace===n._config.namespace&&Array.isArray(l.nodes)){let s=vS(l.nodes);return sp(n,s,t)}}catch{}if(r=e.getData("text/html"))try{var o=new DOMParser().parseFromString(r,"text/html"),i=dS.$generateNodesFromDOM(n,o);return sp(n,i,t)}catch{}if(e=e.getData("text/plain")||e.getData("text/uri-list"),e!=null)if(ue.$isRangeSelection(t))for(e=e.split(/(\r?\n|\t)/),n=e.length,o=0;o<n;o++)i=e[o],i===`
74
- `||i===`\r
75
- `?t.insertParagraph():i===" "?t.insertNodes([ue.$createTabNode()]):t.insertText(i);else t.insertRawText(e)};Yr.$insertGeneratedNodes=sp;Yr.copyToClipboard=async function(e,t){if(Mi!==null)return!1;if(t!==null)return new Promise(l=>{e.update(()=>{l(Uy(e,t))})});var n=e.getRootElement();let r=e._window==null?window.document:e._window.document,o=fS?(e._window||window).getSelection():null;if(n===null||o===null)return!1;let i=r.createElement("span");return i.style.cssText="position: fixed; top: -1000px;",i.append(r.createTextNode("#")),n.append(i),n=new Range,n.setStart(i,0),n.setEnd(i,1),o.removeAllRanges(),o.addRange(n),new Promise(l=>{let s=e.registerCommand(ue.COPY_COMMAND,a=>(pl.objectKlassEquals(a,ClipboardEvent)&&(s(),Mi!==null&&(window.clearTimeout(Mi),Mi=null),l(Uy(e,a))),!0),ue.COMMAND_PRIORITY_CRITICAL);Mi=window.setTimeout(()=>{s(),Mi=null,l(!1)},50),r.execCommand("copy"),i.remove()})};const U2=Yr;var V2=U2,Rc=V2,gu=Oo,dr=Nt,b=ge;function Vy(e,t){return typeof document.caretRangeFromPoint<"u"?(e=document.caretRangeFromPoint(e,t),e===null?null:{node:e.startContainer,offset:e.startOffset}):document.caretPositionFromPoint!=="undefined"?(e=document.caretPositionFromPoint(e,t),e===null?null:{node:e.offsetNode,offset:e.offset}):null}let Kl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",H2=Kl&&"documentMode"in document?document.documentMode:null,K2=Kl&&"InputEvent"in window&&!H2?"getTargetRanges"in new window.InputEvent("input"):!1,G2=Kl&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Y2=Kl&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,X2=Kl&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Q2=Kl&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!X2,ap=b.createCommand("DRAG_DROP_PASTE_FILE"),sm=class yS extends b.ElementNode{static getType(){return"quote"}static clone(t){return new yS(t.__key)}constructor(t){super(t)}createDOM(t){let n=document.createElement("blockquote");return dr.addClassNamesToElement(n,t.theme.quote),n}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:J2,priority:0})}}exportDOM(t){if({element:t}=super.exportDOM(t),t&&dr.isHTMLElement(t)){this.isEmpty()&&t.append(document.createElement("br"));var n=this.getFormatType();t.style.textAlign=n,(n=this.getDirection())&&(t.dir=n)}return{element:t}}static importJSON(t){let n=am();return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(t,n){t=b.$createParagraphNode();let r=this.getDirection();return t.setDirection(r),this.insertAfter(t,n),t}collapseAtStart(){let t=b.$createParagraphNode();return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}};function am(){return b.$applyNodeReplacement(new sm)}let um=class xS extends b.ElementNode{static getType(){return"heading"}static clone(t){return new xS(t.__tag,t.__key)}constructor(t,n){super(n),this.__tag=t}getTag(){return this.__tag}createDOM(t){let n=this.__tag,r=document.createElement(n);return t=t.theme.heading,t!==void 0&&dr.addClassNamesToElement(r,t[n]),r}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:Di,priority:0}),h2:()=>({conversion:Di,priority:0}),h3:()=>({conversion:Di,priority:0}),h4:()=>({conversion:Di,priority:0}),h5:()=>({conversion:Di,priority:0}),h6:()=>({conversion:Di,priority:0}),p:t=>(t=t.firstChild,t!==null&&Hy(t)?{conversion:()=>({node:null}),priority:3}:null),span:t=>Hy(t)?{conversion:()=>({node:rl("h1")}),priority:3}:null}}exportDOM(t){if({element:t}=super.exportDOM(t),t&&dr.isHTMLElement(t)){this.isEmpty()&&t.append(document.createElement("br"));var n=this.getFormatType();t.style.textAlign=n,(n=this.getDirection())&&(t.dir=n)}return{element:t}}static importJSON(t){let n=rl(t.tag);return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(t,n=!0){t=t?t.anchor.offset:0,t=0<t&&t<this.getTextContentSize()?rl(this.getTag()):b.$createParagraphNode();let r=this.getDirection();return t.setDirection(r),this.insertAfter(t,n),t}collapseAtStart(){let t=this.isEmpty()?b.$createParagraphNode():rl(this.getTag());return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}extractWithChild(){return!0}};function Hy(e){return e.nodeName.toLowerCase()==="span"?e.style.fontSize==="26pt":!1}function Di(e){let t=e.nodeName.toLowerCase(),n=null;return(t==="h1"||t==="h2"||t==="h3"||t==="h4"||t==="h5"||t==="h6")&&(n=rl(t),e.style!==null&&n.setFormat(e.style.textAlign)),{node:n}}function J2(e){let t=am();return e.style!==null&&t.setFormat(e.style.textAlign),{node:t}}function rl(e){return b.$applyNodeReplacement(new um(e))}function Z2(e,t){e.preventDefault(),t.update(()=>{let n=b.$getSelection(),r=e instanceof InputEvent||e instanceof KeyboardEvent?null:e.clipboardData;r!=null&&(b.$isRangeSelection(n)||b.DEPRECATED_$isGridSelection(n))&&Rc.$insertDataTransferForRichText(r,n,t)},{tag:"paste"})}async function q2(e,t){await Rc.copyToClipboard(t,dr.objectKlassEquals(e,ClipboardEvent)?e:null),t.update(()=>{let n=b.$getSelection();b.$isRangeSelection(n)?n.removeText():b.$isNodeSelection(n)&&n.getNodes().forEach(r=>r.remove())})}function Cs(e){let t=null;if(e instanceof DragEvent?t=e.dataTransfer:e instanceof ClipboardEvent&&(t=e.clipboardData),t===null)return[!1,[],!1];var n=t.types;return e=n.includes("Files"),n=n.includes("text/html")||n.includes("text/plain"),[e,Array.from(t.files),n]}function Ky(e){var t=b.$getSelection();if(!b.$isRangeSelection(t))return!1;let n=new Set;t=t.getNodes();for(let i=0;i<t.length;i++){var r=t[i],o=r.getKey();n.has(o)||(r=dr.$getNearestBlockElementAncestorOrThrow(r),o=r.getKey(),r.canIndent()&&!n.has(o)&&(n.add(o),e(r)))}return 0<n.size}function mu(e){return e=b.$getNearestNodeFromDOMNode(e),b.$isDecoratorNode(e)}$r.$createHeadingNode=rl;$r.$createQuoteNode=am;$r.$isHeadingNode=function(e){return e instanceof um};$r.$isQuoteNode=function(e){return e instanceof sm};$r.DRAG_DROP_PASTE=ap;$r.HeadingNode=um;$r.QuoteNode=sm;$r.eventFiles=Cs;$r.registerRichText=function(e){return dr.mergeRegister(e.registerCommand(b.CLICK_COMMAND,()=>{const t=b.$getSelection();return b.$isNodeSelection(t)?(t.clear(),!0):!1},0),e.registerCommand(b.DELETE_CHARACTER_COMMAND,t=>{const n=b.$getSelection();return b.$isRangeSelection(n)?(n.deleteCharacter(t),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.DELETE_WORD_COMMAND,t=>{const n=b.$getSelection();return b.$isRangeSelection(n)?(n.deleteWord(t),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.DELETE_LINE_COMMAND,t=>{const n=b.$getSelection();return b.$isRangeSelection(n)?(n.deleteLine(t),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.CONTROLLED_TEXT_INSERTION_COMMAND,t=>{const n=b.$getSelection();if(typeof t=="string")b.$isRangeSelection(n)?n.insertText(t):b.DEPRECATED_$isGridSelection(n);else{if(!b.$isRangeSelection(n)&&!b.DEPRECATED_$isGridSelection(n))return!1;const r=t.dataTransfer;r!=null?Rc.$insertDataTransferForRichText(r,n,e):b.$isRangeSelection(n)&&(t=t.data)&&n.insertText(t)}return!0},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.REMOVE_TEXT_COMMAND,()=>{const t=b.$getSelection();return b.$isRangeSelection(t)?(t.removeText(),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.FORMAT_TEXT_COMMAND,t=>{const n=b.$getSelection();return b.$isRangeSelection(n)?(n.formatText(t),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.FORMAT_ELEMENT_COMMAND,t=>{var n=b.$getSelection();if(!b.$isRangeSelection(n)&&!b.$isNodeSelection(n))return!1;n=n.getNodes();for(const r of n)n=dr.$findMatchingParent(r,o=>b.$isElementNode(o)&&!o.isInline()),n!==null&&n.setFormat(t);return!0},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.INSERT_LINE_BREAK_COMMAND,t=>{const n=b.$getSelection();return b.$isRangeSelection(n)?(n.insertLineBreak(t),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.INSERT_PARAGRAPH_COMMAND,()=>{const t=b.$getSelection();return b.$isRangeSelection(t)?(t.insertParagraph(),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.INSERT_TAB_COMMAND,()=>(b.$insertNodes([b.$createTabNode()]),!0),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.INDENT_CONTENT_COMMAND,()=>Ky(t=>{const n=t.getIndent();t.setIndent(n+1)}),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.OUTDENT_CONTENT_COMMAND,()=>Ky(t=>{const n=t.getIndent();0<n&&t.setIndent(n-1)}),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ARROW_UP_COMMAND,t=>{var n=b.$getSelection();if(b.$isNodeSelection(n)&&!mu(t.target)){if(t=n.getNodes(),0<t.length)return t[0].selectPrevious(),!0}else if(b.$isRangeSelection(n)&&(n=b.$getAdjacentNode(n.focus,!0),!t.shiftKey&&b.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline()))return n.selectPrevious(),t.preventDefault(),!0;return!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ARROW_DOWN_COMMAND,t=>{var n=b.$getSelection();if(b.$isNodeSelection(n)){if(t=n.getNodes(),0<t.length)return t[0].selectNext(0,0),!0}else if(b.$isRangeSelection(n)){let r=n.focus;if(r.key==="root"&&r.offset===b.$getRoot().getChildrenSize())return t.preventDefault(),!0;if(n=b.$getAdjacentNode(n.focus,!1),!t.shiftKey&&b.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),t.preventDefault(),!0}return!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ARROW_LEFT_COMMAND,t=>{const n=b.$getSelection();if(b.$isNodeSelection(n)){var r=n.getNodes();if(0<r.length)return t.preventDefault(),r[0].selectPrevious(),!0}return b.$isRangeSelection(n)&&gu.$shouldOverrideDefaultCharacterSelection(n,!0)?(r=t.shiftKey,t.preventDefault(),gu.$moveCharacter(n,r,!0),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ARROW_RIGHT_COMMAND,t=>{const n=b.$getSelection();if(b.$isNodeSelection(n)&&!mu(t.target)){var r=n.getNodes();if(0<r.length)return t.preventDefault(),r[0].selectNext(0,0),!0}return b.$isRangeSelection(n)?(r=t.shiftKey,gu.$shouldOverrideDefaultCharacterSelection(n,!1)?(t.preventDefault(),gu.$moveCharacter(n,r,!1),!0):!1):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_BACKSPACE_COMMAND,t=>{if(mu(t.target))return!1;const n=b.$getSelection();if(!b.$isRangeSelection(n))return!1;t.preventDefault(),{anchor:t}=n;const r=t.getNode();return n.isCollapsed()&&t.offset===0&&!b.$isRootNode(r)&&0<dr.$getNearestBlockElementAncestorOrThrow(r).getIndent()?e.dispatchCommand(b.OUTDENT_CONTENT_COMMAND,void 0):e.dispatchCommand(b.DELETE_CHARACTER_COMMAND,!0)},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_DELETE_COMMAND,t=>{if(mu(t.target))return!1;const n=b.$getSelection();return b.$isRangeSelection(n)?(t.preventDefault(),e.dispatchCommand(b.DELETE_CHARACTER_COMMAND,!1)):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ENTER_COMMAND,t=>{const n=b.$getSelection();if(!b.$isRangeSelection(n))return!1;if(t!==null){if((Y2||G2||Q2)&&K2)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(b.INSERT_LINE_BREAK_COMMAND,!1)}return e.dispatchCommand(b.INSERT_PARAGRAPH_COMMAND,void 0)},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ESCAPE_COMMAND,()=>{const t=b.$getSelection();return b.$isRangeSelection(t)?(e.blur(),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.DROP_COMMAND,t=>{const[,n]=Cs(t);if(0<n.length){var r=Vy(t.clientX,t.clientY);if(r!==null){const{offset:i,node:l}=r;var o=b.$getNearestNodeFromDOMNode(l);if(o!==null){if(r=b.$createRangeSelection(),b.$isTextNode(o))r.anchor.set(o.getKey(),i,"text"),r.focus.set(o.getKey(),i,"text");else{const s=o.getParentOrThrow().getKey();o=o.getIndexWithinParent()+1,r.anchor.set(s,o,"element"),r.focus.set(s,o,"element")}r=b.$normalizeSelection__EXPERIMENTAL(r),b.$setSelection(r)}e.dispatchCommand(ap,n)}return t.preventDefault(),!0}return t=b.$getSelection(),!!b.$isRangeSelection(t)},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.DRAGSTART_COMMAND,t=>{[t]=Cs(t);const n=b.$getSelection();return!(t&&!b.$isRangeSelection(n))},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.DRAGOVER_COMMAND,t=>{var[n]=Cs(t);const r=b.$getSelection();return n&&!b.$isRangeSelection(r)?!1:(n=Vy(t.clientX,t.clientY),n!==null&&(n=b.$getNearestNodeFromDOMNode(n.node),b.$isDecoratorNode(n)&&t.preventDefault()),!0)},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.SELECT_ALL_COMMAND,()=>(b.$selectAll(),!0),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.COPY_COMMAND,t=>(Rc.copyToClipboard(e,dr.objectKlassEquals(t,ClipboardEvent)?t:null),!0),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.CUT_COMMAND,t=>(q2(t,e),!0),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.PASTE_COMMAND,t=>{const[,n,r]=Cs(t);if(0<n.length&&!r)return e.dispatchCommand(ap,n),!0;if(b.isSelectionCapturedInDecoratorInput(t.target))return!1;const o=b.$getSelection();return b.$isRangeSelection(o)||b.DEPRECATED_$isGridSelection(o)?(Z2(t,e),!0):!1},b.COMMAND_PRIORITY_EDITOR))};const eR=$r;var Ws=eR,_S=rr,tR=A2,Dn=p,nR=D2,wS=Nt,Gy=Hr,rR=I2,oR=Ws,cm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Dn.useLayoutEffect:Dn.useEffect;function Yy(e){return e.getEditorState().read(nR.$canShowPlaceholderCurry(e.isComposing()))}function iR(e){let[t,n]=Dn.useState(()=>Yy(e));return cm(()=>{function r(){let o=Yy(e);n(o)}return r(),wS.mergeRegister(e.registerUpdateListener(()=>{r()}),e.registerEditableListener(()=>{r()}))},[e]),t}function lR(e,t){let[n,r]=Dn.useState(()=>e.getDecorators());return cm(()=>e.registerDecoratorListener(o=>{Gy.flushSync(()=>{r(o)})}),[e]),Dn.useEffect(()=>{r(e.getDecorators())},[e]),Dn.useMemo(()=>{let o=[],i=Object.keys(n);for(let l=0;l<i.length;l++){let s=i[l],a=Dn.createElement(t,{onError:c=>e._onError(c)},Dn.createElement(Dn.Suspense,{fallback:null},n[s])),u=e.getElementByKey(s);u!==null&&o.push(Gy.createPortal(a,u,s))}return o},[t,n,e])}function sR(e){cm(()=>wS.mergeRegister(oR.registerRichText(e),rR.registerDragonSupport(e)),[e])}function aR({content:e}){var[t]=_S.useLexicalComposerContext();t=iR(t);let n=tR();return t?typeof e=="function"?e(n):e:null}oS.RichTextPlugin=function({contentEditable:e,placeholder:t,ErrorBoundary:n}){let[r]=_S.useLexicalComposerContext();return n=lR(r,n),sR(r),Dn.createElement(Dn.Fragment,null,e,Dn.createElement(aR,{content:t}),n)};const uR=oS;var cR=uR,SS={},br=fo,dR=rr,CS=p,fR=Nt,ds=ge;function hR(e){CS.useEffect(()=>fR.mergeRegister(e.registerCommand(br.INSERT_ORDERED_LIST_COMMAND,()=>(br.insertList(e,"number"),!0),ds.COMMAND_PRIORITY_LOW),e.registerCommand(br.INSERT_UNORDERED_LIST_COMMAND,()=>(br.insertList(e,"bullet"),!0),ds.COMMAND_PRIORITY_LOW),e.registerCommand(br.REMOVE_LIST_COMMAND,()=>(br.removeList(e),!0),ds.COMMAND_PRIORITY_LOW),e.registerCommand(ds.INSERT_PARAGRAPH_COMMAND,()=>!!br.$handleListInsertParagraph(),ds.COMMAND_PRIORITY_LOW)),[e])}SS.ListPlugin=function(){let[e]=dR.useLexicalComposerContext();return CS.useEffect(()=>{if(!e.hasNodes([br.ListNode,br.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[e]),hR(e),null};const pR=SS;var gR=pR,ES={},Xr={},$S=Nt,mr=ge;let mR=new Set(["http:","https:","mailto:","sms:","tel:"]);class Gl extends mr.ElementNode{static getType(){return"link"}static clone(t){return new Gl(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(t,n={},r){super(r);let{target:o=null,rel:i=null,title:l=null}=n;this.__url=t,this.__target=o,this.__rel=i,this.__title=l}createDOM(t){let n=document.createElement("a");return n.href=this.sanitizeUrl(this.__url),this.__target!==null&&(n.target=this.__target),this.__rel!==null&&(n.rel=this.__rel),this.__title!==null&&(n.title=this.__title),$S.addClassNamesToElement(n,t.theme.link),n}updateDOM(t,n){let r=this.__url,o=this.__target,i=this.__rel,l=this.__title;return r!==t.__url&&(n.href=r),o!==t.__target&&(o?n.target=o:n.removeAttribute("target")),i!==t.__rel&&(i?n.rel=i:n.removeAttribute("rel")),l!==t.__title&&(l?n.title=l:n.removeAttribute("title")),!1}static importDOM(){return{a:()=>({conversion:vR,priority:1})}}static importJSON(t){let n=xa(t.url,{rel:t.rel,target:t.target,title:t.title});return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}sanitizeUrl(t){try{let n=new URL(t);if(!mR.has(n.protocol))return"about:blank"}catch{}return t}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(t){this.getWritable().__url=t}getTarget(){return this.getLatest().__target}setTarget(t){this.getWritable().__target=t}getRel(){return this.getLatest().__rel}setRel(t){this.getWritable().__rel=t}getTitle(){return this.getLatest().__title}setTitle(t){this.getWritable().__title=t}insertNewAfter(t,n=!0){return t=this.getParentOrThrow().insertNewAfter(t,n),mr.$isElementNode(t)?(n=xa(this.__url,{rel:this.__rel,target:this.__target,title:this.__title}),t.append(n),n):null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(t,n){if(!mr.$isRangeSelection(n))return!1;t=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(t)&&this.isParentOf(r)&&0<n.getTextContent().length}}function vR(e){let t=null;if($S.isHTMLAnchorElement(e)){let n=e.textContent;n!==null&&n!==""&&(t=xa(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function xa(e,t){return mr.$applyNodeReplacement(new Gl(e,t))}function Yo(e){return e instanceof Gl}class Ia extends Gl{static getType(){return"autolink"}static clone(t){return new Ia(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}static importJSON(t){let n=up(t.url,{rel:t.rel,target:t.target,title:t.title});return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),type:"autolink",version:1}}insertNewAfter(t,n=!0){return t=this.getParentOrThrow().insertNewAfter(t,n),mr.$isElementNode(t)?(n=up(this.__url,{rel:this._rel,target:this.__target,title:this.__title}),t.append(n),n):null}}function up(e,t){return mr.$applyNodeReplacement(new Ia(e,t))}let yR=mr.createCommand("TOGGLE_LINK_COMMAND");function xR(e,t){for(;e!==null&&(e=e.getParent())!==null&&!t(e););return e}Xr.$createAutoLinkNode=up;Xr.$createLinkNode=xa;Xr.$isAutoLinkNode=function(e){return e instanceof Ia};Xr.$isLinkNode=Yo;Xr.AutoLinkNode=Ia;Xr.LinkNode=Gl;Xr.TOGGLE_LINK_COMMAND=yR;Xr.toggleLink=function(e,t={}){let{target:n,title:r}=t,o=t.rel===void 0?"noreferrer":t.rel;if(t=mr.$getSelection(),mr.$isRangeSelection(t))if(t=t.extract(),e===null)t.forEach(l=>{if(l=l.getParent(),Yo(l)){let s=l.getChildren();for(let a=0;a<s.length;a++)l.insertBefore(s[a]);l.remove()}});else{if(t.length===1){var i=t[0];if(i=Yo(i)?i:xR(i,Yo),i!==null){i.setURL(e),n!==void 0&&i.setTarget(n),o!==null&&i.setRel(o),r!==void 0&&i.setTitle(r);return}}let l=null,s=null;t.forEach(a=>{var u=a.getParent();if(u!==s&&u!==null&&(!mr.$isElementNode(a)||a.isInline()))if(Yo(u))s=u,u.setURL(e),n!==void 0&&u.setTarget(n),o!==null&&s.setRel(o),r!==void 0&&s.setTitle(r);else if(u.is(l)||(l=u,s=xa(e,{rel:o,target:n}),Yo(u)?a.getPreviousSibling()===null?u.insertBefore(s):u.insertAfter(s):a.insertBefore(s)),Yo(a)){if(!a.is(s)){if(s!==null){u=a.getChildren();for(let c=0;c<u.length;c++)s.append(u[c])}a.remove()}}else s!==null&&s.append(a)})}};const _R=Xr;var bl=_R,Li=bl,wR=rr,SR=Nt,Ii=ge,CR=p;ES.LinkPlugin=function({validateUrl:e}){let[t]=wR.useLexicalComposerContext();return CR.useEffect(()=>{if(!t.hasNodes([Li.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return SR.mergeRegister(t.registerCommand(Li.TOGGLE_LINK_COMMAND,n=>{if(n===null)return Li.toggleLink(n),!0;if(typeof n=="string")return e===void 0||e(n)?(Li.toggleLink(n),!0):!1;let{url:r,target:o,rel:i,title:l}=n;return Li.toggleLink(r,{rel:i,target:o,title:l}),!0},Ii.COMMAND_PRIORITY_LOW),e!==void 0?t.registerCommand(Ii.PASTE_COMMAND,n=>{let r=Ii.$getSelection();if(!Ii.$isRangeSelection(r)||r.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let o=n.clipboardData.getData("text");return e(o)?r.getNodes().some(i=>Ii.$isElementNode(i))?!1:(t.dispatchCommand(Li.TOGGLE_LINK_COMMAND,o),n.preventDefault(),!0):!1},Ii.COMMAND_PRIORITY_LOW):()=>{})},[t,e]),null};const ER=ES;var $R=ER;function kR({ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:r,ariaExpanded:o,ariaLabel:i,ariaLabelledBy:l,ariaMultiline:s,ariaOwns:a,ariaRequired:u,autoCapitalize:c,className:d,id:f,role:h="textbox",spellCheck:g=!0,style:m,tabIndex:S,"data-testid":v,...y}){const[_]=rr.useLexicalComposerContext(),[w,C]=p.useState(!1),$=p.useCallback(E=>{var M;_.setRootElement(E);const T=(M=document.getElementById("val-ui"))==null?void 0:M.shadowRoot;if(T&&"getSelection"in T){_._window=T;return}},[_]);return p.useLayoutEffect(()=>(C(_.isEditable()),_.registerEditableListener(E=>{C(E)})),[_]),x.jsx("div",{...y,"aria-activedescendant":w?e:void 0,"aria-autocomplete":w?t:"none","aria-controls":w?n:void 0,"aria-describedby":r,"aria-expanded":w&&h==="combobox"?!!o:void 0,"aria-label":i,"aria-labelledby":l,"aria-multiline":s,"aria-owns":w?a:void 0,"aria-readonly":w?void 0:!0,"aria-required":u,autoCapitalize:c,className:d,contentEditable:w,"data-testid":v,id:f,ref:$,role:h,spellCheck:g,style:m,tabIndex:S})}function TR({className:e}){return x.jsx(kR,{className:e})}class ja extends ge.DecoratorNode{constructor(t,n){super(n),this.__src=t.src,this.__altText=t.altText,this.__width=t.width,this.__height=t.height}static getType(){return"image"}static clone(t){return new ja({src:t.__src,altText:t.__altText,width:t.__width,height:t.__height})}exportJSON(){return{altText:this.__altText,height:this.__width,src:this.__src,type:"image",version:1,width:this.__width}}static importJSON(t){return kS(t)}createDOM(){return document.createElement("div")}updateDOM(){return!1}decorate(){return x.jsx(NR,{src:this.__src,altText:this.__altText,empty:this.__empty,height:this.__height,nodeKey:this.getKey()})}}function NR(e){return x.jsx("img",{src:e.src})}function kS(e){return new ja(e)}function bR(){const[e]=rr.useLexicalComposerContext();return p.useEffect(()=>{e.focus()},[e]),null}const TS=ge.createCommand("INSERT_IMAGE_COMMAND");function RR(){const[e]=rr.useLexicalComposerContext();return p.useEffect(()=>{if(!e.hasNodes([ja]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Nt.mergeRegister(e.registerCommand(TS,t=>{const n=kS(t);return ge.$insertNodes([n]),ge.$isRootOrShadowRoot(n.getParentOrThrow())&&Nt.$wrapNodeInElement(n,ge.$createParagraphNode).selectEnd(),!0},ge.COMMAND_PRIORITY_EDITOR))},[e]),null}const PR=({className:e})=>x.jsxs("svg",{height:12,width:12,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[x.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),x.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]}),OR=PR,AR=({className:e})=>x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,width:12,height:12,children:[x.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),x.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),x.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]}),MR=AR,DR=({className:e})=>x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1",className:e,width:12,height:12,children:x.jsx("path",{fillRule:"evenodd",d:"M13,15 L13,21 C13,21.5522847 12.5522847,22 12,22 C11.4477153,22 11,21.5522847 11,21 L11,15 L13,15 Z M3,13 C2.44771525,13 2,12.5522847 2,12 C2,11.4477153 2.44771525,11 3,11 L21,11 C21.5522847,11 22,11.4477153 22,12 C22,12.5522847 21.5522847,13 21,13 L3,13 Z M19,2 C19.5522847,2 20,2.44771525 20,3 C20,3.55228475 19.5522847,4 19,4 L13,4 L13,9 L11,9 L11,4 L5,4 C4.44771525,4 4,3.55228475 4,3 C4,2.44771525 4.44771525,2 5,2 L19,2 Z"})}),LR=DR,IR=({variant:e="primary",onClick:t,children:n,icon:r,disabled:o=!1})=>x.jsx("button",{disabled:o,className:id("font-sans font-[12px] tracking-[0.04em] py-1 px-2 rounded whitespace-nowrap group relative text-primary",{"font-bold":e==="primary","bg-background hover:bg-background text-fill disabled:bg-fill disabled:text-background":e==="primary","bg-transparent border border-primary text-primary hover:border-highlight hover:text-highlight disabled:bg-fill disabled:text-background":e!=="primary"}),onClick:t,children:x.jsxs("span",{className:"flex flex-row items-center justify-center gap-2",children:[r&&r,n]})}),Xo=IR,jR=({className:e})=>x.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",className:e,children:[x.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.70733 1.00015L8.7784 6.07121L8.07129 6.77832L3.00022 1.70725L3.70733 1.00015Z",fill:"currentColor"}),x.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.00015 10.4709L8.07121 5.39983L8.77832 6.10693L3.70725 11.178L3.00015 10.4709Z",fill:"currentColor"})]}),zR=jR,NS=q.createContext({get api(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get session(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get theme(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setTheme(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get editMode(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setEditMode(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get highlight(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setHighlight(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setWindowSize(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get windowSize(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")}});function dm(){return q.useContext(NS)}const FR=({options:e,onChange:t,label:n,icon:r})=>{const[o,i]=p.useState(!1),l=p.useRef(null),[s,a]=p.useState(0),{windowSize:u}=dm(),c=()=>{i(!o)},d=(f,h)=>{a(h),t(f),i(!1)};return p.useEffect(()=>{const f=h=>{o&&l.current&&!l.current.contains(h.target)&&i(!1)};return document.addEventListener("click",f),()=>{document.removeEventListener("click",f)}},[]),x.jsx("div",{className:"text-[12px]",ref:l,children:x.jsx(Xo,{onClick:f=>{f.preventDefault(),c()},icon:x.jsx(zR,{className:`rotate-[-90deg] transition-transform duration-150 ease-in-out ${o?"":"rotate-[90deg]"}`}),children:x.jsxs("div",{className:"relative",children:[x.jsxs("span",{className:"flex flex-row items-center justify-center gap-1",children:[n,r&&r]}),o&&x.jsx("div",{className:"absolute -top-[4px] overflow-scroll shadow-lg -left-2 text-primary bg-border w-fit z-overlay",style:{maxHeight:u==null?void 0:u.innerHeight},children:x.jsx("div",{className:"flex flex-col ",children:e==null?void 0:e.map((f,h)=>x.jsx("button",{onClick:g=>{g.preventDefault(),d(f,h)},className:`text-left px-2 py-1 hover:bg-background hover:text-highlight ${h===s&&"font-bold bg-background hover:bg-background truncate"}`,children:f},f))})})]})})})},BR=FR,WR=new TextEncoder;function bS(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const l=o.result;if(typeof l=="string"){const s=new Image;s.addEventListener("load",async()=>{const a=await wn.getSHA256Hash(WR.encode(l));if(s.naturalWidth&&s.naturalHeight){const u=Og(l);t({src:l,width:s.naturalWidth,height:s.naturalHeight,filename:r==null?void 0:r.name,sha256:a,mimeType:u,fileExt:u&&Ag(u)})}else t({src:l,filename:r==null?void 0:r.name,sha256:a})}),s.src=l}else n(l?{message:"Unexpected image result type",result:l}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function RS(e){const t=e.anchor,n=e.focus,r=e.anchor.getNode(),o=e.focus.getNode();return r===o?r:e.isBackward()?Oo.$isAtNodeEnd(n)?r:o:Oo.$isAtNodeEnd(t)?r:o}function UR(){const[e]=rr.useLexicalComposerContext();return p.useEffect(()=>Nt.mergeRegister(e.registerCommand(ge.CLICK_COMMAND,t=>{const n=ge.$getSelection();if(ge.$isRangeSelection(n)){const r=RS(n),o=Nt.$findMatchingParent(r,bl.$isLinkNode);if(bl.$isLinkNode(o)&&(t.metaKey||t.ctrlKey))return window.open(o.getURL(),"_blank"),!0}return!1},ge.COMMAND_PRIORITY_LOW)),[]),null}var PS={exports:{}},VR="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",HR=VR,KR=HR;function OS(){}function AS(){}AS.resetWarningCache=OS;var GR=function(){function e(r,o,i,l,s,a){if(a!==KR){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:AS,resetWarningCache:OS};return n.PropTypes=n,n};PS.exports=GR();var YR=PS.exports;const In=$a(YR);function cp(){return cp=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cp.apply(this,arguments)}function XR(e,t){if(e==null)return{};var n=QR(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function QR(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var fm=p.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=e.size,i=o===void 0?24:o,l=XR(e,["color","size"]);return q.createElement("svg",cp({ref:t,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),q.createElement("polyline",{points:"20 6 9 17 4 12"}))});fm.propTypes={color:In.string,size:In.oneOfType([In.string,In.number])};fm.displayName="Check";const JR=fm;function dp(){return dp=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dp.apply(this,arguments)}function ZR(e,t){if(e==null)return{};var n=qR(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qR(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var hm=p.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=e.size,i=o===void 0?24:o,l=ZR(e,["color","size"]);return q.createElement("svg",dp({ref:t,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),q.createElement("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),q.createElement("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}))});hm.propTypes={color:In.string,size:In.oneOfType([In.string,In.number])};hm.displayName="Link";const eP=hm;function fp(){return fp=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fp.apply(this,arguments)}function tP(e,t){if(e==null)return{};var n=nP(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function nP(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var pm=p.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=e.size,i=o===void 0?24:o,l=tP(e,["color","size"]);return q.createElement("svg",fp({ref:t,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))});pm.propTypes={color:In.string,size:In.oneOfType([In.string,In.number])};pm.displayName="X";const rP=pm,oP=({fontSizes:e,fontsFamilies:t,onEditor:n,colors:r})=>{const[o]=rr.useLexicalComposerContext();p.useEffect(()=>{n&&n(o)},[o]);const[i,l]=p.useState(o),[s,a]=p.useState(null),[u,c]=p.useState(!1),[d,f]=p.useState(!1),[h,g]=p.useState(!1),[m,S]=p.useState(!1);p.useState("15px"),p.useState("#000"),p.useState("Sans");const[v,y]=p.useState("paragraph");p.useState(!1),p.useState(!1),p.useState("url"),p.useState(null);const[_,w]=p.useState(null),C=R=>{o.dispatchCommand(bl.TOGGLE_LINK_COMMAND,R)},$={paragraph:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",number:"Numbered List",bullet:"Bulleted List"},E={};for(const R in $)E[$[R]]=R;const T=p.useCallback(()=>{const R=ge.$getSelection();if(ge.$isRangeSelection(R)){const j=R.anchor.getNode();let F=j.getKey()==="root"?j:Nt.$findMatchingParent(j,O=>{const k=O.getParent();return k!==null&&ge.$isRootOrShadowRoot(k)});F===null&&(F=j.getTopLevelElementOrThrow());const ae=RS(R),H=Nt.$findMatchingParent(ae,bl.$isLinkNode);if(H!==null){const O=H.getURL();w(O)}else w(null);const X=F.getKey(),P=i.getElementByKey(X);if(c(R.hasFormat("bold")),f(R.hasFormat("italic")),g(R.hasFormat("strikethrough")),S(R.hasFormat("underline")),P!==null)if(a(X),fo.$isListNode(F)){const O=Nt.$getNearestNodeOfType(j,fo.ListNode),k=O?O.getListType():F.getListType();y(k)}else{const O=Ws.$isHeadingNode(F)?F.getTag():F.getType();O in $&&y(O)}}},[i]);p.useEffect(()=>Nt.mergeRegister(o.registerUpdateListener(({editorState:R})=>{R.read(()=>{T()})})),[T,i,o]),p.useEffect(()=>o.registerCommand(ge.SELECTION_CHANGE_COMMAND,(R,j)=>(T(),l(j),!1),ge.COMMAND_PRIORITY_CRITICAL),[o,T]);const M=R=>{["h1","h2","h3","h4","h5","h6"].includes(R)?v!==R&&o.update(()=>{const j=ge.$getSelection();ge.$isRangeSelection(j)&&Oo.$setBlocksType(j,()=>Ws.$createHeadingNode(R))}):R==="paragraph"&&v!=="paragraph"?o.update(()=>{const j=ge.$getSelection();(ge.$isRangeSelection(j)||ge.DEPRECATED_$isGridSelection(j))&&Oo.$setBlocksType(j,()=>ge.$createParagraphNode())}):R==="number"&&v!=="number"?o.dispatchCommand(fo.INSERT_ORDERED_LIST_COMMAND,void 0):R==="bullet"&&v!=="bullet"?o.dispatchCommand(fo.INSERT_UNORDERED_LIST_COMMAND,void 0):o.dispatchCommand(fo.REMOVE_LIST_COMMAND,void 0)};return p.useCallback(()=>{o.update(()=>{const R=ge.$getSelection();if(ge.$isRangeSelection(R)){const j=R.anchor,F=R.focus,ae=R.getNodes();if(j.key===F.key&&j.offset===F.offset)return;ae.forEach((H,X)=>{ge.$isTextNode(H)?(X===0&&j.offset!==0&&(H=H.splitText(j.offset)[1]||H),X===ae.length-1&&(H=H.splitText(F.offset)[0]||H),H.__style!==""&&H.setStyle(""),H.__format!==0&&(H.setFormat(0),Nt.$getNearestBlockElementAncestorOrThrow(H).setFormat(""))):Ws.$isHeadingNode(H)&&H.replace(ge.$createParagraphNode(),!0)})}})},[i]),x.jsxs("div",{className:"sticky top-0 border-b bg-background border-highlight flex flex-col",children:[x.jsxs("div",{className:"flex flex-row gap-1",children:[x.jsx(BR,{options:Object.values($),label:$[v]??v+" (not supported)",onChange:R=>{M(E[R])}}),x.jsx(Xo,{variant:"primary",onClick:R=>{R.preventDefault(),o.dispatchCommand(ge.FORMAT_TEXT_COMMAND,"bold")},active:u,icon:x.jsx(OR,{className:`${u&&"stroke-[3px]"}`})}),x.jsx(Xo,{active:h,onClick:R=>{R.preventDefault(),o.dispatchCommand(ge.FORMAT_TEXT_COMMAND,"strikethrough")},icon:x.jsx(LR,{className:`${h&&"stroke-[2px]"}`})}),x.jsx(Xo,{active:d,onClick:R=>{R.preventDefault(),o.dispatchCommand(ge.FORMAT_TEXT_COMMAND,"italic")},icon:x.jsx(MR,{className:`${d&&"stroke-[3px]"}`})}),x.jsx(Xo,{active:_!==null,onClick:R=>{R.preventDefault(),w(""),C("")},icon:x.jsx(eP,{width:12,height:12,className:`${_!==null&&"stroke-[3px]"}`})}),x.jsxs("label",{className:"flex items-center justify-center cursor-pointer",children:[x.jsx(M_,{}),x.jsx("input",{type:"file",hidden:!0,onChange:R=>{R.preventDefault(),bS(R).then(j=>{o.dispatchCommand(TS,{...j})}).catch(j=>{console.error("Error reading image",j)})}})]})]}),_!==null&&x.jsxs("div",{className:"flex flex-row p-2",children:[x.jsx("input",{type:"text",placeholder:"Enter URL",className:"w-1/3 text-primary bg-background px-2",value:_,onChange:R=>{R.preventDefault(),w(R.target.value)}}),x.jsx(Xo,{variant:"primary",onClick:R=>{R.preventDefault(),C(_||null)},icon:x.jsx(JR,{size:14})}),x.jsx(Xo,{variant:"primary",onClick:R=>{R.preventDefault(),C(null)},icon:x.jsx(rP,{size:14})})]})]})},iP=oP,nr={version:1,format:"",indent:0,direction:null};function Yl(e,t=!1){if(typeof e=="string")return{...nr,type:"text",format:"",text:e};if("tag"in e)switch(e.tag){case"h1":return ji(e);case"h2":return ji(e);case"h3":return ji(e);case"h4":return ji(e);case"h5":return ji(e);case"h6":return ji(e);case"li":return dP(e);case"p":return uP(e);case"ul":return Xy(e);case"ol":return Xy(e);case"span":return MS(e);case"a":return sP(e);case"img":return lP(e);case"br":return t?{...nr,type:"linebreak"}:cP();default:throw Error("Unexpected node tag: "+JSON.stringify(e,null,2))}else throw Error("Unexpected node: "+JSON.stringify(e,null,2))}function lP(e){const t=e.src;return{...nr,type:"image",src:t,width:e.width,height:e.height}}function sP(e){return{...nr,type:"link",url:e.href,children:e.children.map(t=>Yl(t))}}function aP(e){return{...nr,format:"",type:"root",children:e.children.map(t=>Yl(t))}}function ji(e){return{...nr,type:"heading",tag:e.tag,children:e.children.map(t=>Yl(t))}}function uP(e){return{...nr,type:"paragraph",children:e.children.map(t=>Yl(t,!0))}}function cP(){return{...nr,type:"paragraph",children:[]}}function dP(e){return{...nr,type:"listitem",children:e.children.map(t=>Yl(t,!0))}}function Xy(e){return{...nr,type:"list",listType:e.tag==="ol"?"number":"bullet",children:e.children.map(t=>Yl(t)),...e.dir?{direction:e.dir}:{direction:null}}}const fP={bold:1,italic:2,"line-through":4};function hP(e){return e.reduce((t,n)=>t|fP[n],0)}function MS(e){const t=e.children[0];return typeof t=="string"?{...nr,type:"text",text:t,format:hP(e.classes)}:MS({...t,classes:e.classes.concat(t.classes)})}function pP(e){console.error(e)}const gP=28,mP=({richtext:e,onEditor:t})=>{const{windowSize:n}=dm(),o={namespace:"val",editorState:i=>{i.setEditorState(i.parseEditorState({root:aP(BS(e))}))},nodes:[Ws.HeadingNode,ja,fo.ListNode,fo.ListItemNode,bl.LinkNode],theme:{text:{bold:"font-semibold",underline:"underline",italic:"italic",strikethrough:"line-through",underlineStrikethrough:"underline line-through"},list:{listitem:"ml-[20px]",ol:"list-decimal",ul:"list-disc"},heading:{h1:"text-4xl font-bold",h2:"text-3xl font-bold",h3:"text-2xl font-bold",h4:"text-xl font-bold",h5:"text-lg font-bold",h6:"text-md font-bold"},link:"text-highlight underline"},onError:pP};return x.jsxs(c2.LexicalComposer,{initialConfig:o,children:[x.jsx(bR,{}),x.jsx(iP,{onEditor:t}),x.jsx(cR.RichTextPlugin,{contentEditable:x.jsx("div",{className:"font-sans border-b text-primary border-highlight",style:{minHeight:n!=null&&n.innerHeight?(n==null?void 0:n.innerHeight)-gP:void 0},children:x.jsx(TR,{className:"p-4 outline-none bg-fill"})}),placeholder:x.jsx("div",{className:"",children:"Enter some text..."}),ErrorBoundary:v2}),x.jsx($R.LinkPlugin,{}),x.jsx(UR,{}),x.jsx(gR.ListPlugin,{}),x.jsx(RR,{}),x.jsx(k2.HistoryPlugin,{})]})};var vP={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const yP=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bn=(e,t)=>{const n=p.forwardRef(({color:r="currentColor",size:o=24,strokeWidth:i=2,absoluteStrokeWidth:l,children:s,...a},u)=>p.createElement("svg",{ref:u,...vP,width:o,height:o,stroke:r,strokeWidth:l?Number(i)*24/Number(o):i,className:`lucide lucide-${yP(e)}`,...a},[...t.map(([c,d])=>p.createElement(c,d)),...(Array.isArray(s)?s:[s])||[]]));return n.displayName=`${e}`,n},xP=bn("Check",[["polyline",{points:"20 6 9 17 4 12",key:"10jjfj"}]]),DS=bn("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),_P=bn("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),wP=bn("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]),SP=bn("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),CP=bn("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]),EP=bn("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),$P=bn("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]),kP=bn("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]),TP=bn("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),NP=bn("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]),bP=bn("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),RP=bn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),hp="p-1 border rounded-full shadow border-accent",Qy="valbuild:urlBeforeNavigation";function PP({api:e}){const{theme:t,setTheme:n,editMode:r,setEditMode:o,session:i}=dm();if(i.status==="success"&&i.data==="not-authenticated")return x.jsx("div",{className:"flex flex-row items-center justify-center w-full h-full font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill",children:x.jsx("a",{className:hp,href:e.getLoginUrl(window.location.href),children:x.jsxs("div",{className:"flex items-center justify-center px-2 gap-x-2",children:[x.jsx("span",{children:"Login"}),x.jsx(wP,{size:18})]})})});const[l,s]=p.useState();return p.useEffect(()=>{i.status==="success"&&i.data!=="not-authenticated"&&e.getPatches({}).then(a=>{if(dl.isOk(a)){let u=0;for(const c in a.value)u+=a.value[c].length;s(u)}else console.error("Could not load patches",a.error)})},[i]),x.jsxs(OP,{children:[x.jsx(vu,{active:r==="hover",onClick:()=>{o(a=>a==="hover"?"off":"hover")},children:x.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:r==="hover"?x.jsx($P,{size:18}):x.jsx(kP,{size:18})})}),x.jsx(vu,{onClick:()=>{n(t==="dark"?"light":"dark")},children:x.jsxs("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:[t==="dark"&&x.jsx(bP,{size:15}),t==="light"&&x.jsx(EP,{size:15})]})}),x.jsx(vu,{active:r==="full",onClick:()=>{if(r!=="full")localStorage.setItem(Qy,window.location.href),window.location.href=e.getEditUrl();else if(r==="full"){const a=localStorage.getItem(Qy);window.location.href=a||"/"}},children:x.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:r==="full"?x.jsx(CP,{size:15}):x.jsx(SP,{size:15})})}),l&&x.jsx(vu,{onClick:()=>{},children:x.jsxs("div",{className:"relative h-[24px] w-[24px] flex justify-center items-center",children:[x.jsx("div",{className:"absolute -right-[10px] -top-[10px] border border-border rounded-full px-1 font-sans text-xs bg-card text-accent",children:l}),x.jsx(NP,{size:18})]})}),x.jsx("a",{className:hp,href:e.getDisableUrl(),children:x.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:x.jsx(TP,{size:18})})})]})}function OP({children:e}){return x.jsx("div",{className:"flex flex-row items-center justify-center w-full h-full px-2 py-2 font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill",children:e})}function vu({active:e,onClick:t,children:n}){return x.jsx("button",{className:id(hp,{"bg-accent drop-shadow-[0px_0px_12px_rgba(56,205,152,0.60)]":e}),onClick:t,children:n})}function LS(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=LS(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function AP(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=LS(e))&&(r&&(r+=" "),r+=t);return r}const Jy=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,Zy=AP,MP=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Zy(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,l=Object.keys(o).map(u=>{const c=n==null?void 0:n[u],d=i==null?void 0:i[u];if(c===null)return null;const f=Jy(c)||Jy(d);return o[u][f]}),s=n&&Object.entries(n).reduce((u,c)=>{let[d,f]=c;return f===void 0||(u[d]=f),u},{}),a=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:f,...h}=c;return Object.entries(h).every(g=>{let[m,S]=g;return Array.isArray(S)?S.includes({...i,...s}[m]):{...i,...s}[m]===S})?[...u,d,f]:u},[]);return Zy(e,l,a,n==null?void 0:n.class,n==null?void 0:n.className)},DP=MP("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Xl=p.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const l=r?$l:"button";return x.jsx(l,{className:ot(DP({variant:t,size:n,className:e})),ref:i,...o})});Xl.displayName="Button";function LP(e="dark"){const[t,n]=p.useState(e);return p.useEffect(()=>{localStorage.getItem("val-theme")==="light"?n("light"):localStorage.getItem("val-theme")==="dark"||window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?n("dark"):window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches&&n("light");const r=o=>{localStorage.getItem("val-theme")||n(o.matches?"dark":"light")};return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",r)}},[]),[t,r=>{localStorage.setItem("val-theme",r),n(r)}]}function gm(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let bi=gm();function IS(e){bi=e}const jS=/[&<>"']/,IP=new RegExp(jS.source,"g"),zS=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,jP=new RegExp(zS.source,"g"),zP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},qy=e=>zP[e];function vn(e,t){if(t){if(jS.test(e))return e.replace(IP,qy)}else if(zS.test(e))return e.replace(jP,qy);return e}const FP=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function BP(e){return e.replace(FP,(t,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const WP=/(^|[^\[])\^/g;function Re(e,t){e=typeof e=="string"?e:e.source,t=t||"";const n={replace:(r,o)=>(o=typeof o=="object"&&"source"in o?o.source:o,o=o.replace(WP,"$1"),e=e.replace(r,o),n),getRegex:()=>new RegExp(e,t)};return n}function e0(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const Pc={exec:()=>null};function t0(e,t){const n=e.replace(/\|/g,(i,l,s)=>{let a=!1,u=l;for(;--u>=0&&s[u]==="\\";)a=!a;return a?"|":" |"}),r=n.split(/ \|/);let o=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(/\\\|/g,"|");return r}function Ef(e,t,n){const r=e.length;if(r===0)return"";let o=0;for(;o<r;){const i=e.charAt(r-o-1);if(i===t&&!n)o++;else if(i!==t&&n)o++;else break}return e.slice(0,r-o)}function UP(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return-1}function n0(e,t,n,r){const o=t.href,i=t.title?vn(t.title):null,l=e[1].replace(/\\([\[\]])/g,"$1");if(e[0].charAt(0)!=="!"){r.state.inLink=!0;const s={type:"link",raw:n,href:o,title:i,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,s}return{type:"image",raw:n,href:o,title:i,text:vn(l)}}function VP(e,t){const n=e.match(/^(\s+)(?:```)/);if(n===null)return t;const r=n[1];return t.split(`
47
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],o=0;o<arguments.length;o++){var i=arguments[o];if(i){var l=typeof i;if(l==="string"||l==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var s=n.apply(null,i);s&&r.push(s)}}else if(l==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var a in i)t.call(i,a)&&i[a]&&r.push(a)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(p_);var VT=p_.exports;const id=$a(VT);function ee(){return ee=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ee.apply(this,arguments)}function HT(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function g_(...e){return t=>e.forEach(n=>HT(n,t))}function Xe(...e){return p.useCallback(g_(...e),e)}const $l=p.forwardRef((e,t)=>{const{children:n,...r}=e,o=p.Children.toArray(n),i=o.find(GT);if(i){const l=i.props.children,s=o.map(a=>a===i?p.Children.count(l)>1?p.Children.only(null):p.isValidElement(l)?l.props.children:null:a);return p.createElement(Oh,ee({},r,{ref:t}),p.isValidElement(l)?p.cloneElement(l,void 0,s):null)}return p.createElement(Oh,ee({},r,{ref:t}),n)});$l.displayName="Slot";const Oh=p.forwardRef((e,t)=>{const{children:n,...r}=e;return p.isValidElement(n)?p.cloneElement(n,{...YT(r,n.props),ref:t?g_(t,n.ref):n.ref}):p.Children.count(n)>1?p.Children.only(null):null});Oh.displayName="SlotClone";const KT=({children:e})=>p.createElement(p.Fragment,null,e);function GT(e){return p.isValidElement(e)&&e.type===KT}function YT(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...s)=>{i(...s),o(...s)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const XT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],De=XT.reduce((e,t)=>{const n=p.forwardRef((r,o)=>{const{asChild:i,...l}=r,s=i?$l:t;return p.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),p.createElement(s,ee({},l,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function QT(e,t){e&&Hr.flushSync(()=>e.dispatchEvent(t))}const $n=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{};function JT(e,t){return p.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Il=e=>{const{present:t,children:n}=e,r=ZT(t),o=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),i=Xe(r.ref,o.ref);return typeof n=="function"||r.isPresent?p.cloneElement(o,{ref:i}):null};Il.displayName="Presence";function ZT(e){const[t,n]=p.useState(),r=p.useRef({}),o=p.useRef(e),i=p.useRef("none"),l=e?"mounted":"unmounted",[s,a]=JT(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const u=cu(r.current);i.current=s==="mounted"?u:"none"},[s]),$n(()=>{const u=r.current,c=o.current;if(c!==e){const f=i.current,h=cu(u);e?a("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?a("UNMOUNT"):a(c&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,a]),$n(()=>{if(t){const u=d=>{const h=cu(r.current).includes(d.animationName);d.target===t&&h&&Hr.flushSync(()=>a("ANIMATION_END"))},c=d=>{d.target===t&&(i.current=cu(r.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else a("ANIMATION_END")},[t,a]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:p.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function cu(e){return(e==null?void 0:e.animationName)||"none"}function $i(e,t=[]){let n=[];function r(i,l){const s=p.createContext(l),a=n.length;n=[...n,l];function u(d){const{scope:f,children:h,...g}=d,m=(f==null?void 0:f[e][a])||s,S=p.useMemo(()=>g,Object.values(g));return p.createElement(m.Provider,{value:S},h)}function c(d,f){const h=(f==null?void 0:f[e][a])||s,g=p.useContext(h);if(g)return g;if(l!==void 0)return l;throw new Error(`\`${d}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,c]}const o=()=>{const i=n.map(l=>p.createContext(l));return function(s){const a=(s==null?void 0:s[e])||i;return p.useMemo(()=>({[`__scope${e}`]:{...s,[e]:a}}),[s,a])}};return o.scopeName=e,[r,qT(o,...t)]}function qT(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const l=r.reduce((s,{useScope:a,scopeName:u})=>{const d=a(i)[`__scope${u}`];return{...s,...d}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function Vt(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const eN=p.createContext(void 0);function bg(e){const t=p.useContext(eN);return e||t||"ltr"}function Ah(e,[t,n]){return Math.min(n,Math.max(t,e))}function He(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function tN(e,t){return p.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const m_="ScrollArea",[v_,v4]=$i(m_),[nN,Wn]=v_(m_),rN=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...l}=e,[s,a]=p.useState(null),[u,c]=p.useState(null),[d,f]=p.useState(null),[h,g]=p.useState(null),[m,S]=p.useState(null),[v,y]=p.useState(0),[_,w]=p.useState(0),[C,$]=p.useState(!1),[E,T]=p.useState(!1),M=Xe(t,j=>a(j)),R=bg(o);return p.createElement(nN,{scope:n,type:r,dir:R,scrollHideDelay:i,scrollArea:s,viewport:u,onViewportChange:c,content:d,onContentChange:f,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:$,scrollbarY:m,onScrollbarYChange:S,scrollbarYEnabled:E,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:w},p.createElement(De.div,ee({dir:R},l,{ref:M,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),oN="ScrollAreaViewport",iN=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,i=Wn(oN,n),l=p.useRef(null),s=Xe(t,l,i.onViewportChange);return p.createElement(p.Fragment,null,p.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),p.createElement(De.div,ee({"data-radix-scroll-area-viewport":""},o,{ref:s,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style}}),p.createElement("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),Kr="ScrollAreaScrollbar",y_=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Wn(Kr,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=o,s=e.orientation==="horizontal";return p.useEffect(()=>(s?i(!0):l(!0),()=>{s?i(!1):l(!1)}),[s,i,l]),o.type==="hover"?p.createElement(lN,ee({},r,{ref:t,forceMount:n})):o.type==="scroll"?p.createElement(sN,ee({},r,{ref:t,forceMount:n})):o.type==="auto"?p.createElement(x_,ee({},r,{ref:t,forceMount:n})):o.type==="always"?p.createElement(Rg,ee({},r,{ref:t})):null}),lN=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Wn(Kr,e.__scopeScrollArea),[i,l]=p.useState(!1);return p.useEffect(()=>{const s=o.scrollArea;let a=0;if(s){const u=()=>{window.clearTimeout(a),l(!0)},c=()=>{a=window.setTimeout(()=>l(!1),o.scrollHideDelay)};return s.addEventListener("pointerenter",u),s.addEventListener("pointerleave",c),()=>{window.clearTimeout(a),s.removeEventListener("pointerenter",u),s.removeEventListener("pointerleave",c)}}},[o.scrollArea,o.scrollHideDelay]),p.createElement(Il,{present:n||i},p.createElement(x_,ee({"data-state":i?"visible":"hidden"},r,{ref:t})))}),sN=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Wn(Kr,e.__scopeScrollArea),i=e.orientation==="horizontal",l=sd(()=>a("SCROLL_END"),100),[s,a]=tN("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(s==="idle"){const u=window.setTimeout(()=>a("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[s,o.scrollHideDelay,a]),p.useEffect(()=>{const u=o.viewport,c=i?"scrollLeft":"scrollTop";if(u){let d=u[c];const f=()=>{const h=u[c];d!==h&&(a("SCROLL"),l()),d=h};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[o.viewport,i,a,l]),p.createElement(Il,{present:n||s!=="hidden"},p.createElement(Rg,ee({"data-state":s==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:He(e.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:He(e.onPointerLeave,()=>a("POINTER_LEAVE"))})))}),x_=p.forwardRef((e,t)=>{const n=Wn(Kr,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,l]=p.useState(!1),s=e.orientation==="horizontal",a=sd(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,c=n.viewport.offsetHeight<n.viewport.scrollHeight;l(s?u:c)}},10);return kl(n.viewport,a),kl(n.content,a),p.createElement(Il,{present:r||i},p.createElement(Rg,ee({"data-state":i?"visible":"hidden"},o,{ref:t})))}),Rg=p.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=Wn(Kr,e.__scopeScrollArea),i=p.useRef(null),l=p.useRef(0),[s,a]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=C_(s.viewport,s.content),c={...r,sizes:s,onSizesChange:a,hasThumb:u>0&&u<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:f=>l.current=f};function d(f,h){return gN(f,l.current,s,h)}return n==="horizontal"?p.createElement(aN,ee({},c,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const f=o.viewport.scrollLeft,h=ry(f,s,o.dir);i.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollLeft=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollLeft=d(f,o.dir))}})):n==="vertical"?p.createElement(uN,ee({},c,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const f=o.viewport.scrollTop,h=ry(f,s);i.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollTop=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollTop=d(f))}})):null}),aN=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=Wn(Kr,e.__scopeScrollArea),[l,s]=p.useState(),a=p.useRef(null),u=Xe(t,a,i.onScrollbarXChange);return p.useEffect(()=>{a.current&&s(getComputedStyle(a.current))},[a]),p.createElement(w_,ee({"data-orientation":"horizontal"},o,{ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ld(n)+"px",...e.style},onThumbPointerDown:c=>e.onThumbPointerDown(c.x),onDragScroll:c=>e.onDragScroll(c.x),onWheelScroll:(c,d)=>{if(i.viewport){const f=i.viewport.scrollLeft+c.deltaX;e.onWheelScroll(f),$_(f,d)&&c.preventDefault()}},onResize:()=>{a.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:gc(l.paddingLeft),paddingEnd:gc(l.paddingRight)}})}}))}),uN=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=Wn(Kr,e.__scopeScrollArea),[l,s]=p.useState(),a=p.useRef(null),u=Xe(t,a,i.onScrollbarYChange);return p.useEffect(()=>{a.current&&s(getComputedStyle(a.current))},[a]),p.createElement(w_,ee({"data-orientation":"vertical"},o,{ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ld(n)+"px",...e.style},onThumbPointerDown:c=>e.onThumbPointerDown(c.y),onDragScroll:c=>e.onDragScroll(c.y),onWheelScroll:(c,d)=>{if(i.viewport){const f=i.viewport.scrollTop+c.deltaY;e.onWheelScroll(f),$_(f,d)&&c.preventDefault()}},onResize:()=>{a.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:gc(l.paddingTop),paddingEnd:gc(l.paddingBottom)}})}}))}),[cN,__]=v_(Kr),w_=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:s,onThumbPositionChange:a,onDragScroll:u,onWheelScroll:c,onResize:d,...f}=e,h=Wn(Kr,n),[g,m]=p.useState(null),S=Xe(t,M=>m(M)),v=p.useRef(null),y=p.useRef(""),_=h.viewport,w=r.content-r.viewport,C=Vt(c),$=Vt(a),E=sd(d,10);function T(M){if(v.current){const R=M.clientX-v.current.left,j=M.clientY-v.current.top;u({x:R,y:j})}}return p.useEffect(()=>{const M=R=>{const j=R.target;(g==null?void 0:g.contains(j))&&C(R,w)};return document.addEventListener("wheel",M,{passive:!1}),()=>document.removeEventListener("wheel",M,{passive:!1})},[_,g,w,C]),p.useEffect($,[r,$]),kl(g,E),kl(h.content,E),p.createElement(cN,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:Vt(i),onThumbPointerUp:Vt(l),onThumbPositionChange:$,onThumbPointerDown:Vt(s)},p.createElement(De.div,ee({},f,{ref:S,style:{position:"absolute",...f.style},onPointerDown:He(e.onPointerDown,M=>{M.button===0&&(M.target.setPointerCapture(M.pointerId),v.current=g.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),T(M))}),onPointerMove:He(e.onPointerMove,T),onPointerUp:He(e.onPointerUp,M=>{const R=M.target;R.hasPointerCapture(M.pointerId)&&R.releasePointerCapture(M.pointerId),document.body.style.webkitUserSelect=y.current,h.viewport&&(h.viewport.style.scrollBehavior=""),v.current=null})})))}),Mh="ScrollAreaThumb",dN=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=__(Mh,e.__scopeScrollArea);return p.createElement(Il,{present:n||o.hasThumb},p.createElement(fN,ee({ref:t},r)))}),fN=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=Wn(Mh,n),l=__(Mh,n),{onThumbPositionChange:s}=l,a=Xe(t,d=>l.onThumbChange(d)),u=p.useRef(),c=sd(()=>{u.current&&(u.current(),u.current=void 0)},100);return p.useEffect(()=>{const d=i.viewport;if(d){const f=()=>{if(c(),!u.current){const h=mN(d,s);u.current=h,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),p.createElement(De.div,ee({"data-state":l.hasThumb?"visible":"hidden"},o,{ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:He(e.onPointerDownCapture,d=>{const h=d.target.getBoundingClientRect(),g=d.clientX-h.left,m=d.clientY-h.top;l.onThumbPointerDown({x:g,y:m})}),onPointerUp:He(e.onPointerUp,l.onThumbPointerUp)}))}),S_="ScrollAreaCorner",hN=p.forwardRef((e,t)=>{const n=Wn(S_,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.createElement(pN,ee({},e,{ref:t})):null}),pN=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Wn(S_,n),[i,l]=p.useState(0),[s,a]=p.useState(0),u=!!(i&&s);return kl(o.scrollbarX,()=>{var c;const d=((c=o.scrollbarX)===null||c===void 0?void 0:c.offsetHeight)||0;o.onCornerHeightChange(d),a(d)}),kl(o.scrollbarY,()=>{var c;const d=((c=o.scrollbarY)===null||c===void 0?void 0:c.offsetWidth)||0;o.onCornerWidthChange(d),l(d)}),u?p.createElement(De.div,ee({},r,{ref:t,style:{width:i,height:s,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function gc(e){return e?parseInt(e,10):0}function C_(e,t){const n=e/t;return isNaN(n)?0:n}function ld(e){const t=C_(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function gN(e,t,n,r="ltr"){const o=ld(n),i=o/2,l=t||i,s=o-l,a=n.scrollbar.paddingStart+l,u=n.scrollbar.size-n.scrollbar.paddingEnd-s,c=n.content-n.viewport,d=r==="ltr"?[0,c]:[c*-1,0];return E_([a,u],d)(e)}function ry(e,t,n="ltr"){const r=ld(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,l=t.content-t.viewport,s=i-r,a=n==="ltr"?[0,l]:[l*-1,0],u=Ah(e,a);return E_([0,l],[0,s])(u)}function E_(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function $_(e,t){return e>0&&e<t}const mN=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},l=n.left!==i.left,s=n.top!==i.top;(l||s)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function sd(e,t){const n=Vt(e),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function kl(e,t){const n=Vt(t);$n(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const k_=rN,vN=iN,yN=hN;function T_(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=T_(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function xN(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=T_(e))&&(r&&(r+=" "),r+=t);return r}const Pg="-";function _N(e){const t=SN(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;function o(l){const s=l.split(Pg);return s[0]===""&&s.length!==1&&s.shift(),N_(s,t)||wN(l)}function i(l,s){const a=n[l]||[];return s&&r[l]?[...a,...r[l]]:a}return{getClassGroupId:o,getConflictingClassGroupIds:i}}function N_(e,t){var l;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?N_(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Pg);return(l=t.validators.find(({validator:s})=>s(i)))==null?void 0:l.classGroupId}const oy=/^\[(.+)\]$/;function wN(e){if(oy.test(e)){const t=oy.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function SN(e){const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return EN(Object.entries(e.classGroups),n).forEach(([i,l])=>{Dh(l,r,i,t)}),r}function Dh(e,t,n,r){e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:iy(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(CN(o)){Dh(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,l])=>{Dh(l,iy(t,i),n,r)})})}function iy(e,t){let n=e;return t.split(Pg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function CN(e){return e.isThemeGetter}function EN(e,t){return t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([l,s])=>[t+l,s])):i);return[n,o]}):e}function $N(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;function o(i,l){n.set(i,l),t++,t>e&&(t=0,r=n,n=new Map)}return{get(i){let l=n.get(i);if(l!==void 0)return l;if((l=r.get(i))!==void 0)return o(i,l),l},set(i,l){n.has(i)?n.set(i,l):o(i,l)}}}const b_="!";function kN(e){const t=e.separator,n=t.length===1,r=t[0],o=t.length;return function(l){const s=[];let a=0,u=0,c;for(let m=0;m<l.length;m++){let S=l[m];if(a===0){if(S===r&&(n||l.slice(m,m+o)===t)){s.push(l.slice(u,m)),u=m+o;continue}if(S==="/"){c=m;continue}}S==="["?a++:S==="]"&&a--}const d=s.length===0?l:l.substring(u),f=d.startsWith(b_),h=f?d.substring(1):d,g=c&&c>u?c-u:void 0;return{modifiers:s,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:g}}}function TN(e){if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t}function NN(e){return{cache:$N(e.cacheSize),splitModifiers:kN(e),..._N(e)}}const bN=/\s+/;function RN(e,t){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=new Set;return e.trim().split(bN).map(l=>{const{modifiers:s,hasImportantModifier:a,baseClassName:u,maybePostfixModifierPosition:c}=n(l);let d=r(c?u.substring(0,c):u),f=!!c;if(!d){if(!c)return{isTailwindClass:!1,originalClassName:l};if(d=r(u),!d)return{isTailwindClass:!1,originalClassName:l};f=!1}const h=TN(s).join(":");return{isTailwindClass:!0,modifierId:a?h+b_:h,classGroupId:d,originalClassName:l,hasPostfixModifier:f}}).reverse().filter(l=>{if(!l.isTailwindClass)return!0;const{modifierId:s,classGroupId:a,hasPostfixModifier:u}=l,c=s+a;return i.has(c)?!1:(i.add(c),o(a,u).forEach(d=>i.add(s+d)),!0)}).reverse().map(l=>l.originalClassName).join(" ")}function PN(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=R_(t))&&(r&&(r+=" "),r+=n);return r}function R_(e){if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=R_(e[r]))&&(n&&(n+=" "),n+=t);return n}function ON(e,...t){let n,r,o,i=l;function l(a){const u=t.reduce((c,d)=>d(c),e());return n=NN(u),r=n.cache.get,o=n.cache.set,i=s,s(a)}function s(a){const u=r(a);if(u)return u;const c=RN(a,n);return o(a,c),c}return function(){return i(PN.apply(null,arguments))}}function We(e){const t=n=>n[e]||[];return t.isThemeGetter=!0,t}const P_=/^\[(?:([a-z-]+):)?(.+)\]$/i,AN=/^\d+\/\d+$/,MN=new Set(["px","full","screen"]),DN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,LN=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,IN=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function Hn(e){return qo(e)||MN.has(e)||AN.test(e)}function to(e){return jl(e,"length",KN)}function qo(e){return!!e&&!Number.isNaN(Number(e))}function du(e){return jl(e,"number",qo)}function us(e){return!!e&&Number.isInteger(Number(e))}function zN(e){return e.endsWith("%")&&qo(e.slice(0,-1))}function ve(e){return P_.test(e)}function no(e){return DN.test(e)}const FN=new Set(["length","size","percentage"]);function BN(e){return jl(e,FN,O_)}function WN(e){return jl(e,"position",O_)}const UN=new Set(["image","url"]);function VN(e){return jl(e,UN,YN)}function HN(e){return jl(e,"",GN)}function cs(){return!0}function jl(e,t,n){const r=P_.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1}function KN(e){return LN.test(e)}function O_(){return!1}function GN(e){return IN.test(e)}function YN(e){return jN.test(e)}function XN(){const e=We("colors"),t=We("spacing"),n=We("blur"),r=We("brightness"),o=We("borderColor"),i=We("borderRadius"),l=We("borderSpacing"),s=We("borderWidth"),a=We("contrast"),u=We("grayscale"),c=We("hueRotate"),d=We("invert"),f=We("gap"),h=We("gradientColorStops"),g=We("gradientColorStopPositions"),m=We("inset"),S=We("margin"),v=We("opacity"),y=We("padding"),_=We("saturate"),w=We("scale"),C=We("sepia"),$=We("skew"),E=We("space"),T=We("translate"),M=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",ve,t],F=()=>[ve,t],ae=()=>["",Hn,to],H=()=>["auto",qo,ve],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],P=()=>["solid","dashed","dotted","double","none"],O=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],k=()=>["start","end","center","between","around","evenly","stretch"],I=()=>["","0",ve],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[qo,du],te=()=>[qo,ve];return{cacheSize:500,separator:":",theme:{colors:[cs],spacing:[Hn,to],blur:["none","",no,ve],brightness:V(),borderColor:[e],borderRadius:["none","","full",no,ve],borderSpacing:F(),borderWidth:ae(),contrast:V(),grayscale:I(),hueRotate:te(),invert:I(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[zN,to],inset:j(),margin:j(),opacity:V(),padding:F(),saturate:V(),scale:V(),sepia:I(),skew:te(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",ve]}],container:["container"],columns:[{columns:[no]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...X(),ve]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",us,ve]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ve]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",us,ve]}],"grid-cols":[{"grid-cols":[cs]}],"col-start-end":[{col:["auto",{span:["full",us,ve]},ve]}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":[cs]}],"row-start-end":[{row:["auto",{span:[us,ve]},ve]}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ve]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ve]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...k()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...k(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...k(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",ve,t]}],"min-w":[{"min-w":["min","max","fit",ve,Hn]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[no]},no,ve]}],h:[{h:[ve,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",Hn,ve]}],"max-h":[{"max-h":[ve,t,"min","max","fit"]}],"font-size":[{text:["base",no,to]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",du]}],"font-family":[{font:[cs]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ve]}],"line-clamp":[{"line-clamp":["none",qo,du]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Hn,ve]}],"list-image":[{"list-image":["none",ve]}],"list-style-type":[{list:["none","disc","decimal",ve]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...P(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Hn,to]}],"underline-offset":[{"underline-offset":["auto",Hn,ve]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...X(),WN]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BN]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VN]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...P(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:P()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...P()]}],"outline-offset":[{"outline-offset":[Hn,ve]}],"outline-w":[{outline:[Hn,to]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Hn,to]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",no,HN]}],"shadow-color":[{shadow:[cs]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":O()}],"bg-blend":[{"bg-blend":O()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",no,ve]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[_]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ve]}],duration:[{duration:te()}],ease:[{ease:["linear","in","out","in-out",ve]}],delay:[{delay:te()}],animate:[{animate:["none","spin","ping","pulse","bounce",ve]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[us,ve]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ve]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ve]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ve]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Hn,to,du]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const QN=ON(XN);function ot(...e){return QN(xN(e))}const As=p.forwardRef(({className:e,children:t,...n},r)=>x.jsxs(k_,{ref:r,className:ot("relative overflow-hidden",e),...n,children:[x.jsx(vN,{className:"h-full w-full rounded-[inherit]",children:t}),x.jsx(A_,{}),x.jsx(yN,{})]}));As.displayName=k_.displayName;const A_=p.forwardRef(({className:e,orientation:t="vertical",...n},r)=>x.jsx(y_,{ref:r,orientation:t,className:ot("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:x.jsx(dN,{className:ot("relative rounded-full bg-border",t==="vertical"&&"flex-1")})}));A_.displayName=y_.displayName;function Ms({children:e}){const t=p.useRef(null),n=p.useRef(null),r=p.useRef(!1),o=p.useRef(0),i=p.useRef(null),l=p.useRef(0),s=()=>{r.current=!1,i.current=null,o.current=0,l.current=0},a=S=>{S.preventDefault();const v=i.current==="left"?t:n;if(v.current&&r.current){const y=i.current==="left"?S.screenX-o.current:o.current-S.screenX;v.current.style.width=`${Math.max(l.current+y,150)}px`}},u=S=>v=>{if(v.target){const _=S==="left"?t:S==="right"?n:null;r.current=!0,_&&_.current&&(o.current=v.screenX,i.current=S,_.current&&(l.current=_.current.offsetWidth))}},[c,d,f,h,g,m]=p.Children.toArray(e);return p.useEffect(()=>(document.addEventListener("mouseup",s),document.addEventListener("mousemove",a),()=>{document.removeEventListener("mouseup",s),document.removeEventListener("mousemove",a)}),[]),x.jsxs("div",{className:"flex h-screen",children:[x.jsxs("div",{ref:t,className:"relative border-r border-border",style:{width:300},children:[x.jsxs(Ms.Column,{children:[c,x.jsx(As,{style:{height:"calc(100vh - 50px)"},children:d})]}),x.jsx("div",{className:"absolute inset-y-0 right-0 cursor-col-resize w-[1px] hover:w-[3px] h-full hover:bg-border",onMouseDown:u("left")})]}),x.jsx("div",{className:id("",{"w-full":!g&&!m}),children:x.jsxs(Ms.Column,{children:[f,x.jsx(As,{style:{height:"calc(100vh - 50px)"},children:h})]})}),g||m&&x.jsxs("div",{ref:n,className:"relative h-screen border-l border-border",style:{width:300},children:[x.jsxs(Ms.Column,{children:[g,x.jsx(As,{style:{height:"calc(100vh - 50px)"},children:m})]}),x.jsx("div",{onMouseDown:u("right"),className:"absolute inset-y-0 left-0 cursor-col-resize w-[1px] bg-border hover:w-[3px] hover:bg-border"})]})]})}Ms.Column=({children:e})=>{const[t,n]=p.Children.toArray(e);return x.jsxs("div",{className:"flex flex-col",children:[x.jsx("div",{className:"flex items-center border-b border-border",children:t}),n]})};const JN=({className:e})=>x.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 9 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[x.jsxs("g",{clipPath:"url(#clip0_1225_1638)",children:[x.jsx("rect",{y:"0.5",width:"9",height:"9"}),x.jsx("path",{d:"M0 7L8.5 5",stroke:"currentColor"}),x.jsx("circle",{cx:"3",cy:"3.5",r:"1",fill:"currentColor"})]}),x.jsx("rect",{x:"0.5",y:"1",width:"8",height:"8",stroke:"currentColor"}),x.jsx("defs",{children:x.jsx("clipPath",{id:"clip0_1225_1638",children:x.jsx("rect",{y:"0.5",width:"9",height:"9",fill:"white"})})})]}),M_=JN,ZN=({className:e})=>x.jsxs("svg",{width:"9",height:"10",viewBox:"0 0 9 10",className:e,fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[x.jsxs("g",{clipPath:"url(#clip0_1222_1618)",children:[x.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 1.5H0V0.5H9V1.5Z",fill:"currentColor"}),x.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 9.5H0V8.5H9V9.5Z",fill:"currentColor"})]}),x.jsx("defs",{children:x.jsx("clipPath",{id:"clip0_1222_1618",children:x.jsx("rect",{width:"9",height:"9",fill:"white",transform:"translate(0 0.5)"})})})]}),qN=ZN,eb=({className:e})=>x.jsx("svg",{width:"9",height:"10",viewBox:"0 0 9 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:e,children:x.jsx("g",{clipPath:"url(#clip0_1229_1625)",children:x.jsx("path",{d:"M0.0145513 0.5H8.98545L9 3.18569H8.57074C8.43007 2.2276 8.02749 1.57948 7.36298 1.24133C6.98949 1.05491 6.43169 0.953035 5.68957 0.935694V7.94581C5.68957 8.43569 5.78416 8.76084 5.97332 8.92124C6.16734 9.08165 6.5675 9.16185 7.17381 9.16185V9.5H1.86257V9.16185C2.44462 9.16185 2.83023 9.08165 3.0194 8.92124C3.21342 8.7565 3.31043 8.43136 3.31043 7.94581V0.935694C2.58286 0.953035 2.02506 1.05491 1.63703 1.24133C0.92401 1.58815 0.521423 2.23627 0.429264 3.18569H0L0.0145513 0.5Z"})})}),tb=eb;function D_({children:e,rootPath:t}){return x.jsx("div",{className:"flex flex-col w-full py-2 text-xs",children:p.Children.map(e,n=>p.cloneElement(n,{paths:[t]}))})}D_.Node=({children:e,paths:t=[],path:n,level:r=1,type:o,setActivePath:i})=>{const l=r*30,s=o==="string"?x.jsx(tb,{}):o==="image"?x.jsx(M_,{className:"h-[9px] w-[9px]"}):x.jsx(qN,{});return x.jsxs("div",{className:"w-full",children:[x.jsx("button",{className:"flex justify-between w-full group py-2 text-xs font-[400] shrink-0",onClick:()=>{i&&i(n)},style:{paddingLeft:l},children:x.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s,x.jsx("p",{children:n})]})}),e&&x.jsx(x.Fragment,{children:p.Children.map(e,a=>p.cloneElement(a,{level:r+1,paths:[...t,n]}))})]})};const nb=/^data:(image\/(png|jpeg|jpg|gif|webp|bmp|tiff|ico|svg\+xml));base64,/;function Og(e){const t=nb.exec(e);if(t&&t[1])return t[1]}function Ag(e){return e==="image/svg+xml"?"svg":e==="image/vnd.microsoft.icon"?"ico":e.startsWith("image/")?e.slice(6):e}function Mg(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let ki=Mg();function L_(e){ki=e}const I_=/[&<>"']/,rb=new RegExp(I_.source,"g"),j_=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,ob=new RegExp(j_.source,"g"),ib={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ly=e=>ib[e];function vn(e,t){if(t){if(I_.test(e))return e.replace(rb,ly)}else if(j_.test(e))return e.replace(ob,ly);return e}const lb=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function sb(e){return e.replace(lb,(t,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const ab=/(^|[^\[])\^/g;function Re(e,t){e=typeof e=="string"?e:e.source,t=t||"";const n={replace:(r,o)=>(o=typeof o=="object"&&"source"in o?o.source:o,o=o.replace(ab,"$1"),e=e.replace(r,o),n),getRegex:()=>new RegExp(e,t)};return n}function sy(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const mc={exec:()=>null};function ay(e,t){const n=e.replace(/\|/g,(i,l,s)=>{let a=!1,u=l;for(;--u>=0&&s[u]==="\\";)a=!a;return a?"|":" |"}),r=n.split(/ \|/);let o=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(/\\\|/g,"|");return r}function hf(e,t,n){const r=e.length;if(r===0)return"";let o=0;for(;o<r;){const i=e.charAt(r-o-1);if(i===t&&!n)o++;else if(i!==t&&n)o++;else break}return e.slice(0,r-o)}function ub(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return-1}function uy(e,t,n,r){const o=t.href,i=t.title?vn(t.title):null,l=e[1].replace(/\\([\[\]])/g,"$1");if(e[0].charAt(0)!=="!"){r.state.inLink=!0;const s={type:"link",raw:n,href:o,title:i,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,s}return{type:"image",raw:n,href:o,title:i,text:vn(l)}}function cb(e,t){const n=e.match(/^(\s+)(?:```)/);if(n===null)return t;const r=n[1];return t.split(`
76
48
  `).map(o=>{const i=o.match(/^\s+/);if(i===null)return o;const[l]=i;return l.length>=r.length?o.slice(r.length):o}).join(`
77
- `)}class Oc{constructor(t){je(this,"options");je(this,"rules");je(this,"lexer");this.options=t||bi}space(t){const n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){const n=this.rules.block.code.exec(t);if(n){const r=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Ef(r,`
78
- `)}}}fences(t){const n=this.rules.block.fences.exec(t);if(n){const r=n[0],o=VP(r,n[3]||"");return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline._escapes,"$1"):n[2],text:o}}}heading(t){const n=this.rules.block.heading.exec(t);if(n){let r=n[2].trim();if(/#$/.test(r)){const o=Ef(r,"#");(this.options.pedantic||!o||/ $/.test(o))&&(r=o.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:n[0]}}blockquote(t){const n=this.rules.block.blockquote.exec(t);if(n){const r=n[0].replace(/^ *>[ \t]?/gm,""),o=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(r);return this.lexer.state.top=o,{type:"blockquote",raw:n[0],tokens:i,text:r}}}list(t){let n=this.rules.block.list.exec(t);if(n){let r=n[1].trim();const o=r.length>1,i={type:"list",raw:"",ordered:o,start:o?+r.slice(0,-1):"",loose:!1,items:[]};r=o?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=o?r:"[*+-]");const l=new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`);let s="",a="",u=!1;for(;t;){let c=!1;if(!(n=l.exec(t))||this.rules.block.hr.test(t))break;s=n[0],t=t.substring(s.length);let d=n[2].split(`
49
+ `)}class vc{constructor(t){je(this,"options");je(this,"rules");je(this,"lexer");this.options=t||ki}space(t){const n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){const n=this.rules.block.code.exec(t);if(n){const r=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:hf(r,`
50
+ `)}}}fences(t){const n=this.rules.block.fences.exec(t);if(n){const r=n[0],o=cb(r,n[3]||"");return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline._escapes,"$1"):n[2],text:o}}}heading(t){const n=this.rules.block.heading.exec(t);if(n){let r=n[2].trim();if(/#$/.test(r)){const o=hf(r,"#");(this.options.pedantic||!o||/ $/.test(o))&&(r=o.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:n[0]}}blockquote(t){const n=this.rules.block.blockquote.exec(t);if(n){const r=n[0].replace(/^ *>[ \t]?/gm,""),o=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(r);return this.lexer.state.top=o,{type:"blockquote",raw:n[0],tokens:i,text:r}}}list(t){let n=this.rules.block.list.exec(t);if(n){let r=n[1].trim();const o=r.length>1,i={type:"list",raw:"",ordered:o,start:o?+r.slice(0,-1):"",loose:!1,items:[]};r=o?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=o?r:"[*+-]");const l=new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`);let s="",a="",u=!1;for(;t;){let c=!1;if(!(n=l.exec(t))||this.rules.block.hr.test(t))break;s=n[0],t=t.substring(s.length);let d=n[2].split(`
79
51
  `,1)[0].replace(/^\t+/,v=>" ".repeat(3*v.length)),f=t.split(`
80
52
  `,1)[0],h=0;this.options.pedantic?(h=2,a=d.trimStart()):(h=n[2].search(/[^ ]/),h=h>4?1:h,a=d.slice(h),h+=n[1].length);let g=!1;if(!d&&/^ *$/.test(f)&&(s+=f+`
81
53
  `,t=t.substring(f.length+1),c=!0),!c){const v=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),_=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),w=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;t;){const C=t.split(`
82
54
  `,1)[0];if(f=C,this.options.pedantic&&(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),_.test(f)||w.test(f)||v.test(f)||y.test(t))break;if(f.search(/[^ ]/)>=h||!f.trim())a+=`
83
55
  `+f.slice(h);else{if(g||d.search(/[^ ]/)>=4||_.test(d)||w.test(d)||y.test(d))break;a+=`
84
56
  `+f}!g&&!f.trim()&&(g=!0),s+=C+`
85
- `,t=t.substring(C.length+1),d=f.slice(h)}}i.loose||(u?i.loose=!0:/\n *\n *$/.test(s)&&(u=!0));let m=null,S;this.options.gfm&&(m=/^\[[ xX]\] /.exec(a),m&&(S=m[0]!=="[ ] ",a=a.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:s,task:!!m,checked:S,loose:!1,text:a,tokens:[]}),i.raw+=s}i.items[i.items.length-1].raw=s.trimEnd(),i.items[i.items.length-1].text=a.trimEnd(),i.raw=i.raw.trimEnd();for(let c=0;c<i.items.length;c++)if(this.lexer.state.top=!1,i.items[c].tokens=this.lexer.blockTokens(i.items[c].text,[]),!i.loose){const d=i.items[c].tokens.filter(h=>h.type==="space"),f=d.length>0&&d.some(h=>/\n.*\n/.test(h.raw));i.loose=f}if(i.loose)for(let c=0;c<i.items.length;c++)i.items[c].loose=!0;return i}}html(t){const n=this.rules.block.html.exec(t);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(t){const n=this.rules.block.def.exec(t);if(n){const r=n[1].toLowerCase().replace(/\s+/g," "),o=n[2]?n[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",i=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline._escapes,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:o,title:i}}}table(t){const n=this.rules.block.table.exec(t);if(n){if(!/[:|]/.test(n[2]))return;const r={type:"table",raw:n[0],header:t0(n[1]).map(o=>({text:o,tokens:[]})),align:n[2].replace(/^\||\| *$/g,"").split("|"),rows:n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(`
86
- `):[]};if(r.header.length===r.align.length){let o=r.align.length,i,l,s,a;for(i=0;i<o;i++){const u=r.align[i];u&&(/^ *-+: *$/.test(u)?r.align[i]="right":/^ *:-+: *$/.test(u)?r.align[i]="center":/^ *:-+ *$/.test(u)?r.align[i]="left":r.align[i]=null)}for(o=r.rows.length,i=0;i<o;i++)r.rows[i]=t0(r.rows[i],r.header.length).map(u=>({text:u,tokens:[]}));for(o=r.header.length,l=0;l<o;l++)r.header[l].tokens=this.lexer.inline(r.header[l].text);for(o=r.rows.length,l=0;l<o;l++)for(a=r.rows[l],s=0;s<a.length;s++)a[s].tokens=this.lexer.inline(a[s].text);return r}}}lheading(t){const n=this.rules.block.lheading.exec(t);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(t){const n=this.rules.block.paragraph.exec(t);if(n){const r=n[1].charAt(n[1].length-1)===`
87
- `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){const n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:vn(n[1])}}tag(t){const n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&/^<a /i.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){const n=this.rules.inline.link.exec(t);if(n){const r=n[2].trim();if(!this.options.pedantic&&/^</.test(r)){if(!/>$/.test(r))return;const l=Ef(r.slice(0,-1),"\\");if((r.length-l.length)%2===0)return}else{const l=UP(n[2],"()");if(l>-1){const a=(n[0].indexOf("!")===0?5:4)+n[1].length+l;n[2]=n[2].substring(0,l),n[0]=n[0].substring(0,a).trim(),n[3]=""}}let o=n[2],i="";if(this.options.pedantic){const l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);l&&(o=l[1],i=l[3])}else i=n[3]?n[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(this.options.pedantic&&!/>$/.test(r)?o=o.slice(1):o=o.slice(1,-1)),n0(n,{href:o&&o.replace(this.rules.inline._escapes,"$1"),title:i&&i.replace(this.rules.inline._escapes,"$1")},n[0],this.lexer)}}reflink(t,n){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let o=(r[2]||r[1]).replace(/\s+/g," ");if(o=n[o.toLowerCase()],!o){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return n0(r,o,r[0],this.lexer)}}emStrong(t,n,r=""){let o=this.rules.inline.emStrong.lDelim.exec(t);if(!o||o[3]&&r.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const l=[...o[0]].length-1;let s,a,u=l,c=0;const d=o[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(d.lastIndex=0,n=n.slice(-1*t.length+o[0].length-1);(o=d.exec(n))!=null;){if(s=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!s)continue;if(a=[...s].length,o[3]||o[4]){u+=a;continue}else if((o[5]||o[6])&&l%3&&!((l+a)%3)){c+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u+c);const f=[...t].slice(0,l+o.index+a+1).join("");if(Math.min(l,a)%2){const g=f.slice(1,-1);return{type:"em",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}const h=f.slice(2,-2);return{type:"strong",raw:f,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){const n=this.rules.inline.code.exec(t);if(n){let r=n[2].replace(/\n/g," ");const o=/[^ ]/.test(r),i=/^ /.test(r)&&/ $/.test(r);return o&&i&&(r=r.substring(1,r.length-1)),r=vn(r,!0),{type:"codespan",raw:n[0],text:r}}}br(t){const n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t){const n=this.rules.inline.del.exec(t);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(t){const n=this.rules.inline.autolink.exec(t);if(n){let r,o;return n[2]==="@"?(r=vn(n[1]),o="mailto:"+r):(r=vn(n[1]),o=r),{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let n;if(n=this.rules.inline.url.exec(t)){let r,o;if(n[2]==="@")r=vn(n[0]),o="mailto:"+r;else{let i;do i=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0];while(i!==n[0]);r=vn(n[0]),n[1]==="www."?o="http://"+n[0]:o=n[0]}return{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){const n=this.rules.inline.text.exec(t);if(n){let r;return this.lexer.state.inRawBlock?r=n[0]:r=vn(n[0]),{type:"text",raw:n[0],text:r}}}}const re={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Pc,lheading:/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};re._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;re._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;re.def=Re(re.def).replace("label",re._label).replace("title",re._title).getRegex();re.bullet=/(?:[*+-]|\d{1,9}[.)])/;re.listItemStart=Re(/^( *)(bull) */).replace("bull",re.bullet).getRegex();re.list=Re(re.list).replace(/bull/g,re.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+re.def.source+")").getRegex();re._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";re._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/;re.html=Re(re.html,"i").replace("comment",re._comment).replace("tag",re._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();re.lheading=Re(re.lheading).replace(/bull/g,re.bullet).getRegex();re.paragraph=Re(re._paragraph).replace("hr",re.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",re._tag).getRegex();re.blockquote=Re(re.blockquote).replace("paragraph",re.paragraph).getRegex();re.normal={...re};re.gfm={...re.normal,table:"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"};re.gfm.table=Re(re.gfm.table).replace("hr",re.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",re._tag).getRegex();re.gfm.paragraph=Re(re._paragraph).replace("hr",re.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",re.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",re._tag).getRegex();re.pedantic={...re.normal,html:Re(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",re._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Pc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Re(re.normal._paragraph).replace("hr",re.hr).replace("heading",` *#{1,6} *[^
88
- ]`).replace("lheading",re.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const K={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Pc,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Pc,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^((?![*_])[\spunctuation])/};K._punctuation="\\p{P}$+<=>`^|~";K.punctuation=Re(K.punctuation,"u").replace(/punctuation/g,K._punctuation).getRegex();K.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;K.anyPunctuation=/\\[punct]/g;K._escapes=/\\([punct])/g;K._comment=Re(re._comment).replace("(?:-->|$)","-->").getRegex();K.emStrong.lDelim=Re(K.emStrong.lDelim,"u").replace(/punct/g,K._punctuation).getRegex();K.emStrong.rDelimAst=Re(K.emStrong.rDelimAst,"gu").replace(/punct/g,K._punctuation).getRegex();K.emStrong.rDelimUnd=Re(K.emStrong.rDelimUnd,"gu").replace(/punct/g,K._punctuation).getRegex();K.anyPunctuation=Re(K.anyPunctuation,"gu").replace(/punct/g,K._punctuation).getRegex();K._escapes=Re(K._escapes,"gu").replace(/punct/g,K._punctuation).getRegex();K._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;K._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;K.autolink=Re(K.autolink).replace("scheme",K._scheme).replace("email",K._email).getRegex();K._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;K.tag=Re(K.tag).replace("comment",K._comment).replace("attribute",K._attribute).getRegex();K._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;K._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;K._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;K.link=Re(K.link).replace("label",K._label).replace("href",K._href).replace("title",K._title).getRegex();K.reflink=Re(K.reflink).replace("label",K._label).replace("ref",re._label).getRegex();K.nolink=Re(K.nolink).replace("ref",re._label).getRegex();K.reflinkSearch=Re(K.reflinkSearch,"g").replace("reflink",K.reflink).replace("nolink",K.nolink).getRegex();K.normal={...K};K.pedantic={...K.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Re(/^!?\[(label)\]\((.*?)\)/).replace("label",K._label).getRegex(),reflink:Re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",K._label).getRegex()};K.gfm={...K.normal,escape:Re(K.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/};K.gfm.url=Re(K.gfm.url,"i").replace("email",K.gfm._extended_email).getRegex();K.breaks={...K.gfm,br:Re(K.br).replace("{2,}","*").getRegex(),text:Re(K.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};class fr{constructor(t){je(this,"tokens");je(this,"options");je(this,"state");je(this,"tokenizer");je(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||bi,this.options.tokenizer=this.options.tokenizer||new Oc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:re.normal,inline:K.normal};this.options.pedantic?(n.block=re.pedantic,n.inline=K.pedantic):this.options.gfm&&(n.block=re.gfm,this.options.breaks?n.inline=K.breaks:n.inline=K.gfm),this.tokenizer.rules=n}static get rules(){return{block:re,inline:K}}static lex(t,n){return new fr(n).lex(t)}static lexInline(t,n){return new fr(n).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
57
+ `,t=t.substring(C.length+1),d=f.slice(h)}}i.loose||(u?i.loose=!0:/\n *\n *$/.test(s)&&(u=!0));let m=null,S;this.options.gfm&&(m=/^\[[ xX]\] /.exec(a),m&&(S=m[0]!=="[ ] ",a=a.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:s,task:!!m,checked:S,loose:!1,text:a,tokens:[]}),i.raw+=s}i.items[i.items.length-1].raw=s.trimEnd(),i.items[i.items.length-1].text=a.trimEnd(),i.raw=i.raw.trimEnd();for(let c=0;c<i.items.length;c++)if(this.lexer.state.top=!1,i.items[c].tokens=this.lexer.blockTokens(i.items[c].text,[]),!i.loose){const d=i.items[c].tokens.filter(h=>h.type==="space"),f=d.length>0&&d.some(h=>/\n.*\n/.test(h.raw));i.loose=f}if(i.loose)for(let c=0;c<i.items.length;c++)i.items[c].loose=!0;return i}}html(t){const n=this.rules.block.html.exec(t);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(t){const n=this.rules.block.def.exec(t);if(n){const r=n[1].toLowerCase().replace(/\s+/g," "),o=n[2]?n[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",i=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline._escapes,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:o,title:i}}}table(t){const n=this.rules.block.table.exec(t);if(n){if(!/[:|]/.test(n[2]))return;const r={type:"table",raw:n[0],header:ay(n[1]).map(o=>({text:o,tokens:[]})),align:n[2].replace(/^\||\| *$/g,"").split("|"),rows:n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(`
58
+ `):[]};if(r.header.length===r.align.length){let o=r.align.length,i,l,s,a;for(i=0;i<o;i++){const u=r.align[i];u&&(/^ *-+: *$/.test(u)?r.align[i]="right":/^ *:-+: *$/.test(u)?r.align[i]="center":/^ *:-+ *$/.test(u)?r.align[i]="left":r.align[i]=null)}for(o=r.rows.length,i=0;i<o;i++)r.rows[i]=ay(r.rows[i],r.header.length).map(u=>({text:u,tokens:[]}));for(o=r.header.length,l=0;l<o;l++)r.header[l].tokens=this.lexer.inline(r.header[l].text);for(o=r.rows.length,l=0;l<o;l++)for(a=r.rows[l],s=0;s<a.length;s++)a[s].tokens=this.lexer.inline(a[s].text);return r}}}lheading(t){const n=this.rules.block.lheading.exec(t);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(t){const n=this.rules.block.paragraph.exec(t);if(n){const r=n[1].charAt(n[1].length-1)===`
59
+ `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){const n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:vn(n[1])}}tag(t){const n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&/^<a /i.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){const n=this.rules.inline.link.exec(t);if(n){const r=n[2].trim();if(!this.options.pedantic&&/^</.test(r)){if(!/>$/.test(r))return;const l=hf(r.slice(0,-1),"\\");if((r.length-l.length)%2===0)return}else{const l=ub(n[2],"()");if(l>-1){const a=(n[0].indexOf("!")===0?5:4)+n[1].length+l;n[2]=n[2].substring(0,l),n[0]=n[0].substring(0,a).trim(),n[3]=""}}let o=n[2],i="";if(this.options.pedantic){const l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);l&&(o=l[1],i=l[3])}else i=n[3]?n[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(this.options.pedantic&&!/>$/.test(r)?o=o.slice(1):o=o.slice(1,-1)),uy(n,{href:o&&o.replace(this.rules.inline._escapes,"$1"),title:i&&i.replace(this.rules.inline._escapes,"$1")},n[0],this.lexer)}}reflink(t,n){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let o=(r[2]||r[1]).replace(/\s+/g," ");if(o=n[o.toLowerCase()],!o){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return uy(r,o,r[0],this.lexer)}}emStrong(t,n,r=""){let o=this.rules.inline.emStrong.lDelim.exec(t);if(!o||o[3]&&r.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const l=[...o[0]].length-1;let s,a,u=l,c=0;const d=o[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(d.lastIndex=0,n=n.slice(-1*t.length+o[0].length-1);(o=d.exec(n))!=null;){if(s=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!s)continue;if(a=[...s].length,o[3]||o[4]){u+=a;continue}else if((o[5]||o[6])&&l%3&&!((l+a)%3)){c+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u+c);const f=[...t].slice(0,l+o.index+a+1).join("");if(Math.min(l,a)%2){const g=f.slice(1,-1);return{type:"em",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}const h=f.slice(2,-2);return{type:"strong",raw:f,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){const n=this.rules.inline.code.exec(t);if(n){let r=n[2].replace(/\n/g," ");const o=/[^ ]/.test(r),i=/^ /.test(r)&&/ $/.test(r);return o&&i&&(r=r.substring(1,r.length-1)),r=vn(r,!0),{type:"codespan",raw:n[0],text:r}}}br(t){const n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t){const n=this.rules.inline.del.exec(t);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(t){const n=this.rules.inline.autolink.exec(t);if(n){let r,o;return n[2]==="@"?(r=vn(n[1]),o="mailto:"+r):(r=vn(n[1]),o=r),{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let n;if(n=this.rules.inline.url.exec(t)){let r,o;if(n[2]==="@")r=vn(n[0]),o="mailto:"+r;else{let i;do i=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0];while(i!==n[0]);r=vn(n[0]),n[1]==="www."?o="http://"+n[0]:o=n[0]}return{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){const n=this.rules.inline.text.exec(t);if(n){let r;return this.lexer.state.inRawBlock?r=n[0]:r=vn(n[0]),{type:"text",raw:n[0],text:r}}}}const re={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:mc,lheading:/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};re._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;re._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;re.def=Re(re.def).replace("label",re._label).replace("title",re._title).getRegex();re.bullet=/(?:[*+-]|\d{1,9}[.)])/;re.listItemStart=Re(/^( *)(bull) */).replace("bull",re.bullet).getRegex();re.list=Re(re.list).replace(/bull/g,re.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+re.def.source+")").getRegex();re._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";re._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/;re.html=Re(re.html,"i").replace("comment",re._comment).replace("tag",re._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();re.lheading=Re(re.lheading).replace(/bull/g,re.bullet).getRegex();re.paragraph=Re(re._paragraph).replace("hr",re.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",re._tag).getRegex();re.blockquote=Re(re.blockquote).replace("paragraph",re.paragraph).getRegex();re.normal={...re};re.gfm={...re.normal,table:"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"};re.gfm.table=Re(re.gfm.table).replace("hr",re.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",re._tag).getRegex();re.gfm.paragraph=Re(re._paragraph).replace("hr",re.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",re.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",re._tag).getRegex();re.pedantic={...re.normal,html:Re(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",re._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:mc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Re(re.normal._paragraph).replace("hr",re.hr).replace("heading",` *#{1,6} *[^
60
+ ]`).replace("lheading",re.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const K={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:mc,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:mc,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^((?![*_])[\spunctuation])/};K._punctuation="\\p{P}$+<=>`^|~";K.punctuation=Re(K.punctuation,"u").replace(/punctuation/g,K._punctuation).getRegex();K.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;K.anyPunctuation=/\\[punct]/g;K._escapes=/\\([punct])/g;K._comment=Re(re._comment).replace("(?:-->|$)","-->").getRegex();K.emStrong.lDelim=Re(K.emStrong.lDelim,"u").replace(/punct/g,K._punctuation).getRegex();K.emStrong.rDelimAst=Re(K.emStrong.rDelimAst,"gu").replace(/punct/g,K._punctuation).getRegex();K.emStrong.rDelimUnd=Re(K.emStrong.rDelimUnd,"gu").replace(/punct/g,K._punctuation).getRegex();K.anyPunctuation=Re(K.anyPunctuation,"gu").replace(/punct/g,K._punctuation).getRegex();K._escapes=Re(K._escapes,"gu").replace(/punct/g,K._punctuation).getRegex();K._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;K._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;K.autolink=Re(K.autolink).replace("scheme",K._scheme).replace("email",K._email).getRegex();K._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;K.tag=Re(K.tag).replace("comment",K._comment).replace("attribute",K._attribute).getRegex();K._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;K._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;K._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;K.link=Re(K.link).replace("label",K._label).replace("href",K._href).replace("title",K._title).getRegex();K.reflink=Re(K.reflink).replace("label",K._label).replace("ref",re._label).getRegex();K.nolink=Re(K.nolink).replace("ref",re._label).getRegex();K.reflinkSearch=Re(K.reflinkSearch,"g").replace("reflink",K.reflink).replace("nolink",K.nolink).getRegex();K.normal={...K};K.pedantic={...K.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Re(/^!?\[(label)\]\((.*?)\)/).replace("label",K._label).getRegex(),reflink:Re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",K._label).getRegex()};K.gfm={...K.normal,escape:Re(K.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/};K.gfm.url=Re(K.gfm.url,"i").replace("email",K.gfm._extended_email).getRegex();K.breaks={...K.gfm,br:Re(K.br).replace("{2,}","*").getRegex(),text:Re(K.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};class dr{constructor(t){je(this,"tokens");je(this,"options");je(this,"state");je(this,"tokenizer");je(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ki,this.options.tokenizer=this.options.tokenizer||new vc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:re.normal,inline:K.normal};this.options.pedantic?(n.block=re.pedantic,n.inline=K.pedantic):this.options.gfm&&(n.block=re.gfm,this.options.breaks?n.inline=K.breaks:n.inline=K.gfm),this.tokenizer.rules=n}static get rules(){return{block:re,inline:K}}static lex(t,n){return new dr(n).lex(t)}static lexInline(t,n){return new dr(n).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
89
61
  `),this.blockTokens(t,this.tokens);let n;for(;n=this.inlineQueue.shift();)this.inlineTokens(n.src,n.tokens);return this.tokens}blockTokens(t,n=[]){this.options.pedantic?t=t.replace(/\t/g," ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(s,a,u)=>a+" ".repeat(u.length));let r,o,i,l;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(s=>(r=s.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length),r.raw.length===1&&n.length>0?n[n.length-1].raw+=`
90
62
  `:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length),o=n[n.length-1],o&&(o.type==="paragraph"||o.type==="text")?(o.raw+=`
91
63
  `+r.raw,o.text+=`
@@ -95,7 +67,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
95
67
  `+r.raw,o.text+=`
96
68
  `+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=o.text):n.push(r),l=i.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length),o=n[n.length-1],o&&o.type==="text"?(o.raw+=`
97
69
  `+r.raw,o.text+=`
98
- `+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=o.text):n.push(r);continue}if(t){const s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let r,o,i,l=t,s,a,u;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(l))!=null;)c.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(l))!=null;)l=l.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(l))!=null;)l=l.slice(0,s.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(a||(u=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(r=c.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.escape(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.tag(t)){t=t.substring(r.raw.length),o=n[n.length-1],o&&r.type==="text"&&o.type==="text"?(o.raw+=r.raw,o.text+=r.text):n.push(r);continue}if(r=this.tokenizer.link(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(r.raw.length),o=n[n.length-1],o&&r.type==="text"&&o.type==="text"?(o.raw+=r.raw,o.text+=r.text):n.push(r);continue}if(r=this.tokenizer.emStrong(t,l,u)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.codespan(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.br(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.del(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.autolink(t)){t=t.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(t))){t=t.substring(r.raw.length),n.push(r);continue}if(i=t,this.options.extensions&&this.options.extensions.startInline){let c=1/0;const d=t.slice(1);let f;this.options.extensions.startInline.forEach(h=>{f=h.call({lexer:this},d),typeof f=="number"&&f>=0&&(c=Math.min(c,f))}),c<1/0&&c>=0&&(i=t.substring(0,c+1))}if(r=this.tokenizer.inlineText(i)){t=t.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(u=r.raw.slice(-1)),a=!0,o=n[n.length-1],o&&o.type==="text"?(o.raw+=r.raw,o.text+=r.text):n.push(r);continue}if(t){const c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return n}}class Ac{constructor(t){je(this,"options");this.options=t||bi}code(t,n,r){var i;const o=(i=(n||"").match(/^\S*/))==null?void 0:i[0];return t=t.replace(/\n$/,"")+`
70
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=o.text):n.push(r);continue}if(t){const s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let r,o,i,l=t,s,a,u;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(l))!=null;)c.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(l))!=null;)l=l.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(l))!=null;)l=l.slice(0,s.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(a||(u=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(r=c.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.escape(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.tag(t)){t=t.substring(r.raw.length),o=n[n.length-1],o&&r.type==="text"&&o.type==="text"?(o.raw+=r.raw,o.text+=r.text):n.push(r);continue}if(r=this.tokenizer.link(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(r.raw.length),o=n[n.length-1],o&&r.type==="text"&&o.type==="text"?(o.raw+=r.raw,o.text+=r.text):n.push(r);continue}if(r=this.tokenizer.emStrong(t,l,u)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.codespan(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.br(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.del(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.autolink(t)){t=t.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(t))){t=t.substring(r.raw.length),n.push(r);continue}if(i=t,this.options.extensions&&this.options.extensions.startInline){let c=1/0;const d=t.slice(1);let f;this.options.extensions.startInline.forEach(h=>{f=h.call({lexer:this},d),typeof f=="number"&&f>=0&&(c=Math.min(c,f))}),c<1/0&&c>=0&&(i=t.substring(0,c+1))}if(r=this.tokenizer.inlineText(i)){t=t.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(u=r.raw.slice(-1)),a=!0,o=n[n.length-1],o&&o.type==="text"?(o.raw+=r.raw,o.text+=r.text):n.push(r);continue}if(t){const c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return n}}class yc{constructor(t){je(this,"options");this.options=t||ki}code(t,n,r){var i;const o=(i=(n||"").match(/^\S*/))==null?void 0:i[0];return t=t.replace(/\n$/,"")+`
99
71
  `,o?'<pre><code class="language-'+vn(o)+'">'+(r?t:vn(t,!0))+`</code></pre>
100
72
  `:"<pre><code>"+(r?t:vn(t,!0))+`</code></pre>
101
73
  `}blockquote(t){return`<blockquote>
@@ -113,10 +85,38 @@ ${t}</blockquote>
113
85
  `}tablerow(t){return`<tr>
114
86
  ${t}</tr>
115
87
  `}tablecell(t,n){const r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+t+`</${r}>
116
- `}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return"<br>"}del(t){return`<del>${t}</del>`}link(t,n,r){const o=e0(t);if(o===null)return r;t=o;let i='<a href="'+t+'"';return n&&(i+=' title="'+n+'"'),i+=">"+r+"</a>",i}image(t,n,r){const o=e0(t);if(o===null)return r;t=o;let i=`<img src="${t}" alt="${r}"`;return n&&(i+=` title="${n}"`),i+=">",i}text(t){return t}}class mm{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,n,r){return""+r}image(t,n,r){return""+r}br(){return""}}class hr{constructor(t){je(this,"options");je(this,"renderer");je(this,"textRenderer");this.options=t||bi,this.options.renderer=this.options.renderer||new Ac,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new mm}static parse(t,n){return new hr(n).parse(t)}static parseInline(t,n){return new hr(n).parseInline(t)}parse(t,n=!0){let r="";for(let o=0;o<t.length;o++){const i=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const l=i,s=this.options.extensions.renderers[l.type].call({parser:this},l);if(s!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){r+=s||"";continue}}switch(i.type){case"space":continue;case"hr":{r+=this.renderer.hr();continue}case"heading":{const l=i;r+=this.renderer.heading(this.parseInline(l.tokens),l.depth,BP(this.parseInline(l.tokens,this.textRenderer)));continue}case"code":{const l=i;r+=this.renderer.code(l.text,l.lang,!!l.escaped);continue}case"table":{const l=i;let s="",a="";for(let c=0;c<l.header.length;c++)a+=this.renderer.tablecell(this.parseInline(l.header[c].tokens),{header:!0,align:l.align[c]});s+=this.renderer.tablerow(a);let u="";for(let c=0;c<l.rows.length;c++){const d=l.rows[c];a="";for(let f=0;f<d.length;f++)a+=this.renderer.tablecell(this.parseInline(d[f].tokens),{header:!1,align:l.align[f]});u+=this.renderer.tablerow(a)}r+=this.renderer.table(s,u);continue}case"blockquote":{const l=i,s=this.parse(l.tokens);r+=this.renderer.blockquote(s);continue}case"list":{const l=i,s=l.ordered,a=l.start,u=l.loose;let c="";for(let d=0;d<l.items.length;d++){const f=l.items[d],h=f.checked,g=f.task;let m="";if(f.task){const S=this.renderer.checkbox(!!h);u?f.tokens.length>0&&f.tokens[0].type==="paragraph"?(f.tokens[0].text=S+" "+f.tokens[0].text,f.tokens[0].tokens&&f.tokens[0].tokens.length>0&&f.tokens[0].tokens[0].type==="text"&&(f.tokens[0].tokens[0].text=S+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:S+" "}):m+=S+" "}m+=this.parse(f.tokens,u),c+=this.renderer.listitem(m,g,!!h)}r+=this.renderer.list(c,s,a);continue}case"html":{const l=i;r+=this.renderer.html(l.text,l.block);continue}case"paragraph":{const l=i;r+=this.renderer.paragraph(this.parseInline(l.tokens));continue}case"text":{let l=i,s=l.tokens?this.parseInline(l.tokens):l.text;for(;o+1<t.length&&t[o+1].type==="text";)l=t[++o],s+=`
117
- `+(l.tokens?this.parseInline(l.tokens):l.text);r+=n?this.renderer.paragraph(s):s;continue}default:{const l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}parseInline(t,n){n=n||this.renderer;let r="";for(let o=0;o<t.length;o++){const i=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=l||"";continue}}switch(i.type){case"escape":{const l=i;r+=n.text(l.text);break}case"html":{const l=i;r+=n.html(l.text);break}case"link":{const l=i;r+=n.link(l.href,l.title,this.parseInline(l.tokens,n));break}case"image":{const l=i;r+=n.image(l.href,l.title,l.text);break}case"strong":{const l=i;r+=n.strong(this.parseInline(l.tokens,n));break}case"em":{const l=i;r+=n.em(this.parseInline(l.tokens,n));break}case"codespan":{const l=i;r+=n.codespan(l.text);break}case"br":{r+=n.br();break}case"del":{const l=i;r+=n.del(this.parseInline(l.tokens,n));break}case"text":{const l=i;r+=n.text(l.text);break}default:{const l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}}class Us{constructor(t){je(this,"options");this.options=t||bi}preprocess(t){return t}postprocess(t){return t}}je(Us,"passThroughHooks",new Set(["preprocess","postprocess"]));var Ea,pp,Wc,FS;class HP{constructor(...t){zd(this,Ea);zd(this,Wc);je(this,"defaults",gm());je(this,"options",this.setOptions);je(this,"parse",Ha(this,Ea,pp).call(this,fr.lex,hr.parse));je(this,"parseInline",Ha(this,Ea,pp).call(this,fr.lexInline,hr.parseInline));je(this,"Parser",hr);je(this,"parser",hr.parse);je(this,"Renderer",Ac);je(this,"TextRenderer",mm);je(this,"Lexer",fr);je(this,"lexer",fr.lex);je(this,"Tokenizer",Oc);je(this,"Hooks",Us);this.use(...t)}walkTokens(t,n){var o,i;let r=[];for(const l of t)switch(r=r.concat(n.call(this,l)),l.type){case"table":{const s=l;for(const a of s.header)r=r.concat(this.walkTokens(a.tokens,n));for(const a of s.rows)for(const u of a)r=r.concat(this.walkTokens(u.tokens,n));break}case"list":{const s=l;r=r.concat(this.walkTokens(s.items,n));break}default:{const s=l;(i=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&i[s.type]?this.defaults.extensions.childTokens[s.type].forEach(a=>{r=r.concat(this.walkTokens(s[a],n))}):s.tokens&&(r=r.concat(this.walkTokens(s.tokens,n)))}}return r}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const l=n.renderers[i.name];l?n.renderers[i.name]=function(...s){let a=i.renderer.apply(this,s);return a===!1&&(a=l.apply(this,s)),a}:n.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=n[i.level];l?l.unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),o.extensions=n),r.renderer){const i=this.defaults.renderer||new Ac(this.defaults);for(const l in r.renderer){const s=r.renderer[l],a=l,u=i[a];i[a]=(...c)=>{let d=s.apply(i,c);return d===!1&&(d=u.apply(i,c)),d||""}}o.renderer=i}if(r.tokenizer){const i=this.defaults.tokenizer||new Oc(this.defaults);for(const l in r.tokenizer){const s=r.tokenizer[l],a=l,u=i[a];i[a]=(...c)=>{let d=s.apply(i,c);return d===!1&&(d=u.apply(i,c)),d}}o.tokenizer=i}if(r.hooks){const i=this.defaults.hooks||new Us;for(const l in r.hooks){const s=r.hooks[l],a=l,u=i[a];Us.passThroughHooks.has(l)?i[a]=c=>{if(this.defaults.async)return Promise.resolve(s.call(i,c)).then(f=>u.call(i,f));const d=s.call(i,c);return u.call(i,d)}:i[a]=(...c)=>{let d=s.apply(i,c);return d===!1&&(d=u.apply(i,c)),d}}o.hooks=i}if(r.walkTokens){const i=this.defaults.walkTokens,l=r.walkTokens;o.walkTokens=function(s){let a=[];return a.push(l.call(this,s)),i&&(a=a.concat(i.call(this,s))),a}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}}Ea=new WeakSet,pp=function(t,n){return(r,o)=>{const i={...o},l={...this.defaults,...i};this.defaults.async===!0&&i.async===!1&&(l.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),l.async=!0);const s=Ha(this,Wc,FS).call(this,!!l.silent,!!l.async);if(typeof r>"u"||r===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(l.hooks&&(l.hooks.options=l),l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(r):r).then(a=>t(a,l)).then(a=>l.walkTokens?Promise.all(this.walkTokens(a,l.walkTokens)).then(()=>a):a).then(a=>n(a,l)).then(a=>l.hooks?l.hooks.postprocess(a):a).catch(s);try{l.hooks&&(r=l.hooks.preprocess(r));const a=t(r,l);l.walkTokens&&this.walkTokens(a,l.walkTokens);let u=n(a,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(a){return s(a)}}},Wc=new WeakSet,FS=function(t,n){return r=>{if(r.message+=`
118
- Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+vn(r.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(r);throw r}};const mi=new HP;function Me(e,t){return mi.parse(e,t)}Me.options=Me.setOptions=function(e){return mi.setOptions(e),Me.defaults=mi.defaults,IS(Me.defaults),Me};Me.getDefaults=gm;Me.defaults=bi;Me.use=function(...e){return mi.use(...e),Me.defaults=mi.defaults,IS(Me.defaults),Me};Me.walkTokens=function(e,t){return mi.walkTokens(e,t)};Me.parseInline=mi.parseInline;Me.Parser=hr;Me.parser=hr.parse;Me.Renderer=Ac;Me.TextRenderer=mm;Me.Lexer=fr;Me.lexer=fr.lex;Me.Tokenizer=Oc;Me.Hooks=Us;Me.parse=Me;Me.options;Me.setOptions;Me.use;Me.walkTokens;Me.parseInline;hr.parse;const KP=fr.lex,Mc='<val value="',gp='">',mp="</val>";function Kn(e,t,n,r=!1){var i,l;const o=[];for(;n<e.length;){const s=e[n];if(s.type==="heading")o.push({tag:`h${s.depth}`,children:Kn(s.tokens?s.tokens:[],t,0).children});else if(s.type==="paragraph")o.push({tag:"p",children:Kn(s.tokens?s.tokens:[],t,0).children});else if(s.type==="strong")o.push({tag:"span",classes:["bold"],children:Kn(s.tokens?s.tokens:[],t,0).children});else if(s.type==="em")o.push({tag:"span",classes:["italic"],children:Kn(s.tokens?s.tokens:[],t,0).children});else if(s.type==="del")o.push({tag:"span",classes:["line-through"],children:Kn(s.tokens?s.tokens:[],t,0).children});else if(s.type==="text")if("tokens"in s&&Array.isArray(s.tokens))o.push(...Kn(s.tokens,t,n,r).children);else if(r&&typeof s.raw=="string"){const a=s.raw.split(`
119
- `),u=a.flatMap((c,d)=>d===a.length-1?[c]:[c,{tag:"br",children:[]}]);o.push(...u)}else o.push(s.raw);else if(s.type==="list")o.push({tag:s.ordered?"ol":"ul",children:Kn(s.items,t,0).children});else if(s.type==="list_item")o.push({tag:"li",children:Kn(s.tokens?s.tokens:[],t,0,!0).children});else if(s.type!=="space")if(s.type==="html"){if(s.text===mp)return{children:o,cursor:n};const a=s.text.indexOf(gp);if(s.text.startsWith(Mc)&&a>-1){const c=Number(s.text.slice(Mc.length,a));if(Number.isNaN(c))throw Error(`Illegal val intermediate node: ${JSON.stringify(s)}`);const{children:d,cursor:f}=Kn(e.map(g=>g.type==="link"||g.type==="list"?{type:"text",raw:g.raw,text:g.raw}:g),t,n+1),h=t[c];h._type==="link"?o.push({tag:"a",href:h.href,children:d}):h._type==="file"&&o.push({tag:"img",src:wn.convertFileSource(h).url,width:(i=h.metadata)==null?void 0:i.width,height:(l=h.metadata)==null?void 0:l.height,children:[]}),n=f}const u=/<br\s*\/?>/gi;s.text.trim().match(u)&&o.push({tag:"br",children:[]})}else s.type==="link"?s.raw===s.href?o.push(s.raw):o.push({tag:"a",href:s.href,children:Kn(s.tokens?s.tokens:[],t,0).children}):s.type==="br"?o.push({tag:"br",children:[]}):console.error(`Could not parse markdown: unsupported token type: ${s.type}. Found: ${s.raw}`);n++}return{children:o,cursor:n}}function BS({templateStrings:e,exprs:t}){const n=e.flatMap((l,s)=>{const a=t[s];return a?a[Kt]==="link"?l.concat(`${Mc}${s}${gp}${a.children[0]}${mp}`):l.concat(`${Mc}${s}${gp}${mp}`):l}).join(""),r=KP(n,{gfm:!0}),{children:o,cursor:i}=Kn(r,t,0);if(i!==r.length)throw Error("Unexpectedly terminated markdown parsing. Possible reason: unclosed html tag?");return{[Kt]:"richtext",children:o}}const GP=/^h([\d+])$/;function YP(e){const t=e.children.map(XP);return QP(t)}function XP(e){var t;if(e.type==="heading"){let n="";const r=Number((t=e.tag.match(GP))==null?void 0:t[1]);if(Number.isNaN(r))throw new Error("Invalid header depth");for(let i=0;i<Number(r);i++)n+="#";return{type:"block",children:[`${n} `].concat(...e.children.map(vp))}}else{if(e.type==="paragraph")return e.children.length===0?{type:"block",children:["<br />"]}:{type:"block",children:e.children.map(n=>vp(n))};if(e.type==="list")return{type:"block",children:e.children.flatMap((n,r)=>US(VS(e),n,0,r===0))};{const n=e;throw new Error(`Unhandled node type: ${"type"in n?"exhaustiveCheck.type":"unknown"}`)}}}async function QP(e){const t=[`
88
+ `}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return"<br>"}del(t){return`<del>${t}</del>`}link(t,n,r){const o=sy(t);if(o===null)return r;t=o;let i='<a href="'+t+'"';return n&&(i+=' title="'+n+'"'),i+=">"+r+"</a>",i}image(t,n,r){const o=sy(t);if(o===null)return r;t=o;let i=`<img src="${t}" alt="${r}"`;return n&&(i+=` title="${n}"`),i+=">",i}text(t){return t}}class Dg{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,n,r){return""+r}image(t,n,r){return""+r}br(){return""}}class fr{constructor(t){je(this,"options");je(this,"renderer");je(this,"textRenderer");this.options=t||ki,this.options.renderer=this.options.renderer||new yc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Dg}static parse(t,n){return new fr(n).parse(t)}static parseInline(t,n){return new fr(n).parseInline(t)}parse(t,n=!0){let r="";for(let o=0;o<t.length;o++){const i=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const l=i,s=this.options.extensions.renderers[l.type].call({parser:this},l);if(s!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){r+=s||"";continue}}switch(i.type){case"space":continue;case"hr":{r+=this.renderer.hr();continue}case"heading":{const l=i;r+=this.renderer.heading(this.parseInline(l.tokens),l.depth,sb(this.parseInline(l.tokens,this.textRenderer)));continue}case"code":{const l=i;r+=this.renderer.code(l.text,l.lang,!!l.escaped);continue}case"table":{const l=i;let s="",a="";for(let c=0;c<l.header.length;c++)a+=this.renderer.tablecell(this.parseInline(l.header[c].tokens),{header:!0,align:l.align[c]});s+=this.renderer.tablerow(a);let u="";for(let c=0;c<l.rows.length;c++){const d=l.rows[c];a="";for(let f=0;f<d.length;f++)a+=this.renderer.tablecell(this.parseInline(d[f].tokens),{header:!1,align:l.align[f]});u+=this.renderer.tablerow(a)}r+=this.renderer.table(s,u);continue}case"blockquote":{const l=i,s=this.parse(l.tokens);r+=this.renderer.blockquote(s);continue}case"list":{const l=i,s=l.ordered,a=l.start,u=l.loose;let c="";for(let d=0;d<l.items.length;d++){const f=l.items[d],h=f.checked,g=f.task;let m="";if(f.task){const S=this.renderer.checkbox(!!h);u?f.tokens.length>0&&f.tokens[0].type==="paragraph"?(f.tokens[0].text=S+" "+f.tokens[0].text,f.tokens[0].tokens&&f.tokens[0].tokens.length>0&&f.tokens[0].tokens[0].type==="text"&&(f.tokens[0].tokens[0].text=S+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:S+" "}):m+=S+" "}m+=this.parse(f.tokens,u),c+=this.renderer.listitem(m,g,!!h)}r+=this.renderer.list(c,s,a);continue}case"html":{const l=i;r+=this.renderer.html(l.text,l.block);continue}case"paragraph":{const l=i;r+=this.renderer.paragraph(this.parseInline(l.tokens));continue}case"text":{let l=i,s=l.tokens?this.parseInline(l.tokens):l.text;for(;o+1<t.length&&t[o+1].type==="text";)l=t[++o],s+=`
89
+ `+(l.tokens?this.parseInline(l.tokens):l.text);r+=n?this.renderer.paragraph(s):s;continue}default:{const l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}parseInline(t,n){n=n||this.renderer;let r="";for(let o=0;o<t.length;o++){const i=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=l||"";continue}}switch(i.type){case"escape":{const l=i;r+=n.text(l.text);break}case"html":{const l=i;r+=n.html(l.text);break}case"link":{const l=i;r+=n.link(l.href,l.title,this.parseInline(l.tokens,n));break}case"image":{const l=i;r+=n.image(l.href,l.title,l.text);break}case"strong":{const l=i;r+=n.strong(this.parseInline(l.tokens,n));break}case"em":{const l=i;r+=n.em(this.parseInline(l.tokens,n));break}case"codespan":{const l=i;r+=n.codespan(l.text);break}case"br":{r+=n.br();break}case"del":{const l=i;r+=n.del(this.parseInline(l.tokens,n));break}case"text":{const l=i;r+=n.text(l.text);break}default:{const l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}}class Ds{constructor(t){je(this,"options");this.options=t||ki}preprocess(t){return t}postprocess(t){return t}}je(Ds,"passThroughHooks",new Set(["preprocess","postprocess"]));var Ea,Lh,Wc,z_;class db{constructor(...t){zd(this,Ea);zd(this,Wc);je(this,"defaults",Mg());je(this,"options",this.setOptions);je(this,"parse",Ha(this,Ea,Lh).call(this,dr.lex,fr.parse));je(this,"parseInline",Ha(this,Ea,Lh).call(this,dr.lexInline,fr.parseInline));je(this,"Parser",fr);je(this,"parser",fr.parse);je(this,"Renderer",yc);je(this,"TextRenderer",Dg);je(this,"Lexer",dr);je(this,"lexer",dr.lex);je(this,"Tokenizer",vc);je(this,"Hooks",Ds);this.use(...t)}walkTokens(t,n){var o,i;let r=[];for(const l of t)switch(r=r.concat(n.call(this,l)),l.type){case"table":{const s=l;for(const a of s.header)r=r.concat(this.walkTokens(a.tokens,n));for(const a of s.rows)for(const u of a)r=r.concat(this.walkTokens(u.tokens,n));break}case"list":{const s=l;r=r.concat(this.walkTokens(s.items,n));break}default:{const s=l;(i=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&i[s.type]?this.defaults.extensions.childTokens[s.type].forEach(a=>{r=r.concat(this.walkTokens(s[a],n))}):s.tokens&&(r=r.concat(this.walkTokens(s.tokens,n)))}}return r}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const l=n.renderers[i.name];l?n.renderers[i.name]=function(...s){let a=i.renderer.apply(this,s);return a===!1&&(a=l.apply(this,s)),a}:n.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=n[i.level];l?l.unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),o.extensions=n),r.renderer){const i=this.defaults.renderer||new yc(this.defaults);for(const l in r.renderer){const s=r.renderer[l],a=l,u=i[a];i[a]=(...c)=>{let d=s.apply(i,c);return d===!1&&(d=u.apply(i,c)),d||""}}o.renderer=i}if(r.tokenizer){const i=this.defaults.tokenizer||new vc(this.defaults);for(const l in r.tokenizer){const s=r.tokenizer[l],a=l,u=i[a];i[a]=(...c)=>{let d=s.apply(i,c);return d===!1&&(d=u.apply(i,c)),d}}o.tokenizer=i}if(r.hooks){const i=this.defaults.hooks||new Ds;for(const l in r.hooks){const s=r.hooks[l],a=l,u=i[a];Ds.passThroughHooks.has(l)?i[a]=c=>{if(this.defaults.async)return Promise.resolve(s.call(i,c)).then(f=>u.call(i,f));const d=s.call(i,c);return u.call(i,d)}:i[a]=(...c)=>{let d=s.apply(i,c);return d===!1&&(d=u.apply(i,c)),d}}o.hooks=i}if(r.walkTokens){const i=this.defaults.walkTokens,l=r.walkTokens;o.walkTokens=function(s){let a=[];return a.push(l.call(this,s)),i&&(a=a.concat(i.call(this,s))),a}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}}Ea=new WeakSet,Lh=function(t,n){return(r,o)=>{const i={...o},l={...this.defaults,...i};this.defaults.async===!0&&i.async===!1&&(l.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),l.async=!0);const s=Ha(this,Wc,z_).call(this,!!l.silent,!!l.async);if(typeof r>"u"||r===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(l.hooks&&(l.hooks.options=l),l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(r):r).then(a=>t(a,l)).then(a=>l.walkTokens?Promise.all(this.walkTokens(a,l.walkTokens)).then(()=>a):a).then(a=>n(a,l)).then(a=>l.hooks?l.hooks.postprocess(a):a).catch(s);try{l.hooks&&(r=l.hooks.preprocess(r));const a=t(r,l);l.walkTokens&&this.walkTokens(a,l.walkTokens);let u=n(a,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(a){return s(a)}}},Wc=new WeakSet,z_=function(t,n){return r=>{if(r.message+=`
90
+ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+vn(r.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(r);throw r}};const hi=new db;function Me(e,t){return hi.parse(e,t)}Me.options=Me.setOptions=function(e){return hi.setOptions(e),Me.defaults=hi.defaults,L_(Me.defaults),Me};Me.getDefaults=Mg;Me.defaults=ki;Me.use=function(...e){return hi.use(...e),Me.defaults=hi.defaults,L_(Me.defaults),Me};Me.walkTokens=function(e,t){return hi.walkTokens(e,t)};Me.parseInline=hi.parseInline;Me.Parser=fr;Me.parser=fr.parse;Me.Renderer=yc;Me.TextRenderer=Dg;Me.Lexer=dr;Me.lexer=dr.lex;Me.Tokenizer=vc;Me.Hooks=Ds;Me.parse=Me;Me.options;Me.setOptions;Me.use;Me.walkTokens;Me.parseInline;fr.parse;const fb=dr.lex,xc='<val value="',Ih='">',jh="</val>";function Kn(e,t,n,r=!1){var i,l;const o=[];for(;n<e.length;){const s=e[n];if(s.type==="heading")o.push({tag:`h${s.depth}`,children:Kn(s.tokens?s.tokens:[],t,0).children});else if(s.type==="paragraph")o.push({tag:"p",children:Kn(s.tokens?s.tokens:[],t,0).children});else if(s.type==="strong")o.push({tag:"span",classes:["bold"],children:Kn(s.tokens?s.tokens:[],t,0).children});else if(s.type==="em")o.push({tag:"span",classes:["italic"],children:Kn(s.tokens?s.tokens:[],t,0).children});else if(s.type==="del")o.push({tag:"span",classes:["line-through"],children:Kn(s.tokens?s.tokens:[],t,0).children});else if(s.type==="text")if("tokens"in s&&Array.isArray(s.tokens))o.push(...Kn(s.tokens,t,n,r).children);else if(r&&typeof s.raw=="string"){const a=s.raw.split(`
91
+ `),u=a.flatMap((c,d)=>d===a.length-1?[c]:[c,{tag:"br",children:[]}]);o.push(...u)}else o.push(s.raw);else if(s.type==="list")o.push({tag:s.ordered?"ol":"ul",children:Kn(s.items,t,0).children});else if(s.type==="list_item")o.push({tag:"li",children:Kn(s.tokens?s.tokens:[],t,0,!0).children});else if(s.type!=="space")if(s.type==="html"){if(s.text===jh)return{children:o,cursor:n};const a=s.text.indexOf(Ih);if(s.text.startsWith(xc)&&a>-1){const c=Number(s.text.slice(xc.length,a));if(Number.isNaN(c))throw Error(`Illegal val intermediate node: ${JSON.stringify(s)}`);const{children:d,cursor:f}=Kn(e.map(g=>g.type==="link"||g.type==="list"?{type:"text",raw:g.raw,text:g.raw}:g),t,n+1),h=t[c];h._type==="link"?o.push({tag:"a",href:h.href,children:d}):h._type==="file"&&o.push({tag:"img",src:wn.convertFileSource(h).url,width:(i=h.metadata)==null?void 0:i.width,height:(l=h.metadata)==null?void 0:l.height,children:[]}),n=f}const u=/<br\s*\/?>/gi;s.text.trim().match(u)&&o.push({tag:"br",children:[]})}else s.type==="link"?s.raw===s.href?o.push(s.raw):o.push({tag:"a",href:s.href,children:Kn(s.tokens?s.tokens:[],t,0).children}):s.type==="br"?o.push({tag:"br",children:[]}):console.error(`Could not parse markdown: unsupported token type: ${s.type}. Found: ${s.raw}`);n++}return{children:o,cursor:n}}function F_({templateStrings:e,exprs:t}){const n=e.flatMap((l,s)=>{const a=t[s];return a?a[Kt]==="link"?l.concat(`${xc}${s}${Ih}${a.children[0]}${jh}`):l.concat(`${xc}${s}${Ih}${jh}`):l}).join(""),r=fb(n,{gfm:!0}),{children:o,cursor:i}=Kn(r,t,0);if(i!==r.length)throw Error("Unexpectedly terminated markdown parsing. Possible reason: unclosed html tag?");return{[Kt]:"richtext",children:o}}var ln={},D={};let ad={},B_={},ca={},Ls={},zh={},fl={},Lg={},Fh={},da={},fa={},go={},Ig={},jg={},W_={},U_={},V_={},H_={},K_={},G_={},Y_={},_c={},X_={},Q_={},J_={},Z_={},q_={},ew={},tw={},nw={},rw={},zg={},Fg={},Bh={},ow={},iw={},lw={};function U(e){let t=new URLSearchParams;t.append("code",e);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Gr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",hb=Gr&&"documentMode"in document?document.documentMode:null,Wt=Gr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),bo=Gr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),wc=Gr&&"InputEvent"in window&&!hb?"getTargetRanges"in new window.InputEvent("input"):!1,Bg=Gr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ud=Gr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,pb=Gr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Wg=Gr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!pb,cd=Bg||ud||Wg?" ":"​",gb=bo?" ":cd,mb=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,vb=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,oi={bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},yb={directionless:1,unmergeable:2},cy={center:2,end:6,justify:4,left:1,right:3,start:5},xb={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},_b={normal:0,segmented:2,token:1},wb={0:"normal",2:"segmented",1:"token"},Wh=!1,Ug=0;function Sb(e){Ug=e.timeStamp}function pf(e,t,n){return t.__lexicalLineBreak===e||e[`__lexicalKey_${n._key}`]!==void 0}function Cb(e){return e.getEditorState().read(()=>{let t=Ke();return t!==null?t.clone():null})}function sw(e,t,n){Wh=!0;let r=100<performance.now()-Ug;try{kn(e,()=>{let o=Ke()||Cb(e);var i=new Map,l=e.getRootElement(),s=e._editorState,a=e._blockCursorElement;let u=!1,c="";for(var d=0;d<t.length;d++){var f=t[d],h=f.type,g=f.target,m=Ma(g,s);if(!(m===null&&g!==l||Ve(m))){if(h==="characterData"){if(f=r&&Q(m))e:{f=o,h=g;var S=m;if(de(f)){var v=f.anchor.getNode();if(v.is(S)&&f.format!==v.getFormat()){f=!1;break e}}f=h.nodeType===3&&S.isAttached()}f&&(S=Cr(e._window),h=f=null,S!==null&&S.anchorNode===g&&(f=S.anchorOffset,h=S.focusOffset),g=g.nodeValue,g!==null&&Xg(m,g,f,h,!1))}else if(h==="childList"){for(u=!0,h=f.addedNodes,S=0;S<h.length;S++){v=h[S];var y=pw(v),_=v.parentNode;_==null||v===a||y!==null||v.nodeName==="BR"&&pf(v,_,e)||(bo&&(y=v.innerText||v.nodeValue)&&(c+=y),_.removeChild(v))}if(f=f.removedNodes,h=f.length,0<h){for(S=0,v=0;v<h;v++)_=f[v],(_.nodeName==="BR"&&pf(_,g,e)||a===_)&&(g.appendChild(_),S++);h!==S&&(g===l&&(m=s._nodeMap.get("root")),i.set(g,m))}}}}if(0<i.size)for(let[w,C]of i)if(B(C))for(i=C.getChildrenKeys(),l=w.firstChild,s=0;s<i.length;s++)a=e.getElementByKey(i[s]),a!==null&&(l==null?(w.appendChild(a),l=a):l!==a&&w.replaceChild(a,l),l=l.nextSibling);else Q(C)&&C.markDirty();if(i=n.takeRecords(),0<i.length){for(l=0;l<i.length;l++)for(a=i[l],s=a.addedNodes,a=a.target,d=0;d<s.length;d++)m=s[d],g=m.parentNode,g==null||m.nodeName!=="BR"||pf(m,a,e)||g.removeChild(m);n.takeRecords()}o!==null&&(u&&(o.dirty=!0,vr(o)),bo&&yw(e)&&o.insertRawText(c))})}finally{Wh=!1}}function aw(e){let t=e._observer;if(t!==null){let n=t.takeRecords();sw(e,n,t)}}function uw(e){Ug===0&&fd(e).addEventListener("textInput",Sb,!0),e._observer=new MutationObserver((t,n)=>{sw(e,t,n)})}function dy(e,t){let n=e.__mode,r=e.__format;e=e.__style;let o=t.__mode,i=t.__format;return t=t.__style,(n===null||n===o)&&(r===null||r===i)&&(e===null||e===t)}function fy(e,t){let n=e.mergeWithSibling(t),r=et()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function cw(e){if(e.__text===""&&e.isSimpleText()&&!e.isUnmergeable())e.remove();else{for(var t;(t=e.getPreviousSibling())!==null&&Q(t)&&t.isSimpleText()&&!t.isUnmergeable();)if(t.__text==="")t.remove();else{dy(t,e)&&(e=fy(t,e));break}for(var n;(n=e.getNextSibling())!==null&&Q(n)&&n.isSimpleText()&&!n.isUnmergeable();)if(n.__text==="")n.remove();else{dy(e,n)&&fy(e,n);break}}}function Vg(e){return hy(e.anchor),hy(e.focus),e}function hy(e){for(;e.type==="element";){var t=e.getNode(),n=e.offset;if(n===t.getChildrenSize()?(t=t.getChildAtIndex(n-1),n=!0):(t=t.getChildAtIndex(n),n=!1),Q(t)){e.set(t.__key,n?t.getTextContentSize():0,"text");break}else if(!B(t))break;e.set(t.__key,n?t.getChildrenSize():0,"element")}}let Eb=1,$b=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function Hg(e){let t=document.activeElement;if(t===null)return!1;let n=t.nodeName;return Ve(Ma(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&t.__lexicalEditor==null)}function Aa(e,t,n){let r=e.getRootElement();try{return r!==null&&r.contains(t)&&r.contains(n)&&t!==null&&!Hg(t)&&Kg(t)===e}catch{return!1}}function Kg(e){for(;e!=null;){let t=e.__lexicalEditor;if(t!=null)return t;e=dd(e)}return null}function Uh(e){return e.isToken()||e.isSegmented()}function Sc(e){for(;e!=null;){if(e.nodeType===3)return e;e=e.firstChild}return null}function dw(e,t,n){return t=oi[t],e&t&&(n===null||!(n&t))?e^t:n===null||n&t?e|t:e}function fw(e){return Q(e)||ma(e)||Ve(e)}function hw(e,t){if(t!=null)e.__key=t;else{Zt(),99<va&&U(14),t=et();var n=Er(),r=""+Eb++;n._nodeMap.set(r,e),B(e)?t._dirtyElements.set(r,!0):t._dirtyLeaves.add(r),t._cloneNotNeeded.add(r),t._dirtyType=1,e.__key=r}}function ii(e){var t=e.getParent();if(t!==null){let o=e.getWritable();t=t.getWritable();var n=e.getPreviousSibling();if(e=e.getNextSibling(),n===null)if(e!==null){var r=e.getWritable();t.__first=e.__key,r.__prev=null}else t.__first=null;else{if(r=n.getWritable(),e!==null){let i=e.getWritable();i.__prev=r.__key,r.__next=i.__key}else r.__next=null;o.__prev=null}e===null?n!==null?(e=n.getWritable(),t.__last=n.__key,e.__next=null):t.__last=null:(e=e.getWritable(),n!==null?(n=n.getWritable(),n.__next=e.__key,e.__prev=n.__key):e.__prev=null,o.__next=null),t.__size--,o.__parent=null}}function Cc(e){99<va&&U(14);var t=e.getLatest(),n=t.__parent,r=Er();let o=et(),i=r._nodeMap;if(r=o._dirtyElements,n!==null)e:for(;n!==null;){if(r.has(n))break e;let l=i.get(n);if(l===void 0)break;r.set(n,!1),n=l.__parent}t=t.__key,o._dirtyType=1,B(e)?r.set(t,!0):o._dirtyLeaves.add(t)}function Mt(e){Zt();var t=et();let n=t._compositionKey;e!==n&&(t._compositionKey=e,n!==null&&(t=$t(n),t!==null&&t.getWritable()),e!==null&&(e=$t(e),e!==null&&e.getWritable()))}function mo(){return Ul()?null:et()._compositionKey}function $t(e,t){return e=(t||Er())._nodeMap.get(e),e===void 0?null:e}function pw(e,t){let n=et();return e=e[`__lexicalKey_${n._key}`],e!==void 0?$t(e,t):null}function Ma(e,t){for(;e!=null;){let n=pw(e,t);if(n!==null)return n;e=dd(e)}return null}function gw(e){let t=Object.assign({},e._decorators);return e._pendingDecorators=t}function py(e){return e.read(()=>Sr().getTextContent())}function kb(e,t){kn(e,()=>{var n=Er();if(!n.isEmpty())if(t==="root")Sr().markDirty();else{n=n._nodeMap;for(let[,r]of n)r.markDirty()}},e._pendingEditorState===null?{tag:"history-merge"}:void 0)}function Sr(){return Er()._nodeMap.get("root")}function vr(e){Zt();let t=Er();e!==null&&(e.dirty=!0,e._cachedNodes=null),t._selection=e}function tl(e){var t=et(),n;e:{for(n=e;n!=null;){let r=n[`__lexicalKey_${t._key}`];if(r!==void 0){n=r;break e}n=dd(n)}n=null}return n===null?(t=t.getRootElement(),e===t?$t("root"):null):$t(n)}function mw(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Gg(e){let t=[];for(;e!==null;)t.push(e),e=e._parentEditor;return t}function vw(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Yg(e,t,n){if(t=Cr(t._window),t!==null){var r=t.anchorNode,{anchorOffset:o,focusOffset:i}=t;if(r!==null&&(t=r.nodeType===3?r.nodeValue:null,r=Ma(r),t!==null&&Q(r))){if(t===cd&&n){let l=n.length;t=n,i=o=l}t!==null&&Xg(r,t,o,i,e)}}}function Xg(e,t,n,r,o){let i=e;if(i.isAttached()&&(o||!i.isDirty())){let u=i.isComposing(),c=t;if((u||o)&&t[t.length-1]===cd&&(c=t.slice(0,-1)),t=i.getTextContent(),o||c!==t)if(c==="")if(Mt(null),Bg||ud||Wg)i.remove();else{let d=et();setTimeout(()=>{d.update(()=>{i.isAttached()&&i.remove()})},20)}else{o=i.getParent(),t=Wl();var l=i.getTextContentSize(),s=mo(),a=i.getKey();i.isToken()||s!==null&&a===s&&!u||de(t)&&(o!==null&&!o.canInsertTextBefore()&&t.anchor.offset===0||t.anchor.key===e.__key&&t.anchor.offset===0&&!i.canInsertTextBefore()||t.focus.key===e.__key&&t.focus.offset===l&&!i.canInsertTextAfter())?i.markDirty():(e=Ke(),de(e)&&n!==null&&r!==null&&(e.setTextNodeRange(i,n,i,r),i.isSegmented()&&(n=i.getTextContent(),n=Ct(n),i.replace(n),i=n)),i.setTextContent(c))}}}function Tb(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;e=e.anchor.offset;let n=t.getParentOrThrow(),r=t.isToken();return e===0?((e=!t.canInsertTextBefore()||!n.canInsertTextBefore()||r)||(t=t.getPreviousSibling(),e=(Q(t)||B(t)&&t.isInline())&&!t.canInsertTextAfter()),e):e===t.getTextContentSize()?!t.canInsertTextAfter()||!n.canInsertTextAfter()||r:!1}function Is(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];return r!==void 0?r:(e=e[t],typeof e=="string"?(e=e.split(" "),n[t]=e):e)}function Qg(e,t,n,r,o){n.size!==0&&(n=r.__type,r=r.__key,t=t.get(n),t===void 0&&U(33,n),n=t.klass,t=e.get(n),t===void 0&&(t=new Map,e.set(n,t)),e=t.get(r),n=e==="destroyed"&&o==="created",(e===void 0||n)&&t.set(r,n?"updated":o))}function gy(e,t,n){let r=e.getParent(),o=n;return r!==null&&(t&&n===0?(o=e.getIndexWithinParent(),e=r):t||n!==e.getChildrenSize()||(o=e.getIndexWithinParent()+1,e=r)),e.getChildAtIndex(t?o-1:o)}function Vh(e,t){var n=e.offset;return e.type==="element"?(e=e.getNode(),gy(e,t,n)):(e=e.getNode(),t&&n===0||!t&&n===e.getTextContentSize()?(n=t?e.getPreviousSibling():e.getNextSibling(),n===null?gy(e.getParentOrThrow(),t,e.getIndexWithinParent()+(t?0:1)):n):null)}function yw(e){return e=(e=fd(e).event)&&e.inputType,e==="insertFromPaste"||e==="insertFromPasteAsQuotation"}function Ec(e){return!en(e)&&!e.isLastChild()&&!e.isInline()}function $c(e,t){return e=e._keyToDOMMap.get(t),e===void 0&&U(75,t),e}function dd(e){return e=e.assignedSlot||e.parentElement,e!==null&&e.nodeType===11?e.host:e}function kc(e,t){for(e=e.getParent();e!==null;){if(e.is(t))return!0;e=e.getParent()}return!1}function fd(e){return e=e._window,e===null&&U(78),e}function xw(e){for(e=e.getParentOrThrow();e!==null&&!Zn(e);)e=e.getParentOrThrow();return e}function Zn(e){return en(e)||B(e)&&e.isShadowRoot()}function _w(e){return e=e.constructor.clone(e),hw(e,null),e}function Da(e){var t=et();let n=e.constructor.getType();return t=t._nodes.get(n),t===void 0&&U(97),t=t.replace,t!==null?(t=t(e),t instanceof e.constructor||U(98),t):e}function gf(e,t){e=e.getParent(),!en(e)||B(t)||Ve(t)||U(99)}function mf(e){return(Ve(e)||B(e)&&!e.canBeEmpty())&&!e.isInline()}function Hh(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null,t=e.parentElement,t!==null&&t.removeChild(e)}function Cr(e){return Gr?(e||window).getSelection():null}function ww(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),Zn(e)&&U(102);let r=l=>{const s=l.getParentOrThrow(),a=Zn(s),u=l!==n||a?_w(l):l;if(a)return l.insertAfter(u),[l,u,u];const[c,d,f]=r(s);return l=l.getNextSiblings(),f.append(u,...l),[c,d,u]},[o,i]=r(n);return[o,i]}function Tc(e,t){for(;e!==Sr()&&e!=null;){if(t(e))return e;e=e.getParent()}return null}function Nb(e){let t=[],n=[e];for(;0<n.length;){let r=n.pop();r===void 0&&U(112),B(r)&&n.unshift(...r.getChildren()),r!==e&&t.push(r)}return t}function hd(e){return e.nodeType===1}function Sw(e,t,n,r,o,i){for(e=e.getFirstChild();e!==null;){let l=e.__key;e.__parent===t&&(B(e)&&Sw(e,l,n,r,o,i),n.has(l)||i.delete(l),o.push(l)),e=e.getNextSibling()}}function bb(e,t,n,r){e=e._nodeMap,t=t._nodeMap;let o=[];for(let[i]of r){let l=t.get(i);l===void 0||l.isAttached()||(B(l)&&Sw(l,i,e,t,o,r),e.has(i)||r.delete(i),o.push(i))}for(let i of o)t.delete(i);for(let i of n)r=t.get(i),r===void 0||r.isAttached()||(e.has(i)||n.delete(i),t.delete(i))}let gt="",Jt="",Or="",Ro,Ht,ha,Cw=!1,Jg=!1,pd,Iu=null,Kh,Gh,pi,Po,Yh,pa;function ju(e,t){let n=pi.get(e);if(t!==null){let r=Jh(e);r.parentNode===t&&t.removeChild(r)}Po.has(e)||Ht._keyToDOMMap.delete(e),B(n)&&(e=Nc(n,pi),Xh(e,0,e.length-1,null)),n!==void 0&&Qg(pa,ha,pd,n,"destroyed")}function Xh(e,t,n,r){for(;t<=n;++t){let o=e[t];o!==void 0&&ju(o,r)}}function Ho(e,t){e.setProperty("text-align",t)}function Ew(e,t){var n=Ro.theme.indent;if(typeof n=="string"){let r=e.classList.contains(n);0<t&&!r?e.classList.add(n):1>t&&r&&e.classList.remove(n)}n=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||"40px",e.style.setProperty("padding-inline-start",t===0?"":`calc(${t} * ${n})`)}function $w(e,t){e=e.style,t===0?Ho(e,""):t===1?Ho(e,"left"):t===2?Ho(e,"center"):t===3?Ho(e,"right"):t===4?Ho(e,"justify"):t===5?Ho(e,"start"):t===6&&Ho(e,"end")}function zu(e,t,n){let r=Po.get(e);r===void 0&&U(60);let o=r.createDOM(Ro,Ht);var i=Ht._keyToDOMMap;if(o["__lexicalKey_"+Ht._key]=e,i.set(e,o),Q(r)?o.setAttribute("data-lexical-text","true"):Ve(r)&&o.setAttribute("data-lexical-decorator","true"),B(r)){if(e=r.__indent,i=r.__size,e!==0&&Ew(o,e),i!==0){--i,e=Nc(r,Po);var l=Jt;Jt="",Qh(e,r,0,i,o,null),Tw(r,o),Jt=l}e=r.__format,e!==0&&$w(o,e),r.isInline()||kw(null,r,o),Ec(r)&&(gt+=`
92
+
93
+ `,Or+=`
94
+
95
+ `)}else i=r.getTextContent(),Ve(r)?(l=r.decorate(Ht,Ro),l!==null&&Nw(e,l),o.contentEditable="false"):Q(r)&&(r.isDirectionless()||(Jt+=i)),gt+=i,Or+=i;return t!==null&&(n!=null?t.insertBefore(o,n):(n=t.__lexicalLineBreak,n!=null?t.insertBefore(o,n):t.appendChild(o))),Qg(pa,ha,pd,r,"created"),o}function Qh(e,t,n,r,o,i){let l=gt;for(gt="";n<=r;++n)zu(e[n],o,i);Ec(t)&&(gt+=`
96
+
97
+ `),o.__lexicalTextContent=gt,gt=l+gt}function my(e,t){return e=t.get(e),ma(e)||Ve(e)&&e.isInline()}function kw(e,t,n){e=e!==null&&(e.__size===0||my(e.__last,pi)),t=t.__size===0||my(t.__last,Po),e?t||(t=n.__lexicalLineBreak,t!=null&&n.removeChild(t),n.__lexicalLineBreak=null):t&&(t=document.createElement("br"),n.__lexicalLineBreak=t,n.appendChild(t))}function Tw(e,t){var n=t.__lexicalDir;if(t.__lexicalDirTextContent!==Jt||n!==Iu){let i=Jt==="";if(i)var r=Iu;else r=Jt,r=mb.test(r)?"rtl":vb.test(r)?"ltr":null;if(r!==n){let l=t.classList,s=Ro.theme;var o=n!==null?s[n]:void 0;let a=r!==null?s[r]:void 0;o!==void 0&&(typeof o=="string"&&(o=o.split(" "),o=s[n]=o),l.remove(...o)),r===null||i&&r==="ltr"?t.removeAttribute("dir"):(a!==void 0&&(typeof a=="string"&&(n=a.split(" "),a=s[r]=n),a!==void 0&&l.add(...a)),t.dir=r),Jg||(e.getWritable().__dir=r)}Iu=r,t.__lexicalDirTextContent=Jt,t.__lexicalDir=r}}function Nc(e,t){let n=[];for(e=e.__first;e!==null;){let r=t.get(e);r===void 0&&U(101),n.push(e),e=r.__next}return n}function _s(e,t){var n=pi.get(e),r=Po.get(e);n!==void 0&&r!==void 0||U(61);var o=Cw||Gh.has(e)||Kh.has(e);let i=$c(Ht,e);if(n===r&&!o)return B(n)?(r=i.__lexicalTextContent,r!==void 0&&(gt+=r,Or+=r),r=i.__lexicalDirTextContent,r!==void 0&&(Jt+=r)):(r=n.getTextContent(),Q(n)&&!n.isDirectionless()&&(Jt+=r),Or+=r,gt+=r),i;if(n!==r&&o&&Qg(pa,ha,pd,r,"updated"),r.updateDOM(n,i,Ro))return r=zu(e,null,null),t===null&&U(62),t.replaceChild(r,i),ju(e,null),r;if(B(n)&&B(r)){if(e=r.__indent,e!==n.__indent&&Ew(i,e),e=r.__format,e!==n.__format&&$w(i,e),o){e=r,o=Jt,Jt="",t=gt;var l=n.__size,s=e.__size;if(gt="",l===1&&s===1){var a=n.__first,u=e.__first;if(a===u)_s(a,i);else{var c=Jh(a);u=zu(u,null,null),i.replaceChild(u,c),ju(a,null)}}else{u=Nc(n,pi);var d=Nc(e,Po);if(l===0)s!==0&&Qh(d,e,0,s-1,i,null);else if(s===0)l!==0&&(a=i.__lexicalLineBreak==null,Xh(u,0,l-1,a?null:i),a&&(i.textContent=""));else{var f=u;u=d,d=l-1,l=s-1;let g=i.firstChild,m=0;for(s=0;m<=d&&s<=l;){var h=f[m];let S=u[s];if(h===S)g=vf(_s(S,i)),m++,s++;else{a===void 0&&(a=new Set(f)),c===void 0&&(c=new Set(u));let v=c.has(h),y=a.has(S);v?(y?(h=$c(Ht,S),h===g?g=vf(_s(S,i)):(g!=null?i.insertBefore(h,g):i.appendChild(h),_s(S,i)),m++):zu(S,i,g),s++):(g=vf(Jh(h)),ju(h,i),m++)}}a=m>d,c=s>l,a&&!c?(a=u[l+1],a=a===void 0?null:Ht.getElementByKey(a),Qh(u,e,s,l,i,a)):c&&!a&&Xh(f,m,d,i)}}Ec(e)&&(gt+=`
98
+
99
+ `),i.__lexicalTextContent=gt,gt=t+gt,Tw(e,i),Jt=o,en(r)||r.isInline()||kw(n,r,i)}Ec(r)&&(gt+=`
100
+
101
+ `,Or+=`
102
+
103
+ `)}else n=r.getTextContent(),Ve(r)?(o=r.decorate(Ht,Ro),o!==null&&Nw(e,o)):Q(r)&&!r.isDirectionless()&&(Jt+=n),gt+=n,Or+=n;return!Jg&&en(r)&&r.__cachedText!==Or&&(r=r.getWritable(),r.__cachedText=Or),i}function Nw(e,t){let n=Ht._pendingDecorators,r=Ht._decorators;if(n===null){if(r[e]===t)return;n=gw(Ht)}n[e]=t}function vf(e){return e=e.nextSibling,e!==null&&e===Ht._blockCursorElement&&(e=e.nextSibling),e}function Jh(e){let t=Yh.get(e);return t===void 0&&U(75,e),t}let Tr=Object.freeze({}),Zh=[["keydown",Ib],["pointerdown",Pb],["compositionstart",Db],["compositionend",Lb],["input",Mb],["click",Rb],["cut",Tr],["copy",Tr],["dragstart",Tr],["dragover",Tr],["dragend",Tr],["paste",Tr],["focus",Tr],["blur",Tr],["drop",Tr]];wc&&Zh.push(["beforeinput",(e,t)=>Ab(e,t)]);let ga=0,bw=0,Rw=0,Wi=null,js=0,qh=!1,ep=!1,zs=!1,ws=!1,Pw=[0,"",0,"root",0];function Ow(e,t,n,r,o){let i=e.anchor,l=e.focus,s=i.getNode();var a=et();let u=Cr(a._window),c=u!==null?u.anchorNode:null,d=i.key;a=a.getElementByKey(d);let f=n.length;return d!==l.key||!Q(s)||(!o&&(!wc||Rw<r+50)||s.isDirty()&&2>f||mw(n))&&i.offset!==l.offset&&!s.isComposing()||Uh(s)||s.isDirty()&&1<f||(o||!wc)&&a!==null&&!s.isComposing()&&c!==Sc(a)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||s.getFormat()!==e.format||s.getStyle()!==e.style||Tb(e,s)}function vy(e,t){return e!==null&&e.nodeValue!==null&&e.nodeType===3&&t!==0&&t!==e.nodeValue.length}function yy(e,t,n){let{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:l}=e;qh&&(qh=!1,vy(r,o)&&vy(i,l))||kn(t,()=>{if(!n)vr(null);else if(Aa(t,r,i)){var s=Ke();if(de(s)){var a=s.anchor,u=a.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);var c=fd(t).event;c=c?c.timeStamp:performance.now();let[d,f,h,g,m]=Pw;c<m+200&&a.offset===h&&a.key===g?(s.format=d,s.style=f):a.type==="text"?(s.format=u.getFormat(),s.style=u.getStyle()):a.type==="element"&&(s.format=0,s.style="")}else{a=255,u=!1,c=s.getNodes();let d=c.length;for(let f=0;f<d;f++){let h=c[f];if(Q(h)&&(u=!0,a&=h.getFormat(),a===0))break}s.format=u?a:0}}Y(t,ad,void 0)}})}function Rb(e,t){kn(t,()=>{let n=Ke();var r=Cr(t._window);let o=Wl();if(r)if(de(n)){let l=n.anchor;var i=l.getNode();l.type==="element"&&l.offset===0&&n.isCollapsed()&&!en(i)&&Sr().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&o!==null&&n.is(o)?(r.removeAllRanges(),n.dirty=!0):e.detail!==3||n.isCollapsed()||(r=n.focus.getNode(),i!==r&&(B(i)?i.select(0):i.getParentOrThrow().select(0)))}else e.pointerType==="touch"&&(i=r.anchorNode,i!==null&&(i=i.nodeType,i===1||i===3))&&(r=qg(o,r,t),vr(r));Y(t,B_,e)})}function Pb(e,t){let n=e.target;e=e.pointerType,n instanceof Node&&e!=="touch"&&kn(t,()=>{Ve(Ma(n))||(ep=!0)})}function Aw(e){return e.getTargetRanges?(e=e.getTargetRanges(),e.length===0?null:e[0]):null}function Ob(e,t){return e!==t||B(e)||B(t)||!e.isToken()||!t.isToken()}function Ab(e,t){let n=e.inputType,r=Aw(e);n==="deleteCompositionText"||bo&&yw(t)||n!=="insertCompositionText"&&kn(t,()=>{let o=Ke();if(n==="deleteContentBackward"){if(o===null){var i=Wl();if(!de(i))return;vr(i.clone())}if(de(o)){bw===229&&e.timeStamp<ga+30&&t.isComposing()&&o.anchor.key===o.focus.key?(Mt(null),ga=0,setTimeout(()=>{kn(t,()=>{Mt(null)})},30),de(o)&&(i=o.anchor.getNode(),i.markDirty(),o.format=i.getFormat(),o.style=i.getStyle())):(e.preventDefault(),Y(t,ca,!0));return}}if(de(o)){i=e.data,Wi!==null&&Yg(!1,t,Wi),o.dirty&&Wi===null||!o.isCollapsed()||en(o.anchor.getNode())||r===null||o.applyDOMRange(r),Wi=null;var l=o.focus,s=o.anchor.getNode();if(l=l.getNode(),n==="insertText"||n==="insertTranspose")i===`
104
+ `?(e.preventDefault(),Y(t,Ls,!1)):i===`
105
+
106
+ `?(e.preventDefault(),Y(t,zh,void 0)):i==null&&e.dataTransfer?(i=e.dataTransfer.getData("text/plain"),e.preventDefault(),o.insertRawText(i)):i!=null&&Ow(o,r,i,e.timeStamp,!0)?(e.preventDefault(),Y(t,fl,i)):Wi=i,Rw=e.timeStamp;else switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Y(t,fl,e);break;case"insertFromComposition":Mt(null),Y(t,fl,e);break;case"insertLineBreak":Mt(null),Y(t,Ls,!1);break;case"insertParagraph":Mt(null),zs&&!ud?(zs=!1,Y(t,Ls,!1)):Y(t,zh,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Y(t,Lg,e);break;case"deleteByComposition":Ob(s,l)&&Y(t,Fh,e);break;case"deleteByDrag":case"deleteByCut":Y(t,Fh,e);break;case"deleteContent":Y(t,ca,!1);break;case"deleteWordBackward":Y(t,da,!0);break;case"deleteWordForward":Y(t,da,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Y(t,fa,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Y(t,fa,!1);break;case"formatStrikeThrough":Y(t,go,"strikethrough");break;case"formatBold":Y(t,go,"bold");break;case"formatItalic":Y(t,go,"italic");break;case"formatUnderline":Y(t,go,"underline");break;case"historyUndo":Y(t,Ig,void 0);break;case"historyRedo":Y(t,jg,void 0)}}})}function Mb(e,t){e.stopPropagation(),kn(t,()=>{var n=Ke(),r=e.data,o=Aw(e);if(r!=null&&de(n)&&Ow(n,o,r,e.timeStamp,!1)){ws&&(tp(t,r),ws=!1);var i=n.anchor,l=i.getNode();if(o=Cr(t._window),o===null)return;let s=i.offset;(i=wc&&!n.isCollapsed()&&Q(l)&&o.anchorNode!==null)&&(l=l.getTextContent().slice(0,s)+r+l.getTextContent().slice(s+n.focus.offset),o=o.anchorNode,i=l===(o.nodeType===3?o.nodeValue:null)),i||Y(t,fl,r),r=r.length,bo&&1<r&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=r),Bg||ud||Wg||!t.isComposing()||(ga=0,Mt(null))}else Yg(!1,t,r!==null?r:void 0),ws&&(tp(t,r||void 0),ws=!1);Zt(),n=et(),aw(n)}),Wi=null}function Db(e,t){kn(t,()=>{let n=Ke();if(de(n)&&!t.isComposing()){let r=n.anchor,o=n.anchor.getNode();Mt(r.key),(e.timeStamp<ga+30||r.type==="element"||!n.isCollapsed()||o.getFormat()!==n.format||o.getStyle()!==n.style)&&Y(t,fl,gb)}})}function tp(e,t){var n=e._compositionKey;if(Mt(null),n!==null&&t!=null){if(t===""){t=$t(n),e=Sc(e.getElementByKey(n)),e!==null&&e.nodeValue!==null&&Q(t)&&Xg(t,e.nodeValue,null,null,!0);return}if(t[t.length-1]===`
107
+ `&&(n=Ke(),de(n))){t=n.focus,n.anchor.set(t.key,t.offset,t.type),Y(e,_c,null);return}}Yg(!0,e,t)}function Lb(e,t){bo?ws=!0:kn(t,()=>{tp(t,e.data)})}function Ib(e,t){if(ga=e.timeStamp,bw=e.keyCode,!t.isComposing()){var{keyCode:n,shiftKey:r,ctrlKey:o,metaKey:i,altKey:l}=e;if(!Y(t,W_,e)){if(n!==39||o||i||l)if(n!==39||l||r||!o&&!i)if(n!==37||o||i||l)if(n!==37||l||r||!o&&!i)if(n!==38||o||i)if(n!==40||o||i)if(n===13&&r)zs=!0,Y(t,_c,e);else if(n===32)Y(t,X_,e);else if(Wt&&o&&n===79)e.preventDefault(),zs=!0,Y(t,Ls,!0);else if(n!==13||r){var s=Wt?l||i?!1:n===8||n===72&&o:o||l||i?!1:n===8;s?n===8?Y(t,Q_,e):(e.preventDefault(),Y(t,ca,!0)):n===27?Y(t,J_,e):(s=Wt?r||l||i?!1:n===46||n===68&&o:o||l||i?!1:n===46,s?n===46?Y(t,Z_,e):(e.preventDefault(),Y(t,ca,!1)):n===8&&(Wt?l:o)?(e.preventDefault(),Y(t,da,!0)):n===46&&(Wt?l:o)?(e.preventDefault(),Y(t,da,!1)):Wt&&i&&n===8?(e.preventDefault(),Y(t,fa,!0)):Wt&&i&&n===46?(e.preventDefault(),Y(t,fa,!1)):n===66&&!l&&(Wt?i:o)?(e.preventDefault(),Y(t,go,"bold")):n===85&&!l&&(Wt?i:o)?(e.preventDefault(),Y(t,go,"underline")):n===73&&!l&&(Wt?i:o)?(e.preventDefault(),Y(t,go,"italic")):n!==9||l||o||i?n===90&&!r&&(Wt?i:o)?(e.preventDefault(),Y(t,Ig,void 0)):(s=Wt?n===90&&i&&r:n===89&&o||n===90&&o&&r,s?(e.preventDefault(),Y(t,jg,void 0)):Bl(t._editorState._selection)?(s=r?!1:n===67?Wt?i:o:!1,s?(e.preventDefault(),Y(t,zg,e)):(s=r?!1:n===88?Wt?i:o:!1,s?(e.preventDefault(),Y(t,Fg,e)):n===65&&(Wt?i:o)&&(e.preventDefault(),Y(t,Bh,e)))):!bo&&n===65&&(Wt?i:o)&&(e.preventDefault(),Y(t,Bh,e))):Y(t,q_,e))}else zs=!1,Y(t,_c,e);else Y(t,Y_,e);else Y(t,G_,e);else Y(t,K_,e);else Y(t,H_,e);else Y(t,V_,e);else Y(t,U_,e);(o||r||l||i)&&Y(t,lw,e)}}}function Mw(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}let hl=new Map;function Dw(e){e=e.target;let t=Cr(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t!==null){var n=Kg(t.anchorNode);if(n!==null){ep&&(ep=!1,kn(n,()=>{var l=Wl(),s=t.anchorNode;s!==null&&(s=s.nodeType,s===1||s===3)&&(l=qg(l,t,n),vr(l))})),e=Gg(n),e=e[e.length-1];var r=e._key,o=hl.get(r),i=o||e;i!==n&&yy(t,i,!1),yy(t,n,!0),n!==e?hl.set(r,n):o&&hl.delete(r)}}}function jb(e,t){js===0&&e.ownerDocument.addEventListener("selectionchange",Dw),js++,e.__lexicalEditor=t;let n=Mw(e);for(let r=0;r<Zh.length;r++){let[o,i]=Zh[r],l=typeof i=="function"?s=>{s._lexicalHandled!==!0&&(s._lexicalHandled=!0,t.isEditable()&&i(s,t))}:s=>{if(s._lexicalHandled!==!0&&(s._lexicalHandled=!0,t.isEditable()))switch(o){case"cut":return Y(t,Fg,s);case"copy":return Y(t,zg,s);case"paste":return Y(t,Lg,s);case"dragstart":return Y(t,tw,s);case"dragover":return Y(t,nw,s);case"dragend":return Y(t,rw,s);case"focus":return Y(t,ow,s);case"blur":return Y(t,iw,s);case"drop":return Y(t,ew,s)}};e.addEventListener(o,l),n.push(()=>{e.removeEventListener(o,l)})}}function np(e,t,n){Zt();var r=e.__key;let o=e.getParent();if(o!==null){var i=Ke();if(de(i)&&B(e)){var{anchor:l,focus:s}=i,a=l.getNode(),u=s.getNode();kc(a,e)&&l.set(e.__key,0,"element"),kc(u,e)&&s.set(e.__key,0,"element")}if(a=i,u=!1,de(a)&&t){i=a.anchor;let c=a.focus;i.key===r&&(Rc(i,e,o,e.getPreviousSibling(),e.getNextSibling()),u=!0),c.key===r&&(Rc(c,e,o,e.getPreviousSibling(),e.getNextSibling()),u=!0)}else Bl(a)&&t&&e.isSelected()&&e.selectPrevious();de(a)&&t&&!u?(r=e.getIndexWithinParent(),ii(e),bc(a,o,r,-1)):ii(e),n||Zn(o)||o.canBeEmpty()||!o.isEmpty()||np(o,t),t&&en(o)&&o.isEmpty()&&o.selectEnd()}}class La{static getType(){U(64,this.name)}static clone(){U(65,this.name)}constructor(t){this.__type=this.constructor.getType(),this.__next=this.__prev=this.__parent=null,hw(this,t)}getType(){return this.__type}isAttached(){for(var t=this.__key;t!==null;){if(t==="root")return!0;if(t=$t(t),t===null)break;t=t.__parent}return!1}isSelected(t){if(t=t||Ke(),t==null)return!1;let n=t.getNodes().some(r=>r.__key===this.__key);return Q(this)?n:de(t)&&t.anchor.type==="element"&&t.focus.type==="element"&&t.anchor.key===t.focus.key&&t.anchor.offset===t.focus.offset?!1:n}getKey(){return this.__key}getIndexWithinParent(){var t=this.getParent();if(t===null)return-1;t=t.getFirstChild();let n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:$t(t)}getParentOrThrow(){let t=this.getParent();return t===null&&U(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(Zn(n))return t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&U(67,this.__key),t}getParents(){let t=[],n=this.getParent();for(;n!==null;)t.push(n),n=n.getParent();return t}getParentKeys(){let t=[],n=this.getParent();for(;n!==null;)t.push(n.__key),n=n.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:$t(t)}getPreviousSiblings(){let t=[];var n=this.getParent();if(n===null)return t;for(n=n.getFirstChild();n!==null&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:$t(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=this.getParents();var r=t.getParents();B(this)&&n.unshift(this),B(t)&&r.unshift(t),t=n.length;var o=r.length;if(t===0||o===0||n[t-1]!==r[o-1])return null;for(r=new Set(r),o=0;o<t;o++){let i=n[o];if(r.has(i))return i}return null}is(t){return t==null?!1:this.__key===t.__key}isBefore(t){if(this===t)return!1;if(t.isParentOf(this))return!0;if(this.isParentOf(t))return!1;var n=this.getCommonAncestor(t);let r=this;for(;;){var o=r.getParentOrThrow();if(o===n){o=r.getIndexWithinParent();break}r=o}for(r=t;;){if(t=r.getParentOrThrow(),t===n){n=r.getIndexWithinParent();break}r=t}return o<n}isParentOf(t){let n=this.__key;if(n===t.__key)return!1;for(;t!==null;){if(t.__key===n)return!0;t=t.getParent()}return!1}getNodesBetween(t){let n=this.isBefore(t),r=[],o=new Set;for(var i=this;;){var l=i.__key;if(o.has(l)||(o.add(l),r.push(i)),i===t)break;if(l=B(i)?n?i.getFirstChild():i.getLastChild():null,l!==null)i=l;else if(l=n?i.getNextSibling():i.getPreviousSibling(),l!==null)i=l;else{if(i=i.getParentOrThrow(),o.has(i.__key)||r.push(i),i===t)break;l=i;do l===null&&U(68),i=n?l.getNextSibling():l.getPreviousSibling(),l=l.getParent(),l!==null&&(i!==null||o.has(l.__key)||r.push(l));while(i===null)}}return n||r.reverse(),r}isDirty(){let t=et()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){let t=$t(this.__key);return t===null&&U(113),t}getWritable(){Zt();var t=Er(),n=et();t=t._nodeMap;let r=this.__key,o=this.getLatest(),i=o.__parent;n=n._cloneNotNeeded;var l=Ke();return l!==null&&(l._cachedNodes=null),n.has(r)?(Cc(o),o):(l=o.constructor.clone(o),l.__parent=i,l.__next=o.__next,l.__prev=o.__prev,B(o)&&B(l)?(l.__first=o.__first,l.__last=o.__last,l.__size=o.__size,l.__indent=o.__indent,l.__format=o.__format,l.__dir=o.__dir):Q(o)&&Q(l)&&(l.__format=o.__format,l.__style=o.__style,l.__mode=o.__mode,l.__detail=o.__detail),n.add(r),l.__key=r,Cc(l),t.set(r,l),l)}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){U(70)}updateDOM(){U(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){U(72)}static importJSON(){U(18,this.name)}static transform(){return null}remove(t){np(this,!0,t)}replace(t,n){Zt();var r=Ke();r!==null&&(r=r.clone()),gf(this,t);let o=this.getLatest(),i=this.__key,l=t.__key,s=t.getWritable();t=this.getParentOrThrow().getWritable();let a=t.__size;ii(s);let u=o.getPreviousSibling(),c=o.getNextSibling(),d=o.__prev,f=o.__next,h=o.__parent;return np(o,!1,!0),u===null?t.__first=l:u.getWritable().__next=l,s.__prev=d,c===null?t.__last=l:c.getWritable().__prev=l,s.__next=f,s.__parent=h,t.__size=a,n&&this.getChildren().forEach(g=>{s.append(g)}),de(r)&&(vr(r),n=r.anchor,r=r.focus,n.key===i&&wy(n,s),r.key===i&&wy(r,s)),mo()===i&&Mt(l),s}insertAfter(t,n=!0){Zt(),gf(this,t);var r=this.getWritable();let o=t.getWritable();var i=o.getParent();let l=Ke();var s=!1,a=!1;if(i!==null){var u=t.getIndexWithinParent();ii(o),de(l)&&(a=i.__key,s=l.anchor,i=l.focus,s=s.type==="element"&&s.key===a&&s.offset===u+1,a=i.type==="element"&&i.key===a&&i.offset===u+1)}i=this.getNextSibling(),u=this.getParentOrThrow().getWritable();let c=o.__key,d=r.__next;return i===null?u.__last=c:i.getWritable().__prev=c,u.__size++,r.__next=c,o.__next=d,o.__prev=r.__key,o.__parent=r.__parent,n&&de(l)&&(n=this.getIndexWithinParent(),bc(l,u,n+1),r=u.__key,s&&l.anchor.set(r,n+2,"element"),a&&l.focus.set(r,n+2,"element")),t}insertBefore(t,n=!0){Zt(),gf(this,t);var r=this.getWritable();let o=t.getWritable(),i=o.__key;ii(o);let l=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),a=r.__prev,u=this.getIndexWithinParent();return l===null?s.__first=i:l.getWritable().__next=i,s.__size++,r.__prev=i,o.__prev=a,o.__next=r.__key,o.__parent=r.__parent,r=Ke(),n&&de(r)&&(n=this.getParentOrThrow(),bc(r,n,u)),t}isParentRequired(){return!1}createParentElementNode(){return gi()}selectPrevious(t,n){Zt();let r=this.getPreviousSibling(),o=this.getParentOrThrow();return r===null?o.select(0,0):B(r)?r.select():Q(r)?r.select(t,n):(t=r.getIndexWithinParent()+1,o.select(t,t))}selectNext(t,n){Zt();let r=this.getNextSibling(),o=this.getParentOrThrow();return r===null?o.select():B(r)?r.select(0,0):Q(r)?r.select(t,n):(t=r.getIndexWithinParent(),o.select(t,t))}markDirty(){this.getWritable()}}class zl extends La{static getType(){return"linebreak"}static clone(t){return new zl(t.__key)}constructor(t){super(t)}getTextContent(){return`
108
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:t=>{let n=t.parentElement,r,o;return n!==null&&((r=n.firstChild)===t||r.nextSibling===t&&r.nodeType===3&&(r.textContent||"").match(/^( |\t|\r?\n)+$/)!==null)&&((o=n.lastChild)===t||o.previousSibling===t&&o.nodeType===3&&(o.textContent||"").match(/^( |\t|\r?\n)+$/)!==null)?null:{conversion:zb,priority:0}}}}static importJSON(){return Tl()}exportJSON(){return{type:"linebreak",version:1}}}function zb(){return{node:Tl()}}function Tl(){return Da(new zl)}function ma(e){return e instanceof zl}function yf(e,t){return t&16?"code":t&128?"mark":t&32?"sub":t&64?"sup":null}function xf(e,t){return t&1?"strong":t&2?"em":"span"}function _f(e,t,n,r,o){e=r.classList,r=Is(o,"base"),r!==void 0&&e.add(...r),r=Is(o,"underlineStrikethrough");let i=!1,l=t&8&&t&4;var s=n&8&&n&4;r!==void 0&&(s?(i=!0,l||e.add(...r)):l&&e.remove(...r));for(let a in oi)s=oi[a],r=Is(o,a),r!==void 0&&(n&s?!i||a!=="underline"&&a!=="strikethrough"?(!(t&s)||l&&a==="underline"||a==="strikethrough")&&e.add(...r):t&s&&e.remove(...r):t&s&&e.remove(...r))}function wf(e,t,n){let r=t.firstChild;if(n=n.isComposing(),e+=n?cd:"",r==null)t.textContent=e;else if(t=r.nodeValue,t!==e)if(n||bo){n=t.length;let o=e.length,i=0,l=0;for(;i<n&&i<o&&t[i]===e[i];)i++;for(;l+i<n&&l+i<o&&t[n-l-1]===e[o-l-1];)l++;e=[i,n-i-l,e.slice(i,o-l)];let[s,a,u]=e;a!==0&&r.deleteData(s,a),r.insertData(s,u)}else r.nodeValue=e}function fu(e,t){return t=document.createElement(t),t.appendChild(e),t}class Ti extends La{static getType(){return"text"}static clone(t){return new Ti(t.__text,t.__key)}constructor(t,n){super(n),this.__text=t,this.__format=0,this.__style="",this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let t=this.getLatest();return wb[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===mo()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return(this.getLatest().__detail&1)!==0}isUnmergeable(){return(this.getLatest().__detail&2)!==0}hasFormat(t){return t=oi[t],(this.getFormat()&t)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){let r=this.getLatest().__format;return dw(r,t,n)}createDOM(t){var n=this.__format,r=yf(this,n);let o=xf(this,n),i=document.createElement(r===null?o:r),l=i;return this.hasFormat("code")&&i.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(o),i.appendChild(l)),r=l,wf(this.__text,r,this),t=t.theme.text,t!==void 0&&_f(o,0,n,r,t),n=this.__style,n!==""&&(i.style.cssText=n),i}updateDOM(t,n,r){let o=this.__text;var i=t.__format,l=this.__format,s=yf(this,i);let a=yf(this,l);var u=xf(this,i);let c=xf(this,l);return(s===null?u:s)!==(a===null?c:a)?!0:s===a&&u!==c?(i=n.firstChild,i==null&&U(48),t=s=document.createElement(c),wf(o,t,this),r=r.theme.text,r!==void 0&&_f(c,0,l,t,r),n.replaceChild(s,i),!1):(u=n,a!==null&&s!==null&&(u=n.firstChild,u==null&&U(49)),wf(o,u,this),r=r.theme.text,r!==void 0&&i!==l&&_f(c,i,l,u,r),l=this.__style,t.__style!==l&&(n.style.cssText=l),!1)}static importDOM(){return{"#text":()=>({conversion:Wb,priority:0}),b:()=>({conversion:Bb,priority:0}),code:()=>({conversion:ro,priority:0}),em:()=>({conversion:ro,priority:0}),i:()=>({conversion:ro,priority:0}),s:()=>({conversion:ro,priority:0}),span:()=>({conversion:Fb,priority:0}),strong:()=>({conversion:ro,priority:0}),sub:()=>({conversion:ro,priority:0}),sup:()=>({conversion:ro,priority:0}),u:()=>({conversion:ro,priority:0})}}static importJSON(t){let n=Ct(t.text);return n.setFormat(t.format),n.setDetail(t.detail),n.setMode(t.mode),n.setStyle(t.style),n}exportDOM(t){return{element:t}=super.exportDOM(t),t!==null&&hd(t)||U(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=fu(t,"b")),this.hasFormat("italic")&&(t=fu(t,"i")),this.hasFormat("strikethrough")&&(t=fu(t,"s")),this.hasFormat("underline")&&(t=fu(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(t){let n=this.getWritable();return n.__format=typeof t=="string"?oi[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?yb[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){return t=oi[t],this.setFormat(this.getFormat()^t)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){if(t=_b[t],this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(t){if(this.__text===t)return this;let n=this.getWritable();return n.__text=t,n}select(t,n){Zt();let r=Ke();var o=this.getTextContent();let i=this.__key;if(typeof o=="string"?(o=o.length,t===void 0&&(t=o),n===void 0&&(n=o)):n=t=0,de(r))o=mo(),o!==r.anchor.key&&o!==r.focus.key||Mt(i),r.setTextNodeRange(this,t,this,n);else return jw(i,t,i,n,"text","text");return r}spliceText(t,n,r,o){let i=this.getWritable(),l=i.__text,s=r.length,a=t;0>a&&(a=s+a,0>a&&(a=0));let u=Ke();return o&&de(u)&&(t+=s,u.setTextNodeRange(i,t,i,t)),n=l.slice(0,a)+r+l.slice(a+n),i.__text=n,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Zt();var n=this.getLatest(),r=n.getTextContent(),o=n.__key,i=mo(),l=new Set(t);t=[];for(var s=r.length,a="",u=0;u<s;u++)a!==""&&l.has(u)&&(t.push(a),a=""),a+=r[u];if(a!==""&&t.push(a),l=t.length,l===0)return[];if(t[0]===r)return[n];var c=t[0];r=n.getParentOrThrow(),u=n.getFormat();let d=n.getStyle(),f=n.__detail;s=!1,n.isSegmented()?(a=Ct(c),a.__format=u,a.__style=d,a.__detail=f,s=!0):(a=n.getWritable(),a.__text=c),n=Ke(),a=[a],c=c.length;for(let m=1;m<l;m++){var h=t[m],g=h.length;h=Ct(h).getWritable(),h.__format=u,h.__style=d,h.__detail=f;let S=h.__key;if(g=c+g,de(n)){let v=n.anchor,y=n.focus;v.key===o&&v.type==="text"&&v.offset>c&&v.offset<=g&&(v.key=S,v.offset-=c,n.dirty=!0),y.key===o&&y.type==="text"&&y.offset>c&&y.offset<=g&&(y.key=S,y.offset-=c,n.dirty=!0)}i===o&&Mt(S),c=g,a.push(h)}return o=this.getPreviousSibling(),i=this.getNextSibling(),o!==null&&Cc(o),i!==null&&Cc(i),o=r.getWritable(),i=this.getIndexWithinParent(),s?(o.splice(i,0,a),this.remove()):o.splice(i,1,a),de(n)&&bc(n,r,i,l-1),a}mergeWithSibling(t){var n=t===this.getPreviousSibling();n||t===this.getNextSibling()||U(50);var r=this.__key;let o=t.__key,i=this.__text,l=i.length;mo()===o&&Mt(r);let s=Ke();if(de(s)){let a=s.anchor,u=s.focus;a!==null&&a.key===o&&(Ny(a,n,r,t,l),s.dirty=!0),u!==null&&u.key===o&&(Ny(u,n,r,t,l),s.dirty=!0)}return r=t.__text,this.setTextContent(n?r+i:i+r),n=this.getWritable(),t.remove(),n}isTextEntity(){return!1}}function Fb(e){let t=e.style.fontWeight==="700",n=e.style.textDecoration==="line-through",r=e.style.fontStyle==="italic",o=e.style.textDecoration==="underline",i=e.style.verticalAlign;return{forChild:l=>(Q(l)&&(t&&l.toggleFormat("bold"),n&&l.toggleFormat("strikethrough"),r&&l.toggleFormat("italic"),o&&l.toggleFormat("underline"),i==="sub"&&l.toggleFormat("subscript"),i==="super"&&l.toggleFormat("superscript")),l),node:null}}function Bb(e){let t=e.style.fontWeight==="normal";return{forChild:n=>(Q(n)&&!t&&n.toggleFormat("bold"),n),node:null}}let xy=new WeakMap;function Wb(e){e.parentElement===null&&U(129);for(var t=e.textContent||"",n,r=e.parentNode,o=[e];r!==null&&(n=xy.get(r))===void 0&&!(r.nodeName==="PRE"||r.nodeType===1&&r.style.whiteSpace.startsWith("pre"));)o.push(r),r=r.parentNode;for(n=n===void 0?r:n,r=0;r<o.length;r++)xy.set(o[r],n);if(n!==null){for(t=t.split(/(\r?\n|\t)/),e=[],o=t.length,n=0;n<o;n++)r=t[n],r===`
109
+ `||r===`\r
110
+ `?e.push(Tl()):r===" "?e.push(gd()):r!==""&&e.push(Ct(r));return{node:e}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){for(o=e,n=!0;o!==null&&(o=_y(o,!1))!==null;)if(r=o.textContent||"",0<r.length){/[ \t\n]$/.test(r)&&(t=t.slice(1)),n=!1;break}n&&(t=t.slice(1))}if(t[t.length-1]===" "){for(o=!0;e!==null&&(e=_y(e,!0))!==null;)if(0<(e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length){o=!1;break}o&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:Ct(t)}}let Ub=new RegExp(/^(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 _y(e,t){for(;;){for(var n=void 0;(n=t?e.nextSibling:e.previousSibling)===null;)if(e=e.parentElement,e===null)return null;if(e=n,e.nodeType===1&&(n=e.style.display,n===""&&e.nodeName.match(Ub)===null||n!==""&&!n.startsWith("inline")))return null;for(;(n=t?e.firstChild:e.lastChild)!==null;)e=n;if(e.nodeType===3)return e;if(e.nodeName==="BR")return null}}let Vb={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function ro(e){let t=Vb[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:n=>(Q(n)&&!n.hasFormat(t)&&n.toggleFormat(t),n),node:null}}function Ct(e=""){return Da(new Ti(e))}function Q(e){return e instanceof Ti}class Fl extends Ti{static getType(){return"tab"}static clone(t){let n=new Fl(t.__key);return n.__text=t.__text,n.__format=t.__format,n.__style=t.__style,n}constructor(t){super(" ",t),this.__detail=2}static importDOM(){return null}static importJSON(t){let n=gd();return n.setFormat(t.format),n.setStyle(t.style),n}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(){U(126)}setDetail(){U(127)}setMode(){U(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function gd(){return Da(new Fl)}class yr{constructor(t,n,r){this._selection=null,this.key=t,this.offset=n,this.type=r}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){let n=this.getNode(),r=t.getNode(),o=this.offset;if(t=t.offset,B(n)){var i=n.getDescendantByIndex(o);n=i??n}return B(r)&&(i=r.getDescendantByIndex(t),r=i??r),n===r?o<t:n.isBefore(r)}getNode(){let t=$t(this.key);return t===null&&U(20),t}set(t,n,r){let o=this._selection,i=this.key;this.key=t,this.offset=n,this.type=r,Ul()||(mo()===i&&Mt(t),o!==null&&(o._cachedNodes=null,o.dirty=!0))}}function Sf(e,t){let n=t.__key,r=e.offset,o="element";if(Q(t))o="text",t=t.getTextContentSize(),r>t&&(r=t);else if(!B(t)){var i=t.getNextSibling();Q(i)?(n=i.__key,r=0,o="text"):(i=t.getParent())&&(n=i.__key,r=t.getIndexWithinParent()+1)}e.set(n,r,o)}function wy(e,t){if(B(t)){let n=t.getLastDescendant();B(n)||Q(n)?Sf(e,n):Sf(e,t)}else Sf(e,t)}function Sy(e,t,n,r){let o=e.getNode(),i=o.getChildAtIndex(e.offset),l=Ct(),s=en(o)?gi().append(l):l;l.setFormat(n),l.setStyle(r),i===null?o.append(s):(i.insertBefore(s),t.type==="element"&&t.key===e.key&&t.offset!==e.offset&&t.set(t.key,t.offset+1,"element")),e.is(t)&&t.set(l.__key,0,"text"),e.set(l.__key,0,"text")}function ao(e,t,n,r){e.key=t,e.offset=n,e.type=r}class md{constructor(t){this.dirty=!1,this._nodes=t,this._cachedNodes=null}is(t){if(!Bl(t))return!1;let n=this._nodes,r=t._nodes;return n.size===r.size&&Array.from(n).every(o=>r.has(o))}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new md(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(t,n){let r=this.getNodes(),o=r.length;var i=r[o-1];if(Q(i))i=i.select();else{let l=i.getIndexWithinParent()+1;i=i.getParentOrThrow().select(l,l)}for(i.insertNodes(t,n),t=0;t<o;t++)r[t].remove();return!0}getNodes(){var t=this._cachedNodes;if(t!==null)return t;var n=this._nodes;t=[];for(let r of n)n=$t(r),n!==null&&t.push(n);return Ul()||(this._cachedNodes=t),t}getTextContent(){let t=this.getNodes(),n="";for(let r=0;r<t.length;r++)n+=t[r].getTextContent();return n}}function de(e){return e instanceof Ni}function rp(e){let[t,,n]=Fw(e);e=n.getChildren();let r=e.length;var o=e[0].getChildren().length;let i=Array(r);for(var l=0;l<r;l++)i[l]=Array(o);for(o=0;o<r;o++){l=e[o].getChildren();let s=0;for(let a=0;a<l.length;a++){for(;i[o][s];)s++;let u=l[a],c=u.__rowSpan||1,d=u.__colSpan||1;for(let f=0;f<c;f++)for(let h=0;h<d;h++)i[o+f][s+h]=u;if(t===u)return{colSpan:d,columnIndex:s,rowIndex:o,rowSpan:c};s+=d}}return null}class vd{constructor(t,n,r){this.gridKey=t,this.anchor=n,this.focus=r,this.dirty=!1,this._cachedNodes=null,n._selection=this,r._selection=this}is(t){return Zg(t)?this.gridKey===t.gridKey&&this.anchor.is(t.anchor)&&this.focus.is(t.focus):!1}set(t,n,r){this.dirty=!0,this.gridKey=t,this.anchor.key=n,this.focus.key=r,this._cachedNodes=null}clone(){return new vd(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return Fu(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(t,n){let r=this.focus.getNode();return Vg(r.select(0,r.getChildrenSize())).insertNodes(t,n)}getShape(){var t=$t(this.anchor.key);if(Mn(t)||U(103),t=rp(t),t===null)throw Error("getCellRect: expected to find AnchorNode");var n=$t(this.focus.key);Mn(n)||U(104);let r=rp(n);if(r===null)throw Error("getCellRect: expected to find focusCellNode");n=Math.min(t.columnIndex,r.columnIndex);let o=Math.max(t.columnIndex,r.columnIndex),i=Math.min(t.rowIndex,r.rowIndex);return t=Math.max(t.rowIndex,r.rowIndex),{fromX:Math.min(n,o),fromY:Math.min(i,t),toX:Math.max(n,o),toY:Math.max(i,t)}}getNodes(){function t(S){let{cell:v,startColumn:y,startRow:_}=S;a=Math.min(a,y),u=Math.min(u,_),c=Math.max(c,y+v.__colSpan-1),d=Math.max(d,_+v.__rowSpan-1)}var n=this._cachedNodes;if(n!==null)return n;var r=this.anchor.getNode();n=this.focus.getNode(),r=Tc(r,Mn);var o=Tc(n,Mn);Mn(r)||U(103),Mn(o)||U(104),n=r.getParent(),ya(n)||U(105),n=n.getParent(),rm(n)||U(106);let[i,l,s]=zw(n,r,o),a=Math.min(l.startColumn,s.startColumn),u=Math.min(l.startRow,s.startRow),c=Math.max(l.startColumn+l.cell.__colSpan-1,s.startColumn+s.cell.__colSpan-1),d=Math.max(l.startRow+l.cell.__rowSpan-1,s.startRow+s.cell.__rowSpan-1);r=a,o=u;for(var f=a,h=u;a<r||u<o||c>f||d>h;){if(a<r){var g=h-o;--r;for(var m=0;m<=g;m++)t(i[o+m][r])}if(u<o)for(g=f-r,--o,m=0;m<=g;m++)t(i[o][r+m]);if(c>f)for(g=h-o,f+=1,m=0;m<=g;m++)t(i[o+m][f]);if(d>h)for(g=f-r,h+=1,m=0;m<=g;m++)t(i[h][r+m])}for(n=[n],r=null,o=u;o<=d;o++)for(f=a;f<=c;f++)({cell:h}=i[o][f]),g=h.getParent(),ya(g)||U(107),g!==r&&n.push(g),n.push(h,...Nb(h)),r=g;return Ul()||(this._cachedNodes=n),n}getTextContent(){let t=this.getNodes(),n="";for(let r=0;r<t.length;r++)n+=t[r].getTextContent();return n}}function Zg(e){return e instanceof vd}class Ni{constructor(t,n,r,o){this.anchor=t,this.focus=n,this.dirty=!1,this.format=r,this.style=o,this._cachedNodes=null,t._selection=this,n._selection=this}is(t){return de(t)?this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var t=this._cachedNodes;if(t!==null)return t;t=this.anchor;var n=this.focus,r=t.isBefore(n),o=r?t:n;r=r?n:t,t=o.getNode(),n=r.getNode();let i=o.offset;return o=r.offset,B(t)&&(r=t.getDescendantByIndex(i),t=r??t),B(n)&&(r=n.getDescendantByIndex(o),r!==null&&r!==t&&n.getChildAtIndex(o)===r&&(r=r.getPreviousSibling()),n=r??n),t=t.is(n)?B(t)&&0<t.getChildrenSize()?[]:[t]:t.getNodesBetween(n),Ul()||(this._cachedNodes=t),t}setTextNodeRange(t,n,r,o){ao(this.anchor,t.__key,n,"text"),ao(this.focus,r.__key,o,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let n=t[0],r=t[t.length-1],o=this.anchor,i=this.focus,l=o.isBefore(i),[s,a]=Fu(this),u="",c=!0;for(let d=0;d<t.length;d++){let f=t[d];if(B(f)&&!f.isInline())c||(u+=`
111
+ `),c=!f.isEmpty();else if(c=!1,Q(f)){let h=f.getTextContent();f===n?f===r?(o.type!=="element"||i.type!=="element"||i.offset===o.offset)&&(h=s<a?h.slice(s,a):h.slice(a,s)):h=l?h.slice(s):h.slice(a):f===r&&(h=l?h.slice(0,a):h.slice(0,s)),u+=h}else!Ve(f)&&!ma(f)||f===r&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(t){let n=et(),r=n.getEditorState()._selection;if(t=Iw(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,r),t!==null){var[o,i]=t;ao(this.anchor,o.key,o.offset,o.type),ao(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}}clone(){let t=this.anchor,n=this.focus;return new Ni(new yr(t.key,t.offset,t.type),new yr(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=dw(this.format,t,null),this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){return(this.format&oi[t])!==0}insertRawText(t){t=t.split(/(\r?\n|\t)/);let n=[],r=t.length;for(let o=0;o<r;o++){let i=t[o];i===`
112
+ `||i===`\r
113
+ `?n.push(Tl()):i===" "?n.push(gd()):n.push(Ct(i))}this.insertNodes(n)}insertText(t){var n=this.anchor,r=this.focus,o=this.isCollapsed()||n.isBefore(r),i=this.format,l=this.style;o&&n.type==="element"?Sy(n,r,i,l):o||r.type!=="element"||Sy(r,n,i,l);var s=this.getNodes(),a=s.length,u=o?r:n;r=(o?n:r).offset;var c=u.offset;n=s[0],Q(n)||U(26),o=n.getTextContent().length;var d=n.getParentOrThrow(),f=s[a-1];if(this.isCollapsed()&&r===o&&(n.isSegmented()||n.isToken()||!n.canInsertTextAfter()||!d.canInsertTextAfter()&&n.getNextSibling()===null)){var h=n.getNextSibling();if(Q(h)&&h.canInsertTextBefore()&&!Uh(h)||(h=Ct(),h.setFormat(i),d.canInsertTextAfter()?n.insertAfter(h):d.insertAfter(h)),h.select(0,0),n=h,t!==""){this.insertText(t);return}}else if(this.isCollapsed()&&r===0&&(n.isSegmented()||n.isToken()||!n.canInsertTextBefore()||!d.canInsertTextBefore()&&n.getPreviousSibling()===null)){if(h=n.getPreviousSibling(),(!Q(h)||Uh(h))&&(h=Ct(),h.setFormat(i),d.canInsertTextBefore()?n.insertBefore(h):d.insertBefore(h)),h.select(),n=h,t!==""){this.insertText(t);return}}else if(n.isSegmented()&&r!==o)d=Ct(n.getTextContent()),d.setFormat(i),n.replace(d),n=d;else if(!(this.isCollapsed()||t===""||(h=f.getParent(),d.canInsertTextBefore()&&d.canInsertTextAfter()&&(!B(h)||h.canInsertTextBefore()&&h.canInsertTextAfter())))){this.insertText(""),Lw(this.anchor,this.focus,null),this.insertText(t);return}if(a===1)if(n.isToken())t=Ct(t),t.select(),n.replace(t);else{if(s=n.getFormat(),a=n.getStyle(),r===c&&(s!==i||a!==l))if(n.getTextContent()==="")n.setFormat(i),n.setStyle(l);else{s=Ct(t),s.setFormat(i),s.setStyle(l),s.select(),r===0?n.insertBefore(s,!1):([a]=n.splitText(r),a.insertAfter(s,!1)),s.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length);return}n=n.spliceText(r,c-r,t,!0),n.getTextContent()===""?n.remove():this.anchor.type==="text"&&(n.isComposing()?this.anchor.offset-=t.length:(this.format=s,this.style=a))}else{if(i=new Set([...n.getParentKeys(),...f.getParentKeys()]),h=B(n)?n:n.getParentOrThrow(),l=B(f)?f:f.getParentOrThrow(),d=f,!h.is(l)&&l.isInline())do d=l,l=l.getParentOrThrow();while(l.isInline());if(u.type==="text"&&(c!==0||f.getTextContent()==="")||u.type==="element"&&f.getIndexWithinParent()<c)if(Q(f)&&!f.isToken()&&c!==f.getTextContentSize()){if(f.isSegmented()){var g=Ct(f.getTextContent());f.replace(g),f=g}en(u.getNode())||(f=f.spliceText(0,c,"")),i.add(f.__key)}else u=f.getParentOrThrow(),u.canBeEmpty()||u.getChildrenSize()!==1?f.remove():u.remove();else i.add(f.__key);for(u=l.getChildren(),c=new Set(s),f=h.is(l),h=h.isInline()&&n.getNextSibling()===null?h:n,g=u.length-1;0<=g;g--){let m=u[g];if(m.is(n)||B(m)&&m.isParentOf(n))break;m.isAttached()&&(!c.has(m)||m.is(d)?f||h.insertAfter(m,!1):m.remove())}if(!f)for(u=l,c=null;u!==null;)l=u.getChildren(),f=l.length,(f===0||l[f-1].is(c))&&(i.delete(u.__key),c=u),u=u.getParent();for(n.isToken()?r===o?n.select():(t=Ct(t),t.select(),n.replace(t)):(n=n.spliceText(r,o-r,t,!0),n.getTextContent()===""?n.remove():n.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length)),t=1;t<a;t++)n=s[t],i.has(n.__key)||n.remove()}}removeText(){this.insertText("")}formatText(t){if(this.isCollapsed())this.toggleFormat(t),Mt(null);else{var n=this.getNodes(),r=[];for(var o of n)Q(o)&&r.push(o);var i=r.length;if(i===0)this.toggleFormat(t),Mt(null);else{o=this.anchor;var l=this.focus,s=this.isBackward();n=s?l:o,o=s?o:l;var a=0,u=r[0];if(l=n.type==="element"?0:n.offset,n.type==="text"&&l===u.getTextContentSize()&&(a=1,u=r[1],l=0),u!=null){s=u.getFormatFlags(t,null);var c=i-1,d=r[c];if(i=o.type==="text"?o.offset:d.getTextContentSize(),u.is(d))l!==i&&(l===0&&i===u.getTextContentSize()?u.setFormat(s):(t=u.splitText(l,i),t=l===0?t[0]:t[1],t.setFormat(s),n.type==="text"&&n.set(t.__key,0,"text"),o.type==="text"&&o.set(t.__key,i-l,"text")),this.format=s);else{l!==0&&([,u]=u.splitText(l),l=0),u.setFormat(s);var f=d.getFormatFlags(t,s);for(0<i&&(i!==d.getTextContentSize()&&([d]=d.splitText(i)),d.setFormat(f)),a+=1;a<c;a++){let h=r[a];if(!h.isToken()){let g=h.getFormatFlags(t,f);h.setFormat(g)}}n.type==="text"&&n.set(u.__key,l,"text"),o.type==="text"&&o.set(d.__key,i,"text"),this.format=s|f}}}}}insertNodes(t,n){if(!this.isCollapsed()){var r=this.isBackward()?this.anchor:this.focus,o=r.getNode().getNextSibling();if(o=o?o.getKey():null,r=(r=r.getNode().getPreviousSibling())?r.getKey():null,this.removeText(),this.isCollapsed()&&this.focus.type==="element"){if(this.focus.key===o&&this.focus.offset===0){var i=Ct();this.focus.getNode().insertBefore(i)}else this.focus.key===r&&this.focus.offset===this.focus.getNode().getChildrenSize()&&(i=Ct(),this.focus.getNode().insertAfter(i));i&&(this.focus.set(i.__key,0,"text"),this.anchor.set(i.__key,0,"text"))}}i=this.anchor,r=i.offset;var l=i.getNode();o=l,i.type==="element"&&(i=i.getNode(),o=i.getChildAtIndex(r-1),o=o===null?i:o),i=[];var s=l.getNextSiblings(),a=Zn(l)?null:l.getTopLevelElementOrThrow();if(Q(l))if(o=l.getTextContent().length,r===0&&o!==0)o=l.getPreviousSibling(),o=o!==null?o:l.getParentOrThrow(),i.push(l);else if(r===o)o=l;else{if(l.isToken())return!1;[o,l]=l.splitText(r),i.push(l)}l=o,i.push(...s),s=t[0];var u=!1,c=null;for(let g=0;g<t.length;g++){var d=t[g];if(Zn(o)||Ve(o)||!B(d)||d.isInline())u&&!B(d)&&!Ve(d)&&Zn(o.getParent())&&U(28);else{if(d.is(s)){if(B(o)&&o.isEmpty()&&o.canReplaceWith(d)){o.replace(d),o=d,u=!0;continue}if(u=d.getFirstDescendant(),fw(u)){for(var f=u.getParentOrThrow();f.isInline();)f=f.getParentOrThrow();if(c=f.getChildren(),u=c.length,B(o)){var h=o.getFirstChild();for(let m=0;m<u;m++){let S=c[m];h===null?o.append(S):h.insertAfter(S),h=S}}else{for(h=u-1;0<=h;h--)o.insertAfter(c[h]);o=o.getParentOrThrow()}if(c=c[u-1],f.remove(),u=!0,f.is(d))continue}}Q(o)&&(a===null&&U(27),o=a)}u=!1,B(o)&&!o.isInline()?(c=d,Ve(d)&&!d.isInline()?o=t.length===1&&o.canBeEmpty()&&o.isEmpty()?o.insertBefore(d,!1):o.insertAfter(d,!1):B(d)?(d.canBeEmpty()||!d.isEmpty())&&(en(o)?(f=o.getChildAtIndex(r),f!==null?f.insertBefore(d):o.append(d),o=d):d.isInline()?(o.append(d),o=d):o=o.insertAfter(d,!1)):(f=o.getFirstChild(),f!==null?f.insertBefore(d):o.append(d),o=d)):!B(d)||B(d)&&d.isInline()||Ve(o)&&!o.isInline()?(c=d,de(this)&&Ve(d)&&(B(o)||Q(o))&&!d.isInline()?(Q(o)?(f=o.getParentOrThrow(),[o]=o.splitText(r),o=o.getIndexWithinParent()+1):(f=o,o=r),[,o]=ww(f,o),o=o.insertBefore(d)):o=o.insertAfter(d,!1)):(d=o.getParentOrThrow(),ma(o)&&o.remove(),o=d,g--)}if(n&&(Q(l)?l.select():(t=o.getPreviousSibling(),Q(t)?t.select():(t=o.getIndexWithinParent(),o.getParentOrThrow().select(t,t)))),B(o)){if(t=Q(c)?c:B(c)&&c.isInline()?c.getLastDescendant():o.getLastDescendant(),n||(t===null?o.select():Q(t)?t.getTextContent()===""?t.selectPrevious():t.select():t.selectNext()),i.length!==0)for(n=o,t=i.length-1;0<=t;t--)r=i[t],a=r.getParentOrThrow(),!B(o)||op(r)||Ve(r)&&(!r.isInline()||r.isIsolated())?B(o)||op(r)?B(r)&&!r.canInsertAfter(o)?(l=a.constructor.clone(a),B(l)||U(29),l.append(r),o.insertAfter(l)):o.insertAfter(r):(o.insertBefore(r),o=r):(n===o?o.append(r):o.insertBefore(r),o=r),a.isEmpty()&&!a.canBeEmpty()&&a.remove()}else n||(Q(o)?o.select():(n=o.getParentOrThrow(),t=o.getIndexWithinParent()+1,n.select(t,t)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var t=this.anchor,n=t.offset,r=[];if(t.type==="text"){var o=t.getNode(),i=o.getNextSiblings().reverse(),l=o.getParentOrThrow(),s=l.isInline(),a=s?l.getTextContentSize():o.getTextContentSize();n===0?i.push(o):(s&&(r=l.getNextSiblings()),n===a||s&&n===o.getTextContentSize()||([,o]=o.splitText(n),i.push(o)))}else{if(l=t.getNode(),Zn(l)){i=gi(),r=l.getChildAtIndex(n),i.select(),r!==null?r.insertBefore(i,!1):l.append(i);return}i=l.getChildren().slice(n).reverse()}if(o=i.length,n===0&&0<o&&l.isInline()){if(r=l.getParentOrThrow(),i=r.insertNewAfter(this,!1),B(i))for(r=r.getChildren(),l=0;l<r.length;l++)i.append(r[l])}else if(s=l.insertNewAfter(this,!1),s===null)this.insertLineBreak();else if(B(s))if(a=l.getFirstChild(),n===0&&(l.is(t.getNode())||a&&a.is(t.getNode()))&&0<o)l.insertBefore(s);else{if(l=null,n=r.length,t=s.getParentOrThrow(),0<n)for(a=0;a<n;a++)t.append(r[a]);if(o!==0)for(r=0;r<o;r++)n=i[r],l===null?s.append(n):l.insertBefore(n),l=n;s.canBeEmpty()||s.getChildrenSize()!==0?s.selectStart():(s.selectPrevious(),s.remove())}}insertLineBreak(t){let n=Tl();var r=this.anchor;r.type==="element"&&(r=r.getNode(),en(r)&&this.insertParagraph()),t?this.insertNodes([n],!0):this.insertNodes([n])&&n.selectNext(0,0)}getCharacterOffsets(){return Fu(this)}extract(){var t=this.getNodes(),n=t.length,r=n-1,o=this.anchor;let i=this.focus;var l=t[0];let s=t[r],[a,u]=Fu(this);return n===0?[]:n===1?Q(l)&&!this.isCollapsed()?(t=a>u?u:a,r=l.splitText(t,a>u?a:u),t=t===0?r[0]:r[1],t!=null?[t]:[]):[l]:(n=o.isBefore(i),Q(l)&&(o=n?a:u,o===l.getTextContentSize()?t.shift():o!==0&&([,l]=l.splitText(o),t[0]=l)),Q(s)&&(l=s.getTextContent().length,n=n?u:a,n===0?t.pop():n!==l&&([s]=s.splitText(n),t[r]=s)),t)}modify(t,n,r){var o=this.focus,i=this.anchor,l=t==="move",s=Vh(o,n);if(Ve(s)&&!s.isIsolated())l&&s.isKeyboardSelectable()?(n=ip(),n.add(s.__key),vr(n)):(t=n?s.getPreviousSibling():s.getNextSibling(),Q(t)?(s=t.__key,n=n?t.getTextContent().length:0,o.set(s,n,"text"),l&&i.set(s,n,"text")):(r=s.getParentOrThrow(),B(t)?(r=t.__key,s=n?t.getChildrenSize():0):(s=s.getIndexWithinParent(),r=r.__key,n||s++),o.set(r,s,"element"),l&&i.set(r,s,"element")));else if(i=et(),o=Cr(i._window)){var a=i._blockCursorElement,u=i._rootElement;if(u===null||a===null||!B(s)||s.isInline()||s.canBeEmpty()||Hh(a,i,u),o.modify(t,n?"backward":"forward",r),0<o.rangeCount&&(s=o.getRangeAt(0),i=this.anchor.getNode(),i=en(i)?i:xw(i),this.applyDOMRange(s),this.dirty=!0,!l)){for(l=this.getNodes(),t=[],r=!1,a=0;a<l.length;a++)u=l[a],kc(u,i)?t.push(u):r=!0;r&&0<t.length&&(n?(n=t[0],B(n)?n.selectStart():n.getParentOrThrow().selectStart()):(n=t[t.length-1],B(n)?n.selectEnd():n.getParentOrThrow().selectEnd())),(o.anchorNode!==s.startContainer||o.anchorOffset!==s.startOffset)&&(n=this.focus,l=this.anchor,o=l.key,s=l.offset,i=l.type,ao(l,n.key,n.offset,n.type),ao(n,o,s,i),this._cachedNodes=null)}}}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){var r=this.anchor,o=this.focus,i=r.getNode();if(!t&&(r.type==="element"&&B(i)&&r.offset===i.getChildrenSize()||r.type==="text"&&r.offset===i.getTextContentSize())){var l=i.getParent();if(l=i.getNextSibling()||(l===null?null:l.getNextSibling()),B(l)&&l.isShadowRoot())return}if(l=Vh(o,t),Ve(l)&&!l.isIsolated()){l.isKeyboardSelectable()&&B(i)&&i.getChildrenSize()===0?(i.remove(),t=ip(),t.add(l.__key),vr(t)):(l.remove(),et().dispatchCommand(ad,void 0));return}if(!t&&B(l)&&B(i)&&i.isEmpty()){i.remove(),l.selectStart();return}if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&r.offset===0&&(r.type==="element"?r.getNode():r.getNode().getParentOrThrow()).collapseAtStart(this))return}else{if(l=o.type==="text"?o.getNode():null,i=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){if(r=o.offset,o=l.getTextContentSize(),l.is(i)||t&&r!==o||!t&&r!==0){Ey(l,t,r);return}}else if(i!==null&&i.isSegmented()&&(r=r.offset,o=i.getTextContentSize(),i.is(l)||t&&r!==0||!t&&r!==o)){Ey(i,t,r);return}if(i=this.anchor,l=this.focus,r=i.getNode(),o=l.getNode(),r===o&&i.type==="text"&&l.type==="text"){var s=i.offset,a=l.offset;let u=s<a;o=u?s:a,a=u?a:s,s=a-1,o!==s&&(r=r.getTextContent().slice(o,a),mw(r)||(t?l.offset=s:i.offset=s))}}}this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0&&(t=this.anchor.getNode(),t.isEmpty()&&en(t.getParent())&&t.getIndexWithinParent()===0&&t.collapseAtStart(this))}deleteLine(t){this.isCollapsed()&&(this.anchor.type==="text"&&this.modify("extend",t,"lineboundary"),(t?this.focus:this.anchor).offset===0&&this.modify("extend",t,"character")),this.removeText()}deleteWord(t){this.isCollapsed()&&this.modify("extend",t,"word"),this.removeText()}}function Bl(e){return e instanceof md}function Cy(e){let t=e.offset;return e.type==="text"?t:(e=e.getNode(),t===e.getChildrenSize()?e.getTextContent().length:0)}function Fu(e){let t=e.anchor;return e=e.focus,t.type==="element"&&e.type==="element"&&t.key===e.key&&t.offset===e.offset?[0,0]:[Cy(t),Cy(e)]}function Ey(e,t,n){let r=e.getTextContent().split(/(?=\s)/g),o=r.length,i=0,l=0;for(let s=0;s<o;s++){let a=r[s],u=s===o-1;if(l=i,i+=a.length,t&&i===n||i>n||u){r.splice(s,1),u&&(l=void 0);break}}t=r.join("").trim(),t===""?e.remove():(e.setTextContent(t),e.select(l,l))}function $y(e,t,n,r){var o=t;if(e.nodeType===1){let s=!1;var i=e.childNodes,l=i.length;o===l&&(s=!0,o=l-1);let a=i[o];if(l=!1,a===r._blockCursorElement?(a=i[o+1],l=!0):r._blockCursorElement!==null&&o--,r=tl(a),Q(r))o=s?r.getTextContentSize():0;else{if(i=tl(e),i===null)return null;if(B(i)?(e=i.getChildAtIndex(o),(t=B(e))&&(t=e.getParent(),t=n===null||t===null||!t.canBeEmpty()||t!==n.getNode()),t&&(n=s?e.getLastDescendant():e.getFirstDescendant(),n===null?(i=e,o=0):(e=n,i=B(e)?e:e.getParentOrThrow())),Q(e)?(r=e,i=null,o=s?e.getTextContentSize():0):e!==i&&s&&!l&&o++):(o=i.getIndexWithinParent(),o=t===0&&Ve(i)&&tl(e)===i?o:o+1,i=i.getParentOrThrow()),B(i))return new yr(i.__key,o,"element")}}else r=tl(e);return Q(r)?new yr(r.__key,o,"text"):null}function ky(e,t,n){var r=e.offset,o=e.getNode();r===0?(r=o.getPreviousSibling(),o=o.getParent(),t?(n||!t)&&r===null&&B(o)&&o.isInline()&&(t=o.getPreviousSibling(),Q(t)&&(e.key=t.__key,e.offset=t.getTextContent().length)):B(r)&&!n&&r.isInline()?(e.key=r.__key,e.offset=r.getChildrenSize(),e.type="element"):Q(r)&&(e.key=r.__key,e.offset=r.getTextContent().length)):r===o.getTextContent().length&&(r=o.getNextSibling(),o=o.getParent(),t&&B(r)&&r.isInline()?(e.key=r.__key,e.offset=0,e.type="element"):(n||t)&&r===null&&B(o)&&o.isInline()&&!o.canInsertTextAfter()&&(t=o.getNextSibling(),Q(t)&&(e.key=t.__key,e.offset=0)))}function Lw(e,t,n){if(e.type==="text"&&t.type==="text"){var r=e.isBefore(t);let o=e.is(t);ky(e,r,o),ky(t,!r,o),o&&(t.key=e.key,t.offset=e.offset,t.type=e.type),r=et(),r.isComposing()&&r._compositionKey!==e.key&&de(n)&&(r=n.anchor,n=n.focus,ao(e,r.key,r.offset,r.type),ao(t,n.key,n.offset,n.type))}}function Iw(e,t,n,r,o,i){return e===null||n===null||!Aa(o,e,n)||(t=$y(e,t,de(i)?i.anchor:null,o),t===null)||(r=$y(n,r,de(i)?i.focus:null,o),r===null||t.type==="element"&&r.type==="element"&&(e=tl(e),n=tl(n),Ve(e)&&Ve(n)))?null:(Lw(t,r,i),[t,r])}function op(e){return B(e)&&!e.isInline()}function jw(e,t,n,r,o,i){let l=Er();return e=new Ni(new yr(e,t,o),new yr(n,r,i),0,""),e.dirty=!0,l._selection=e}function ip(){return new md(new Set)}function Hb(e){let t=e.getEditorState()._selection,n=Cr(e._window);return Bl(t)||Zg(t)?t.clone():qg(t,n,e)}function qg(e,t,n){var r=n._window;if(r===null)return null;var o=r.event,i=o?o.type:void 0;r=i==="selectionchange",o=!Wh&&(r||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let l;if(!de(e)||o){if(t===null)return null;if(o=t.anchorNode,i=t.focusNode,l=t.anchorOffset,t=t.focusOffset,r&&de(e)&&!Aa(n,o,i))return e.clone()}else return e.clone();if(n=Iw(o,l,i,t,n,e),n===null)return null;let[s,a]=n;return new Ni(s,a,de(e)?e.format:0,de(e)?e.style:"")}function Ke(){return Er()._selection}function Wl(){return et()._editorState._selection}function bc(e,t,n,r=1){var o=e.anchor,i=e.focus,l=o.getNode(),s=i.getNode();if(t.is(l)||t.is(s)){if(l=t.__key,e.isCollapsed())t=o.offset,(n<=t&&0<r||n<t&&0>r)&&(n=Math.max(0,t+r),o.set(l,n,"element"),i.set(l,n,"element"),Ty(e));else{let u=e.isBackward();s=u?i:o;var a=s.getNode();o=u?o:i,i=o.getNode(),t.is(a)&&(a=s.offset,(n<=a&&0<r||n<a&&0>r)&&s.set(l,Math.max(0,a+r),"element")),t.is(i)&&(t=o.offset,(n<=t&&0<r||n<t&&0>r)&&o.set(l,Math.max(0,t+r),"element"))}Ty(e)}}function Ty(e){var t=e.anchor,n=t.offset;let r=e.focus;var o=r.offset,i=t.getNode(),l=r.getNode();if(e.isCollapsed())B(i)&&(l=i.getChildrenSize(),l=(o=n>=l)?i.getChildAtIndex(l-1):i.getChildAtIndex(n),Q(l)&&(n=0,o&&(n=l.getTextContentSize()),t.set(l.__key,n,"text"),r.set(l.__key,n,"text")));else{if(B(i)){let s=i.getChildrenSize();n=(e=n>=s)?i.getChildAtIndex(s-1):i.getChildAtIndex(n),Q(n)&&(i=0,e&&(i=n.getTextContentSize()),t.set(n.__key,i,"text"))}B(l)&&(n=l.getChildrenSize(),o=(t=o>=n)?l.getChildAtIndex(n-1):l.getChildAtIndex(o),Q(o)&&(l=0,t&&(l=o.getTextContentSize()),r.set(o.__key,l,"text")))}}function Kb(e,t){if(t=t.getEditorState()._selection,e=e._selection,de(e)){var n=e.anchor;let r=e.focus,o;n.type==="text"&&(o=n.getNode(),o.selectionTransform(t,e)),r.type==="text"&&(n=r.getNode(),o!==n&&n.selectionTransform(t,e))}}function Rc(e,t,n,r,o){let i=null,l=0,s=null;r!==null?(i=r.__key,Q(r)?(l=r.getTextContentSize(),s="text"):B(r)&&(l=r.getChildrenSize(),s="element")):o!==null&&(i=o.__key,Q(o)?s="text":B(o)&&(s="element")),i!==null&&s!==null?e.set(i,l,s):(l=t.getIndexWithinParent(),l===-1&&(l=n.getChildrenSize()),e.set(n.__key,l,"element"))}function Ny(e,t,n,r,o){e.type==="text"?(e.key=n,t||(e.offset+=o)):e.offset>r.getIndexWithinParent()&&--e.offset}function zw(e,t,n){let r=[],o=null,i=null;e=e.getChildren();for(let c=0;c<e.length;c++){var l=e[c];ya(l)||U(108);var s=l.getChildren();l=0;for(let d of s){for(Mn(d)||U(109);r[c]!==void 0&&r[c][l]!==void 0;)l++;s=c;var a=l,u=d;let f={cell:u,startColumn:a,startRow:s},h=u.__rowSpan,g=u.__colSpan;for(let m=0;m<h;m++){r[s+m]===void 0&&(r[s+m]=[]);for(let S=0;S<g;S++)r[s+m][a+S]=f}t.is(u)&&(o=f),n.is(u)&&(i=f),l+=d.__colSpan}}return o===null&&U(110),i===null&&U(111),[r,o,i]}function Fw(e){e instanceof nm||(e instanceof La?(e=Tc(e,Mn),Mn(e)||U(114)):(e=Tc(e.getNode(),Mn),Mn(e)||U(114)));let t=e.getParent();ya(t)||U(115);let n=t.getParent();return rm(n)||U(116),[e,t,n]}let kt=null,Tt=null,pn=!1,Cf=!1,va=0,by={characterData:!0,childList:!0,subtree:!0};function Ul(){return pn||kt!==null&&kt._readOnly}function Zt(){pn&&U(13)}function Er(){return kt===null&&U(15),kt}function et(){return Tt===null&&U(16),Tt}function Ry(e,t,n){var r=t.__type;let o=e._nodes.get(r);for(o===void 0&&U(30,r),e=n.get(r),e===void 0&&(e=Array.from(o.transforms),n.set(r,e)),n=e.length,r=0;r<n&&(e[r](t),t.isAttached());r++);}function Gb(e,t){t=t._dirtyLeaves,e=e._nodeMap;for(let n of t)t=e.get(n),Q(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&cw(t)}function Yb(e,t){let n=t._dirtyLeaves,r=t._dirtyElements;e=e._nodeMap;let o=mo(),i=new Map;var l=n;let s=l.size;for(var a=r,u=a.size;0<s||0<u;){if(0<s){t._dirtyLeaves=new Set;for(let c of l)l=e.get(c),Q(l)&&l.isAttached()&&l.isSimpleText()&&!l.isUnmergeable()&&cw(l),l!==void 0&&l!==void 0&&l.__key!==o&&l.isAttached()&&Ry(t,l,i),n.add(c);if(l=t._dirtyLeaves,s=l.size,0<s){va++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map;for(let c of a)a=c[0],u=c[1],(a==="root"||u)&&(l=e.get(a),l!==void 0&&l!==void 0&&l.__key!==o&&l.isAttached()&&Ry(t,l,i),r.set(a,u));l=t._dirtyLeaves,s=l.size,a=t._dirtyElements,u=a.size,va++}t._dirtyLeaves=n,t._dirtyElements=r}function em(e,t){var n=e.type,r=t.get(n);if(r===void 0&&U(17,n),n=r.klass,e.type!==n.getType()&&U(18,n.name),n=n.importJSON(e),e=e.children,B(n)&&Array.isArray(e))for(r=0;r<e.length;r++){let o=em(e[r],t);n.append(o)}return n}function Py(e,t){let n=kt,r=pn,o=Tt;kt=e,pn=!0,Tt=null;try{return t()}finally{kt=n,pn=r,Tt=o}}function li(e,t){let n=e._pendingEditorState,r=e._rootElement,o=e._headless||r===null;if(n!==null){var i=e._editorState,l=i._selection,s=n._selection,a=e._dirtyType!==0,u=kt,c=pn,d=Tt,f=e._updating,h=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=n,!o&&a&&h!==null){Tt=e,kt=n,pn=!1,e._updating=!0;try{let Te=e._dirtyType,ft=e._dirtyElements,ht=e._dirtyLeaves;h.disconnect();var m=Te,S=ft,v=ht;Jt=Or=gt="",Cw=m===2,Iu=null,Ht=e,Ro=e._config,ha=e._nodes,pd=Ht._listeners.mutation,Kh=S,Gh=v,pi=i._nodeMap,Po=n._nodeMap,Jg=n._readOnly,Yh=new Map(e._keyToDOMMap);let _t=new Map;pa=_t,_s("root",null),pa=Yh=Ro=Po=pi=Gh=Kh=ha=Ht=void 0,g=_t}catch(Te){if(Te instanceof Error&&e._onError(Te),Cf)throw Te;Vw(e,null,r,n),uw(e),e._dirtyType=2,Cf=!0,li(e,i),Cf=!1;return}finally{h.observe(r,by),e._updating=f,kt=u,pn=c,Tt=d}}n._readOnly||(n._readOnly=!0);var y=e._dirtyLeaves,_=e._dirtyElements,w=e._normalizedNodes,C=e._updateTags,$=e._deferred;a&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set);var E=e._decorators,T=e._pendingDecorators||E,M=n._nodeMap,R;for(R in T)M.has(R)||(T===E&&(T=gw(e)),delete T[R]);var j=o?null:Cr(e._window);if(e._editable&&j!==null&&(a||s===null||s.dirty)){Tt=e,kt=n;try{if(h!==null&&h.disconnect(),a||s===null||s.dirty){let Te=e._blockCursorElement;Te!==null&&Hh(Te,e,r);e:{let ft=j.anchorNode,ht=j.focusNode,_t=j.anchorOffset,gn=j.focusOffset,It=document.activeElement;if(!(C.has("collaboration")&&It!==r||It!==null&&Hg(It)))if(de(s)){var F=s.anchor,ae=s.focus,H=F.key,X=ae.key,P=$c(e,H),O=$c(e,X),k=F.offset,I=ae.offset,L=s.format,V=s.style,te=s.isCollapsed(),ye=P,fe=O,Oe=!1;if(F.type==="text"){ye=Sc(P);let wt=F.getNode();Oe=wt.getFormat()!==L||wt.getStyle()!==V}else de(l)&&l.anchor.type==="text"&&(Oe=!0);if(ae.type==="text"&&(fe=Sc(O)),ye!==null&&fe!==null){if(te&&(l===null||Oe||de(l)&&(l.format!==L||l.style!==V))){var be=performance.now();Pw=[L,V,k,H,be]}if(_t===k&&gn===I&&ft===ye&&ht===fe&&(j.type!=="Range"||!te)&&(It!==null&&r.contains(It)||r.focus({preventScroll:!0}),F.type!=="element"))break e;try{j.setBaseAndExtent(ye,k,fe,I)}catch{}if(!C.has("skip-scroll-into-view")&&s.isCollapsed()&&r!==null&&r===document.activeElement){let wt=s instanceof Ni&&s.anchor.type==="element"?ye.childNodes[k]||null:0<j.rangeCount?j.getRangeAt(0):null;if(wt!==null){let Ot;if(wt instanceof Text){let zt=document.createRange();zt.selectNode(wt),Ot=zt.getBoundingClientRect()}else Ot=wt.getBoundingClientRect();let or=r.ownerDocument,jt=or.defaultView;if(jt!==null)for(var{top:Z,bottom:ke}=Ot,ce,_e,me=r;me!==null;){let zt=me===or.body;if(zt)ce=0,_e=fd(e).innerHeight;else{let Wo=me.getBoundingClientRect();ce=Wo.top,_e=Wo.bottom}let ir=0;if(Z<ce?ir=-(ce-Z):ke>_e&&(ir=ke-_e),ir!==0)if(zt)jt.scrollBy(0,ir);else{let Wo=me.scrollTop;me.scrollTop+=ir;let Wa=me.scrollTop-Wo;Z-=Wa,ke-=Wa}if(zt)break;me=dd(me)}}}qh=!0}}else l!==null&&Aa(e,ft,ht)&&j.removeAllRanges()}}e:{let Te=e._blockCursorElement;if(de(s)&&s.isCollapsed()&&s.anchor.type==="element"&&r.contains(document.activeElement)){let ft=s.anchor,ht=ft.getNode(),_t=ft.offset,gn=ht.getChildrenSize(),It=!1,wt=null;if(_t===gn){let Ot=ht.getChildAtIndex(_t-1);mf(Ot)&&(It=!0)}else{let Ot=ht.getChildAtIndex(_t);if(mf(Ot)){let or=Ot.getPreviousSibling();(or===null||mf(or))&&(It=!0,wt=e.getElementByKey(Ot.__key))}}if(It){let Ot=e.getElementByKey(ht.__key);if(Te===null){let or=e._config.theme,jt=document.createElement("div");jt.contentEditable="false",jt.setAttribute("data-lexical-cursor","true");let zt=or.blockCursor;if(zt!==void 0){if(typeof zt=="string"){let ir=zt.split(" ");zt=or.blockCursor=ir}zt!==void 0&&jt.classList.add(...zt)}e._blockCursorElement=Te=jt}r.style.caretColor="transparent",wt===null?Ot.appendChild(Te):Ot.insertBefore(Te,wt);break e}}Te!==null&&Hh(Te,e,r)}h!==null&&h.observe(r,by)}finally{Tt=d,kt=u}}if(g!==null){var $e=g;let Te=Array.from(e._listeners.mutation),ft=Te.length;for(let ht=0;ht<ft;ht++){let[_t,gn]=Te[ht],It=$e.get(gn);It!==void 0&&_t(It,{dirtyLeaves:y,prevEditorState:i,updateTags:C})}}de(s)||s===null||l!==null&&l.is(s)||e.dispatchCommand(ad,void 0);var Be=e._pendingDecorators;Be!==null&&(e._decorators=Be,e._pendingDecorators=null,Fs("decorator",e,!0,Be));var Pt=py(t||i),sn=py(n);if(Pt!==sn&&Fs("textcontent",e,!0,sn),Fs("update",e,!0,{dirtyElements:_,dirtyLeaves:y,editorState:n,normalizedNodes:w,prevEditorState:t||i,tags:C}),e._deferred=[],$.length!==0){let Te=e._updating;e._updating=!0;try{for(let ft=0;ft<$.length;ft++)$[ft]()}finally{e._updating=Te}}var Rn=e._updates;if(Rn.length!==0){let Te=Rn.shift();if(Te){let[ft,ht]=Te;Bw(e,ft,ht)}}}}function Fs(e,t,n,...r){let o=t._updating;t._updating=n;try{let i=Array.from(t._listeners[e]);for(e=0;e<i.length;e++)i[e].apply(null,r)}finally{t._updating=o}}function Y(e,t,n){if(e._updating===!1||Tt!==e){let i=!1;return e.update(()=>{i=Y(e,t,n)}),i}let r=Gg(e);for(let i=4;0<=i;i--)for(let l=0;l<r.length;l++){var o=r[l]._commands.get(t);if(o!==void 0&&(o=o[i],o!==void 0)){o=Array.from(o);let s=o.length;for(let a=0;a<s;a++)if(o[a](n,e)===!0)return!0}}return!1}function Oy(e,t){let n=e._updates;for(t=t||!1;n.length!==0;){var r=n.shift();if(r){let[o,i]=r,l;i!==void 0&&(r=i.onUpdate,l=i.tag,i.skipTransforms&&(t=!0),r&&e._deferred.push(r),l&&e._updateTags.add(l)),o()}}return t}function Bw(e,t,n){let r=e._updateTags;var o,i=o=!1;if(n!==void 0){var l=n.onUpdate;o=n.tag,o!=null&&r.add(o),o=n.skipTransforms||!1,i=n.discrete||!1}l&&e._deferred.push(l),n=e._editorState,l=e._pendingEditorState;let s=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=new yd(new Map((l||n)._nodeMap)),s=!0),l._flushSync=i,i=kt;let a=pn,u=Tt,c=e._updating;kt=l,pn=!1,e._updating=!0,Tt=e;try{s&&(e._headless?n._selection!=null&&(l._selection=n._selection.clone()):l._selection=Hb(e));let d=e._compositionKey;t(),o=Oy(e,o),Kb(l,e),e._dirtyType!==0&&(o?Gb(l,e):Yb(l,e),Oy(e),bb(n,l,e._dirtyLeaves,e._dirtyElements)),d!==e._compositionKey&&(l._flushSync=!0);let f=l._selection;if(de(f)){let h=l._nodeMap,g=f.focus.key;h.get(f.anchor.key)!==void 0&&h.get(g)!==void 0||U(19)}else Bl(f)&&f._nodes.size===0&&(l._selection=null)}catch(d){d instanceof Error&&e._onError(d),e._pendingEditorState=n,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),li(e);return}finally{kt=i,pn=a,Tt=u,e._updating=c,va=0}e._dirtyType!==0||Xb(l,e)?l._flushSync?(l._flushSync=!1,li(e)):s&&$b(()=>{li(e)}):(l._flushSync=!1,s&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function kn(e,t,n){e._updating?e._updates.push([t,n]):Bw(e,t,n)}class Ww extends La{constructor(t){super(t)}decorate(){U(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Ve(e){return e instanceof Ww}class bi extends La{constructor(t){super(t),this.__last=this.__first=null,this.__indent=this.__format=this.__size=0,this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let t=this.getFormat();return xb[t]||""}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=et()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(Q(n)&&t.push(n),B(n)){let r=n.getAllTextNodes();t.push(...r)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;t!==null;){if(B(t)){let n=t.getFirstChild();if(n!==null){t=n;continue}}break}return t}getLastDescendant(){let t=this.getLastChild();for(;t!==null;){if(B(t)){let n=t.getLastChild();if(n!==null){t=n;continue}}break}return t}getDescendantByIndex(t){let n=this.getChildren(),r=n.length;return t>=r?(t=n[r-1],B(t)&&t.getLastDescendant()||t||null):(t=n[t],B(t)&&t.getFirstDescendant()||t||null)}getFirstChild(){let t=this.getLatest().__first;return t===null?null:$t(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&U(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:$t(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&U(96,this.__key),t}getChildAtIndex(t){var n=this.getChildrenSize();let r;if(t<n/2){for(r=this.getFirstChild(),n=0;r!==null&&n<=t;){if(n===t)return r;r=r.getNextSibling(),n++}return null}for(r=this.getLastChild(),--n;r!==null&&n>=t;){if(n===t)return r;r=r.getPreviousSibling(),n--}return null}getTextContent(){let t="",n=this.getChildren(),r=n.length;for(let o=0;o<r;o++){let i=n[o];t+=i.getTextContent(),B(i)&&o!==r-1&&!i.isInline()&&(t+=`
114
+
115
+ `)}return t}getTextContentSize(){let t=0,n=this.getChildren(),r=n.length;for(let o=0;o<r;o++){let i=n[o];t+=i.getTextContentSize(),B(i)&&o!==r-1&&!i.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}hasFormat(t){return t!==""?(t=cy[t],(this.getFormat()&t)!==0):!1}select(t,n){Zt();let r=Ke(),o=t,i=n;var l=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){if(t=this.getFirstChild(),Q(t)||B(t))return t.select(0,0)}else if(!(t!==void 0&&t!==l||n!==void 0&&n!==l)&&(t=this.getLastChild(),Q(t)||B(t)))return t.select()}if(o===void 0&&(o=l),i===void 0&&(i=l),l=this.__key,de(r))r.anchor.set(l,o,"element"),r.focus.set(l,i,"element"),r.dirty=!0;else return jw(l,o,l,i,"element","element");return r}selectStart(){let t=this.getFirstDescendant();return B(t)||Q(t)?t.select(0,0):t!==null?t.selectPrevious():this.select(0,0)}selectEnd(){let t=this.getLastDescendant();return B(t)||Q(t)?t.select():t!==null?t.selectNext():this.select()}clear(){let t=this.getWritable();return this.getChildren().forEach(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?cy[t]:0,this}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,r){let o=r.length,i=this.getChildrenSize(),l=this.getWritable(),s=l.__key;var a=[],u=[];let c=this.getChildAtIndex(t+n),d=null,f=i-n+o;if(t!==0)if(t===i)d=this.getLastChild();else{var h=this.getChildAtIndex(t);h!==null&&(d=h.getPreviousSibling())}if(0<n){var g=d===null?this.getFirstChild():d.getNextSibling();for(h=0;h<n;h++){g===null&&U(100);var m=g.getNextSibling(),S=g.__key;g=g.getWritable(),ii(g),u.push(S),g=m}}for(h=d,m=0;m<o;m++){S=r[m],h!==null&&S.is(h)&&(d=h=h.getPreviousSibling()),g=S.getWritable(),g.__parent===s&&f--,ii(g);let v=S.__key;h===null?(l.__first=v,g.__prev=null):(h=h.getWritable(),h.__next=v,g.__prev=h.__key),S.__key===s&&U(76),g.__parent=s,a.push(v),h=S}if(t+n===i?h!==null&&(h.getWritable().__next=null,l.__last=h.__key):c!==null&&(t=c.getWritable(),h!==null?(n=h.getWritable(),t.__prev=h.__key,n.__next=c.__key):t.__prev=null),l.__size=f,u.length&&(t=Ke(),de(t))){u=new Set(u),a=new Set(a);let{anchor:v,focus:y}=t;Ay(v,u,a)&&Rc(v,v.getNode(),this,d,c),Ay(y,u,a)&&Rc(y,y.getNode(),this,d,c),f!==0||this.canBeEmpty()||Zn(this)||this.remove()}return l}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function B(e){return e instanceof bi}function Ay(e,t,n){for(e=e.getNode();e;){let r=e.__key;if(t.has(r)&&!n.has(r))return!0;e=e.getParent()}return!1}class Vl extends bi{static getType(){return"root"}static clone(){return new Vl}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){U(51)}getTextContent(){let t=this.__cachedText;return!Ul()&&et()._dirtyType!==0||t===null?super.getTextContent():t}remove(){U(52)}replace(){U(53)}insertBefore(){U(54)}insertAfter(){U(55)}updateDOM(){return!1}append(...t){for(let n=0;n<t.length;n++){let r=t[n];B(r)||Ve(r)||U(56)}return super.append(...t)}static importJSON(t){let n=Sr();return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function en(e){return e instanceof Vl}function Xb(e,t){if(t=t.getEditorState()._selection,e=e._selection,e!==null){if(e.dirty||!e.is(t))return!0}else if(t!==null)return!0;return!1}function tm(){return new yd(new Map([["root",new Vl]]))}function Uw(e){let t=e.exportJSON();var n=e.constructor;t.type!==n.getType()&&U(130,n.name);let r=t.children;if(B(e))for(Array.isArray(r)||U(59,n.name),e=e.getChildren(),n=0;n<e.length;n++){let o=Uw(e[n]);r.push(o)}return t}class yd{constructor(t,n){this._nodeMap=t,this._selection=n||null,this._readOnly=this._flushSync=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t){return Py(this,t)}clone(t){return t=new yd(this._nodeMap,t===void 0?this._selection:t),t._readOnly=!0,t}toJSON(){return Py(this,()=>({root:Uw(Sr())}))}}class Hl extends bi{static getType(){return"paragraph"}static clone(t){return new Hl(t.__key)}createDOM(t){let n=document.createElement("p");return t=Is(t.theme,"paragraph"),t!==void 0&&n.classList.add(...t),n}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Qb,priority:0})}}exportDOM(t){if({element:t}=super.exportDOM(t),t&&hd(t)){this.isEmpty()&&t.append(document.createElement("br"));var n=this.getFormatType();t.style.textAlign=n,(n=this.getDirection())&&(t.dir=n),n=this.getIndent(),0<n&&(t.style.textIndent=`${20*n}px`)}return{element:t}}static importJSON(t){let n=gi();return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(t,n){t=gi();let r=this.getDirection();return t.setDirection(r),this.insertAfter(t,n),t}collapseAtStart(){let t=this.getChildren();if(t.length===0||Q(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Qb(e){let t=gi();return e.style&&(t.setFormat(e.style.textAlign),e=parseInt(e.style.textIndent,10)/20,0<e&&t.setIndent(e)),{node:t}}function gi(){return Da(new Hl)}function Vw(e,t,n,r){let o=e._keyToDOMMap;o.clear(),e._editorState=tm(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null,r=e._observer,r!==null&&(r.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",o.set("root",n))}function Jb(e){let t=new Map,n=new Set;return e.forEach(r=>{if(r=r.klass.importDOM!=null?r.klass.importDOM.bind(r.klass):null,r!=null&&!n.has(r)){n.add(r);var o=r();o!==null&&Object.keys(o).forEach(i=>{let l=t.get(i);l===void 0&&(l=[],t.set(i,l)),l.push(o[i])})}}),t}class Zb{constructor(t,n,r,o,i,l,s){this._parentEditor=n,this._rootElement=null,this._editorState=t,this._compositionKey=this._pendingEditorState=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=o,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=vw(),this._onError=i,this._htmlConversions=l,this._editable=s,this._headless=n!==null&&n._headless,this._blockCursorElement=this._window=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,r){r===void 0&&U(35);let o=this._commands;o.has(t)||o.set(t,[new Set,new Set,new Set,new Set,new Set]);let i=o.get(t);i===void 0&&U(36,String(t));let l=i[r];return l.add(n),()=>{l.delete(n),i.every(s=>s.size===0)&&o.delete(t)}}registerMutationListener(t,n){this._nodes.get(t.getType())===void 0&&U(37,t.name);let r=this._listeners.mutation;return r.set(n,t),()=>{r.delete(n)}}registerNodeTransformToKlass(t,n){var r=t.getType();return r=this._nodes.get(r),r===void 0&&U(37,t.name),r.transforms.add(n),r}registerNodeTransform(t,n){var r=this.registerNodeTransformToKlass(t,n);let o=[r];return r=r.replaceWithKlass,r!=null&&(r=this.registerNodeTransformToKlass(r,n),o.push(r)),kb(this,t.getType()),()=>{o.forEach(i=>i.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Y(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let l=Is(this._config.theme,"root");var r=this._pendingEditorState||this._editorState;if(this._rootElement=t,Vw(this,n,t,r),n!==null){if(!this._config.disableEvents){js!==0&&(js--,js===0&&n.ownerDocument.removeEventListener("selectionchange",Dw));var o=n.__lexicalEditor;if(o!=null){if(o._parentEditor!==null){var i=Gg(o);i=i[i.length-1]._key,hl.get(i)===o&&hl.delete(i)}else hl.delete(o._key);n.__lexicalEditor=null}for(o=Mw(n),i=0;i<o.length;i++)o[i]();n.__lexicalEventHandles=[]}l!=null&&n.classList.remove(...l)}t!==null?(r=(r=t.ownerDocument)&&r.defaultView||null,o=t.style,o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=r,this._dirtyType=2,uw(this),this._updateTags.add("history-merge"),li(this),this._config.disableEvents||jb(t,this),l!=null&&t.classList.add(...l)):(this._editorState=r,this._window=this._pendingEditorState=null),Fs("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&U(38),aw(this);let r=this._pendingEditorState,o=this._updateTags;n=n!==void 0?n.tag:null,r===null||r.isEmpty()||(n!=null&&o.add(n),li(this)),this._pendingEditorState=t,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,n!=null&&o.add(n),li(this)}parseEditorState(t,n){t=typeof t=="string"?JSON.parse(t):t;let r=tm(),o=kt,i=pn,l=Tt,s=this._dirtyElements,a=this._dirtyLeaves,u=this._cloneNotNeeded,c=this._dirtyType;this._dirtyElements=new Map,this._dirtyLeaves=new Set,this._cloneNotNeeded=new Set,this._dirtyType=0,kt=r,pn=!1,Tt=this;try{em(t.root,this._nodes),n&&n(),r._readOnly=!0}catch(d){d instanceof Error&&this._onError(d)}finally{this._dirtyElements=s,this._dirtyLeaves=a,this._cloneNotNeeded=u,this._dirtyType=c,kt=o,pn=i,Tt=l}return r}update(t,n){kn(this,t,n)}focus(t,n={}){let r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),kn(this,()=>{let o=Ke(),i=Sr();o!==null?o.dirty=!0:i.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?i.selectStart():i.selectEnd())},{onUpdate:()=>{r.removeAttribute("autocapitalize"),t&&t()},tag:"focus"}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){var t=this._rootElement;t!==null&&t.blur(),t=Cr(this._window),t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Fs("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}}class nm extends bi{constructor(t,n){super(n),this.__colSpan=t,this.__rowSpan=1}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan,rowSpan:this.__rowSpan}}getColSpan(){return this.__colSpan}setColSpan(t){return this.getWritable().__colSpan=t,this}getRowSpan(){return this.__rowSpan}setRowSpan(t){return this.getWritable().__rowSpan=t,this}}function Mn(e){return e instanceof nm}class Hw extends bi{}function rm(e){return e instanceof Hw}class Kw extends bi{}function ya(e){return e instanceof Kw}D.$addUpdateTag=function(e){Zt(),et()._updateTags.add(e)};D.$applyNodeReplacement=Da;D.$copyNode=_w;D.$createLineBreakNode=Tl;D.$createNodeSelection=ip;D.$createParagraphNode=gi;D.$createRangeSelection=function(){let e=new yr("root",0,"element"),t=new yr("root",0,"element");return new Ni(e,t,0,"")};D.$createTabNode=gd;D.$createTextNode=Ct;D.$getAdjacentNode=Vh;D.$getNearestNodeFromDOMNode=Ma;D.$getNearestRootOrShadowRoot=xw;D.$getNodeByKey=$t;D.$getPreviousSelection=Wl;D.$getRoot=Sr;D.$getSelection=Ke;D.$getTextContent=function(){let e=Ke();return e===null?"":e.getTextContent()};D.$hasAncestor=kc;D.$hasUpdateTag=function(e){return et()._updateTags.has(e)};D.$insertNodes=function(e,t){let n=Ke()||Wl();return n===null&&(n=Sr().selectEnd()),n.insertNodes(e,t)};D.$isBlockElementNode=op;D.$isDecoratorNode=Ve;D.$isElementNode=B;D.$isInlineElementOrDecoratorNode=function(e){return B(e)&&e.isInline()||Ve(e)&&e.isInline()};D.$isLeafNode=fw;D.$isLineBreakNode=ma;D.$isNodeSelection=Bl;D.$isParagraphNode=function(e){return e instanceof Hl};D.$isRangeSelection=de;D.$isRootNode=en;D.$isRootOrShadowRoot=Zn;D.$isTabNode=function(e){return e instanceof Fl};D.$isTextNode=Q;D.$nodesOfType=function(e){var t=Er();let n=t._readOnly,r=e.getType();t=t._nodeMap;let o=[];for(let[,i]of t)i instanceof e&&i.__type===r&&(n||i.isAttached())&&o.push(i);return o};D.$normalizeSelection__EXPERIMENTAL=Vg;D.$parseSerializedNode=function(e){return em(e,et()._nodes)};D.$selectAll=function(){var e=Sr();e=e.select(0,e.getChildrenSize()),vr(Vg(e))};D.$setCompositionKey=Mt;D.$setSelection=vr;D.$splitNode=ww;D.BLUR_COMMAND=iw;D.CAN_REDO_COMMAND={};D.CAN_UNDO_COMMAND={};D.CLEAR_EDITOR_COMMAND={};D.CLEAR_HISTORY_COMMAND={};D.CLICK_COMMAND=B_;D.COMMAND_PRIORITY_CRITICAL=4;D.COMMAND_PRIORITY_EDITOR=0;D.COMMAND_PRIORITY_HIGH=3;D.COMMAND_PRIORITY_LOW=1;D.COMMAND_PRIORITY_NORMAL=2;D.CONTROLLED_TEXT_INSERTION_COMMAND=fl;D.COPY_COMMAND=zg;D.CUT_COMMAND=Fg;D.DELETE_CHARACTER_COMMAND=ca;D.DELETE_LINE_COMMAND=fa;D.DELETE_WORD_COMMAND=da;D.DEPRECATED_$computeGridMap=zw;D.DEPRECATED_$createGridSelection=function(){let e=new yr("root",0,"element"),t=new yr("root",0,"element");return new vd("root",e,t)};D.DEPRECATED_$getGridCellNodeRect=rp;D.DEPRECATED_$getNodeTriplet=Fw;D.DEPRECATED_$isGridCellNode=Mn;D.DEPRECATED_$isGridNode=rm;D.DEPRECATED_$isGridRowNode=ya;D.DEPRECATED_$isGridSelection=Zg;D.DEPRECATED_GridCellNode=nm;D.DEPRECATED_GridNode=Hw;D.DEPRECATED_GridRowNode=Kw;D.DRAGEND_COMMAND=rw;D.DRAGOVER_COMMAND=nw;D.DRAGSTART_COMMAND=tw;D.DROP_COMMAND=ew;D.DecoratorNode=Ww;D.ElementNode=bi;D.FOCUS_COMMAND=ow;D.FORMAT_ELEMENT_COMMAND={};D.FORMAT_TEXT_COMMAND=go;D.INDENT_CONTENT_COMMAND={};D.INSERT_LINE_BREAK_COMMAND=Ls;D.INSERT_PARAGRAPH_COMMAND=zh;D.INSERT_TAB_COMMAND={};D.KEY_ARROW_DOWN_COMMAND=Y_;D.KEY_ARROW_LEFT_COMMAND=H_;D.KEY_ARROW_RIGHT_COMMAND=U_;D.KEY_ARROW_UP_COMMAND=G_;D.KEY_BACKSPACE_COMMAND=Q_;D.KEY_DELETE_COMMAND=Z_;D.KEY_DOWN_COMMAND=W_;D.KEY_ENTER_COMMAND=_c;D.KEY_ESCAPE_COMMAND=J_;D.KEY_MODIFIER_COMMAND=lw;D.KEY_SPACE_COMMAND=X_;D.KEY_TAB_COMMAND=q_;D.LineBreakNode=zl;D.MOVE_TO_END=V_;D.MOVE_TO_START=K_;D.OUTDENT_CONTENT_COMMAND={};D.PASTE_COMMAND=Lg;D.ParagraphNode=Hl;D.REDO_COMMAND=jg;D.REMOVE_TEXT_COMMAND=Fh;D.RootNode=Vl;D.SELECTION_CHANGE_COMMAND=ad;D.SELECT_ALL_COMMAND=Bh;D.TabNode=Fl;D.TextNode=Ti;D.UNDO_COMMAND=Ig;D.createCommand=function(){return{}};D.createEditor=function(e){var t=e||{},n=Tt,r=t.theme||{};let o=e===void 0?n:t.parentEditor||null,i=t.disableEvents||!1,l=tm(),s=t.namespace||(o!==null?o._config.namespace:vw()),a=t.editorState,u=[Vl,Ti,zl,Fl,Hl,...t.nodes||[]],c=t.onError;if(t=t.editable!==void 0?t.editable:!0,e===void 0&&n!==null)e=n._nodes;else for(e=new Map,n=0;n<u.length;n++){let f=u[n],h=null;var d=null;typeof f!="function"&&(d=f,f=d.replace,h=d.with,d=d.withKlass?d.withKlass:null);let g=f.getType(),m=f.transform(),S=new Set;m!==null&&S.add(m),e.set(g,{klass:f,replace:h,replaceWithKlass:d,transforms:S})}return r=new Zb(l,o,e,{disableEvents:i,namespace:s,theme:r},c||console.error,Jb(e),t),a!==void 0&&(r._pendingEditorState=a,r._dirtyType=2),r};D.getNearestEditorFromDOMNode=Kg;D.isHTMLAnchorElement=function(e){return hd(e)&&e.tagName==="A"};D.isHTMLElement=hd;D.isSelectionCapturedInDecoratorInput=Hg;D.isSelectionWithinEditor=Aa;const qb=D;var ge=qb,dt={},Rt={},ne=ge;let Pc=new Map;function My(e){for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function Dy(e){let t=e.parentNode;if(t==null)throw Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function Gw(e){let t={};e=e.split(";");for(let n of e)if(n!==""){let[r,o]=n.split(/:([^]+)/);t[r.trim()]=o.trim()}return t}function Oc(e){let t=Pc.get(e);return t===void 0&&(t=Gw(e),Pc.set(e,t)),t}function e2(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Ai(e,t){var n=Oc("getStyle"in e?e.getStyle():e.style);t=Object.entries(t).reduce((r,[o,i])=>(i===null?delete r[o]:r[o]=i,r),{...n}),n=e2(t),e.setStyle(n),Pc.set(n,t)}function Yw(e,t){var n=e.getNodes(),r=n.length;if(ne.DEPRECATED_$isGridSelection(e)){for(var o=ne.$createRangeSelection(),i=o.anchor,l=o.focus,s=0;s<r;s++){var a=n[s];ne.DEPRECATED_$isGridCellNode(a)&&(i.set(a.getKey(),0,"element"),l.set(a.getKey(),a.getChildrenSize(),"element"),Yw(ne.$normalizeSelection__EXPERIMENTAL(o),t))}ne.$setSelection(e)}else if(--r,o=n[0],i=n[r],e.isCollapsed())Ai(e,t);else{var u=e.anchor,c=e.focus;s=o.getTextContent().length,a=c.offset;var d=u.offset,f=u.isBefore(c);l=f?d:a,e=f?a:d;var h=f?u.type:c.type,g=f?c.type:u.type;if(u=f?c.key:u.key,ne.$isTextNode(o)&&l===s&&(c=o.getNextSibling(),ne.$isTextNode(c)&&(l=d=0,o=c)),n.length===1)ne.$isTextNode(o)&&(l=h==="element"?0:d>a?a:d,e=g==="element"?s:d>a?d:a,l!==e&&(l===0&&e===s?(Ai(o,t),o.select(l,e)):(n=o.splitText(l,e),n=l===0?n[0]:n[1],Ai(n,t),n.select(0,e-l))));else for(ne.$isTextNode(o)&&l<o.getTextContentSize()&&(l!==0&&(o=o.splitText(l)[1]),Ai(o,t)),ne.$isTextNode(i)&&(l=i.getTextContent().length,i.__key!==u&&e!==0&&(e=l),e!==l&&([i]=i.splitText(e)),e!==0&&Ai(i,t)),e=1;e<r;e++)l=n[e],s=l.getKey(),ne.$isTextNode(l)&&s!==o.getKey()&&s!==i.getKey()&&!l.isToken()&&Ai(l,t)}}function t2(e){for(;e!==null&&!ne.$isRootOrShadowRoot(e);){let t=e.getLatest(),n=e.getParent();t.getChildrenSize()===0&&e.remove(!0),e=n}}function Ef(e,t,n,r,o=null){if(t.length!==0){var i=t[0],l=new Map,s=[];i=ne.$isElementNode(i)?i:i.getParentOrThrow(),i.isInline()&&(i=i.getParentOrThrow());for(var a=!1;i!==null;){var u=i.getPreviousSibling();if(u!==null){i=u,a=!0;break}if(i=i.getParentOrThrow(),ne.$isRootOrShadowRoot(i))break}u=new Set;for(var c=0;c<n;c++){var d=t[c];ne.$isElementNode(d)&&d.getChildrenSize()===0&&u.add(d.getKey())}var f=new Set;for(c=0;c<n;c++){d=t[c];var h=d.getParent();if(h!==null&&h.isInline()&&(h=h.getParent()),h!==null&&ne.$isLeafNode(d)&&!f.has(d.getKey())){if(d=h.getKey(),l.get(d)===void 0){let g=r();g.setFormat(h.getFormatType()),g.setIndent(h.getIndent()),s.push(g),l.set(d,g),h.getChildren().forEach(m=>{g.append(m),f.add(m.getKey()),ne.$isElementNode(m)&&m.getChildrenKeys().forEach(S=>f.add(S))}),t2(h)}}else u.has(d.getKey())&&(h=r(),h.setFormat(d.getFormatType()),h.setIndent(d.getIndent()),s.push(h),d.remove(!0))}if(o!==null)for(t=0;t<s.length;t++)o.append(s[t]);if(t=null,ne.$isRootOrShadowRoot(i))if(a)if(o!==null)i.insertAfter(o);else for(o=s.length-1;0<=o;o--)i.insertAfter(s[o]);else if(a=i.getFirstChild(),ne.$isElementNode(a)&&(i=a),a===null)if(o)i.append(o);else for(o=0;o<s.length;o++)a=s[o],i.append(a),t=a;else if(o!==null)a.insertBefore(o);else for(i=0;i<s.length;i++)o=s[i],a.insertBefore(o),t=o;else if(o)i.insertAfter(o);else for(o=s.length-1;0<=o;o--)a=s[o],i.insertAfter(a),t=a;s=ne.$getPreviousSelection(),ne.$isRangeSelection(s)&&s.anchor.getNode().isAttached()&&s.focus.getNode().isAttached()?ne.$setSelection(s.clone()):t!==null?t.selectEnd():e.dirty=!0}}function Xw(e,t,n,r){e.modify(t?"extend":"move",n,r)}function Qw(e){return e=e.anchor.getNode(),(ne.$isRootNode(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}Rt.$addNodeStyle=function(e){e=e.getStyle();let t=Gw(e);Pc.set(e,t)};Rt.$cloneWithProperties=function(e){let t=e.constructor.clone(e);return t.__parent=e.__parent,t.__next=e.__next,t.__prev=e.__prev,ne.$isElementNode(e)&&ne.$isElementNode(t)?(t.__first=e.__first,t.__last=e.__last,t.__size=e.__size,t.__format=e.__format,t.__indent=e.__indent,t.__dir=e.__dir,t):(ne.$isTextNode(e)&&ne.$isTextNode(t)&&(t.__format=e.__format,t.__style=e.__style,t.__mode=e.__mode,t.__detail=e.__detail),t)};Rt.$getSelectionStyleValueForProperty=function(e,t,n=""){let r=null,o=e.getNodes();var i=e.anchor,l=e.focus,s=e.isBackward();let a=s?l.offset:i.offset;if(i=s?l.getNode():i.getNode(),e.style!==""&&(e=Oc(e.style),e!==null&&t in e))return e[t];for(e=0;e<o.length;e++){var u=o[e];if((e===0||a!==0||!u.is(i))&&ne.$isTextNode(u)){if(l=t,s=n,u=u.getStyle(),u=Oc(u),l=u!==null&&u[l]||s,r===null)r=l;else if(r!==l){r="";break}}}return r===null?n:r};Rt.$isAtNodeEnd=function(e){return e.type==="text"?e.offset===e.getNode().getTextContentSize():e.offset===e.getNode().getChildrenSize()};Rt.$isParentElementRTL=Qw;Rt.$moveCaretSelection=Xw;Rt.$moveCharacter=function(e,t,n){let r=Qw(e);Xw(e,t,n?!r:r,"character")};Rt.$patchStyleText=Yw;Rt.$selectAll=function(e){let t=e.anchor;e=e.focus;var n=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();let r=n.getFirstDescendant();n=n.getLastDescendant();let o="element",i="element",l=0;ne.$isTextNode(r)?o="text":ne.$isElementNode(r)||r===null||(r=r.getParentOrThrow()),ne.$isTextNode(n)?(i="text",l=n.getTextContentSize()):ne.$isElementNode(n)||n===null||(n=n.getParentOrThrow()),r&&n&&(t.set(r.getKey(),0,o),e.set(n.getKey(),l,i))};Rt.$setBlocksType=function(e,t){if(e.anchor.key==="root"){t=t();var n=ne.$getRoot();(e=n.getFirstChild())?e.replace(t,!0):n.append(t)}else for(n=e.getNodes(),e=e.anchor.getNode().getParentOrThrow(),n.indexOf(e)===-1&&n.push(e),e.isInline()&&(e=e.getParentOrThrow(),n.indexOf(e)===-1&&n.push(e)),e=0;e<n.length;e++){let i=n[e];var r=i;if(!ne.$isElementNode(r)||ne.$isRootOrShadowRoot(r))r=!1;else{var o=r.getFirstChild();o=o===null||ne.$isLineBreakNode(o)||ne.$isTextNode(o)||o.isInline(),r=!r.isInline()&&r.canBeEmpty()!==!1&&o}r&&(r=t(),r.setFormat(i.getFormatType()),r.setIndent(i.getIndent()),i.replace(r,!0))}};Rt.$shouldOverrideDefaultCharacterSelection=function(e,t){return e=ne.$getAdjacentNode(e.focus,t),ne.$isDecoratorNode(e)&&!e.isIsolated()||ne.$isElementNode(e)&&!e.isInline()&&!e.canBeEmpty()};Rt.$sliceSelectedTextNodeContent=function(e,t){if(t.isSelected()&&!t.isSegmented()&&!t.isToken()&&(ne.$isRangeSelection(e)||ne.DEPRECATED_$isGridSelection(e))){var n=e.anchor.getNode(),r=e.focus.getNode(),o=t.is(n),i=t.is(r);if(o||i){o=e.isBackward();let[l,s]=e.getCharacterOffsets();e=n.is(r),i=t.is(o?r:n),r=t.is(o?n:r),n=0;let a;e?(n=l>s?s:l,a=l>s?l:s):i?(n=o?s:l,a=void 0):r&&(o=o?l:s,n=0,a=o),t.__text=t.__text.slice(n,a)}}return t};Rt.$wrapNodes=function(e,t,n=null){var r=e.getNodes();let o=r.length;var i=e.anchor;if(o===0||o===1&&i.type==="element"&&i.getNode().getChildrenSize()===0){e=i.type==="text"?i.getNode().getParentOrThrow():i.getNode(),r=e.getChildren();let s=t();s.setFormat(e.getFormatType()),s.setIndent(e.getIndent()),r.forEach(a=>s.append(a)),n&&(s=n.append(s)),e.replace(s)}else{i=null;var l=[];for(let s=0;s<o;s++){let a=r[s];ne.$isRootOrShadowRoot(a)?(Ef(e,l,l.length,t,n),l=[],i=a):i===null||i!==null&&ne.$hasAncestor(a,i)?l.push(a):(Ef(e,l,l.length,t,n),l=[a])}Ef(e,l,l.length,t,n)}};Rt.createDOMRange=function(e,t,n,r,o){let i=t.getKey(),l=r.getKey(),s=document.createRange(),a=e.getElementByKey(i);if(e=e.getElementByKey(l),ne.$isTextNode(t)&&(a=My(a)),ne.$isTextNode(r)&&(e=My(e)),t===void 0||r===void 0||a===null||e===null)return null;a.nodeName==="BR"&&([a,n]=Dy(a)),e.nodeName==="BR"&&([e,o]=Dy(e)),t=a.firstChild,a===e&&t!=null&&t.nodeName==="BR"&&n===0&&o===0&&(o=1);try{s.setStart(a,n),s.setEnd(e,o)}catch{return null}return!s.collapsed||n===o&&i===l||(s.setStart(e,o),s.setEnd(a,n)),s};Rt.createRectsFromDOMRange=function(e,t){var n=e.getRootElement();if(n===null)return[];e=n.getBoundingClientRect(),n=getComputedStyle(n),n=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight),t=Array.from(t.getClientRects());let r=t.length;t.sort((i,l)=>{let s=i.top-l.top;return 3>=Math.abs(s)?i.left-l.left:s});let o;for(let i=0;i<r;i++){let l=t[i],s=l.width+n===e.width;o&&o.top<=l.top&&o.top+o.height>l.top&&o.left+o.width>l.left||s?(t.splice(i--,1),r--):o=l}return t};Rt.getStyleObjectFromCSS=Oc;Rt.trimTextContentFromAnchor=function(e,t,n){let r=t.getNode();if(ne.$isElementNode(r)){var o=r.getDescendantByIndex(t.offset);o!==null&&(r=o)}for(;0<n&&r!==null;){var i=r.getPreviousSibling(),l=0;if(i===null){o=r.getParentOrThrow();for(var s=o.getPreviousSibling();s===null;){if(o=o.getParent(),o===null){i=null;break}s=o.getPreviousSibling()}o!==null&&(l=o.isInline()?0:2,i=ne.$isElementNode(s)?s.getLastDescendant():s)}if(s=r.getTextContent(),s===""&&ne.$isElementNode(r)&&!r.isInline()&&(s=`
116
+
117
+ `),o=s.length,!ne.$isTextNode(r)||n>=o)s=r.getParent(),r.remove(),s==null||s.getChildrenSize()!==0||ne.$isRootNode(s)||s.remove(),n-=o+l,r=i;else{let a=r.getKey();l=e.getEditorState().read(()=>{const c=ne.$getNodeByKey(a);return ne.$isTextNode(c)&&c.isSimpleText()?c.getTextContent():null}),i=o-n;let u=s.slice(0,i);l!==null&&l!==s?(n=ne.$getPreviousSelection(),o=r,r.isSimpleText()?r.setTextContent(l):(o=ne.$createTextNode(l),r.replace(o)),ne.$isRangeSelection(n)&&n.isCollapsed()&&(n=n.anchor.offset,o.select(n,n))):r.isSimpleText()?(l=t.key===a,s=t.offset,s<n&&(s=o),n=l?s-n:0,o=l?s:i,l&&n===0?([n]=r.splitText(n,o),n.remove()):([,n]=r.splitText(n,o),n.remove())):(n=ne.$createTextNode(u),r.replace(n)),n=0}}};const n2=Rt;var Oo=n2,r2=Oo,at=ge;function o2(e){let t=new URLSearchParams;t.append("code",e);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Jw(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function Zw(e,t){for(;e!==at.$getRoot()&&e!=null;){if(t(e))return e;e=e.getParent()}return null}dt.$splitNode=at.$splitNode;dt.isHTMLAnchorElement=at.isHTMLAnchorElement;dt.isHTMLElement=at.isHTMLElement;dt.$dfs=function(e,t){let n=[];e=(e||at.$getRoot()).getLatest(),t=t||(at.$isElementNode(e)?e.getLastDescendant():e);for(var r=e,o=0;(r=r.getParent())!==null;)o++;for(r=o;e!==null&&!e.is(t);)if(n.push({depth:r,node:e}),at.$isElementNode(e)&&0<e.getChildrenSize())e=e.getFirstChild(),r++;else for(o=null;o===null&&e!==null;)o=e.getNextSibling(),o===null?(e=e.getParent(),r--):e=o;return e!==null&&e.is(t)&&n.push({depth:r,node:e}),n};dt.$filter=function(e,t){let n=[];for(let r=0;r<e.length;r++){let o=t(e[r]);o!==null&&n.push(o)}return n};dt.$findMatchingParent=Zw;dt.$getNearestBlockElementAncestorOrThrow=function(e){let t=Zw(e,n=>at.$isElementNode(n)&&!n.isInline());return at.$isElementNode(t)||o2(4,e.__key),t};dt.$getNearestNodeOfType=function(e,t){for(;e!=null;){if(e instanceof t)return e;e=e.getParent()}return null};dt.$insertFirst=function(e,t){let n=e.getFirstChild();n!==null?n.insertBefore(t):e.append(t)};dt.$insertNodeToNearestRoot=function(e){var t=at.$getSelection()||at.$getPreviousSelection();if(at.$isRangeSelection(t)){var{focus:n}=t;if(t=n.getNode(),n=n.offset,at.$isRootOrShadowRoot(t))n=t.getChildAtIndex(n),n==null?t.append(e):n.insertBefore(e),e.selectNext();else{let r,o;at.$isTextNode(t)?(r=t.getParentOrThrow(),o=t.getIndexWithinParent(),0<n&&(o+=1,t.splitText(n))):(r=t,o=n),[,t]=at.$splitNode(r,o),t.insertBefore(e),t.selectStart()}}else at.$isNodeSelection(t)||at.DEPRECATED_$isGridSelection(t)?(t=t.getNodes(),t[t.length-1].getTopLevelElementOrThrow().insertAfter(e)):at.$getRoot().append(e),t=at.$createParagraphNode(),e.insertAfter(t),t.select();return e.getLatest()};dt.$restoreEditorState=function(e,t){let n=new Map,r=e._pendingEditorState;for(let[o,i]of t._nodeMap){let l=r2.$cloneWithProperties(i);at.$isTextNode(l)&&(l.__text=i.__text),n.set(o,l)}r&&(r._nodeMap=n),e._dirtyType=2,e=t._selection,at.$setSelection(e===null?null:e.clone())};dt.$wrapNodeInElement=function(e,t){return t=t(),e.replace(t),t.append(e),t};dt.addClassNamesToElement=function(e,...t){t.forEach(n=>{typeof n=="string"&&(n=n.split(" ").filter(r=>r!==""),e.classList.add(...n))})};dt.isMimeType=Jw;dt.mediaFileReader=function(e,t){let n=e[Symbol.iterator]();return new Promise((r,o)=>{let i=[],l=()=>{const{done:s,value:a}=n.next();if(s)return r(i);const u=new FileReader;u.addEventListener("error",o),u.addEventListener("load",()=>{const c=u.result;typeof c=="string"&&i.push({file:a,result:c}),l()}),Jw(a,t)?u.readAsDataURL(a):l()};l()})};dt.mergeRegister=function(...e){return()=>{e.forEach(t=>t())}};dt.objectKlassEquals=function(e,t){return e!==null?Object.getPrototypeOf(e).constructor.name===t.name:!1};dt.registerNestedElementResolver=function(e,t,n,r){return e.registerNodeTransform(t,o=>{e:{for(var i=o.getChildren(),l=0;l<i.length;l++)if(i[l]instanceof t){i=null;break e}for(i=o;i!==null;)if(l=i,i=i.getParent(),i instanceof t){i={child:l,parent:i};break e}i=null}if(i!==null){const{child:s,parent:a}=i;if(s.is(o)){if(r(a,o),o=s.getNextSiblings(),i=o.length,a.insertAfter(s),i!==0){l=n(a),s.insertAfter(l);for(let u=0;u<i;u++)l.append(o[u])}a.canBeEmpty()||a.getChildrenSize()!==0||a.remove()}}})};dt.removeClassNamesFromElement=function(e,...t){t.forEach(n=>{typeof n=="string"&&e.classList.remove(...n.split(" "))})};const i2=dt;var Nt=i2,Ne=ge,Ao=Nt;function Nl(e){let t=new URLSearchParams;t.append("code",e);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function qw(e){let t=1;for(e=e.getParent();e!=null;){if(Ze(e)){if(e=e.getParent(),xe(e)){t++,e=e.getParent();continue}Nl(40)}break}return t}function lp(e){e=e.getParent(),xe(e)||Nl(40);let t=e;for(;t!==null;)t=t.getParent(),xe(t)&&(e=t);return e}function eS(e){let t=[];e=e.getChildren().filter(Ze);for(let n=0;n<e.length;n++){let r=e[n],o=r.getFirstChild();xe(o)?t=t.concat(eS(o)):t.push(r)}return t}function ar(e){return Ze(e)&&xe(e.getFirstChild())}function l2(e){for(;e.getNextSibling()==null&&e.getPreviousSibling()==null;){let t=e.getParent();if(t==null||!Ze(e)&&!xe(e))break;e=t}e.remove()}function Ly(e){return Sn().append(e)}function tS(e,t){return Ze(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function mi(e,t){e.splice(e.getChildrenSize(),0,t)}function Iy(e,t){if(xe(e))return e;let n=e.getPreviousSibling(),r=e.getNextSibling(),o=Sn();return o.setFormat(e.getFormatType()),o.setIndent(e.getIndent()),mi(o,e.getChildren()),xe(n)&&t===n.getListType()?(n.append(o),e.remove(),xe(r)&&t===r.getListType()&&(mi(n,r.getChildren()),r.remove()),n):xe(r)&&t===r.getListType()?(r.getFirstChildOrThrow().insertBefore(o),e.remove(),r):(t=tn(t),t.append(o),e.replace(t),Xt(t),t)}function nS(e,t){var n=e.getLastChild();let r=t.getFirstChild();n&&r&&ar(n)&&ar(r)&&(nS(n.getFirstChild(),r.getFirstChild()),r.remove()),n=t.getChildren(),0<n.length&&(e.append(...n),Xt(e)),t.remove()}function Xt(e,t){if(e=t||e.getChildren(),e!==void 0)for(t=0;t<e.length;t++){let i=e[t];if(Ze(i)){let l=i.getValue();var n=i,r=n.getParent(),o=1;for(r!=null&&(xe(r)?o=r.getStart():Nl(44)),n=n.getPreviousSiblings(),r=0;r<n.length;r++){let s=n[r];Ze(s)&&!xe(s.getFirstChild())&&o++}l!==o&&i.setValue(o)}}}function s2(e){if(!ar(e)){var t=e.getParent(),n=t?t.getParent():void 0,r=n?n.getParent():void 0;if(xe(r)&&Ze(n)&&xe(t)){var o=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(o))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{var l=t.getListType();o=Sn();let s=tn(l);o.append(s),e.getPreviousSiblings().forEach(a=>s.append(a)),i=Sn(),l=tn(l),i.append(l),mi(l,e.getNextSiblings()),n.insertBefore(o),n.insertAfter(i),n.replace(e)}Xt(t),Xt(r)}}}let xd=class rS extends Ne.ElementNode{static getType(){return"listitem"}static clone(t){return new rS(t.__value,t.__checked,t.__key)}constructor(t,n,r){super(r),this.__value=t===void 0?1:t,this.__checked=n}createDOM(t){let n=document.createElement("li"),r=this.getParent();return xe(r)&&r.getListType()==="check"&&zy(n,this,null),n.value=this.__value,jy(n,t.theme,this),n}updateDOM(t,n,r){let o=this.getParent();return xe(o)&&o.getListType()==="check"&&zy(n,this,t),n.value=this.__value,jy(n,r.theme,this),!1}static transform(){return t=>{let n=t.getParent();xe(n)&&(Xt(n),n.getListType()!=="check"&&t.getChecked()!=null&&t.setChecked(void 0))}}static importDOM(){return{li:()=>({conversion:a2,priority:0})}}static importJSON(t){let n=Sn();return n.setChecked(t.checked),n.setValue(t.value),n.setFormat(t.format),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...t){for(let n=0;n<t.length;n++){let r=t[n];if(Ne.$isElementNode(r)&&this.canMergeWith(r)){let o=r.getChildren();this.append(...o),r.remove()}else super.append(r)}return this}replace(t,n){if(Ze(t))return super.replace(t);this.setIndent(0);let r=this.getParentOrThrow();if(!xe(r))return t;if(r.__first===this.getKey())r.insertBefore(t);else if(r.__last===this.getKey())r.insertAfter(t);else{let o=tn(r.getListType()),i=this.getNextSibling();for(;i;){let l=i;i=i.getNextSibling(),o.append(l)}r.insertAfter(t),t.insertAfter(o)}return n&&this.getChildren().forEach(o=>{t.append(o)}),this.remove(),r.getChildrenSize()===0&&r.remove(),t}insertAfter(t,n=!0){var r=this.getParentOrThrow();xe(r)||Nl(39);var o=this.getNextSiblings();if(Ze(t))return n=super.insertAfter(t,n),t=t.getParentOrThrow(),xe(t)&&Xt(t),n;if(xe(t)){for(r=t,t=t.getChildren(),o=t.length-1;0<=o;o--)r=t[o],this.insertAfter(r,n);return r}if(r.insertAfter(t,n),o.length!==0){let i=tn(r.getListType());o.forEach(l=>i.append(l)),t.insertAfter(i,n)}return t}remove(t){let n=this.getPreviousSibling(),r=this.getNextSibling();super.remove(t),n&&r&&ar(n)&&ar(r)?(nS(n.getFirstChild(),r.getFirstChild()),r.remove()):r&&(t=r.getParent(),xe(t)&&Xt(t))}insertNewAfter(t,n=!0){return t=Sn(this.__checked==null?void 0:!1),this.insertAfter(t,n),t}collapseAtStart(t){let n=Ne.$createParagraphNode();this.getChildren().forEach(l=>n.append(l));var r=this.getParentOrThrow(),o=r.getParentOrThrow();let i=Ze(o);return r.getChildrenSize()===1?i?(r.remove(),o.select()):(r.insertBefore(n),r.remove(),r=t.anchor,t=t.focus,o=n.getKey(),r.type==="element"&&r.getNode().is(this)&&r.set(o,r.offset,"element"),t.type==="element"&&t.getNode().is(this)&&t.set(o,t.offset,"element")):(r.insertBefore(n),this.remove()),!0}getValue(){return this.getLatest().__value}setValue(t){this.getWritable().__value=t}getChecked(){return this.getLatest().__checked}setChecked(t){this.getWritable().__checked=t}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var t=this.getParent();if(t===null)return this.getLatest().__indent;t=t.getParentOrThrow();let n=0;for(;Ze(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(t){typeof t=="number"&&-1<t||Nl(117);let n=this.getIndent();for(;n!==t;)if(n<t){e:{var r=new Set;if(ar(this)||r.has(this.getKey()))break e;let s=this.getParent();var o=this.getNextSibling(),i=this.getPreviousSibling();if(ar(o)&&ar(i)){if(i=i.getFirstChild(),xe(i)){i.append(this);var l=o.getFirstChild();xe(l)&&(l=l.getChildren(),mi(i,l),o.remove(),r.add(o.getKey())),Xt(i)}}else ar(o)?(o=o.getFirstChild(),xe(o)&&(r=o.getFirstChild(),r!==null&&r.insertBefore(this),Xt(o))):ar(i)?(o=i.getFirstChild(),xe(o)&&(o.append(this),Xt(o))):xe(s)&&(r=Sn(),l=tn(s.getListType()),r.append(l),l.append(this),i?i.insertAfter(r):o?o.insertBefore(r):s.append(r),Xt(l));xe(s)&&Xt(s)}n++}else s2(this),n--;return this}insertBefore(t){if(Ze(t)){let n=this.getParentOrThrow();if(xe(n)){let r=this.getNextSiblings();Xt(n,r)}}return super.insertBefore(t)}canInsertAfter(t){return Ze(t)}canReplaceWith(t){return Ze(t)}canMergeWith(t){return Ne.$isParagraphNode(t)||Ze(t)}extractWithChild(t,n){if(!Ne.$isRangeSelection(n))return!1;t=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(t)&&this.isParentOf(r)&&this.getTextContent().length===n.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return tn("bullet")}};function jy(e,t,n){let r=[],o=[];var i=(t=t.list)?t.listitem:void 0;if(t&&t.nested)var l=t.nested.listitem;if(i!==void 0&&(i=i.split(" "),r.push(...i)),t){i=n.getParent(),i=xe(i)&&i.getListType()==="check";let s=n.getChecked();i&&!s||o.push(t.listitemUnchecked),i&&s||o.push(t.listitemChecked),i&&r.push(s?t.listitemChecked:t.listitemUnchecked)}l!==void 0&&(l=l.split(" "),n.getChildren().some(s=>xe(s))?r.push(...l):o.push(...l)),0<o.length&&Ao.removeClassNamesFromElement(e,...o),0<r.length&&Ao.addClassNamesToElement(e,...r)}function zy(e,t,n){xe(t.getFirstChild())?(e.removeAttribute("role"),e.removeAttribute("tabIndex"),e.removeAttribute("aria-checked")):(e.setAttribute("role","checkbox"),e.setAttribute("tabIndex","-1"),n&&t.__checked===n.__checked||e.setAttribute("aria-checked",t.getChecked()?"true":"false"))}function a2(e){return e=Ao.isHTMLElement(e)&&e.getAttribute("aria-checked")==="true",{node:Sn(e)}}function Sn(e){return Ne.$applyNodeReplacement(new xd(void 0,e))}function Ze(e){return e instanceof xd}let om=class oS extends Ne.ElementNode{static getType(){return"list"}static clone(t){return new oS(t.__listType||Wy[t.__tag],t.__start,t.__key)}constructor(t,n,r){super(r),this.__listType=t=Wy[t]||t,this.__tag=t==="number"?"ol":"ul",this.__start=n}getTag(){return this.__tag}setListType(t){let n=this.getWritable();n.__listType=t,n.__tag=t==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(t){let n=document.createElement(this.__tag);return this.__start!==1&&n.setAttribute("start",String(this.__start)),n.__lexicalListType=this.__listType,Fy(n,t.theme,this),n}updateDOM(t,n,r){return t.__tag!==this.__tag?!0:(Fy(n,r.theme,this),!1)}static importDOM(){return{ol:()=>({conversion:By,priority:0}),ul:()=>({conversion:By,priority:0})}}static importJSON(t){let n=tn(t.listType,t.start);return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportDOM(t){return{element:t}=super.exportDOM(t),t&&Ao.isHTMLElement(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...t){for(let r=0;r<t.length;r++){var n=t[r];if(Ze(n))super.append(n);else{let o=Sn();xe(n)||Ne.$isElementNode(n)&&(n=Ne.$createTextNode(n.getTextContent())),o.append(n),super.append(o)}}return Xt(this),this}extractWithChild(t){return Ze(t)}};function Fy(e,t,n){let r=[],o=[];var i=t.list;if(i!==void 0){let s=i[`${n.__tag}Depth`]||[];t=qw(n)-1;let a=t%s.length;var l=s[a];let u=i[n.__tag],c;if(i=i.nested,i!==void 0&&i.list&&(c=i.list),u!==void 0&&r.push(u),l!==void 0)for(l=l.split(" "),r.push(...l),l=0;l<s.length;l++)l!==a&&o.push(n.__tag+l);c!==void 0&&(n=c.split(" "),1<t?r.push(...n):o.push(...n))}0<o.length&&Ao.removeClassNamesFromElement(e,...o),0<r.length&&Ao.addClassNamesToElement(e,...r)}function u2(e){let t=[];for(let r=0;r<e.length;r++){var n=e[r];Ze(n)?(t.push(n),n=n.getChildren(),1<n.length&&n.forEach(o=>{xe(o)&&t.push(Ly(o))})):t.push(Ly(n))}return t}function By(e){let t=e.nodeName.toLowerCase(),n=null;return t==="ol"?n=tn("number",e.start):t==="ul"&&(n=Ao.isHTMLElement(e)&&e.getAttribute("__lexicallisttype")==="check"?tn("check"):tn("bullet")),{after:u2,node:n}}let Wy={ol:"number",ul:"bullet"};function tn(e,t=1){return Ne.$applyNodeReplacement(new om(e,t))}function xe(e){return e instanceof om}let c2=Ne.createCommand("INSERT_UNORDERED_LIST_COMMAND"),d2=Ne.createCommand("INSERT_ORDERED_LIST_COMMAND"),f2=Ne.createCommand("INSERT_CHECK_LIST_COMMAND"),h2=Ne.createCommand("REMOVE_LIST_COMMAND");ln.$createListItemNode=Sn;ln.$createListNode=tn;ln.$getListDepth=qw;ln.$handleListInsertParagraph=function(){var e=Ne.$getSelection();if(!Ne.$isRangeSelection(e)||!e.isCollapsed()||(e=e.anchor.getNode(),!Ze(e)||e.getChildrenSize()!==0))return!1;var t=lp(e),n=e.getParent();xe(n)||Nl(40);let r=n.getParent(),o;if(Ne.$isRootOrShadowRoot(r))o=Ne.$createParagraphNode(),t.insertAfter(o);else if(Ze(r))o=Sn(),r.insertAfter(o);else return!1;if(o.select(),t=e.getNextSiblings(),0<t.length){let i=tn(n.getListType());Ne.$isParagraphNode(o)?o.insertAfter(i):(n=Sn(),n.append(i),o.insertAfter(n)),t.forEach(l=>{l.remove(),i.append(l)})}return l2(e),!0};ln.$isListItemNode=Ze;ln.$isListNode=xe;ln.INSERT_CHECK_LIST_COMMAND=f2;ln.INSERT_ORDERED_LIST_COMMAND=d2;ln.INSERT_UNORDERED_LIST_COMMAND=c2;ln.ListItemNode=xd;ln.ListNode=om;ln.REMOVE_LIST_COMMAND=h2;ln.insertList=function(e,t){e.update(()=>{var n=Ne.$getSelection();if(Ne.$isRangeSelection(n)||Ne.DEPRECATED_$isGridSelection(n)){var r=n.getNodes();n=n.anchor.getNode();var o=n.getParent();if(tS(n,r))r=tn(t),Ne.$isRootOrShadowRoot(o)?(n.replace(r),o=Sn(),Ne.$isElementNode(n)&&(o.setFormat(n.getFormatType()),o.setIndent(n.getIndent())),r.append(o)):Ze(n)&&(n=n.getParentOrThrow(),mi(r,n.getChildren()),n.replace(r));else for(n=new Set,o=0;o<r.length;o++){var i=r[o];if(Ne.$isElementNode(i)&&i.isEmpty()&&!n.has(i.getKey()))Iy(i,t);else if(Ne.$isLeafNode(i))for(i=i.getParent();i!=null;){let s=i.getKey();if(xe(i)){if(!n.has(s)){var l=tn(t);mi(l,i.getChildren()),i.replace(l),Xt(l),n.add(s)}break}else{if(l=i.getParent(),Ne.$isRootOrShadowRoot(l)&&!n.has(s)){n.add(s),Iy(i,t);break}i=l}}}}})};ln.removeList=function(e){e.update(()=>{let t=Ne.$getSelection();if(Ne.$isRangeSelection(t)){var n=new Set,r=t.getNodes(),o=t.anchor.getNode();if(tS(o,r))n.add(lp(o));else for(o=0;o<r.length;o++){var i=r[o];Ne.$isLeafNode(i)&&(i=Ao.$getNearestNodeOfType(i,xd),i!=null&&n.add(lp(i)))}for(let l of n){n=l,r=eS(l);for(let s of r)r=Ne.$createParagraphNode(),mi(r,s.getChildren()),n.insertAfter(r),n=r,s.__key===t.anchor.key&&t.anchor.set(r.getKey(),0,"element"),s.__key===t.focus.key&&t.focus.set(r.getKey(),0,"element"),s.remove();l.remove()}}})};const p2=ln;var fo=p2,iS={},_d={},lS=p;function g2(e){let t=new URLSearchParams;t.append("code",e);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let sS=lS.createContext(null);_d.LexicalComposerContext=sS;_d.createLexicalComposerContext=function(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}};_d.useLexicalComposerContext=function(){let e=lS.useContext(sS);return e==null&&g2(8),e};const m2=_d;var rr=m2,Uy=rr,Ss=ge,Ac=p;let aS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var v2=aS?Ac.useLayoutEffect:Ac.useEffect;let hu={tag:"history-merge"};function y2(e,t){if(t!==null){if(t===void 0)e.update(()=>{var n=Ss.$getRoot();if(n.isEmpty()){let r=Ss.$createParagraphNode();n.append(r),n=aS?document.activeElement:null,(Ss.$getSelection()!==null||n!==null&&n===e.getRootElement())&&r.select()}},hu);else if(t!==null)switch(typeof t){case"string":let n=e.parseEditorState(t);e.setEditorState(n,hu);break;case"object":e.setEditorState(t,hu);break;case"function":e.update(()=>{Ss.$getRoot().isEmpty()&&t(e)},hu)}}}iS.LexicalComposer=function({initialConfig:e,children:t}){let n=Ac.useMemo(()=>{const{theme:r,namespace:o,editor__DEPRECATED:i,nodes:l,onError:s,editorState:a}=e,u=Uy.createLexicalComposerContext(null,r);let c=i||null;if(c===null){const d=Ss.createEditor({editable:e.editable,namespace:o,nodes:l,onError:f=>s(f,d),theme:r});y2(d,a),c=d}return[c,u]},[]);return v2(()=>{let r=e.editable,[o]=n;o.setEditable(r!==void 0?r:!0)},[]),Ac.createElement(Uy.LexicalComposerContext.Provider,{value:n},t)};const x2=iS;var _2=x2,Bs=p;function sp(e,t){return sp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},sp(e,t)}function w2(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,sp(e,t)}function S2(e,t){return e===void 0&&(e=[]),t===void 0&&(t=[]),e.length!==t.length||e.some(function(n,r){return!Object.is(n,t[r])})}var Vy={error:null},C2=function(e){function t(){for(var r,o=arguments.length,i=Array(o),l=0;l<o;l++)i[l]=arguments[l];return r=e.call.apply(e,[this].concat(i))||this,r.state=Vy,r.resetErrorBoundary=function(){for(var s,a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];r.props.onReset==null||(s=r.props).onReset.apply(s,u),r.reset()},r}w2(t,e),t.getDerivedStateFromError=function(r){return{error:r}};var n=t.prototype;return n.reset=function(){this.setState(Vy)},n.componentDidCatch=function(r,o){var i,l;(i=(l=this.props).onError)==null||i.call(l,r,o)},n.componentDidUpdate=function(r,o){var i=this.props.resetKeys;if(this.state.error!==null&&o.error!==null&&S2(r.resetKeys,i)){var l,s;(l=(s=this.props).onResetKeysChange)==null||l.call(s,r.resetKeys,i),this.reset()}},n.render=function(){var r=this.state.error,o=this.props,i=o.fallbackRender,l=o.FallbackComponent;if(o=o.fallback,r!==null){if(r={error:r,resetErrorBoundary:this.resetErrorBoundary},Bs.isValidElement(o))return o;if(typeof i=="function")return i(r);if(l)return Bs.createElement(l,r);throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},t}(Bs.Component),E2=function({children:e,onError:t}){return Bs.createElement(C2,{fallback:Bs.createElement("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"}},"An error was thrown."),onError:t},e)};const $2=E2;var k2=$2;const T2=$a(k2);var im={},lm={},N2=Nt,ze=ge;function b2(e,t,n,r,o){if(e===null||n.size===0&&r.size===0&&!o)return 0;var i=t._selection,l=e._selection;if(o)return 1;if(!(ze.$isRangeSelection(i)&&ze.$isRangeSelection(l)&&l.isCollapsed()&&i.isCollapsed()))return 0;o=t._nodeMap;let s=[];for(let a of n)n=o.get(a),n!==void 0&&s.push(n);for(let[a,u]of r)u&&(r=o.get(a),r===void 0||ze.$isRootNode(r)||s.push(r));return s.length===0?0:1<s.length?(r=t._nodeMap,t=r.get(i.anchor.key),l=r.get(l.anchor.key),t&&l&&!e._nodeMap.has(t.__key)&&ze.$isTextNode(t)&&t.__text.length===1&&i.anchor.offset===1?2:0):(t=s[0],e=e._nodeMap.get(t.__key),!ze.$isTextNode(e)||!ze.$isTextNode(t)||e.__mode!==t.__mode||(e=e.__text,t=t.__text,e===t)||(i=i.anchor,l=l.anchor,i.key!==l.key||i.type!=="text")?0:(i=i.offset,l=l.offset,e=t.length-e.length,e===1&&l===i-1?2:e===-1&&l===i+1?3:e===-1&&l===i?4:0))}function R2(e,t){let n=Date.now(),r=0;return(o,i,l,s,a,u)=>{let c=Date.now();if(u.has("historic"))return r=0,n=c,2;let d=b2(o,i,s,a,e.isComposing()),f=(()=>{var h=l===null||l.editor===e,g=u.has("history-push");if(!g&&h&&u.has("history-merge"))return 0;if(o===null)return 1;var m=i._selection;if(!(0<s.size||0<a.size))return m!==null?0:2;if(g===!1&&d!==0&&d===r&&c<n+t&&h)return 0;if(s.size===1){{g=Array.from(s)[0],h=o._nodeMap.get(g),g=i._nodeMap.get(g),m=o._selection;let S=i._selection,v=!1;ze.$isRangeSelection(m)&&ze.$isRangeSelection(S)&&(v=m.anchor.type==="element"&&m.focus.type==="element"&&S.anchor.type==="text"&&S.focus.type==="text"),h=!v&&ze.$isTextNode(h)&&ze.$isTextNode(g)?h.__type===g.__type&&h.__text===g.__text&&h.__mode===g.__mode&&h.__detail===g.__detail&&h.__style===g.__style&&h.__format===g.__format&&h.__parent===g.__parent:!1}if(h)return 0}return 1})();return n=c,r=d,f}}lm.createEmptyHistoryState=function(){return{current:null,redoStack:[],undoStack:[]}};lm.registerHistory=function(e,t,n){let r=R2(e,n);n=({editorState:l,prevEditorState:s,dirtyLeaves:a,dirtyElements:u,tags:c})=>{const d=t.current,f=t.redoStack,h=t.undoStack,g=d===null?null:d.editorState;if(d===null||l!==g){if(s=r(s,l,d,a,u,c),s===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(ze.CAN_REDO_COMMAND,!1)),d!==null&&(h.push({...d}),e.dispatchCommand(ze.CAN_UNDO_COMMAND,!0));else if(s===2)return;t.current={editor:e,editorState:l}}};let o=N2.mergeRegister(e.registerCommand(ze.UNDO_COMMAND,()=>{let l=t.redoStack,s=t.undoStack;if(s.length!==0){let a=t.current,u=s.pop();a!==null&&(l.push(a),e.dispatchCommand(ze.CAN_REDO_COMMAND,!0)),s.length===0&&e.dispatchCommand(ze.CAN_UNDO_COMMAND,!1),t.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:"historic"})}return!0},ze.COMMAND_PRIORITY_EDITOR),e.registerCommand(ze.REDO_COMMAND,()=>{let l=t.redoStack;var s=t.undoStack;if(l.length!==0){let a=t.current;a!==null&&(s.push(a),e.dispatchCommand(ze.CAN_UNDO_COMMAND,!0)),s=l.pop(),l.length===0&&e.dispatchCommand(ze.CAN_REDO_COMMAND,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}return!0},ze.COMMAND_PRIORITY_EDITOR),e.registerCommand(ze.CLEAR_EDITOR_COMMAND,()=>(t.undoStack=[],t.redoStack=[],t.current=null,!1),ze.COMMAND_PRIORITY_EDITOR),e.registerCommand(ze.CLEAR_HISTORY_COMMAND,()=>(t.undoStack=[],t.redoStack=[],t.current=null,e.dispatchCommand(ze.CAN_REDO_COMMAND,!1),e.dispatchCommand(ze.CAN_UNDO_COMMAND,!1),!0),ze.COMMAND_PRIORITY_EDITOR),e.registerUpdateListener(n)),i=e.registerUpdateListener(n);return()=>{o(),i()}};const P2=lm;var O2=P2,A2=rr,ap=O2,Hy=p;function M2(e,t,n=1e3){let r=Hy.useMemo(()=>t||ap.createEmptyHistoryState(),[t]);Hy.useEffect(()=>ap.registerHistory(e,r,n),[n,e,r])}im.createEmptyHistoryState=ap.createEmptyHistoryState;im.HistoryPlugin=function({externalHistoryState:e}){let[t]=A2.useLexicalComposerContext();return M2(t,e),null};const D2=im;var L2=D2,uS={},I2=rr,Ws=p,j2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Ws.useLayoutEffect:Ws.useEffect;function z2(e){let[t]=I2.useLexicalComposerContext(),n=Ws.useMemo(()=>e(t),[t,e]),r=Ws.useRef(n.initialValueFn()),[o,i]=Ws.useState(r.current);return j2(()=>{let{initialValueFn:l,subscribe:s}=n,a=l();return r.current!==a&&(r.current=a,i(a)),s(u=>{r.current=u,i(u)})},[n,e]),o}function F2(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}var B2=function(){return z2(F2)};const W2=B2;var U2=W2,Fo={},Qt=ge;function sm(e,t=!0){return e?!1:(e=cS(),t&&(e=e.trim()),e==="")}function cS(){return Qt.$getRoot().getTextContent()}function dS(e){if(!sm(e,!1))return!1;e=Qt.$getRoot().getChildren();let t=e.length;if(1<t)return!1;for(let r=0;r<t;r++){var n=e[r];if(Qt.$isDecoratorNode(n))return!1;if(Qt.$isElementNode(n)){if(!Qt.$isParagraphNode(n)||n.__indent!==0)return!1;n=n.getChildren();let o=n.length;for(let i=0;i<o;i++)if(!Qt.$isTextNode(n[r]))return!1}}return!0}Fo.$canShowPlaceholder=dS;Fo.$canShowPlaceholderCurry=function(e){return()=>dS(e)};Fo.$findTextIntersectionFromCharacters=function(e,t){var n=e.getFirstChild();e=0;e:for(;n!==null;){if(Qt.$isElementNode(n)){var r=n.getFirstChild();if(r!==null){n=r;continue}}else if(Qt.$isTextNode(n)){if(r=n.getTextContentSize(),e+r>t)return{node:n,offset:t-e};e+=r}if(r=n.getNextSibling(),r!==null)n=r;else{for(n=n.getParent();n!==null;){if(r=n.getNextSibling(),r!==null){n=r;continue e}n=n.getParent()}break}}return null};Fo.$isRootTextContentEmpty=sm;Fo.$isRootTextContentEmptyCurry=function(e,t){return()=>sm(e,t)};Fo.$rootTextContent=cS;Fo.registerLexicalTextEntity=function(e,t,n,r){let o=l=>{const s=Qt.$createTextNode(l.getTextContent());s.setFormat(l.getFormat()),l.replace(s)},i=e.registerNodeTransform(Qt.TextNode,l=>{if(l.isSimpleText()){var s=l.getPreviousSibling(),a=l.getTextContent(),u=l;if(Qt.$isTextNode(s)){var c=s.getTextContent(),d=t(c+a);if(s instanceof n){if(d===null||s.getLatest().__mode!==0){o(s);return}if(d=d.end-c.length,0<d){u=a.slice(0,d),u=c+u,s.select(),s.setTextContent(u),d===a.length?l.remove():(s=a.slice(d),l.setTextContent(s));return}}else if(d===null||d.start<c.length)return}for(;;){if(l=t(a),a=d=l===null?"":a.slice(l.end),d===""){if(c=u.getNextSibling(),Qt.$isTextNode(c)){if(d=u.getTextContent()+c.getTextContent(),d=t(d),d===null){c instanceof n?o(c):c.markDirty();break}else if(d.start!==0)break}}else if(c=t(d),c!==null&&c.start===0)break;if(l===null)break;if(l.start===0&&Qt.$isTextNode(s)&&s.isTextEntity())continue;let f;if(l.start===0?[f,u]=u.splitText(l.end):[,f,u]=u.splitText(l.start,l.end),l=r(f),l.setFormat(f.getFormat()),f.replace(l),u==null)break}}});return e=e.registerNodeTransform(n,l=>{var s=l.getTextContent();const a=t(s);a===null||a.start!==0?o(l):s.length>a.end?l.splitText(a.end):(s=l.getPreviousSibling(),Qt.$isTextNode(s)&&s.isTextEntity()&&(o(s),o(l)),s=l.getNextSibling(),Qt.$isTextNode(s)&&s.isTextEntity()&&(o(s),l instanceof n&&o(l)))}),[i,e]};const V2=Fo;var H2=V2,fS={},pu=ge;fS.registerDragonSupport=function(e){let t=window.location.origin,n=r=>{if(r.origin===t){var o=e.getRootElement();if(document.activeElement===o&&(o=r.data,typeof o=="string")){try{var i=JSON.parse(o)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"&&(i=i.payload)&&i.functionId==="makeChanges"&&(i=i.args)){const[l,s,a,u,c]=i;e.update(()=>{const d=pu.$getSelection();if(pu.$isRangeSelection(d)){var f=d.anchor;let h=f.getNode(),g=0,m=0;pu.$isTextNode(h)&&0<=l&&0<=s&&(g=l,m=l+s,d.setTextNodeRange(h,g,h,m)),(g!==m||a!=="")&&(d.insertRawText(a),h=f.getNode()),pu.$isTextNode(h)&&(g=u,m=u+c,f=h.getTextContentSize(),g=g>f?f:g,m=m>f?f:m,d.setTextNodeRange(h,g,h,m)),r.stopImmediatePropagation()}})}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}};const K2=fS;var G2=K2,$r={},Yr={},am={},Ky=Oo,Y2=Nt,nl=ge;function hS(e,t,n,r=null){let o=r!=null?t.isSelected(r):!0,i=nl.$isElementNode(t)&&t.excludeFromCopy("html");var l=t;r!==null&&(l=Ky.$cloneWithProperties(t),l=nl.$isTextNode(l)&&r!=null?Ky.$sliceSelectedTextNodeContent(r,l):l);let s=nl.$isElementNode(l)?l.getChildren():[],{element:a,after:u}=l.exportDOM(e);if(!a)return!1;let c=document.createDocumentFragment();for(let d=0;d<s.length;d++){let f=s[d],h=hS(e,f,c,r);!o&&nl.$isElementNode(t)&&h&&t.extractWithChild(f,r,"html")&&(o=!0)}return o&&!i?(Y2.isHTMLElement(a)&&a.append(c),n.append(a),u&&(e=u.call(l,a))&&a.replaceWith(e)):n.append(c),o}let pS=new Set(["STYLE","SCRIPT"]);function gS(e,t,n=new Map,r){let o=[];if(pS.has(e.nodeName))return o;let i=null;var l,{nodeName:s}=e,a=t._htmlConversions.get(s.toLowerCase());if(s=null,a!==void 0)for(l of a)a=l(e),a!==null&&(s===null||s.priority<a.priority)&&(s=a);if(s=(l=s!==null?s.conversion:null)?l(e):null,l=null,s!==null){if(l=s.after,a=s.node,i=Array.isArray(a)?a[a.length-1]:a,i!==null){for(var[,u]of n)if(i=u(i,r),!i)break;i&&o.push(...Array.isArray(a)?a:[i])}s.forChild!=null&&n.set(e.nodeName,s.forChild)}for(e=e.childNodes,r=[],u=0;u<e.length;u++)r.push(...gS(e[u],t,new Map(n),i));return l!=null&&(r=l(r)),i==null?o=o.concat(r):nl.$isElementNode(i)&&i.append(...r),o}am.$generateHtmlFromNodes=function(e,t){if(typeof document>"u"||typeof window>"u")throw Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),r=nl.$getRoot().getChildren();for(let o=0;o<r.length;o++)hS(e,r[o],n,t);return n.innerHTML};am.$generateNodesFromDOM=function(e,t){t=t.body?t.body.childNodes:[];let n=[];for(let o=0;o<t.length;o++){var r=t[o];pS.has(r.nodeName)||(r=gS(r,e),r!==null&&(n=n.concat(r)))}return n};const X2=am;var Q2=X2,mS=Q2,up=Oo,pl=Nt,ue=ge;function Ar(e){let t=new URLSearchParams;t.append("code",e);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let vS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yS(e){let t=ue.$getSelection();if(t==null)throw Error("Expected valid LexicalSelection");return ue.$isRangeSelection(t)&&t.isCollapsed()||t.getNodes().length===0?"":mS.$generateHtmlFromNodes(e,t)}function xS(e){let t=ue.$getSelection();if(t==null)throw Error("Expected valid LexicalSelection");return ue.$isRangeSelection(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(wS(e,t))}function cp(e,t,n){(ue.DEPRECATED_$isGridSelection(n)||pl.$findMatchingParent(n.anchor.getNode(),r=>ue.DEPRECATED_$isGridCellNode(r))!==null&&pl.$findMatchingParent(n.focus.getNode(),r=>ue.DEPRECATED_$isGridCellNode(r))!==null)&&t.length===1&&ue.DEPRECATED_$isGridNode(t[0])?Z2(t,n,!1,e):J2(t,n)}function J2(e,t){let n=[],r=null;for(let o=0;o<e.length;o++){let i=e[o],l=ue.$isLineBreakNode(i);if(l||ue.$isDecoratorNode(i)&&i.isInline()||ue.$isElementNode(i)&&i.isInline()||ue.$isTextNode(i)||i.isParentRequired()){if(r===null&&(r=i.createParentElementNode(),n.push(r),l))continue;r!==null&&r.append(i)}else n.push(i),r=null}ue.$isRangeSelection(t)?t.insertNodes(n):ue.DEPRECATED_$isGridSelection(t)&&(e=t.anchor.getNode(),ue.DEPRECATED_$isGridCellNode(e)||Ar(41),e.append(...n))}function Z2(e,t,n,r){e.length===1&&ue.DEPRECATED_$isGridNode(e[0])||Ar(42);var o=e[0];e=o.getChildren(),n=o.getFirstChildOrThrow().getChildrenSize();var i=o.getChildrenSize(),l=pl.$findMatchingParent(t.anchor.getNode(),h=>ue.DEPRECATED_$isGridCellNode(h));t=(o=l&&pl.$findMatchingParent(l,h=>ue.DEPRECATED_$isGridRowNode(h)))&&pl.$findMatchingParent(o,h=>ue.DEPRECATED_$isGridNode(h)),ue.DEPRECATED_$isGridCellNode(l)&&ue.DEPRECATED_$isGridRowNode(o)&&ue.DEPRECATED_$isGridNode(t)||Ar(43);var s=o.getIndexWithinParent(),a=Math.min(t.getChildrenSize()-1,s+i-1);i=l.getIndexWithinParent(),l=Math.min(o.getChildrenSize()-1,i+n-1),n=Math.min(i,l),o=Math.min(s,a),i=Math.max(i,l),s=Math.max(s,a),a=t.getChildren(),l=0;let u,c;for(let h=o;h<=s;h++){var d=a[h];ue.DEPRECATED_$isGridRowNode(d)||Ar(24);var f=e[l];ue.DEPRECATED_$isGridRowNode(f)||Ar(24),d=d.getChildren(),f=f.getChildren();let g=0;for(let m=n;m<=i;m++){let S=d[m];ue.DEPRECATED_$isGridCellNode(S)||Ar(25);let v=f[g];ue.DEPRECATED_$isGridCellNode(v)||Ar(25),h===o&&m===n?u=S.getKey():h===s&&m===i&&(c=S.getKey());let y=S.getChildren();v.getChildren().forEach(_=>{ue.$isTextNode(_)&&ue.$createParagraphNode().append(_),S.append(_)}),y.forEach(_=>_.remove()),g++}l++}u&&c&&(e=ue.DEPRECATED_$createGridSelection(),e.set(t.getKey(),u,c),ue.$setSelection(e),r.dispatchCommand(ue.SELECTION_CHANGE_COMMAND,void 0))}function _S(e,t,n,r=[]){let o=t!=null?n.isSelected(t):!0,i=ue.$isElementNode(n)&&n.excludeFromCopy("html");var l=n;if(t!==null){var s=up.$cloneWithProperties(n);l=s=ue.$isTextNode(s)&&t!=null?up.$sliceSelectedTextNodeContent(t,s):s}let a=ue.$isElementNode(l)?l.getChildren():[];var u=l;s=u.exportJSON();var c=u.constructor;s.type!==c.getType()&&Ar(58,c.name);let d=s.children;for(ue.$isElementNode(u)&&(Array.isArray(d)||Ar(59,c.name)),ue.$isTextNode(l)&&(l=l.__text,0<l.length?s.text=l:o=!1),l=0;l<a.length;l++)u=a[l],c=_S(e,t,u,s.children),!o&&ue.$isElementNode(n)&&c&&n.extractWithChild(u,t,"clone")&&(o=!0);if(o&&!i)r.push(s);else if(Array.isArray(s.children))for(e=0;e<s.children.length;e++)r.push(s.children[e]);return o}function wS(e,t){let n=[],r=ue.$getRoot().getChildren();for(let o=0;o<r.length;o++)_S(e,t,r[o],n);return{namespace:e._config.namespace,nodes:n}}function SS(e){let t=[];for(let n=0;n<e.length;n++){let r=ue.$parseSerializedNode(e[n]);ue.$isTextNode(r)&&up.$addNodeStyle(r),t.push(r)}return t}let Mi=null;function Gy(e,t){var n=vS?(e._window||window).getSelection():null;if(!n)return!1;var r=n.anchorNode;if(n=n.focusNode,r!==null&&n!==null&&!ue.isSelectionWithinEditor(e,r,n)||(t.preventDefault(),t=t.clipboardData,r=ue.$getSelection(),t===null||r===null))return!1;n=yS(e),e=xS(e);let o="";return r!==null&&(o=r.getTextContent()),n!==null&&t.setData("text/html",n),e!==null&&t.setData("application/x-lexical-editor",e),t.setData("text/plain",o),!0}Yr.$generateJSONFromSelectedNodes=wS;Yr.$generateNodesFromSerializedNodes=SS;Yr.$getHtmlContent=yS;Yr.$getLexicalContent=xS;Yr.$insertDataTransferForPlainText=function(e,t){e=e.getData("text/plain")||e.getData("text/uri-list"),e!=null&&t.insertRawText(e)};Yr.$insertDataTransferForRichText=function(e,t,n){var r=e.getData("application/x-lexical-editor");if(r)try{let l=JSON.parse(r);if(l.namespace===n._config.namespace&&Array.isArray(l.nodes)){let s=SS(l.nodes);return cp(n,s,t)}}catch{}if(r=e.getData("text/html"))try{var o=new DOMParser().parseFromString(r,"text/html"),i=mS.$generateNodesFromDOM(n,o);return cp(n,i,t)}catch{}if(e=e.getData("text/plain")||e.getData("text/uri-list"),e!=null)if(ue.$isRangeSelection(t))for(e=e.split(/(\r?\n|\t)/),n=e.length,o=0;o<n;o++)i=e[o],i===`
118
+ `||i===`\r
119
+ `?t.insertParagraph():i===" "?t.insertNodes([ue.$createTabNode()]):t.insertText(i);else t.insertRawText(e)};Yr.$insertGeneratedNodes=cp;Yr.copyToClipboard=async function(e,t){if(Mi!==null)return!1;if(t!==null)return new Promise(l=>{e.update(()=>{l(Gy(e,t))})});var n=e.getRootElement();let r=e._window==null?window.document:e._window.document,o=vS?(e._window||window).getSelection():null;if(n===null||o===null)return!1;let i=r.createElement("span");return i.style.cssText="position: fixed; top: -1000px;",i.append(r.createTextNode("#")),n.append(i),n=new Range,n.setStart(i,0),n.setEnd(i,1),o.removeAllRanges(),o.addRange(n),new Promise(l=>{let s=e.registerCommand(ue.COPY_COMMAND,a=>(pl.objectKlassEquals(a,ClipboardEvent)&&(s(),Mi!==null&&(window.clearTimeout(Mi),Mi=null),l(Gy(e,a))),!0),ue.COMMAND_PRIORITY_CRITICAL);Mi=window.setTimeout(()=>{s(),Mi=null,l(!1)},50),r.execCommand("copy"),i.remove()})};const q2=Yr;var eR=q2,Mc=eR,gu=Oo,hr=Nt,b=ge;function Yy(e,t){return typeof document.caretRangeFromPoint<"u"?(e=document.caretRangeFromPoint(e,t),e===null?null:{node:e.startContainer,offset:e.startOffset}):document.caretPositionFromPoint!=="undefined"?(e=document.caretPositionFromPoint(e,t),e===null?null:{node:e.offsetNode,offset:e.offset}):null}let Kl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",tR=Kl&&"documentMode"in document?document.documentMode:null,nR=Kl&&"InputEvent"in window&&!tR?"getTargetRanges"in new window.InputEvent("input"):!1,rR=Kl&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),oR=Kl&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,iR=Kl&&/^(?=.*Chrome).*/i.test(navigator.userAgent),lR=Kl&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!iR,dp=b.createCommand("DRAG_DROP_PASTE_FILE"),um=class CS extends b.ElementNode{static getType(){return"quote"}static clone(t){return new CS(t.__key)}constructor(t){super(t)}createDOM(t){let n=document.createElement("blockquote");return hr.addClassNamesToElement(n,t.theme.quote),n}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:sR,priority:0})}}exportDOM(t){if({element:t}=super.exportDOM(t),t&&hr.isHTMLElement(t)){this.isEmpty()&&t.append(document.createElement("br"));var n=this.getFormatType();t.style.textAlign=n,(n=this.getDirection())&&(t.dir=n)}return{element:t}}static importJSON(t){let n=cm();return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(t,n){t=b.$createParagraphNode();let r=this.getDirection();return t.setDirection(r),this.insertAfter(t,n),t}collapseAtStart(){let t=b.$createParagraphNode();return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}};function cm(){return b.$applyNodeReplacement(new um)}let dm=class ES extends b.ElementNode{static getType(){return"heading"}static clone(t){return new ES(t.__tag,t.__key)}constructor(t,n){super(n),this.__tag=t}getTag(){return this.__tag}createDOM(t){let n=this.__tag,r=document.createElement(n);return t=t.theme.heading,t!==void 0&&hr.addClassNamesToElement(r,t[n]),r}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:Di,priority:0}),h2:()=>({conversion:Di,priority:0}),h3:()=>({conversion:Di,priority:0}),h4:()=>({conversion:Di,priority:0}),h5:()=>({conversion:Di,priority:0}),h6:()=>({conversion:Di,priority:0}),p:t=>(t=t.firstChild,t!==null&&Xy(t)?{conversion:()=>({node:null}),priority:3}:null),span:t=>Xy(t)?{conversion:()=>({node:rl("h1")}),priority:3}:null}}exportDOM(t){if({element:t}=super.exportDOM(t),t&&hr.isHTMLElement(t)){this.isEmpty()&&t.append(document.createElement("br"));var n=this.getFormatType();t.style.textAlign=n,(n=this.getDirection())&&(t.dir=n)}return{element:t}}static importJSON(t){let n=rl(t.tag);return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(t,n=!0){t=t?t.anchor.offset:0,t=0<t&&t<this.getTextContentSize()?rl(this.getTag()):b.$createParagraphNode();let r=this.getDirection();return t.setDirection(r),this.insertAfter(t,n),t}collapseAtStart(){let t=this.isEmpty()?b.$createParagraphNode():rl(this.getTag());return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}extractWithChild(){return!0}};function Xy(e){return e.nodeName.toLowerCase()==="span"?e.style.fontSize==="26pt":!1}function Di(e){let t=e.nodeName.toLowerCase(),n=null;return(t==="h1"||t==="h2"||t==="h3"||t==="h4"||t==="h5"||t==="h6")&&(n=rl(t),e.style!==null&&n.setFormat(e.style.textAlign)),{node:n}}function sR(e){let t=cm();return e.style!==null&&t.setFormat(e.style.textAlign),{node:t}}function rl(e){return b.$applyNodeReplacement(new dm(e))}function aR(e,t){e.preventDefault(),t.update(()=>{let n=b.$getSelection(),r=e instanceof InputEvent||e instanceof KeyboardEvent?null:e.clipboardData;r!=null&&(b.$isRangeSelection(n)||b.DEPRECATED_$isGridSelection(n))&&Mc.$insertDataTransferForRichText(r,n,t)},{tag:"paste"})}async function uR(e,t){await Mc.copyToClipboard(t,hr.objectKlassEquals(e,ClipboardEvent)?e:null),t.update(()=>{let n=b.$getSelection();b.$isRangeSelection(n)?n.removeText():b.$isNodeSelection(n)&&n.getNodes().forEach(r=>r.remove())})}function Cs(e){let t=null;if(e instanceof DragEvent?t=e.dataTransfer:e instanceof ClipboardEvent&&(t=e.clipboardData),t===null)return[!1,[],!1];var n=t.types;return e=n.includes("Files"),n=n.includes("text/html")||n.includes("text/plain"),[e,Array.from(t.files),n]}function Qy(e){var t=b.$getSelection();if(!b.$isRangeSelection(t))return!1;let n=new Set;t=t.getNodes();for(let i=0;i<t.length;i++){var r=t[i],o=r.getKey();n.has(o)||(r=hr.$getNearestBlockElementAncestorOrThrow(r),o=r.getKey(),r.canIndent()&&!n.has(o)&&(n.add(o),e(r)))}return 0<n.size}function mu(e){return e=b.$getNearestNodeFromDOMNode(e),b.$isDecoratorNode(e)}$r.$createHeadingNode=rl;$r.$createQuoteNode=cm;$r.$isHeadingNode=function(e){return e instanceof dm};$r.$isQuoteNode=function(e){return e instanceof um};$r.DRAG_DROP_PASTE=dp;$r.HeadingNode=dm;$r.QuoteNode=um;$r.eventFiles=Cs;$r.registerRichText=function(e){return hr.mergeRegister(e.registerCommand(b.CLICK_COMMAND,()=>{const t=b.$getSelection();return b.$isNodeSelection(t)?(t.clear(),!0):!1},0),e.registerCommand(b.DELETE_CHARACTER_COMMAND,t=>{const n=b.$getSelection();return b.$isRangeSelection(n)?(n.deleteCharacter(t),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.DELETE_WORD_COMMAND,t=>{const n=b.$getSelection();return b.$isRangeSelection(n)?(n.deleteWord(t),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.DELETE_LINE_COMMAND,t=>{const n=b.$getSelection();return b.$isRangeSelection(n)?(n.deleteLine(t),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.CONTROLLED_TEXT_INSERTION_COMMAND,t=>{const n=b.$getSelection();if(typeof t=="string")b.$isRangeSelection(n)?n.insertText(t):b.DEPRECATED_$isGridSelection(n);else{if(!b.$isRangeSelection(n)&&!b.DEPRECATED_$isGridSelection(n))return!1;const r=t.dataTransfer;r!=null?Mc.$insertDataTransferForRichText(r,n,e):b.$isRangeSelection(n)&&(t=t.data)&&n.insertText(t)}return!0},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.REMOVE_TEXT_COMMAND,()=>{const t=b.$getSelection();return b.$isRangeSelection(t)?(t.removeText(),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.FORMAT_TEXT_COMMAND,t=>{const n=b.$getSelection();return b.$isRangeSelection(n)?(n.formatText(t),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.FORMAT_ELEMENT_COMMAND,t=>{var n=b.$getSelection();if(!b.$isRangeSelection(n)&&!b.$isNodeSelection(n))return!1;n=n.getNodes();for(const r of n)n=hr.$findMatchingParent(r,o=>b.$isElementNode(o)&&!o.isInline()),n!==null&&n.setFormat(t);return!0},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.INSERT_LINE_BREAK_COMMAND,t=>{const n=b.$getSelection();return b.$isRangeSelection(n)?(n.insertLineBreak(t),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.INSERT_PARAGRAPH_COMMAND,()=>{const t=b.$getSelection();return b.$isRangeSelection(t)?(t.insertParagraph(),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.INSERT_TAB_COMMAND,()=>(b.$insertNodes([b.$createTabNode()]),!0),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.INDENT_CONTENT_COMMAND,()=>Qy(t=>{const n=t.getIndent();t.setIndent(n+1)}),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.OUTDENT_CONTENT_COMMAND,()=>Qy(t=>{const n=t.getIndent();0<n&&t.setIndent(n-1)}),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ARROW_UP_COMMAND,t=>{var n=b.$getSelection();if(b.$isNodeSelection(n)&&!mu(t.target)){if(t=n.getNodes(),0<t.length)return t[0].selectPrevious(),!0}else if(b.$isRangeSelection(n)&&(n=b.$getAdjacentNode(n.focus,!0),!t.shiftKey&&b.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline()))return n.selectPrevious(),t.preventDefault(),!0;return!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ARROW_DOWN_COMMAND,t=>{var n=b.$getSelection();if(b.$isNodeSelection(n)){if(t=n.getNodes(),0<t.length)return t[0].selectNext(0,0),!0}else if(b.$isRangeSelection(n)){let r=n.focus;if(r.key==="root"&&r.offset===b.$getRoot().getChildrenSize())return t.preventDefault(),!0;if(n=b.$getAdjacentNode(n.focus,!1),!t.shiftKey&&b.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),t.preventDefault(),!0}return!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ARROW_LEFT_COMMAND,t=>{const n=b.$getSelection();if(b.$isNodeSelection(n)){var r=n.getNodes();if(0<r.length)return t.preventDefault(),r[0].selectPrevious(),!0}return b.$isRangeSelection(n)&&gu.$shouldOverrideDefaultCharacterSelection(n,!0)?(r=t.shiftKey,t.preventDefault(),gu.$moveCharacter(n,r,!0),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ARROW_RIGHT_COMMAND,t=>{const n=b.$getSelection();if(b.$isNodeSelection(n)&&!mu(t.target)){var r=n.getNodes();if(0<r.length)return t.preventDefault(),r[0].selectNext(0,0),!0}return b.$isRangeSelection(n)?(r=t.shiftKey,gu.$shouldOverrideDefaultCharacterSelection(n,!1)?(t.preventDefault(),gu.$moveCharacter(n,r,!1),!0):!1):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_BACKSPACE_COMMAND,t=>{if(mu(t.target))return!1;const n=b.$getSelection();if(!b.$isRangeSelection(n))return!1;t.preventDefault(),{anchor:t}=n;const r=t.getNode();return n.isCollapsed()&&t.offset===0&&!b.$isRootNode(r)&&0<hr.$getNearestBlockElementAncestorOrThrow(r).getIndent()?e.dispatchCommand(b.OUTDENT_CONTENT_COMMAND,void 0):e.dispatchCommand(b.DELETE_CHARACTER_COMMAND,!0)},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_DELETE_COMMAND,t=>{if(mu(t.target))return!1;const n=b.$getSelection();return b.$isRangeSelection(n)?(t.preventDefault(),e.dispatchCommand(b.DELETE_CHARACTER_COMMAND,!1)):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ENTER_COMMAND,t=>{const n=b.$getSelection();if(!b.$isRangeSelection(n))return!1;if(t!==null){if((oR||rR||lR)&&nR)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(b.INSERT_LINE_BREAK_COMMAND,!1)}return e.dispatchCommand(b.INSERT_PARAGRAPH_COMMAND,void 0)},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.KEY_ESCAPE_COMMAND,()=>{const t=b.$getSelection();return b.$isRangeSelection(t)?(e.blur(),!0):!1},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.DROP_COMMAND,t=>{const[,n]=Cs(t);if(0<n.length){var r=Yy(t.clientX,t.clientY);if(r!==null){const{offset:i,node:l}=r;var o=b.$getNearestNodeFromDOMNode(l);if(o!==null){if(r=b.$createRangeSelection(),b.$isTextNode(o))r.anchor.set(o.getKey(),i,"text"),r.focus.set(o.getKey(),i,"text");else{const s=o.getParentOrThrow().getKey();o=o.getIndexWithinParent()+1,r.anchor.set(s,o,"element"),r.focus.set(s,o,"element")}r=b.$normalizeSelection__EXPERIMENTAL(r),b.$setSelection(r)}e.dispatchCommand(dp,n)}return t.preventDefault(),!0}return t=b.$getSelection(),!!b.$isRangeSelection(t)},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.DRAGSTART_COMMAND,t=>{[t]=Cs(t);const n=b.$getSelection();return!(t&&!b.$isRangeSelection(n))},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.DRAGOVER_COMMAND,t=>{var[n]=Cs(t);const r=b.$getSelection();return n&&!b.$isRangeSelection(r)?!1:(n=Yy(t.clientX,t.clientY),n!==null&&(n=b.$getNearestNodeFromDOMNode(n.node),b.$isDecoratorNode(n)&&t.preventDefault()),!0)},b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.SELECT_ALL_COMMAND,()=>(b.$selectAll(),!0),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.COPY_COMMAND,t=>(Mc.copyToClipboard(e,hr.objectKlassEquals(t,ClipboardEvent)?t:null),!0),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.CUT_COMMAND,t=>(uR(t,e),!0),b.COMMAND_PRIORITY_EDITOR),e.registerCommand(b.PASTE_COMMAND,t=>{const[,n,r]=Cs(t);if(0<n.length&&!r)return e.dispatchCommand(dp,n),!0;if(b.isSelectionCapturedInDecoratorInput(t.target))return!1;const o=b.$getSelection();return b.$isRangeSelection(o)||b.DEPRECATED_$isGridSelection(o)?(aR(t,e),!0):!1},b.COMMAND_PRIORITY_EDITOR))};const cR=$r;var Us=cR,$S=rr,dR=U2,Dn=p,fR=H2,kS=Nt,Jy=Hr,hR=G2,pR=Us,fm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Dn.useLayoutEffect:Dn.useEffect;function Zy(e){return e.getEditorState().read(fR.$canShowPlaceholderCurry(e.isComposing()))}function gR(e){let[t,n]=Dn.useState(()=>Zy(e));return fm(()=>{function r(){let o=Zy(e);n(o)}return r(),kS.mergeRegister(e.registerUpdateListener(()=>{r()}),e.registerEditableListener(()=>{r()}))},[e]),t}function mR(e,t){let[n,r]=Dn.useState(()=>e.getDecorators());return fm(()=>e.registerDecoratorListener(o=>{Jy.flushSync(()=>{r(o)})}),[e]),Dn.useEffect(()=>{r(e.getDecorators())},[e]),Dn.useMemo(()=>{let o=[],i=Object.keys(n);for(let l=0;l<i.length;l++){let s=i[l],a=Dn.createElement(t,{onError:c=>e._onError(c)},Dn.createElement(Dn.Suspense,{fallback:null},n[s])),u=e.getElementByKey(s);u!==null&&o.push(Jy.createPortal(a,u,s))}return o},[t,n,e])}function vR(e){fm(()=>kS.mergeRegister(pR.registerRichText(e),hR.registerDragonSupport(e)),[e])}function yR({content:e}){var[t]=$S.useLexicalComposerContext();t=gR(t);let n=dR();return t?typeof e=="function"?e(n):e:null}uS.RichTextPlugin=function({contentEditable:e,placeholder:t,ErrorBoundary:n}){let[r]=$S.useLexicalComposerContext();return n=mR(r,n),vR(r),Dn.createElement(Dn.Fragment,null,e,Dn.createElement(yR,{content:t}),n)};const xR=uS;var _R=xR,TS={},br=fo,wR=rr,NS=p,SR=Nt,ds=ge;function CR(e){NS.useEffect(()=>SR.mergeRegister(e.registerCommand(br.INSERT_ORDERED_LIST_COMMAND,()=>(br.insertList(e,"number"),!0),ds.COMMAND_PRIORITY_LOW),e.registerCommand(br.INSERT_UNORDERED_LIST_COMMAND,()=>(br.insertList(e,"bullet"),!0),ds.COMMAND_PRIORITY_LOW),e.registerCommand(br.REMOVE_LIST_COMMAND,()=>(br.removeList(e),!0),ds.COMMAND_PRIORITY_LOW),e.registerCommand(ds.INSERT_PARAGRAPH_COMMAND,()=>!!br.$handleListInsertParagraph(),ds.COMMAND_PRIORITY_LOW)),[e])}TS.ListPlugin=function(){let[e]=wR.useLexicalComposerContext();return NS.useEffect(()=>{if(!e.hasNodes([br.ListNode,br.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[e]),CR(e),null};const ER=TS;var $R=ER,bS={},Xr={},RS=Nt,mr=ge;let kR=new Set(["http:","https:","mailto:","sms:","tel:"]);class Gl extends mr.ElementNode{static getType(){return"link"}static clone(t){return new Gl(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(t,n={},r){super(r);let{target:o=null,rel:i=null,title:l=null}=n;this.__url=t,this.__target=o,this.__rel=i,this.__title=l}createDOM(t){let n=document.createElement("a");return n.href=this.sanitizeUrl(this.__url),this.__target!==null&&(n.target=this.__target),this.__rel!==null&&(n.rel=this.__rel),this.__title!==null&&(n.title=this.__title),RS.addClassNamesToElement(n,t.theme.link),n}updateDOM(t,n){let r=this.__url,o=this.__target,i=this.__rel,l=this.__title;return r!==t.__url&&(n.href=r),o!==t.__target&&(o?n.target=o:n.removeAttribute("target")),i!==t.__rel&&(i?n.rel=i:n.removeAttribute("rel")),l!==t.__title&&(l?n.title=l:n.removeAttribute("title")),!1}static importDOM(){return{a:()=>({conversion:TR,priority:1})}}static importJSON(t){let n=xa(t.url,{rel:t.rel,target:t.target,title:t.title});return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}sanitizeUrl(t){try{let n=new URL(t);if(!kR.has(n.protocol))return"about:blank"}catch{}return t}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(t){this.getWritable().__url=t}getTarget(){return this.getLatest().__target}setTarget(t){this.getWritable().__target=t}getRel(){return this.getLatest().__rel}setRel(t){this.getWritable().__rel=t}getTitle(){return this.getLatest().__title}setTitle(t){this.getWritable().__title=t}insertNewAfter(t,n=!0){return t=this.getParentOrThrow().insertNewAfter(t,n),mr.$isElementNode(t)?(n=xa(this.__url,{rel:this.__rel,target:this.__target,title:this.__title}),t.append(n),n):null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(t,n){if(!mr.$isRangeSelection(n))return!1;t=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(t)&&this.isParentOf(r)&&0<n.getTextContent().length}}function TR(e){let t=null;if(RS.isHTMLAnchorElement(e)){let n=e.textContent;n!==null&&n!==""&&(t=xa(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function xa(e,t){return mr.$applyNodeReplacement(new Gl(e,t))}function Yo(e){return e instanceof Gl}class Ia extends Gl{static getType(){return"autolink"}static clone(t){return new Ia(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}static importJSON(t){let n=fp(t.url,{rel:t.rel,target:t.target,title:t.title});return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),type:"autolink",version:1}}insertNewAfter(t,n=!0){return t=this.getParentOrThrow().insertNewAfter(t,n),mr.$isElementNode(t)?(n=fp(this.__url,{rel:this._rel,target:this.__target,title:this.__title}),t.append(n),n):null}}function fp(e,t){return mr.$applyNodeReplacement(new Ia(e,t))}let NR=mr.createCommand("TOGGLE_LINK_COMMAND");function bR(e,t){for(;e!==null&&(e=e.getParent())!==null&&!t(e););return e}Xr.$createAutoLinkNode=fp;Xr.$createLinkNode=xa;Xr.$isAutoLinkNode=function(e){return e instanceof Ia};Xr.$isLinkNode=Yo;Xr.AutoLinkNode=Ia;Xr.LinkNode=Gl;Xr.TOGGLE_LINK_COMMAND=NR;Xr.toggleLink=function(e,t={}){let{target:n,title:r}=t,o=t.rel===void 0?"noreferrer":t.rel;if(t=mr.$getSelection(),mr.$isRangeSelection(t))if(t=t.extract(),e===null)t.forEach(l=>{if(l=l.getParent(),Yo(l)){let s=l.getChildren();for(let a=0;a<s.length;a++)l.insertBefore(s[a]);l.remove()}});else{if(t.length===1){var i=t[0];if(i=Yo(i)?i:bR(i,Yo),i!==null){i.setURL(e),n!==void 0&&i.setTarget(n),o!==null&&i.setRel(o),r!==void 0&&i.setTitle(r);return}}let l=null,s=null;t.forEach(a=>{var u=a.getParent();if(u!==s&&u!==null&&(!mr.$isElementNode(a)||a.isInline()))if(Yo(u))s=u,u.setURL(e),n!==void 0&&u.setTarget(n),o!==null&&s.setRel(o),r!==void 0&&s.setTitle(r);else if(u.is(l)||(l=u,s=xa(e,{rel:o,target:n}),Yo(u)?a.getPreviousSibling()===null?u.insertBefore(s):u.insertAfter(s):a.insertBefore(s)),Yo(a)){if(!a.is(s)){if(s!==null){u=a.getChildren();for(let c=0;c<u.length;c++)s.append(u[c])}a.remove()}}else s!==null&&s.append(a)})}};const RR=Xr;var bl=RR,Li=bl,PR=rr,OR=Nt,Ii=ge,AR=p;bS.LinkPlugin=function({validateUrl:e}){let[t]=PR.useLexicalComposerContext();return AR.useEffect(()=>{if(!t.hasNodes([Li.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return OR.mergeRegister(t.registerCommand(Li.TOGGLE_LINK_COMMAND,n=>{if(n===null)return Li.toggleLink(n),!0;if(typeof n=="string")return e===void 0||e(n)?(Li.toggleLink(n),!0):!1;let{url:r,target:o,rel:i,title:l}=n;return Li.toggleLink(r,{rel:i,target:o,title:l}),!0},Ii.COMMAND_PRIORITY_LOW),e!==void 0?t.registerCommand(Ii.PASTE_COMMAND,n=>{let r=Ii.$getSelection();if(!Ii.$isRangeSelection(r)||r.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let o=n.clipboardData.getData("text");return e(o)?r.getNodes().some(i=>Ii.$isElementNode(i))?!1:(t.dispatchCommand(Li.TOGGLE_LINK_COMMAND,o),n.preventDefault(),!0):!1},Ii.COMMAND_PRIORITY_LOW):()=>{})},[t,e]),null};const MR=bS;var DR=MR;function LR({ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:r,ariaExpanded:o,ariaLabel:i,ariaLabelledBy:l,ariaMultiline:s,ariaOwns:a,ariaRequired:u,autoCapitalize:c,className:d,id:f,role:h="textbox",spellCheck:g=!0,style:m,tabIndex:S,"data-testid":v,...y}){const[_]=rr.useLexicalComposerContext(),[w,C]=p.useState(!1),$=p.useCallback(E=>{var M;_.setRootElement(E);const T=(M=document.getElementById("val-ui"))==null?void 0:M.shadowRoot;if(T&&"getSelection"in T){_._window=T;return}},[_]);return p.useLayoutEffect(()=>(C(_.isEditable()),_.registerEditableListener(E=>{C(E)})),[_]),x.jsx("div",{...y,"aria-activedescendant":w?e:void 0,"aria-autocomplete":w?t:"none","aria-controls":w?n:void 0,"aria-describedby":r,"aria-expanded":w&&h==="combobox"?!!o:void 0,"aria-label":i,"aria-labelledby":l,"aria-multiline":s,"aria-owns":w?a:void 0,"aria-readonly":w?void 0:!0,"aria-required":u,autoCapitalize:c,className:d,contentEditable:w,"data-testid":v,id:f,ref:$,role:h,spellCheck:g,style:m,tabIndex:S})}function IR({className:e}){return x.jsx(LR,{className:e})}class ja extends ge.DecoratorNode{constructor(t,n){super(n),this.__src=t.src,this.__altText=t.altText,this.__width=t.width,this.__height=t.height}static getType(){return"image"}static clone(t){return new ja({src:t.__src,altText:t.__altText,width:t.__width,height:t.__height})}exportJSON(){return{altText:this.__altText,height:this.__width,src:this.__src,type:"image",version:1,width:this.__width}}static importJSON(t){return PS(t)}createDOM(){return document.createElement("div")}updateDOM(){return!1}decorate(){return x.jsx(jR,{src:this.__src,altText:this.__altText,empty:this.__empty,height:this.__height,nodeKey:this.getKey()})}}function jR(e){return x.jsx("img",{src:e.src})}function PS(e){return new ja(e)}function zR(){const[e]=rr.useLexicalComposerContext();return p.useEffect(()=>{e.focus()},[e]),null}const OS=ge.createCommand("INSERT_IMAGE_COMMAND");function FR(){const[e]=rr.useLexicalComposerContext();return p.useEffect(()=>{if(!e.hasNodes([ja]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Nt.mergeRegister(e.registerCommand(OS,t=>{const n=PS(t);return ge.$insertNodes([n]),ge.$isRootOrShadowRoot(n.getParentOrThrow())&&Nt.$wrapNodeInElement(n,ge.$createParagraphNode).selectEnd(),!0},ge.COMMAND_PRIORITY_EDITOR))},[e]),null}const BR=({className:e})=>x.jsxs("svg",{height:12,width:12,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[x.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),x.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]}),WR=BR,UR=({className:e})=>x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,width:12,height:12,children:[x.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),x.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),x.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]}),VR=UR,HR=({className:e})=>x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1",className:e,width:12,height:12,children:x.jsx("path",{fillRule:"evenodd",d:"M13,15 L13,21 C13,21.5522847 12.5522847,22 12,22 C11.4477153,22 11,21.5522847 11,21 L11,15 L13,15 Z M3,13 C2.44771525,13 2,12.5522847 2,12 C2,11.4477153 2.44771525,11 3,11 L21,11 C21.5522847,11 22,11.4477153 22,12 C22,12.5522847 21.5522847,13 21,13 L3,13 Z M19,2 C19.5522847,2 20,2.44771525 20,3 C20,3.55228475 19.5522847,4 19,4 L13,4 L13,9 L11,9 L11,4 L5,4 C4.44771525,4 4,3.55228475 4,3 C4,2.44771525 4.44771525,2 5,2 L19,2 Z"})}),KR=HR,GR=({variant:e="primary",onClick:t,children:n,icon:r,disabled:o=!1})=>x.jsx("button",{disabled:o,className:id("font-sans font-[12px] tracking-[0.04em] py-1 px-2 rounded whitespace-nowrap group relative text-primary",{"font-bold":e==="primary","bg-background hover:bg-background text-fill disabled:bg-fill disabled:text-background":e==="primary","bg-transparent border border-primary text-primary hover:border-highlight hover:text-highlight disabled:bg-fill disabled:text-background":e!=="primary"}),onClick:t,children:x.jsxs("span",{className:"flex flex-row items-center justify-center gap-2",children:[r&&r,n]})}),Xo=GR,YR=({className:e})=>x.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",className:e,children:[x.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.70733 1.00015L8.7784 6.07121L8.07129 6.77832L3.00022 1.70725L3.70733 1.00015Z",fill:"currentColor"}),x.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.00015 10.4709L8.07121 5.39983L8.77832 6.10693L3.70725 11.178L3.00015 10.4709Z",fill:"currentColor"})]}),XR=YR,AS=q.createContext({get api(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get session(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get theme(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setTheme(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get editMode(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setEditMode(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get highlight(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setHighlight(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setWindowSize(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get windowSize(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")}});function hm(){return q.useContext(AS)}const QR=({options:e,onChange:t,label:n,icon:r})=>{const[o,i]=p.useState(!1),l=p.useRef(null),[s,a]=p.useState(0),{windowSize:u}=hm(),c=()=>{i(!o)},d=(f,h)=>{a(h),t(f),i(!1)};return p.useEffect(()=>{const f=h=>{o&&l.current&&!l.current.contains(h.target)&&i(!1)};return document.addEventListener("click",f),()=>{document.removeEventListener("click",f)}},[]),x.jsx("div",{className:"text-[12px]",ref:l,children:x.jsx(Xo,{onClick:f=>{f.preventDefault(),c()},icon:x.jsx(XR,{className:`rotate-[-90deg] transition-transform duration-150 ease-in-out ${o?"":"rotate-[90deg]"}`}),children:x.jsxs("div",{className:"relative",children:[x.jsxs("span",{className:"flex flex-row items-center justify-center gap-1",children:[n,r&&r]}),o&&x.jsx("div",{className:"absolute -top-[4px] overflow-scroll shadow-lg -left-2 text-primary bg-border w-fit z-overlay",style:{maxHeight:u==null?void 0:u.innerHeight},children:x.jsx("div",{className:"flex flex-col ",children:e==null?void 0:e.map((f,h)=>x.jsx("button",{onClick:g=>{g.preventDefault(),d(f,h)},className:`text-left px-2 py-1 hover:bg-background hover:text-highlight ${h===s&&"font-bold bg-background hover:bg-background truncate"}`,children:f},f))})})]})})})},JR=QR,ZR=new TextEncoder;function MS(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const l=o.result;if(typeof l=="string"){const s=new Image;s.addEventListener("load",async()=>{const a=await wn.getSHA256Hash(ZR.encode(l));if(s.naturalWidth&&s.naturalHeight){const u=Og(l);t({src:l,width:s.naturalWidth,height:s.naturalHeight,filename:r==null?void 0:r.name,sha256:a,mimeType:u,fileExt:u&&Ag(u)})}else t({src:l,filename:r==null?void 0:r.name,sha256:a})}),s.src=l}else n(l?{message:"Unexpected image result type",result:l}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function DS(e){const t=e.anchor,n=e.focus,r=e.anchor.getNode(),o=e.focus.getNode();return r===o?r:e.isBackward()?Oo.$isAtNodeEnd(n)?r:o:Oo.$isAtNodeEnd(t)?r:o}function qR(){const[e]=rr.useLexicalComposerContext();return p.useEffect(()=>Nt.mergeRegister(e.registerCommand(ge.CLICK_COMMAND,t=>{const n=ge.$getSelection();if(ge.$isRangeSelection(n)){const r=DS(n),o=Nt.$findMatchingParent(r,bl.$isLinkNode);if(bl.$isLinkNode(o)&&(t.metaKey||t.ctrlKey))return window.open(o.getURL(),"_blank"),!0}return!1},ge.COMMAND_PRIORITY_LOW)),[]),null}var LS={exports:{}},eP="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",tP=eP,nP=tP;function IS(){}function jS(){}jS.resetWarningCache=IS;var rP=function(){function e(r,o,i,l,s,a){if(a!==nP){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:jS,resetWarningCache:IS};return n.PropTypes=n,n};LS.exports=rP();var oP=LS.exports;const In=$a(oP);function hp(){return hp=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hp.apply(this,arguments)}function iP(e,t){if(e==null)return{};var n=lP(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function lP(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var pm=p.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=e.size,i=o===void 0?24:o,l=iP(e,["color","size"]);return q.createElement("svg",hp({ref:t,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),q.createElement("polyline",{points:"20 6 9 17 4 12"}))});pm.propTypes={color:In.string,size:In.oneOfType([In.string,In.number])};pm.displayName="Check";const sP=pm;function pp(){return pp=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pp.apply(this,arguments)}function aP(e,t){if(e==null)return{};var n=uP(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function uP(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var gm=p.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=e.size,i=o===void 0?24:o,l=aP(e,["color","size"]);return q.createElement("svg",pp({ref:t,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),q.createElement("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),q.createElement("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}))});gm.propTypes={color:In.string,size:In.oneOfType([In.string,In.number])};gm.displayName="Link";const cP=gm;function gp(){return gp=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gp.apply(this,arguments)}function dP(e,t){if(e==null)return{};var n=fP(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function fP(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var mm=p.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=e.size,i=o===void 0?24:o,l=dP(e,["color","size"]);return q.createElement("svg",gp({ref:t,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))});mm.propTypes={color:In.string,size:In.oneOfType([In.string,In.number])};mm.displayName="X";const hP=mm,pP=({fontSizes:e,fontsFamilies:t,onEditor:n,colors:r})=>{const[o]=rr.useLexicalComposerContext();p.useEffect(()=>{n&&n(o)},[o]);const[i,l]=p.useState(o),[s,a]=p.useState(null),[u,c]=p.useState(!1),[d,f]=p.useState(!1),[h,g]=p.useState(!1),[m,S]=p.useState(!1);p.useState("15px"),p.useState("#000"),p.useState("Sans");const[v,y]=p.useState("paragraph");p.useState(!1),p.useState(!1),p.useState("url"),p.useState(null);const[_,w]=p.useState(null),C=R=>{o.dispatchCommand(bl.TOGGLE_LINK_COMMAND,R)},$={paragraph:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",number:"Numbered List",bullet:"Bulleted List"},E={};for(const R in $)E[$[R]]=R;const T=p.useCallback(()=>{const R=ge.$getSelection();if(ge.$isRangeSelection(R)){const j=R.anchor.getNode();let F=j.getKey()==="root"?j:Nt.$findMatchingParent(j,O=>{const k=O.getParent();return k!==null&&ge.$isRootOrShadowRoot(k)});F===null&&(F=j.getTopLevelElementOrThrow());const ae=DS(R),H=Nt.$findMatchingParent(ae,bl.$isLinkNode);if(H!==null){const O=H.getURL();w(O)}else w(null);const X=F.getKey(),P=i.getElementByKey(X);if(c(R.hasFormat("bold")),f(R.hasFormat("italic")),g(R.hasFormat("strikethrough")),S(R.hasFormat("underline")),P!==null)if(a(X),fo.$isListNode(F)){const O=Nt.$getNearestNodeOfType(j,fo.ListNode),k=O?O.getListType():F.getListType();y(k)}else{const O=Us.$isHeadingNode(F)?F.getTag():F.getType();O in $&&y(O)}}},[i]);p.useEffect(()=>Nt.mergeRegister(o.registerUpdateListener(({editorState:R})=>{R.read(()=>{T()})})),[T,i,o]),p.useEffect(()=>o.registerCommand(ge.SELECTION_CHANGE_COMMAND,(R,j)=>(T(),l(j),!1),ge.COMMAND_PRIORITY_CRITICAL),[o,T]);const M=R=>{["h1","h2","h3","h4","h5","h6"].includes(R)?v!==R&&o.update(()=>{const j=ge.$getSelection();ge.$isRangeSelection(j)&&Oo.$setBlocksType(j,()=>Us.$createHeadingNode(R))}):R==="paragraph"&&v!=="paragraph"?o.update(()=>{const j=ge.$getSelection();(ge.$isRangeSelection(j)||ge.DEPRECATED_$isGridSelection(j))&&Oo.$setBlocksType(j,()=>ge.$createParagraphNode())}):R==="number"&&v!=="number"?o.dispatchCommand(fo.INSERT_ORDERED_LIST_COMMAND,void 0):R==="bullet"&&v!=="bullet"?o.dispatchCommand(fo.INSERT_UNORDERED_LIST_COMMAND,void 0):o.dispatchCommand(fo.REMOVE_LIST_COMMAND,void 0)};return p.useCallback(()=>{o.update(()=>{const R=ge.$getSelection();if(ge.$isRangeSelection(R)){const j=R.anchor,F=R.focus,ae=R.getNodes();if(j.key===F.key&&j.offset===F.offset)return;ae.forEach((H,X)=>{ge.$isTextNode(H)?(X===0&&j.offset!==0&&(H=H.splitText(j.offset)[1]||H),X===ae.length-1&&(H=H.splitText(F.offset)[0]||H),H.__style!==""&&H.setStyle(""),H.__format!==0&&(H.setFormat(0),Nt.$getNearestBlockElementAncestorOrThrow(H).setFormat(""))):Us.$isHeadingNode(H)&&H.replace(ge.$createParagraphNode(),!0)})}})},[i]),x.jsxs("div",{className:"sticky top-0 border-b bg-background border-highlight flex flex-col",children:[x.jsxs("div",{className:"flex flex-row gap-1",children:[x.jsx(JR,{options:Object.values($),label:$[v]??v+" (not supported)",onChange:R=>{M(E[R])}}),x.jsx(Xo,{variant:"primary",onClick:R=>{R.preventDefault(),o.dispatchCommand(ge.FORMAT_TEXT_COMMAND,"bold")},active:u,icon:x.jsx(WR,{className:`${u&&"stroke-[3px]"}`})}),x.jsx(Xo,{active:h,onClick:R=>{R.preventDefault(),o.dispatchCommand(ge.FORMAT_TEXT_COMMAND,"strikethrough")},icon:x.jsx(KR,{className:`${h&&"stroke-[2px]"}`})}),x.jsx(Xo,{active:d,onClick:R=>{R.preventDefault(),o.dispatchCommand(ge.FORMAT_TEXT_COMMAND,"italic")},icon:x.jsx(VR,{className:`${d&&"stroke-[3px]"}`})}),x.jsx(Xo,{active:_!==null,onClick:R=>{R.preventDefault(),w(""),C("")},icon:x.jsx(cP,{width:12,height:12,className:`${_!==null&&"stroke-[3px]"}`})}),x.jsxs("label",{className:"flex items-center justify-center cursor-pointer",children:[x.jsx(M_,{}),x.jsx("input",{type:"file",hidden:!0,onChange:R=>{R.preventDefault(),MS(R).then(j=>{o.dispatchCommand(OS,{...j})}).catch(j=>{console.error("Error reading image",j)})}})]})]}),_!==null&&x.jsxs("div",{className:"flex flex-row p-2",children:[x.jsx("input",{type:"text",placeholder:"Enter URL",className:"w-1/3 text-primary bg-background px-2",value:_,onChange:R=>{R.preventDefault(),w(R.target.value)}}),x.jsx(Xo,{variant:"primary",onClick:R=>{R.preventDefault(),C(_||null)},icon:x.jsx(sP,{size:14})}),x.jsx(Xo,{variant:"primary",onClick:R=>{R.preventDefault(),C(null)},icon:x.jsx(hP,{size:14})})]})]})},gP=pP,nr={version:1,format:"",indent:0,direction:null};function Yl(e,t=!1){if(typeof e=="string")return{...nr,type:"text",format:"",text:e};if("tag"in e)switch(e.tag){case"h1":return ji(e);case"h2":return ji(e);case"h3":return ji(e);case"h4":return ji(e);case"h5":return ji(e);case"h6":return ji(e);case"li":return wP(e);case"p":return xP(e);case"ul":return qy(e);case"ol":return qy(e);case"span":return zS(e);case"a":return vP(e);case"img":return mP(e);case"br":return t?{...nr,type:"linebreak"}:_P();default:throw Error("Unexpected node tag: "+JSON.stringify(e,null,2))}else throw Error("Unexpected node: "+JSON.stringify(e,null,2))}function mP(e){const t=e.src;return{...nr,type:"image",src:t,width:e.width,height:e.height}}function vP(e){return{...nr,type:"link",url:e.href,children:e.children.map(t=>Yl(t))}}function yP(e){return{...nr,format:"",type:"root",children:e.children.map(t=>Yl(t))}}function ji(e){return{...nr,type:"heading",tag:e.tag,children:e.children.map(t=>Yl(t))}}function xP(e){return{...nr,type:"paragraph",children:e.children.map(t=>Yl(t,!0))}}function _P(){return{...nr,type:"paragraph",children:[]}}function wP(e){return{...nr,type:"listitem",children:e.children.map(t=>Yl(t,!0))}}function qy(e){return{...nr,type:"list",listType:e.tag==="ol"?"number":"bullet",children:e.children.map(t=>Yl(t)),...e.dir?{direction:e.dir}:{direction:null}}}const SP={bold:1,italic:2,"line-through":4};function CP(e){return e.reduce((t,n)=>t|SP[n],0)}function zS(e){const t=e.children[0];return typeof t=="string"?{...nr,type:"text",text:t,format:CP(e.classes)}:zS({...t,classes:e.classes.concat(t.classes)})}function EP(e){console.error(e)}const $P=28,kP=({richtext:e,onEditor:t})=>{const{windowSize:n}=hm(),o={namespace:"val",editorState:i=>{i.setEditorState(i.parseEditorState({root:yP(F_(e))}))},nodes:[Us.HeadingNode,ja,fo.ListNode,fo.ListItemNode,bl.LinkNode],theme:{text:{bold:"font-semibold",underline:"underline",italic:"italic",strikethrough:"line-through",underlineStrikethrough:"underline line-through"},list:{listitem:"ml-[20px]",ol:"list-decimal",ul:"list-disc"},heading:{h1:"text-4xl font-bold",h2:"text-3xl font-bold",h3:"text-2xl font-bold",h4:"text-xl font-bold",h5:"text-lg font-bold",h6:"text-md font-bold"},link:"text-highlight underline"},onError:EP};return x.jsxs(_2.LexicalComposer,{initialConfig:o,children:[x.jsx(zR,{}),x.jsx(gP,{onEditor:t}),x.jsx(_R.RichTextPlugin,{contentEditable:x.jsx("div",{className:"font-sans border-b text-primary border-highlight",style:{minHeight:n!=null&&n.innerHeight?(n==null?void 0:n.innerHeight)-$P:void 0},children:x.jsx(IR,{className:"p-4 outline-none bg-fill"})}),placeholder:x.jsx("div",{className:"",children:"Enter some text..."}),ErrorBoundary:T2}),x.jsx(DR.LinkPlugin,{}),x.jsx(qR,{}),x.jsx($R.ListPlugin,{}),x.jsx(FR,{}),x.jsx(L2.HistoryPlugin,{})]})};var TP={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const NP=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bn=(e,t)=>{const n=p.forwardRef(({color:r="currentColor",size:o=24,strokeWidth:i=2,absoluteStrokeWidth:l,children:s,...a},u)=>p.createElement("svg",{ref:u,...TP,width:o,height:o,stroke:r,strokeWidth:l?Number(i)*24/Number(o):i,className:`lucide lucide-${NP(e)}`,...a},[...t.map(([c,d])=>p.createElement(c,d)),...(Array.isArray(s)?s:[s])||[]]));return n.displayName=`${e}`,n},bP=bn("Check",[["polyline",{points:"20 6 9 17 4 12",key:"10jjfj"}]]),FS=bn("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),RP=bn("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),PP=bn("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]),OP=bn("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),AP=bn("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]),MP=bn("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),DP=bn("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]),LP=bn("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]),IP=bn("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),jP=bn("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]),zP=bn("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),FP=bn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),mp="p-1 border rounded-full shadow border-accent",e0="valbuild:urlBeforeNavigation";function BP({api:e}){const{theme:t,setTheme:n,editMode:r,setEditMode:o,session:i}=hm();if(i.status==="success"&&i.data==="not-authenticated")return x.jsx("div",{className:"flex flex-row items-center justify-center w-full h-full font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill",children:x.jsx("a",{className:mp,href:e.getLoginUrl(window.location.href),children:x.jsxs("div",{className:"flex items-center justify-center px-2 gap-x-2",children:[x.jsx("span",{children:"Login"}),x.jsx(PP,{size:18})]})})});const[l,s]=p.useState();return p.useEffect(()=>{i.status==="success"&&i.data!=="not-authenticated"&&e.getPatches({}).then(a=>{if(dl.isOk(a)){let u=0;for(const c in a.value)u+=a.value[c].length;s(u)}else console.error("Could not load patches",a.error)})},[i]),x.jsxs(WP,{children:[x.jsx(vu,{active:r==="hover",onClick:()=>{o(a=>a==="hover"?"off":"hover")},children:x.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:r==="hover"?x.jsx(DP,{size:18}):x.jsx(LP,{size:18})})}),x.jsx(vu,{onClick:()=>{n(t==="dark"?"light":"dark")},children:x.jsxs("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:[t==="dark"&&x.jsx(zP,{size:15}),t==="light"&&x.jsx(MP,{size:15})]})}),x.jsx(vu,{active:r==="full",onClick:()=>{if(r!=="full")localStorage.setItem(e0,window.location.href),window.location.href=e.getEditUrl();else if(r==="full"){const a=localStorage.getItem(e0);window.location.href=a||"/"}},children:x.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:r==="full"?x.jsx(AP,{size:15}):x.jsx(OP,{size:15})})}),l&&x.jsx(vu,{onClick:()=>{},children:x.jsxs("div",{className:"relative h-[24px] w-[24px] flex justify-center items-center",children:[x.jsx("div",{className:"absolute -right-[10px] -top-[10px] border border-border rounded-full px-1 font-sans text-xs bg-card text-accent",children:l}),x.jsx(jP,{size:18})]})}),x.jsx("a",{className:mp,href:e.getDisableUrl(),children:x.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:x.jsx(IP,{size:18})})})]})}function WP({children:e}){return x.jsx("div",{className:"flex flex-row items-center justify-center w-full h-full px-2 py-2 font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill",children:e})}function vu({active:e,onClick:t,children:n}){return x.jsx("button",{className:id(mp,{"bg-accent drop-shadow-[0px_0px_12px_rgba(56,205,152,0.60)]":e}),onClick:t,children:n})}function BS(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=BS(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function UP(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=BS(e))&&(r&&(r+=" "),r+=t);return r}const t0=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,n0=UP,VP=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return n0(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,l=Object.keys(o).map(u=>{const c=n==null?void 0:n[u],d=i==null?void 0:i[u];if(c===null)return null;const f=t0(c)||t0(d);return o[u][f]}),s=n&&Object.entries(n).reduce((u,c)=>{let[d,f]=c;return f===void 0||(u[d]=f),u},{}),a=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:f,...h}=c;return Object.entries(h).every(g=>{let[m,S]=g;return Array.isArray(S)?S.includes({...i,...s}[m]):{...i,...s}[m]===S})?[...u,d,f]:u},[]);return n0(e,l,a,n==null?void 0:n.class,n==null?void 0:n.className)},HP=VP("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Xl=p.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const l=r?$l:"button";return x.jsx(l,{className:ot(HP({variant:t,size:n,className:e})),ref:i,...o})});Xl.displayName="Button";function KP(e="dark"){const[t,n]=p.useState(e);return p.useEffect(()=>{localStorage.getItem("val-theme")==="light"?n("light"):localStorage.getItem("val-theme")==="dark"||window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?n("dark"):window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches&&n("light");const r=o=>{localStorage.getItem("val-theme")||n(o.matches?"dark":"light")};return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",r)}},[]),[t,r=>{localStorage.setItem("val-theme",r),n(r)}]}const GP=/^h([\d+])$/;function YP(e){const t=e.children.map(XP);return QP(t)}function XP(e){var t;if(e.type==="heading"){let n="";const r=Number((t=e.tag.match(GP))==null?void 0:t[1]);if(Number.isNaN(r))throw new Error("Invalid header depth");for(let i=0;i<Number(r);i++)n+="#";return{type:"block",children:[`${n} `].concat(...e.children.map(vp))}}else{if(e.type==="paragraph")return e.children.length===0?{type:"block",children:["<br />"]}:{type:"block",children:e.children.map(n=>vp(n))};if(e.type==="list")return{type:"block",children:e.children.flatMap((n,r)=>US(VS(e),n,0,r===0))};{const n=e;throw new Error(`Unhandled node type: ${"type"in n?"exhaustiveCheck.type":"unknown"}`)}}}async function QP(e){const t=[`
120
120
  `],n=[],r={};for(let o=0;o<e.length;o++){const i=e[o];for(const l of i.children)if(typeof l=="string")t[t.length-1]+=l;else{if(l.type==="image")n.push(await eO(l,r));else if(l.type==="link")n.push(nO(l));else{const s=l;throw new Error(`Unexpected node type: ${JSON.stringify(s,null,2)}`)}t.push("")}o===e.length-1?t[t.length-1]+=`
121
121
  `:t[t.length-1]+=`
122
122
 
@@ -162,7 +162,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
162
162
  `)},W5=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,i=p.useMemo(function(){return z5(o)},[o]);return p.createElement(F5,{styles:B5(i,!t,o,n?"":"!important")})},wp=!1;if(typeof window<"u")try{var wu=Object.defineProperty({},"passive",{get:function(){return wp=!0,!0}});window.addEventListener("test",wu,wu),window.removeEventListener("test",wu,wu)}catch{wp=!1}var Fi=wp?{passive:!1}:!1,U5=function(e){return e.tagName==="TEXTAREA"},mC=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!U5(e)&&n[t]==="visible")},V5=function(e){return mC(e,"overflowY")},H5=function(e){return mC(e,"overflowX")},_0=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=vC(e,n);if(r){var o=yC(e,n),i=o[1],l=o[2];if(i>l)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},K5=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},G5=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},vC=function(e,t){return e==="v"?V5(t):H5(t)},yC=function(e,t){return e==="v"?K5(t):G5(t)},Y5=function(e,t){return e==="h"&&t==="rtl"?-1:1},X5=function(e,t,n,r,o){var i=Y5(e,window.getComputedStyle(t).direction),l=i*r,s=n.target,a=t.contains(s),u=!1,c=l>0,d=0,f=0;do{var h=yC(e,s),g=h[0],m=h[1],S=h[2],v=m-S-i*g;(g||v)&&vC(e,s)&&(d+=v,f+=g),s=s.parentNode}while(!a&&s!==document.body||a&&(t.contains(s)||t===s));return(c&&(o&&d===0||!o&&l>d)||!c&&(o&&f===0||!o&&-l>f))&&(u=!0),u},Su=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},w0=function(e){return[e.deltaX,e.deltaY]},S0=function(e){return e&&"current"in e?e.current:e},Q5=function(e,t){return e[0]===t[0]&&e[1]===t[1]},J5=function(e){return`
163
163
  .block-interactivity-`.concat(e,` {pointer-events: none;}
164
164
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
165
- `)},Z5=0,Bi=[];function q5(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),o=p.useState(Z5++)[0],i=p.useState(function(){return gC()})[0],l=p.useRef(e);p.useEffect(function(){l.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=w5([e.lockRef.current],(e.shards||[]).map(S0),!0).filter(Boolean);return m.forEach(function(S){return S.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=p.useCallback(function(m,S){if("touches"in m&&m.touches.length===2)return!l.current.allowPinchZoom;var v=Su(m),y=n.current,_="deltaX"in m?m.deltaX:y[0]-v[0],w="deltaY"in m?m.deltaY:y[1]-v[1],C,$=m.target,E=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in m&&E==="h"&&$.type==="range")return!1;var T=_0(E,$);if(!T)return!0;if(T?C=E:(C=E==="v"?"h":"v",T=_0(E,$)),!T)return!1;if(!r.current&&"changedTouches"in m&&(_||w)&&(r.current=C),!C)return!0;var M=r.current||C;return X5(M,S,m,M==="h"?_:w,!0)},[]),a=p.useCallback(function(m){var S=m;if(!(!Bi.length||Bi[Bi.length-1]!==i)){var v="deltaY"in S?w0(S):Su(S),y=t.current.filter(function(C){return C.name===S.type&&C.target===S.target&&Q5(C.delta,v)})[0];if(y&&y.should){S.cancelable&&S.preventDefault();return}if(!y){var _=(l.current.shards||[]).map(S0).filter(Boolean).filter(function(C){return C.contains(S.target)}),w=_.length>0?s(S,_[0]):!l.current.noIsolation;w&&S.cancelable&&S.preventDefault()}}},[]),u=p.useCallback(function(m,S,v,y){var _={name:m,delta:S,target:v,should:y};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(w){return w!==_})},1)},[]),c=p.useCallback(function(m){n.current=Su(m),r.current=void 0},[]),d=p.useCallback(function(m){u(m.type,w0(m),m.target,s(m,e.lockRef.current))},[]),f=p.useCallback(function(m){u(m.type,Su(m),m.target,s(m,e.lockRef.current))},[]);p.useEffect(function(){return Bi.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Fi),document.addEventListener("touchmove",a,Fi),document.addEventListener("touchstart",c,Fi),function(){Bi=Bi.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,Fi),document.removeEventListener("touchmove",a,Fi),document.removeEventListener("touchstart",c,Fi)}},[]);var h=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(i,{styles:J5(o)}):null,h?p.createElement(W5,{gapMode:"margin"}):null)}const eA=R5(pC,q5);var xC=p.forwardRef(function(e,t){return p.createElement(Ed,cr({},e,{ref:t,sideCar:eA}))});xC.classNames=Ed.classNames;const tA=xC,nA=[" ","Enter","ArrowUp","ArrowDown"],rA=[" ","Enter"],$d="Select",[kd,Em,oA]=HS($d),[Zl,x4]=$i($d,[oA,lC]),$m=lC(),[iA,Ri]=Zl($d),[lA,sA]=Zl($d),aA=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:l,defaultValue:s,onValueChange:a,dir:u,name:c,autoComplete:d,disabled:f,required:h}=e,g=$m(t),[m,S]=p.useState(null),[v,y]=p.useState(null),[_,w]=p.useState(!1),C=bg(u),[$=!1,E]=Pl({prop:r,defaultProp:o,onChange:i}),[T,M]=Pl({prop:l,defaultProp:s,onChange:a}),R=p.useRef(null),j=m?!!m.closest("form"):!0,[F,ae]=p.useState(new Set),H=Array.from(F).map(X=>X.props.value).join(";");return p.createElement(d5,g,p.createElement(iA,{required:h,scope:t,trigger:m,onTriggerChange:S,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:_,onValueNodeHasChildrenChange:w,contentId:wd(),value:T,onValueChange:M,open:$,onOpenChange:E,dir:C,triggerPointerDownPosRef:R,disabled:f},p.createElement(kd.Provider,{scope:t},p.createElement(lA,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(X=>{ae(P=>new Set(P).add(X))},[]),onNativeOptionRemove:p.useCallback(X=>{ae(P=>{const O=new Set(P);return O.delete(X),O})},[])},n)),j?p.createElement(CC,{key:H,"aria-hidden":!0,required:h,tabIndex:-1,name:c,autoComplete:d,value:T,onChange:X=>M(X.target.value),disabled:f},T===void 0?p.createElement("option",{value:""}):null,Array.from(F)):null))},uA="SelectTrigger",cA=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=$m(n),l=Ri(uA,n),s=l.disabled||r,a=Xe(t,l.onTriggerChange),u=Em(n),[c,d,f]=EC(g=>{const m=u().filter(y=>!y.disabled),S=m.find(y=>y.value===l.value),v=$C(m,g,S);v!==void 0&&l.onValueChange(v.value)}),h=()=>{s||(l.onOpenChange(!0),f())};return p.createElement(f5,ee({asChild:!0},i),p.createElement(De.button,ee({type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":SC(l.value)?"":void 0},o,{ref:a,onClick:He(o.onClick,g=>{g.currentTarget.focus()}),onPointerDown:He(o.onPointerDown,g=>{const m=g.target;m.hasPointerCapture(g.pointerId)&&m.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&(h(),l.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)},g.preventDefault())}),onKeyDown:He(o.onKeyDown,g=>{const m=c.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&d(g.key),!(m&&g.key===" ")&&nA.includes(g.key)&&(h(),g.preventDefault())})})))}),dA="SelectValue",fA=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:l="",...s}=e,a=Ri(dA,n),{onValueNodeHasChildrenChange:u}=a,c=i!==void 0,d=Xe(t,a.onValueNodeChange);return $n(()=>{u(c)},[u,c]),p.createElement(De.span,ee({},s,{ref:d,style:{pointerEvents:"none"}}),SC(a.value)?p.createElement(p.Fragment,null,l):i)}),hA=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.createElement(De.span,ee({"aria-hidden":!0},o,{ref:t}),r||"▼")}),pA=e=>p.createElement(p5,ee({asChild:!0},e)),Ol="SelectContent",gA=p.forwardRef((e,t)=>{const n=Ri(Ol,e.__scopeSelect),[r,o]=p.useState();if($n(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Hr.createPortal(p.createElement(_C,{scope:e.__scopeSelect},p.createElement(kd.Slot,{scope:e.__scopeSelect},p.createElement("div",null,e.children))),i):null}return p.createElement(mA,ee({},e,{ref:t}))}),Rr=10,[_C,Td]=Zl(Ol),mA=p.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:l,side:s,sideOffset:a,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:g,hideWhenDetached:m,avoidCollisions:S,...v}=e,y=Ri(Ol,n),[_,w]=p.useState(null),[C,$]=p.useState(null),E=Xe(t,Z=>w(Z)),[T,M]=p.useState(null),[R,j]=p.useState(null),F=Em(n),[ae,H]=p.useState(!1),X=p.useRef(!1);p.useEffect(()=>{if(_)return _5(_)},[_]),cO();const P=p.useCallback(Z=>{const[ke,...ce]=F().map($e=>$e.ref.current),[_e]=ce.slice(-1),me=document.activeElement;for(const $e of Z)if($e===me||($e==null||$e.scrollIntoView({block:"nearest"}),$e===ke&&C&&(C.scrollTop=0),$e===_e&&C&&(C.scrollTop=C.scrollHeight),$e==null||$e.focus(),document.activeElement!==me))return},[F,C]),O=p.useCallback(()=>P([T,_]),[P,T,_]);p.useEffect(()=>{ae&&O()},[ae,O]);const{onOpenChange:k,triggerPointerDownPosRef:I}=y;p.useEffect(()=>{if(_){let Z={x:0,y:0};const ke=_e=>{var me,$e,Be,Pt;Z={x:Math.abs(Math.round(_e.pageX)-((me=($e=I.current)===null||$e===void 0?void 0:$e.x)!==null&&me!==void 0?me:0)),y:Math.abs(Math.round(_e.pageY)-((Be=(Pt=I.current)===null||Pt===void 0?void 0:Pt.y)!==null&&Be!==void 0?Be:0))}},ce=_e=>{Z.x<=10&&Z.y<=10?_e.preventDefault():_.contains(_e.target)||k(!1),document.removeEventListener("pointermove",ke),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ke),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ke),document.removeEventListener("pointerup",ce,{capture:!0})}}},[_,k,I]),p.useEffect(()=>{const Z=()=>k(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[k]);const[L,V]=EC(Z=>{const ke=F().filter(me=>!me.disabled),ce=ke.find(me=>me.ref.current===document.activeElement),_e=$C(ke,Z,ce);_e&&setTimeout(()=>_e.ref.current.focus())}),te=p.useCallback((Z,ke,ce)=>{const _e=!X.current&&!ce;(y.value!==void 0&&y.value===ke||_e)&&(M(Z),_e&&(X.current=!0))},[y.value]),ye=p.useCallback(()=>_==null?void 0:_.focus(),[_]),fe=p.useCallback((Z,ke,ce)=>{const _e=!X.current&&!ce;(y.value!==void 0&&y.value===ke||_e)&&j(Z)},[y.value]),Oe=r==="popper"?C0:vA,be=Oe===C0?{side:s,sideOffset:a,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:g,hideWhenDetached:m,avoidCollisions:S}:{};return p.createElement(_C,{scope:n,content:_,viewport:C,onViewportChange:$,itemRefCallback:te,selectedItem:T,onItemLeave:ye,itemTextRefCallback:fe,focusSelectedItem:O,selectedItemText:R,position:r,isPositioned:ae,searchRef:L},p.createElement(tA,{as:$l,allowPinchZoom:!0},p.createElement(dO,{asChild:!0,trapped:y.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:He(o,Z=>{var ke;(ke=y.trigger)===null||ke===void 0||ke.focus({preventScroll:!0}),Z.preventDefault()})},p.createElement(sO,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>y.onOpenChange(!1)},p.createElement(Oe,ee({role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:Z=>Z.preventDefault()},v,be,{onPlaced:()=>H(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:He(v.onKeyDown,Z=>{const ke=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!ke&&Z.key.length===1&&V(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let _e=F().filter(me=>!me.disabled).map(me=>me.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(_e=_e.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const me=Z.target,$e=_e.indexOf(me);_e=_e.slice($e+1)}setTimeout(()=>P(_e)),Z.preventDefault()}})}))))))}),vA=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Ri(Ol,n),l=Td(Ol,n),[s,a]=p.useState(null),[u,c]=p.useState(null),d=Xe(t,E=>c(E)),f=Em(n),h=p.useRef(!1),g=p.useRef(!0),{viewport:m,selectedItem:S,selectedItemText:v,focusSelectedItem:y}=l,_=p.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&u&&m&&S&&v){const E=i.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),M=i.valueNode.getBoundingClientRect(),R=v.getBoundingClientRect();if(i.dir!=="rtl"){const me=R.left-T.left,$e=M.left-me,Be=E.left-$e,Pt=E.width+Be,sn=Math.max(Pt,T.width),Rn=window.innerWidth-Rr,Te=Ah($e,[Rr,Rn-sn]);s.style.minWidth=Pt+"px",s.style.left=Te+"px"}else{const me=T.right-R.right,$e=window.innerWidth-M.right-me,Be=window.innerWidth-E.right-$e,Pt=E.width+Be,sn=Math.max(Pt,T.width),Rn=window.innerWidth-Rr,Te=Ah($e,[Rr,Rn-sn]);s.style.minWidth=Pt+"px",s.style.right=Te+"px"}const j=f(),F=window.innerHeight-Rr*2,ae=m.scrollHeight,H=window.getComputedStyle(u),X=parseInt(H.borderTopWidth,10),P=parseInt(H.paddingTop,10),O=parseInt(H.borderBottomWidth,10),k=parseInt(H.paddingBottom,10),I=X+P+ae+k+O,L=Math.min(S.offsetHeight*5,I),V=window.getComputedStyle(m),te=parseInt(V.paddingTop,10),ye=parseInt(V.paddingBottom,10),fe=E.top+E.height/2-Rr,Oe=F-fe,be=S.offsetHeight/2,Z=S.offsetTop+be,ke=X+P+Z,ce=I-ke;if(ke<=fe){const me=S===j[j.length-1].ref.current;s.style.bottom="0px";const $e=u.clientHeight-m.offsetTop-m.offsetHeight,Be=Math.max(Oe,be+(me?ye:0)+$e+O),Pt=ke+Be;s.style.height=Pt+"px"}else{const me=S===j[0].ref.current;s.style.top="0px";const Be=Math.max(fe,X+m.offsetTop+(me?te:0)+be)+ce;s.style.height=Be+"px",m.scrollTop=ke-fe+m.offsetTop}s.style.margin=`${Rr}px 0`,s.style.minHeight=L+"px",s.style.maxHeight=F+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[f,i.trigger,i.valueNode,s,u,m,S,v,i.dir,r]);$n(()=>_(),[_]);const[w,C]=p.useState();$n(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const $=p.useCallback(E=>{E&&g.current===!0&&(_(),y==null||y(),g.current=!1)},[_,y]);return p.createElement(yA,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:$},p.createElement("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w}},p.createElement(De.div,ee({},o,{ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}}))))}),C0=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Rr,...i}=e,l=$m(n);return p.createElement(h5,ee({},l,i,{ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}))}),[yA,xA]=Zl(Ol,{}),E0="SelectViewport",_A=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Td(E0,n),i=xA(E0,n),l=Xe(t,o.onViewportChange),s=p.useRef(0);return p.createElement(p.Fragment,null,p.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),p.createElement(kd.Slot,{scope:n},p.createElement(De.div,ee({"data-radix-select-viewport":"",role:"presentation"},r,{ref:l,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:He(r.onScroll,a=>{const u=a.currentTarget,{contentWrapper:c,shouldExpandOnScrollRef:d}=i;if(d!=null&&d.current&&c){const f=Math.abs(s.current-u.scrollTop);if(f>0){const h=window.innerHeight-Rr*2,g=parseFloat(c.style.minHeight),m=parseFloat(c.style.height),S=Math.max(g,m);if(S<h){const v=S+f,y=Math.min(h,v),_=v-y;c.style.height=y+"px",c.style.bottom==="0px"&&(u.scrollTop=_>0?_:0,c.style.justifyContent="flex-end")}}}s.current=u.scrollTop})}))))}),wA="SelectGroup",[_4,SA]=Zl(wA),CA="SelectLabel",EA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=SA(CA,n);return p.createElement(De.div,ee({id:o.id},r,{ref:t}))}),Sp="SelectItem",[$A,wC]=Zl(Sp),kA=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...l}=e,s=Ri(Sp,n),a=Td(Sp,n),u=s.value===r,[c,d]=p.useState(i??""),[f,h]=p.useState(!1),g=Xe(t,v=>{var y;return(y=a.itemRefCallback)===null||y===void 0?void 0:y.call(a,v,r,o)}),m=wd(),S=()=>{o||(s.onValueChange(r),s.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.createElement($A,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:p.useCallback(v=>{d(y=>{var _;return y||((_=v==null?void 0:v.textContent)!==null&&_!==void 0?_:"").trim()})},[])},p.createElement(kd.ItemSlot,{scope:n,value:r,disabled:o,textValue:c},p.createElement(De.div,ee({role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1},l,{ref:g,onFocus:He(l.onFocus,()=>h(!0)),onBlur:He(l.onBlur,()=>h(!1)),onPointerUp:He(l.onPointerUp,S),onPointerMove:He(l.onPointerMove,v=>{if(o){var y;(y=a.onItemLeave)===null||y===void 0||y.call(a)}else v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:He(l.onPointerLeave,v=>{if(v.currentTarget===document.activeElement){var y;(y=a.onItemLeave)===null||y===void 0||y.call(a)}}),onKeyDown:He(l.onKeyDown,v=>{var y;((y=a.searchRef)===null||y===void 0?void 0:y.current)!==""&&v.key===" "||(rA.includes(v.key)&&S(),v.key===" "&&v.preventDefault())})}))))}),Cu="SelectItemText",TA=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,l=Ri(Cu,n),s=Td(Cu,n),a=wC(Cu,n),u=sA(Cu,n),[c,d]=p.useState(null),f=Xe(t,v=>d(v),a.onItemTextChange,v=>{var y;return(y=s.itemTextRefCallback)===null||y===void 0?void 0:y.call(s,v,a.value,a.disabled)}),h=c==null?void 0:c.textContent,g=p.useMemo(()=>p.createElement("option",{key:a.value,value:a.value,disabled:a.disabled},h),[a.disabled,a.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:S}=u;return $n(()=>(m(g),()=>S(g)),[m,S,g]),p.createElement(p.Fragment,null,p.createElement(De.span,ee({id:a.textId},i,{ref:f})),a.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Hr.createPortal(i.children,l.valueNode):null)}),NA="SelectItemIndicator",bA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return wC(NA,n).isSelected?p.createElement(De.span,ee({"aria-hidden":!0},r,{ref:t})):null}),RA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.createElement(De.div,ee({"aria-hidden":!0},r,{ref:t}))});function SC(e){return e===""||e===void 0}const CC=p.forwardRef((e,t)=>{const{value:n,...r}=e,o=p.useRef(null),i=Xe(t,o),l=cC(n);return p.useEffect(()=>{const s=o.current,a=window.HTMLSelectElement.prototype,c=Object.getOwnPropertyDescriptor(a,"value").set;if(l!==n&&c){const d=new Event("change",{bubbles:!0});c.call(s,n),s.dispatchEvent(d)}},[l,n]),p.createElement(m5,{asChild:!0},p.createElement("select",ee({},r,{ref:i,defaultValue:n})))});CC.displayName="BubbleSelect";function EC(e){const t=Vt(e),n=p.useRef(""),r=p.useRef(0),o=p.useCallback(l=>{const s=n.current+l;t(s),function a(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>a(""),1e3))}(s)},[t]),i=p.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function $C(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=PA(e,Math.max(i,0));o.length===1&&(l=l.filter(u=>u!==n));const a=l.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}function PA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const OA=aA,kC=cA,AA=fA,MA=hA,DA=pA,TC=gA,LA=_A,NC=EA,bC=kA,IA=TA,jA=bA,RC=RA,zA=OA,FA=AA,PC=p.forwardRef(({className:e,children:t,...n},r)=>x.jsxs(kC,{ref:r,className:ot("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,x.jsx(MA,{asChild:!0,children:x.jsx(DS,{className:"w-4 h-4 opacity-50"})})]}));PC.displayName=kC.displayName;const OC=p.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>x.jsx(DA,{children:x.jsx(TC,{ref:o,className:ot("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:x.jsx(LA,{className:ot("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));OC.displayName=TC.displayName;const BA=p.forwardRef(({className:e,...t},n)=>x.jsx(NC,{ref:n,className:ot("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));BA.displayName=NC.displayName;const AC=p.forwardRef(({className:e,children:t,...n},r)=>x.jsxs(bC,{ref:r,className:ot("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[x.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:x.jsx(jA,{children:x.jsx(xP,{className:"w-4 h-4"})})}),x.jsx(IA,{children:t})]}));AC.displayName=bC.displayName;const WA=p.forwardRef(({className:e,...t},n)=>x.jsx(RC,{ref:n,className:ot("-mx-1 my-1 h-px bg-muted",e),...t}));WA.displayName=RC.displayName;function MC({path:e,disabled:t,source:n,schema:r,registerPatchCallback:o,onSubmit:i}){return(typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="string"?x.jsx(GA,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||n===null)&&(r==null?void 0:r.type)==="number"?x.jsx(KA,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="keyOf"?x.jsx(HA,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i,selector:r.selector}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="richtext"?x.jsx(VA,{registerPatchCallback:o,onSubmit:i,defaultValue:n}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="image"?x.jsx(UA,{path:e,registerPatchCallback:o,onSubmit:i,defaultValue:n}):x.jsxs("div",{children:["Unsupported schema: ",r.type]})}function $0(e,t,n,r){if(!t||!r)return[];const o=r.sha256.slice(0,5),i=function(){const l=Og(t)??"unknown",s=Ag(l);return n?`/public/${n.split(".").slice(0,-1).join(".")||n}_${o}.${s}`:`/public/${r.sha256}.${s}`}();return[{value:{[hn]:i,[Kt]:"file",metadata:r},op:"replace",path:e},{value:t,op:"file",path:e,filePath:i}]}function UA({path:e,defaultValue:t,onSubmit:n,registerPatchCallback:r}){const[o,i]=p.useState(null),[l,s]=p.useState(!1),[a,u]=p.useState(),[c,d]=p.useState();return p.useEffect(()=>{d(t&&wn.convertFileSource(t).url)},[t]),p.useEffect(()=>{r&&r(async f=>$0(f,(o==null?void 0:o.src)??null,(o==null?void 0:o.filename)??null,a))},[o,t]),x.jsxs("div",{className:"max-w-4xl p-4",children:[x.jsxs("label",{htmlFor:`img_input:${e}`,className:"",children:[o||c?x.jsx("img",{src:(o==null?void 0:o.src)||c}):x.jsx("div",{children:"Empty"}),x.jsx("input",{id:`img_input:${e}`,type:"file",hidden:!0,onChange:f=>{bS(f).then(h=>{i({src:h.src,filename:h.filename}),h.width&&h.height?u({sha256:h.sha256,width:h.width,height:h.height}):u(void 0)}).catch(h=>{console.error(h.message),i(null),u(void 0)})}})]}),n&&x.jsx("div",{children:o&&x.jsx(Xl,{disabled:l,onClick:()=>{s(!0),n(f=>Promise.resolve($0(f,o.src,o.filename??null,a))).finally(()=>{s(!1),i(null),u(void 0)})},children:l?"Saving...":"Submit"})})]},e)}async function k0(e,t){const{templateStrings:n,exprs:r,files:o}=t?await YP(t.getEditorState().toJSON().root):{[Kt]:"richtext",templateStrings:[""],exprs:[],files:{}};return[{op:"replace",path:e,value:{templateStrings:n,exprs:r,[Kt]:"richtext"}},...Object.entries(o).map(([i,l])=>({op:"file",path:e,filePath:i,value:l}))]}function VA({defaultValue:e,onSubmit:t,registerPatchCallback:n}){const[r,o]=p.useState(null),[i,l]=p.useState(!1),[s,a]=p.useState(!1);return p.useEffect(()=>{r&&(l(!1),r.registerTextContentListener(()=>{l(!0)}),r.registerDecoratorListener(()=>{l(!0)}))},[r]),p.useEffect(()=>{r&&n&&n(u=>k0(u,r))},[r]),x.jsxs("div",{className:"p-4 border rounded border-card",children:[x.jsx(mP,{onEditor:u=>{o(u)},richtext:e||{children:[],[Kt]:"root"}}),t&&x.jsx("div",{children:i&&x.jsx(Xl,{disabled:s||!r,onClick:()=>{r&&(a(!0),t(u=>k0(u,r)).finally(()=>{a(!1),l(!1)}))},children:s?"Saving...":"Submit"})})]})}function HA({disabled:e,defaultValue:t,registerPatchCallback:n,onSubmit:r,selector:o}){const i=p3(o),s=(h=>Array.isArray(h.moduleSource)?{type:"number",values:Object.keys(h.moduleSource).map(g=>parseInt(g))}:{type:"string",values:Object.keys(h.moduleSource??["ERROR fetching source"])})(i),[a,u]=p.useState(t??s.values[0]),[c,d]=p.useState(!1);p.useEffect(()=>{d(e)},[e]);const f=h=>{if(s.type==="number"){if(h==="")throw new Error("Value cannot be empty");if(Number.isNaN(Number(h)))throw new Error("Value was not a number: "+JSON.stringify(h));return Number(h)}return h};return p.useEffect(()=>{n&&n(async h=>[{op:"replace",path:h,value:a}])},[a]),x.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[x.jsxs(zA,{defaultValue:a.toString(),disabled:c,onValueChange:h=>{u(f(h))},children:[x.jsx(PC,{children:x.jsx(FA,{placeholder:"Select a value"})}),x.jsx(OC,{children:s.values.map(h=>x.jsx(AC,{value:h.toString(),children:h.toString()},h))})]}),r&&x.jsx("div",{children:t!==a&&x.jsx(Xl,{disabled:c,onClick:()=>{d(!0),r(async h=>[{op:"replace",path:h,value:a}]).finally(()=>{d(!1)})},children:c?"Saving...":"Submit"})})]})}function KA({disabled:e,defaultValue:t,registerPatchCallback:n,onSubmit:r}){const[o,i]=p.useState(t||0),[l,s]=p.useState(!1);p.useEffect(()=>{s(e)},[e]);const a=p.useRef(null);return p.useEffect(()=>{n&&n(async u=>{var c;return[{op:"replace",path:u,value:Number((c=a.current)==null?void 0:c.value)||0}]})},[]),x.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[x.jsx(vm,{ref:a,disabled:l,defaultValue:o??0,onChange:u=>i(Number(u.target.value)),type:"number"}),r&&x.jsx("div",{children:t!==o&&x.jsx(Xl,{disabled:l,onClick:()=>{s(!0),r(async u=>{var c;return[{op:"replace",path:u,value:Number((c=a.current)==null?void 0:c.value)||0}]}).finally(()=>{s(!1)})},children:l?"Saving...":"Submit"})})]})}function GA({disabled:e,defaultValue:t,registerPatchCallback:n,onSubmit:r}){const[o,i]=p.useState(t||""),[l,s]=p.useState(!1);p.useEffect(()=>{s(e)},[e]);const a=p.useRef(null);return p.useEffect(()=>{n&&n(async u=>{var c;return[{op:"replace",path:u,value:((c=a.current)==null?void 0:c.value)||""}]})},[]),x.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[x.jsx(vm,{ref:a,disabled:l,defaultValue:o??"",onChange:u=>i(u.target.value)}),r&&x.jsx("div",{children:t!==o&&x.jsx(Xl,{disabled:l,onClick:()=>{s(!0),r(async u=>{var c;return[{op:"replace",path:u,value:((c=a.current)==null?void 0:c.value)||""}]}).finally(()=>{s(!1)})},children:l?"Saving...":"Submit"})})]})}const YA=({className:e})=>x.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[x.jsx("g",{filter:"url(#filter0_d_21_1677)",children:x.jsx("path",{d:"M5 5.36426C5 5.16309 5.16309 5 5.36426 5H17.6581C17.8593 5 18.0223 5.16309 18.0223 5.36426V28.4949C18.0223 28.696 17.8593 28.8591 17.6581 28.8591H5.36426C5.16309 28.8591 5 28.696 5 28.4949V5.36426Z",fill:"#38CD98"})}),x.jsx("g",{filter:"url(#filter1_i_21_1677)",children:x.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),x.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M52.8588 23.839H48.7257H48.537H48.1128C47.6715 23.839 47.4508 23.5942 47.4508 23.1044V13.7293C47.4508 13.5784 47.3285 13.4561 47.1777 13.4561H45.8118C45.6609 13.4561 45.5386 13.5784 45.5386 13.7293V15.1836C45.5386 15.2844 45.4569 15.3661 45.3561 15.3661C45.2876 15.3661 45.225 15.3275 45.1924 15.2672C44.805 14.5503 44.283 14.02 43.6264 13.6765C42.9563 13.301 42.2045 13.1132 41.3709 13.1132C40.6028 13.1132 39.8755 13.252 39.189 13.5295C38.5026 13.8071 37.8979 14.2152 37.3748 14.7539C36.8682 15.2764 36.4678 15.9212 36.1736 16.6885C35.8794 17.4558 35.7323 18.3374 35.7323 19.3332V19.725C35.7323 20.7372 35.8794 21.627 36.1736 22.3942C36.4678 23.1615 36.8682 23.8146 37.3748 24.3533C37.8979 24.8757 38.5026 25.2757 39.189 25.5532C39.8755 25.8144 40.6191 25.945 41.42 25.945C42.1881 25.945 42.9154 25.7491 43.6019 25.3573C44.2751 24.982 44.8058 24.4119 45.1941 23.6471C45.2255 23.5852 45.2886 23.5452 45.358 23.5452H45.3917C45.4728 23.5452 45.5386 23.611 45.5386 23.6921C45.5386 23.7904 45.544 23.8856 45.5547 23.9777V25.1392C45.5547 25.3904 45.7584 25.5941 46.0096 25.5941H47.2261C47.2914 25.5995 47.3581 25.6022 47.4263 25.6022H48.537H48.7257H57.7268C57.8777 25.6022 58 25.4799 58 25.329V24.1122C58 23.9614 57.8777 23.839 57.7268 23.839H55.3174C55.1665 23.839 55.0442 23.7167 55.0442 23.5659V8.73368C55.0442 8.58279 54.9219 8.46048 54.771 8.46048H50.5054C50.3545 8.46048 50.2322 8.58279 50.2322 8.73368V9.95043C50.2322 10.1013 50.3545 10.2236 50.5054 10.2236H52.8588C53.0097 10.2236 53.132 10.3459 53.132 10.4968V23.5659C53.132 23.7167 53.0097 23.839 52.8588 23.839ZM41.6161 24.1329C42.1881 24.1329 42.7111 24.0268 43.1851 23.8146C43.6754 23.6023 44.0922 23.3003 44.4354 22.9085C44.7786 22.5167 45.0483 22.0514 45.2444 21.5127C45.4406 20.9576 45.5386 20.3454 45.5386 19.6761V19.3822C45.5386 18.7292 45.4406 18.1333 45.2444 17.5946C45.0483 17.0395 44.7705 16.5661 44.4109 16.1743C44.0677 15.7824 43.6509 15.4804 43.1606 15.2682C42.6866 15.0396 42.1718 14.9254 41.6161 14.9254C41.044 14.9254 40.521 15.0315 40.0471 15.2437C39.5731 15.4559 39.1563 15.758 38.7968 16.1498C38.4535 16.5252 38.1839 16.9905 37.9877 17.5456C37.7916 18.0843 37.6936 18.6802 37.6936 19.3332V19.725C37.6936 21.1127 38.0531 22.1983 38.7722 22.982C39.5077 23.7493 40.4557 24.1329 41.6161 24.1329ZM31.1115 25.4191C31.0732 25.5287 30.9698 25.6022 30.8536 25.6022H27.4661C27.35 25.6022 27.2465 25.5287 27.2082 25.4191L23.1578 13.8193C23.0958 13.6417 23.2276 13.4561 23.4157 13.4561H25.089C25.2068 13.4561 25.3114 13.5316 25.3484 13.6435L28.9666 24.581C28.9942 24.6643 29.0721 24.7206 29.1599 24.7206C29.2477 24.7206 29.3256 24.6643 29.3532 24.581L32.9714 13.6435C33.0084 13.5316 33.1129 13.4561 33.2308 13.4561H34.9041C35.0922 13.4561 35.224 13.6417 35.162 13.8193L31.1115 25.4191Z",fill:"currentColor"}),x.jsxs("defs",{children:[x.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[x.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),x.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),x.jsx("feOffset",{}),x.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),x.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),x.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),x.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),x.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),x.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[x.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),x.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),x.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),x.jsx("feOffset",{}),x.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),x.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),x.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),x.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]}),DC=YA,LC="Switch",[XA,w4]=$i(LC),[QA,JA]=XA(LC),ZA=p.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:l,disabled:s,value:a="on",onCheckedChange:u,...c}=e,[d,f]=p.useState(null),h=Xe(t,y=>f(y)),g=p.useRef(!1),m=d?!!d.closest("form"):!0,[S=!1,v]=Pl({prop:o,defaultProp:i,onChange:u});return p.createElement(QA,{scope:n,checked:S,disabled:s},p.createElement(De.button,ee({type:"button",role:"switch","aria-checked":S,"aria-required":l,"data-state":IC(S),"data-disabled":s?"":void 0,disabled:s,value:a},c,{ref:h,onClick:He(e.onClick,y=>{v(_=>!_),m&&(g.current=y.isPropagationStopped(),g.current||y.stopPropagation())})})),m&&p.createElement(tM,{control:d,bubbles:!g.current,name:r,value:a,checked:S,required:l,disabled:s,style:{transform:"translateX(-100%)"}}))}),qA="SwitchThumb",eM=p.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=JA(qA,n);return p.createElement(De.span,ee({"data-state":IC(o.checked),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),tM=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=p.useRef(null),l=cC(n),s=rC(t);return p.useEffect(()=>{const a=i.current,u=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(u,"checked").set;if(l!==n&&d){const f=new Event("click",{bubbles:r});d.call(a,n),a.dispatchEvent(f)}},[l,n,r]),p.createElement("input",ee({type:"checkbox","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function IC(e){return e?"checked":"unchecked"}const jC=ZA,nM=eM,Cp=p.forwardRef(({className:e,...t},n)=>x.jsx(jC,{className:ot("peer inline-flex h-[22px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-accent data-[state=unchecked]:bg-primary",e),...t,ref:n,children:x.jsx(nM,{className:ot("pointer-events-none block h-[18px] w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Cp.displayName=jC.displayName;const km=p.forwardRef(({className:e,...t},n)=>x.jsx("div",{ref:n,className:ot("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));km.displayName="Card";const rM=p.forwardRef(({className:e,...t},n)=>x.jsx("div",{ref:n,className:ot("flex flex-col space-y-1.5 p-6",e),...t}));rM.displayName="CardHeader";const oM=p.forwardRef(({className:e,...t},n)=>x.jsx("h3",{ref:n,className:ot("text-2xl font-semibold leading-none tracking-tight",e),...t}));oM.displayName="CardTitle";const iM=p.forwardRef(({className:e,...t},n)=>x.jsx("p",{ref:n,className:ot("text-sm text-muted-foreground",e),...t}));iM.displayName="CardDescription";const lM=p.forwardRef(({className:e,...t},n)=>x.jsx("div",{ref:n,className:ot("p-6 pt-0",e),...t}));lM.displayName="CardContent";const sM=p.forwardRef(({className:e,...t},n)=>x.jsx("div",{ref:n,className:ot("flex items-center p-6 pt-0",e),...t}));sM.displayName="CardFooter";/**
165
+ `)},Z5=0,Bi=[];function q5(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),o=p.useState(Z5++)[0],i=p.useState(function(){return gC()})[0],l=p.useRef(e);p.useEffect(function(){l.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=w5([e.lockRef.current],(e.shards||[]).map(S0),!0).filter(Boolean);return m.forEach(function(S){return S.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=p.useCallback(function(m,S){if("touches"in m&&m.touches.length===2)return!l.current.allowPinchZoom;var v=Su(m),y=n.current,_="deltaX"in m?m.deltaX:y[0]-v[0],w="deltaY"in m?m.deltaY:y[1]-v[1],C,$=m.target,E=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in m&&E==="h"&&$.type==="range")return!1;var T=_0(E,$);if(!T)return!0;if(T?C=E:(C=E==="v"?"h":"v",T=_0(E,$)),!T)return!1;if(!r.current&&"changedTouches"in m&&(_||w)&&(r.current=C),!C)return!0;var M=r.current||C;return X5(M,S,m,M==="h"?_:w,!0)},[]),a=p.useCallback(function(m){var S=m;if(!(!Bi.length||Bi[Bi.length-1]!==i)){var v="deltaY"in S?w0(S):Su(S),y=t.current.filter(function(C){return C.name===S.type&&C.target===S.target&&Q5(C.delta,v)})[0];if(y&&y.should){S.cancelable&&S.preventDefault();return}if(!y){var _=(l.current.shards||[]).map(S0).filter(Boolean).filter(function(C){return C.contains(S.target)}),w=_.length>0?s(S,_[0]):!l.current.noIsolation;w&&S.cancelable&&S.preventDefault()}}},[]),u=p.useCallback(function(m,S,v,y){var _={name:m,delta:S,target:v,should:y};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(w){return w!==_})},1)},[]),c=p.useCallback(function(m){n.current=Su(m),r.current=void 0},[]),d=p.useCallback(function(m){u(m.type,w0(m),m.target,s(m,e.lockRef.current))},[]),f=p.useCallback(function(m){u(m.type,Su(m),m.target,s(m,e.lockRef.current))},[]);p.useEffect(function(){return Bi.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Fi),document.addEventListener("touchmove",a,Fi),document.addEventListener("touchstart",c,Fi),function(){Bi=Bi.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,Fi),document.removeEventListener("touchmove",a,Fi),document.removeEventListener("touchstart",c,Fi)}},[]);var h=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(i,{styles:J5(o)}):null,h?p.createElement(W5,{gapMode:"margin"}):null)}const eA=R5(pC,q5);var xC=p.forwardRef(function(e,t){return p.createElement(Ed,cr({},e,{ref:t,sideCar:eA}))});xC.classNames=Ed.classNames;const tA=xC,nA=[" ","Enter","ArrowUp","ArrowDown"],rA=[" ","Enter"],$d="Select",[kd,Em,oA]=HS($d),[Zl,x4]=$i($d,[oA,lC]),$m=lC(),[iA,Ri]=Zl($d),[lA,sA]=Zl($d),aA=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:l,defaultValue:s,onValueChange:a,dir:u,name:c,autoComplete:d,disabled:f,required:h}=e,g=$m(t),[m,S]=p.useState(null),[v,y]=p.useState(null),[_,w]=p.useState(!1),C=bg(u),[$=!1,E]=Pl({prop:r,defaultProp:o,onChange:i}),[T,M]=Pl({prop:l,defaultProp:s,onChange:a}),R=p.useRef(null),j=m?!!m.closest("form"):!0,[F,ae]=p.useState(new Set),H=Array.from(F).map(X=>X.props.value).join(";");return p.createElement(d5,g,p.createElement(iA,{required:h,scope:t,trigger:m,onTriggerChange:S,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:_,onValueNodeHasChildrenChange:w,contentId:wd(),value:T,onValueChange:M,open:$,onOpenChange:E,dir:C,triggerPointerDownPosRef:R,disabled:f},p.createElement(kd.Provider,{scope:t},p.createElement(lA,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(X=>{ae(P=>new Set(P).add(X))},[]),onNativeOptionRemove:p.useCallback(X=>{ae(P=>{const O=new Set(P);return O.delete(X),O})},[])},n)),j?p.createElement(CC,{key:H,"aria-hidden":!0,required:h,tabIndex:-1,name:c,autoComplete:d,value:T,onChange:X=>M(X.target.value),disabled:f},T===void 0?p.createElement("option",{value:""}):null,Array.from(F)):null))},uA="SelectTrigger",cA=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=$m(n),l=Ri(uA,n),s=l.disabled||r,a=Xe(t,l.onTriggerChange),u=Em(n),[c,d,f]=EC(g=>{const m=u().filter(y=>!y.disabled),S=m.find(y=>y.value===l.value),v=$C(m,g,S);v!==void 0&&l.onValueChange(v.value)}),h=()=>{s||(l.onOpenChange(!0),f())};return p.createElement(f5,ee({asChild:!0},i),p.createElement(De.button,ee({type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":SC(l.value)?"":void 0},o,{ref:a,onClick:He(o.onClick,g=>{g.currentTarget.focus()}),onPointerDown:He(o.onPointerDown,g=>{const m=g.target;m.hasPointerCapture(g.pointerId)&&m.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&(h(),l.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)},g.preventDefault())}),onKeyDown:He(o.onKeyDown,g=>{const m=c.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&d(g.key),!(m&&g.key===" ")&&nA.includes(g.key)&&(h(),g.preventDefault())})})))}),dA="SelectValue",fA=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:l="",...s}=e,a=Ri(dA,n),{onValueNodeHasChildrenChange:u}=a,c=i!==void 0,d=Xe(t,a.onValueNodeChange);return $n(()=>{u(c)},[u,c]),p.createElement(De.span,ee({},s,{ref:d,style:{pointerEvents:"none"}}),SC(a.value)?p.createElement(p.Fragment,null,l):i)}),hA=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.createElement(De.span,ee({"aria-hidden":!0},o,{ref:t}),r||"▼")}),pA=e=>p.createElement(p5,ee({asChild:!0},e)),Ol="SelectContent",gA=p.forwardRef((e,t)=>{const n=Ri(Ol,e.__scopeSelect),[r,o]=p.useState();if($n(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Hr.createPortal(p.createElement(_C,{scope:e.__scopeSelect},p.createElement(kd.Slot,{scope:e.__scopeSelect},p.createElement("div",null,e.children))),i):null}return p.createElement(mA,ee({},e,{ref:t}))}),Rr=10,[_C,Td]=Zl(Ol),mA=p.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:l,side:s,sideOffset:a,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:g,hideWhenDetached:m,avoidCollisions:S,...v}=e,y=Ri(Ol,n),[_,w]=p.useState(null),[C,$]=p.useState(null),E=Xe(t,Z=>w(Z)),[T,M]=p.useState(null),[R,j]=p.useState(null),F=Em(n),[ae,H]=p.useState(!1),X=p.useRef(!1);p.useEffect(()=>{if(_)return _5(_)},[_]),cO();const P=p.useCallback(Z=>{const[ke,...ce]=F().map($e=>$e.ref.current),[_e]=ce.slice(-1),me=document.activeElement;for(const $e of Z)if($e===me||($e==null||$e.scrollIntoView({block:"nearest"}),$e===ke&&C&&(C.scrollTop=0),$e===_e&&C&&(C.scrollTop=C.scrollHeight),$e==null||$e.focus(),document.activeElement!==me))return},[F,C]),O=p.useCallback(()=>P([T,_]),[P,T,_]);p.useEffect(()=>{ae&&O()},[ae,O]);const{onOpenChange:k,triggerPointerDownPosRef:I}=y;p.useEffect(()=>{if(_){let Z={x:0,y:0};const ke=_e=>{var me,$e,Be,Pt;Z={x:Math.abs(Math.round(_e.pageX)-((me=($e=I.current)===null||$e===void 0?void 0:$e.x)!==null&&me!==void 0?me:0)),y:Math.abs(Math.round(_e.pageY)-((Be=(Pt=I.current)===null||Pt===void 0?void 0:Pt.y)!==null&&Be!==void 0?Be:0))}},ce=_e=>{Z.x<=10&&Z.y<=10?_e.preventDefault():_.contains(_e.target)||k(!1),document.removeEventListener("pointermove",ke),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ke),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ke),document.removeEventListener("pointerup",ce,{capture:!0})}}},[_,k,I]),p.useEffect(()=>{const Z=()=>k(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[k]);const[L,V]=EC(Z=>{const ke=F().filter(me=>!me.disabled),ce=ke.find(me=>me.ref.current===document.activeElement),_e=$C(ke,Z,ce);_e&&setTimeout(()=>_e.ref.current.focus())}),te=p.useCallback((Z,ke,ce)=>{const _e=!X.current&&!ce;(y.value!==void 0&&y.value===ke||_e)&&(M(Z),_e&&(X.current=!0))},[y.value]),ye=p.useCallback(()=>_==null?void 0:_.focus(),[_]),fe=p.useCallback((Z,ke,ce)=>{const _e=!X.current&&!ce;(y.value!==void 0&&y.value===ke||_e)&&j(Z)},[y.value]),Oe=r==="popper"?C0:vA,be=Oe===C0?{side:s,sideOffset:a,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:g,hideWhenDetached:m,avoidCollisions:S}:{};return p.createElement(_C,{scope:n,content:_,viewport:C,onViewportChange:$,itemRefCallback:te,selectedItem:T,onItemLeave:ye,itemTextRefCallback:fe,focusSelectedItem:O,selectedItemText:R,position:r,isPositioned:ae,searchRef:L},p.createElement(tA,{as:$l,allowPinchZoom:!0},p.createElement(dO,{asChild:!0,trapped:y.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:He(o,Z=>{var ke;(ke=y.trigger)===null||ke===void 0||ke.focus({preventScroll:!0}),Z.preventDefault()})},p.createElement(sO,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>y.onOpenChange(!1)},p.createElement(Oe,ee({role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:Z=>Z.preventDefault()},v,be,{onPlaced:()=>H(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:He(v.onKeyDown,Z=>{const ke=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!ke&&Z.key.length===1&&V(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let _e=F().filter(me=>!me.disabled).map(me=>me.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(_e=_e.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const me=Z.target,$e=_e.indexOf(me);_e=_e.slice($e+1)}setTimeout(()=>P(_e)),Z.preventDefault()}})}))))))}),vA=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Ri(Ol,n),l=Td(Ol,n),[s,a]=p.useState(null),[u,c]=p.useState(null),d=Xe(t,E=>c(E)),f=Em(n),h=p.useRef(!1),g=p.useRef(!0),{viewport:m,selectedItem:S,selectedItemText:v,focusSelectedItem:y}=l,_=p.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&u&&m&&S&&v){const E=i.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),M=i.valueNode.getBoundingClientRect(),R=v.getBoundingClientRect();if(i.dir!=="rtl"){const me=R.left-T.left,$e=M.left-me,Be=E.left-$e,Pt=E.width+Be,sn=Math.max(Pt,T.width),Rn=window.innerWidth-Rr,Te=Ah($e,[Rr,Rn-sn]);s.style.minWidth=Pt+"px",s.style.left=Te+"px"}else{const me=T.right-R.right,$e=window.innerWidth-M.right-me,Be=window.innerWidth-E.right-$e,Pt=E.width+Be,sn=Math.max(Pt,T.width),Rn=window.innerWidth-Rr,Te=Ah($e,[Rr,Rn-sn]);s.style.minWidth=Pt+"px",s.style.right=Te+"px"}const j=f(),F=window.innerHeight-Rr*2,ae=m.scrollHeight,H=window.getComputedStyle(u),X=parseInt(H.borderTopWidth,10),P=parseInt(H.paddingTop,10),O=parseInt(H.borderBottomWidth,10),k=parseInt(H.paddingBottom,10),I=X+P+ae+k+O,L=Math.min(S.offsetHeight*5,I),V=window.getComputedStyle(m),te=parseInt(V.paddingTop,10),ye=parseInt(V.paddingBottom,10),fe=E.top+E.height/2-Rr,Oe=F-fe,be=S.offsetHeight/2,Z=S.offsetTop+be,ke=X+P+Z,ce=I-ke;if(ke<=fe){const me=S===j[j.length-1].ref.current;s.style.bottom="0px";const $e=u.clientHeight-m.offsetTop-m.offsetHeight,Be=Math.max(Oe,be+(me?ye:0)+$e+O),Pt=ke+Be;s.style.height=Pt+"px"}else{const me=S===j[0].ref.current;s.style.top="0px";const Be=Math.max(fe,X+m.offsetTop+(me?te:0)+be)+ce;s.style.height=Be+"px",m.scrollTop=ke-fe+m.offsetTop}s.style.margin=`${Rr}px 0`,s.style.minHeight=L+"px",s.style.maxHeight=F+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[f,i.trigger,i.valueNode,s,u,m,S,v,i.dir,r]);$n(()=>_(),[_]);const[w,C]=p.useState();$n(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const $=p.useCallback(E=>{E&&g.current===!0&&(_(),y==null||y(),g.current=!1)},[_,y]);return p.createElement(yA,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:$},p.createElement("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w}},p.createElement(De.div,ee({},o,{ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}}))))}),C0=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Rr,...i}=e,l=$m(n);return p.createElement(h5,ee({},l,i,{ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}))}),[yA,xA]=Zl(Ol,{}),E0="SelectViewport",_A=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Td(E0,n),i=xA(E0,n),l=Xe(t,o.onViewportChange),s=p.useRef(0);return p.createElement(p.Fragment,null,p.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),p.createElement(kd.Slot,{scope:n},p.createElement(De.div,ee({"data-radix-select-viewport":"",role:"presentation"},r,{ref:l,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:He(r.onScroll,a=>{const u=a.currentTarget,{contentWrapper:c,shouldExpandOnScrollRef:d}=i;if(d!=null&&d.current&&c){const f=Math.abs(s.current-u.scrollTop);if(f>0){const h=window.innerHeight-Rr*2,g=parseFloat(c.style.minHeight),m=parseFloat(c.style.height),S=Math.max(g,m);if(S<h){const v=S+f,y=Math.min(h,v),_=v-y;c.style.height=y+"px",c.style.bottom==="0px"&&(u.scrollTop=_>0?_:0,c.style.justifyContent="flex-end")}}}s.current=u.scrollTop})}))))}),wA="SelectGroup",[_4,SA]=Zl(wA),CA="SelectLabel",EA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=SA(CA,n);return p.createElement(De.div,ee({id:o.id},r,{ref:t}))}),Sp="SelectItem",[$A,wC]=Zl(Sp),kA=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...l}=e,s=Ri(Sp,n),a=Td(Sp,n),u=s.value===r,[c,d]=p.useState(i??""),[f,h]=p.useState(!1),g=Xe(t,v=>{var y;return(y=a.itemRefCallback)===null||y===void 0?void 0:y.call(a,v,r,o)}),m=wd(),S=()=>{o||(s.onValueChange(r),s.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.createElement($A,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:p.useCallback(v=>{d(y=>{var _;return y||((_=v==null?void 0:v.textContent)!==null&&_!==void 0?_:"").trim()})},[])},p.createElement(kd.ItemSlot,{scope:n,value:r,disabled:o,textValue:c},p.createElement(De.div,ee({role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1},l,{ref:g,onFocus:He(l.onFocus,()=>h(!0)),onBlur:He(l.onBlur,()=>h(!1)),onPointerUp:He(l.onPointerUp,S),onPointerMove:He(l.onPointerMove,v=>{if(o){var y;(y=a.onItemLeave)===null||y===void 0||y.call(a)}else v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:He(l.onPointerLeave,v=>{if(v.currentTarget===document.activeElement){var y;(y=a.onItemLeave)===null||y===void 0||y.call(a)}}),onKeyDown:He(l.onKeyDown,v=>{var y;((y=a.searchRef)===null||y===void 0?void 0:y.current)!==""&&v.key===" "||(rA.includes(v.key)&&S(),v.key===" "&&v.preventDefault())})}))))}),Cu="SelectItemText",TA=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,l=Ri(Cu,n),s=Td(Cu,n),a=wC(Cu,n),u=sA(Cu,n),[c,d]=p.useState(null),f=Xe(t,v=>d(v),a.onItemTextChange,v=>{var y;return(y=s.itemTextRefCallback)===null||y===void 0?void 0:y.call(s,v,a.value,a.disabled)}),h=c==null?void 0:c.textContent,g=p.useMemo(()=>p.createElement("option",{key:a.value,value:a.value,disabled:a.disabled},h),[a.disabled,a.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:S}=u;return $n(()=>(m(g),()=>S(g)),[m,S,g]),p.createElement(p.Fragment,null,p.createElement(De.span,ee({id:a.textId},i,{ref:f})),a.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Hr.createPortal(i.children,l.valueNode):null)}),NA="SelectItemIndicator",bA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return wC(NA,n).isSelected?p.createElement(De.span,ee({"aria-hidden":!0},r,{ref:t})):null}),RA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.createElement(De.div,ee({"aria-hidden":!0},r,{ref:t}))});function SC(e){return e===""||e===void 0}const CC=p.forwardRef((e,t)=>{const{value:n,...r}=e,o=p.useRef(null),i=Xe(t,o),l=cC(n);return p.useEffect(()=>{const s=o.current,a=window.HTMLSelectElement.prototype,c=Object.getOwnPropertyDescriptor(a,"value").set;if(l!==n&&c){const d=new Event("change",{bubbles:!0});c.call(s,n),s.dispatchEvent(d)}},[l,n]),p.createElement(m5,{asChild:!0},p.createElement("select",ee({},r,{ref:i,defaultValue:n})))});CC.displayName="BubbleSelect";function EC(e){const t=Vt(e),n=p.useRef(""),r=p.useRef(0),o=p.useCallback(l=>{const s=n.current+l;t(s),function a(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>a(""),1e3))}(s)},[t]),i=p.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function $C(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=PA(e,Math.max(i,0));o.length===1&&(l=l.filter(u=>u!==n));const a=l.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}function PA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const OA=aA,kC=cA,AA=fA,MA=hA,DA=pA,TC=gA,LA=_A,NC=EA,bC=kA,IA=TA,jA=bA,RC=RA,zA=OA,FA=AA,PC=p.forwardRef(({className:e,children:t,...n},r)=>x.jsxs(kC,{ref:r,className:ot("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,x.jsx(MA,{asChild:!0,children:x.jsx(FS,{className:"w-4 h-4 opacity-50"})})]}));PC.displayName=kC.displayName;const OC=p.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>x.jsx(DA,{children:x.jsx(TC,{ref:o,className:ot("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:x.jsx(LA,{className:ot("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));OC.displayName=TC.displayName;const BA=p.forwardRef(({className:e,...t},n)=>x.jsx(NC,{ref:n,className:ot("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));BA.displayName=NC.displayName;const AC=p.forwardRef(({className:e,children:t,...n},r)=>x.jsxs(bC,{ref:r,className:ot("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[x.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:x.jsx(jA,{children:x.jsx(bP,{className:"w-4 h-4"})})}),x.jsx(IA,{children:t})]}));AC.displayName=bC.displayName;const WA=p.forwardRef(({className:e,...t},n)=>x.jsx(RC,{ref:n,className:ot("-mx-1 my-1 h-px bg-muted",e),...t}));WA.displayName=RC.displayName;function MC({path:e,disabled:t,source:n,schema:r,registerPatchCallback:o,onSubmit:i}){return(typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="string"?x.jsx(GA,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||n===null)&&(r==null?void 0:r.type)==="number"?x.jsx(KA,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="keyOf"?x.jsx(HA,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i,selector:r.selector}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="richtext"?x.jsx(VA,{registerPatchCallback:o,onSubmit:i,defaultValue:n}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="image"?x.jsx(UA,{path:e,registerPatchCallback:o,onSubmit:i,defaultValue:n}):x.jsxs("div",{children:["Unsupported schema: ",r.type]})}function $0(e,t,n,r){if(!t||!r)return[];const o=r.sha256.slice(0,5),i=function(){const l=Og(t)??"unknown",s=Ag(l);return n?`/public/${n.split(".").slice(0,-1).join(".")||n}_${o}.${s}`:`/public/${r.sha256}.${s}`}();return[{value:{[hn]:i,[Kt]:"file",metadata:r},op:"replace",path:e},{value:t,op:"file",path:e,filePath:i}]}function UA({path:e,defaultValue:t,onSubmit:n,registerPatchCallback:r}){const[o,i]=p.useState(null),[l,s]=p.useState(!1),[a,u]=p.useState(),[c,d]=p.useState();return p.useEffect(()=>{d(t&&wn.convertFileSource(t).url)},[t]),p.useEffect(()=>{r&&r(async f=>$0(f,(o==null?void 0:o.src)??null,(o==null?void 0:o.filename)??null,a))},[o,t]),x.jsxs("div",{className:"max-w-4xl p-4",children:[x.jsxs("label",{htmlFor:`img_input:${e}`,className:"",children:[o||c?x.jsx("img",{src:(o==null?void 0:o.src)||c}):x.jsx("div",{children:"Empty"}),x.jsx("input",{id:`img_input:${e}`,type:"file",hidden:!0,onChange:f=>{MS(f).then(h=>{i({src:h.src,filename:h.filename}),h.width&&h.height?u({sha256:h.sha256,width:h.width,height:h.height}):u(void 0)}).catch(h=>{console.error(h.message),i(null),u(void 0)})}})]}),n&&x.jsx("div",{children:o&&x.jsx(Xl,{disabled:l,onClick:()=>{s(!0),n(f=>Promise.resolve($0(f,o.src,o.filename??null,a))).finally(()=>{s(!1),i(null),u(void 0)})},children:l?"Saving...":"Submit"})})]},e)}async function k0(e,t){const{templateStrings:n,exprs:r,files:o}=t?await YP(t.getEditorState().toJSON().root):{[Kt]:"richtext",templateStrings:[""],exprs:[],files:{}};return[{op:"replace",path:e,value:{templateStrings:n,exprs:r,[Kt]:"richtext"}},...Object.entries(o).map(([i,l])=>({op:"file",path:e,filePath:i,value:l}))]}function VA({defaultValue:e,onSubmit:t,registerPatchCallback:n}){const[r,o]=p.useState(null),[i,l]=p.useState(!1),[s,a]=p.useState(!1);return p.useEffect(()=>{r&&(l(!1),r.registerTextContentListener(()=>{l(!0)}),r.registerDecoratorListener(()=>{l(!0)}))},[r]),p.useEffect(()=>{r&&n&&n(u=>k0(u,r))},[r]),x.jsxs("div",{className:"p-4 border rounded border-card",children:[x.jsx(kP,{onEditor:u=>{o(u)},richtext:e||{children:[],[Kt]:"root"}}),t&&x.jsx("div",{children:i&&x.jsx(Xl,{disabled:s||!r,onClick:()=>{r&&(a(!0),t(u=>k0(u,r)).finally(()=>{a(!1),l(!1)}))},children:s?"Saving...":"Submit"})})]})}function HA({disabled:e,defaultValue:t,registerPatchCallback:n,onSubmit:r,selector:o}){const i=p3(o),s=(h=>Array.isArray(h.moduleSource)?{type:"number",values:Object.keys(h.moduleSource).map(g=>parseInt(g))}:{type:"string",values:Object.keys(h.moduleSource??["ERROR fetching source"])})(i),[a,u]=p.useState(t??s.values[0]),[c,d]=p.useState(!1);p.useEffect(()=>{d(e)},[e]);const f=h=>{if(s.type==="number"){if(h==="")throw new Error("Value cannot be empty");if(Number.isNaN(Number(h)))throw new Error("Value was not a number: "+JSON.stringify(h));return Number(h)}return h};return p.useEffect(()=>{n&&n(async h=>[{op:"replace",path:h,value:a}])},[a]),x.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[x.jsxs(zA,{defaultValue:a.toString(),disabled:c,onValueChange:h=>{u(f(h))},children:[x.jsx(PC,{children:x.jsx(FA,{placeholder:"Select a value"})}),x.jsx(OC,{children:s.values.map(h=>x.jsx(AC,{value:h.toString(),children:h.toString()},h))})]}),r&&x.jsx("div",{children:t!==a&&x.jsx(Xl,{disabled:c,onClick:()=>{d(!0),r(async h=>[{op:"replace",path:h,value:a}]).finally(()=>{d(!1)})},children:c?"Saving...":"Submit"})})]})}function KA({disabled:e,defaultValue:t,registerPatchCallback:n,onSubmit:r}){const[o,i]=p.useState(t||0),[l,s]=p.useState(!1);p.useEffect(()=>{s(e)},[e]);const a=p.useRef(null);return p.useEffect(()=>{n&&n(async u=>{var c;return[{op:"replace",path:u,value:Number((c=a.current)==null?void 0:c.value)||0}]})},[]),x.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[x.jsx(vm,{ref:a,disabled:l,defaultValue:o??0,onChange:u=>i(Number(u.target.value)),type:"number"}),r&&x.jsx("div",{children:t!==o&&x.jsx(Xl,{disabled:l,onClick:()=>{s(!0),r(async u=>{var c;return[{op:"replace",path:u,value:Number((c=a.current)==null?void 0:c.value)||0}]}).finally(()=>{s(!1)})},children:l?"Saving...":"Submit"})})]})}function GA({disabled:e,defaultValue:t,registerPatchCallback:n,onSubmit:r}){const[o,i]=p.useState(t||""),[l,s]=p.useState(!1);p.useEffect(()=>{s(e)},[e]);const a=p.useRef(null);return p.useEffect(()=>{n&&n(async u=>{var c;return[{op:"replace",path:u,value:((c=a.current)==null?void 0:c.value)||""}]})},[]),x.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[x.jsx(vm,{ref:a,disabled:l,defaultValue:o??"",onChange:u=>i(u.target.value)}),r&&x.jsx("div",{children:t!==o&&x.jsx(Xl,{disabled:l,onClick:()=>{s(!0),r(async u=>{var c;return[{op:"replace",path:u,value:((c=a.current)==null?void 0:c.value)||""}]}).finally(()=>{s(!1)})},children:l?"Saving...":"Submit"})})]})}const YA=({className:e})=>x.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[x.jsx("g",{filter:"url(#filter0_d_21_1677)",children:x.jsx("path",{d:"M5 5.36426C5 5.16309 5.16309 5 5.36426 5H17.6581C17.8593 5 18.0223 5.16309 18.0223 5.36426V28.4949C18.0223 28.696 17.8593 28.8591 17.6581 28.8591H5.36426C5.16309 28.8591 5 28.696 5 28.4949V5.36426Z",fill:"#38CD98"})}),x.jsx("g",{filter:"url(#filter1_i_21_1677)",children:x.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),x.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M52.8588 23.839H48.7257H48.537H48.1128C47.6715 23.839 47.4508 23.5942 47.4508 23.1044V13.7293C47.4508 13.5784 47.3285 13.4561 47.1777 13.4561H45.8118C45.6609 13.4561 45.5386 13.5784 45.5386 13.7293V15.1836C45.5386 15.2844 45.4569 15.3661 45.3561 15.3661C45.2876 15.3661 45.225 15.3275 45.1924 15.2672C44.805 14.5503 44.283 14.02 43.6264 13.6765C42.9563 13.301 42.2045 13.1132 41.3709 13.1132C40.6028 13.1132 39.8755 13.252 39.189 13.5295C38.5026 13.8071 37.8979 14.2152 37.3748 14.7539C36.8682 15.2764 36.4678 15.9212 36.1736 16.6885C35.8794 17.4558 35.7323 18.3374 35.7323 19.3332V19.725C35.7323 20.7372 35.8794 21.627 36.1736 22.3942C36.4678 23.1615 36.8682 23.8146 37.3748 24.3533C37.8979 24.8757 38.5026 25.2757 39.189 25.5532C39.8755 25.8144 40.6191 25.945 41.42 25.945C42.1881 25.945 42.9154 25.7491 43.6019 25.3573C44.2751 24.982 44.8058 24.4119 45.1941 23.6471C45.2255 23.5852 45.2886 23.5452 45.358 23.5452H45.3917C45.4728 23.5452 45.5386 23.611 45.5386 23.6921C45.5386 23.7904 45.544 23.8856 45.5547 23.9777V25.1392C45.5547 25.3904 45.7584 25.5941 46.0096 25.5941H47.2261C47.2914 25.5995 47.3581 25.6022 47.4263 25.6022H48.537H48.7257H57.7268C57.8777 25.6022 58 25.4799 58 25.329V24.1122C58 23.9614 57.8777 23.839 57.7268 23.839H55.3174C55.1665 23.839 55.0442 23.7167 55.0442 23.5659V8.73368C55.0442 8.58279 54.9219 8.46048 54.771 8.46048H50.5054C50.3545 8.46048 50.2322 8.58279 50.2322 8.73368V9.95043C50.2322 10.1013 50.3545 10.2236 50.5054 10.2236H52.8588C53.0097 10.2236 53.132 10.3459 53.132 10.4968V23.5659C53.132 23.7167 53.0097 23.839 52.8588 23.839ZM41.6161 24.1329C42.1881 24.1329 42.7111 24.0268 43.1851 23.8146C43.6754 23.6023 44.0922 23.3003 44.4354 22.9085C44.7786 22.5167 45.0483 22.0514 45.2444 21.5127C45.4406 20.9576 45.5386 20.3454 45.5386 19.6761V19.3822C45.5386 18.7292 45.4406 18.1333 45.2444 17.5946C45.0483 17.0395 44.7705 16.5661 44.4109 16.1743C44.0677 15.7824 43.6509 15.4804 43.1606 15.2682C42.6866 15.0396 42.1718 14.9254 41.6161 14.9254C41.044 14.9254 40.521 15.0315 40.0471 15.2437C39.5731 15.4559 39.1563 15.758 38.7968 16.1498C38.4535 16.5252 38.1839 16.9905 37.9877 17.5456C37.7916 18.0843 37.6936 18.6802 37.6936 19.3332V19.725C37.6936 21.1127 38.0531 22.1983 38.7722 22.982C39.5077 23.7493 40.4557 24.1329 41.6161 24.1329ZM31.1115 25.4191C31.0732 25.5287 30.9698 25.6022 30.8536 25.6022H27.4661C27.35 25.6022 27.2465 25.5287 27.2082 25.4191L23.1578 13.8193C23.0958 13.6417 23.2276 13.4561 23.4157 13.4561H25.089C25.2068 13.4561 25.3114 13.5316 25.3484 13.6435L28.9666 24.581C28.9942 24.6643 29.0721 24.7206 29.1599 24.7206C29.2477 24.7206 29.3256 24.6643 29.3532 24.581L32.9714 13.6435C33.0084 13.5316 33.1129 13.4561 33.2308 13.4561H34.9041C35.0922 13.4561 35.224 13.6417 35.162 13.8193L31.1115 25.4191Z",fill:"currentColor"}),x.jsxs("defs",{children:[x.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[x.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),x.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),x.jsx("feOffset",{}),x.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),x.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),x.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),x.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),x.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),x.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[x.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),x.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),x.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),x.jsx("feOffset",{}),x.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),x.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),x.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),x.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]}),DC=YA,LC="Switch",[XA,w4]=$i(LC),[QA,JA]=XA(LC),ZA=p.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:l,disabled:s,value:a="on",onCheckedChange:u,...c}=e,[d,f]=p.useState(null),h=Xe(t,y=>f(y)),g=p.useRef(!1),m=d?!!d.closest("form"):!0,[S=!1,v]=Pl({prop:o,defaultProp:i,onChange:u});return p.createElement(QA,{scope:n,checked:S,disabled:s},p.createElement(De.button,ee({type:"button",role:"switch","aria-checked":S,"aria-required":l,"data-state":IC(S),"data-disabled":s?"":void 0,disabled:s,value:a},c,{ref:h,onClick:He(e.onClick,y=>{v(_=>!_),m&&(g.current=y.isPropagationStopped(),g.current||y.stopPropagation())})})),m&&p.createElement(tM,{control:d,bubbles:!g.current,name:r,value:a,checked:S,required:l,disabled:s,style:{transform:"translateX(-100%)"}}))}),qA="SwitchThumb",eM=p.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=JA(qA,n);return p.createElement(De.span,ee({"data-state":IC(o.checked),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),tM=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=p.useRef(null),l=cC(n),s=rC(t);return p.useEffect(()=>{const a=i.current,u=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(u,"checked").set;if(l!==n&&d){const f=new Event("click",{bubbles:r});d.call(a,n),a.dispatchEvent(f)}},[l,n,r]),p.createElement("input",ee({type:"checkbox","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function IC(e){return e?"checked":"unchecked"}const jC=ZA,nM=eM,Cp=p.forwardRef(({className:e,...t},n)=>x.jsx(jC,{className:ot("peer inline-flex h-[22px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-accent data-[state=unchecked]:bg-primary",e),...t,ref:n,children:x.jsx(nM,{className:ot("pointer-events-none block h-[18px] w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Cp.displayName=jC.displayName;const km=p.forwardRef(({className:e,...t},n)=>x.jsx("div",{ref:n,className:ot("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));km.displayName="Card";const rM=p.forwardRef(({className:e,...t},n)=>x.jsx("div",{ref:n,className:ot("flex flex-col space-y-1.5 p-6",e),...t}));rM.displayName="CardHeader";const oM=p.forwardRef(({className:e,...t},n)=>x.jsx("h3",{ref:n,className:ot("text-2xl font-semibold leading-none tracking-tight",e),...t}));oM.displayName="CardTitle";const iM=p.forwardRef(({className:e,...t},n)=>x.jsx("p",{ref:n,className:ot("text-sm text-muted-foreground",e),...t}));iM.displayName="CardDescription";const lM=p.forwardRef(({className:e,...t},n)=>x.jsx("div",{ref:n,className:ot("p-6 pt-0",e),...t}));lM.displayName="CardContent";const sM=p.forwardRef(({className:e,...t},n)=>x.jsx("div",{ref:n,className:ot("flex items-center p-6 pt-0",e),...t}));sM.displayName="CardFooter";/**
166
166
  * @remix-run/router v1.11.0
167
167
  *
168
168
  * Copyright (c) Remix Software Inc.
@@ -185,7 +185,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
185
185
  ${d.map((T,M)=>`${M+1}. ${T.message}`).join(`
186
186
  `)}
187
187
 
188
- Showing stack trace of: 0. ${d[0].message}`,E=new Error($);throw E.stack=d[0].stack,E}f&&f.length>0&&console.warn("Val encountered validation errors:",f),p.useEffect(()=>{s(t?`/${t}`:l)},[t]);const[h,g]=p.useState(null);p.useEffect(()=>{try{new WebSocket(`${window.location.origin.replace("http://","ws://")}/_next/webpack-hmr`).addEventListener("message",E=>{let T;try{T=JSON.parse(E.data)}catch{console.error("Failed to parse HMR")}typeof(T==null?void 0:T.hash)=="string"&&(T==null?void 0:T.action)==="built"&&g(T.hash)})}catch($){console.warn("Failed to initialize HMR",$)}},[]),p.useEffect(()=>{console.log("(Re)-fetching modules"),e.getModules({patch:!0,includeSchema:!0,includeSource:!0}).then($=>{dl.isOk($)?r($.value.modules):(i("Could not load modules: "+$.error.message),console.error($.error))})},[h]);const m=Rm(),[S,v]=LP();p.useEffect(()=>{const $=E=>{console.log("popstate",E)};return window.addEventListener("popstate",$),()=>{window.removeEventListener("popstate",$)}},[]);const y=q.useRef(null),_=p.useCallback($=>async E=>{const[T,M]=wn.splitModuleIdAndModulePath($),R=await E(wn.createPatchJSONPath(M));return e.postPatches(T,R).then(j=>{if(dl.isErr(j))throw j.error;if(console.log("submitted",R),!h)return e.getModules({patch:!0,includeSchema:!0,includeSource:!0}).then(F=>{dl.isOk(F)?r(F.value.modules):(i("Could not load modules: "+F.error.message),console.error(F.error))})}).catch(j=>{console.error(j)})},[]);return x.jsx(NS.Provider,{value:{theme:S,setTheme:v,api:e,editMode:"full",session:{status:"not-asked"},highlight:!1,setHighlight:()=>{},setEditMode:()=>{},setWindowSize:()=>{}},children:x.jsxs("div",{id:"val-fullscreen-container",className:"relative font-serif antialiased","data-mode":S,children:[x.jsx("div",{className:"fixed -translate-x-1/2 z-overlay left-1/2 bottom-4",children:x.jsx(PP,{api:e})}),x.jsx("div",{id:"val-fullscreen-hover",ref:y}),x.jsx(nE.Provider,{value:{hoverElem:y==null?void 0:y.current},children:x.jsx("div",{className:"text-primary bg-background",children:x.jsxs(Ms,{children:[x.jsx("div",{className:"px-4 h-[50px] flex items-center justify-center",children:x.jsx(DC,{})}),x.jsx(As,{className:"px-4",children:n?x.jsx(E3,{paths:Object.keys(n),setSelectedModuleId:$=>{m($)}}):!o&&x.jsx("div",{className:"py-4",children:"Loading..."})}),x.jsxs("div",{className:"flex items-center justify-start w-full h-[50px] gap-2 font-serif text-xs",children:[x.jsx("button",{onClick:()=>{history.back()},children:x.jsx(_P,{})}),x.jsx("p",{children:l||"/"})]}),x.jsxs("div",{className:"p-4",children:[o&&x.jsxs("div",{className:"text-lg text-destructive-foreground",children:["ERROR: ",o]}),n&&l&&a&&u!==void 0&&c!==void 0&&x.jsx(tE.Provider,{value:n,children:x.jsx(v3,{path:l,source:u,schema:c,setSelectedPath:s,initOnSubmit:_})})]})]})})})]})})},nE=q.createContext({hoverElem:null}),m3=()=>q.useContext(nE);function v3({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o}){const[,i]=wn.splitModuleIdAndModulePath(e),l=wn.resolvePath(i,t,n);if(!l)throw Error("Could not resolve module: "+e);return x.jsx(rE,{path:e,source:l.source,schema:l.schema,setSelectedPath:r,initOnSubmit:o,top:!0})}function rE({path:e,source:t,schema:n,setSelectedPath:r,field:o,initOnSubmit:i,top:l}){return t===null||n.opt?x.jsx(w3,{path:e,source:t,schema:n,field:o,initOnSubmit:i,setSelectedPath:r}):n.type==="object"?typeof t!="object"||Ks(t)?x.jsxs("div",{children:["ERROR: expected object, but found ",typeof t]}):x.jsx(oE,{source:t,path:e,schema:n,initOnSubmit:i,setSelectedPath:r,top:l}):n.type==="array"?typeof t!="object"||!Ks(t)?x.jsxs("div",{children:["ERROR: expected array, but found ",typeof t]}):x.jsx(iE,{source:t,path:e,schema:n,setSelectedPath:r}):n.type==="record"?typeof t!="object"?x.jsxs("div",{children:["ERROR: expected object for ",n.type,", but found ",typeof t]}):Ks(t)?x.jsxs("div",{children:["ERROR: did not expect array for ",n.type]}):x.jsx(y3,{source:t,path:e,schema:n,setSelectedPath:r}):x.jsxs("div",{className:"py-2 gap-y-4",children:[x.jsx("div",{className:"text-left",children:o||e}),x.jsx(MC,{path:e,disabled:!1,source:t,schema:n,onSubmit:i(e)})]})}function oE({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o,top:i}){return x.jsx("div",{className:id("flex flex-col gap-y-8",{"border-l-2 border-border pl-6":!i}),children:Object.entries(n.items).map(([l,s])=>{const a=Ca(e,l);return x.jsx(rE,{path:a,source:t[l],schema:s,setSelectedPath:r,field:l,initOnSubmit:o},a)})},e)}function y3({path:e,source:t,schema:n,setSelectedPath:r}){const o=Rm();return x.jsx("div",{className:"flex flex-col gap-4 p-2",children:Object.entries(t).map(([i,l])=>{const s=Ca(e,i);return x.jsx("button",{onClick:()=>{r(s),o(s)},children:x.jsx(x3,{recordKey:i,path:s,source:l,schema:n.item})},s)})},e)}const Np=170;function x3({recordKey:e,path:t,source:n,schema:r}){const o=q.useRef(null),[i,l]=p.useState(!1);return p.useEffect(()=>{o.current&&o.current.getBoundingClientRect().height>=Np&&l(!0)},[]),x.jsxs(km,{ref:o,className:"relative px-4 pt-2 pb-4 overflow-hidden border gap-y-2",style:{maxHeight:Np},children:[x.jsx("div",{className:"pb-4 font-serif text-left text-accent",children:e}),x.jsx("div",{className:"text-xs",children:x.jsx(Pm,{path:t,source:n,schema:r})}),i&&x.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[20px] bg-gradient-to-b from-transparent to-background"})]},t)}function iE({path:e,source:t,schema:n,setSelectedPath:r}){const o=Rm();return x.jsx("div",{className:"flex flex-col gap-4 p-2",children:t.map((i,l)=>{const s=Ca(e,l);return x.jsx("button",{onClick:()=>{r(s),o(s)},children:x.jsx(_3,{index:l,path:s,source:i,schema:n.item},s)},s)})},e)}const B0=Np;function _3({index:e,path:t,source:n,schema:r}){const o=q.useRef(null),[i,l]=p.useState(!1);return p.useEffect(()=>{o.current&&o.current.getBoundingClientRect().height>=B0&&l(!0)},[]),x.jsxs(km,{ref:o,className:"relative px-4 pt-2 pb-4 overflow-hidden border gap-y-2",style:{maxHeight:B0},children:[x.jsx("div",{className:"pb-4 font-serif text-left uppercase text-accent",children:e+1<10?`0${e+1}`:e+1}),x.jsx("div",{className:"text-xs",children:x.jsx(Pm,{path:t,source:n,schema:r})}),i&&x.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[20px] bg-gradient-to-b from-transparent to-background"})]})}function Ca(e,t){const n=wn.createValPathOfItem(e,t);if(!n)throw Error(`Could not create val path: ${e} of ${t==null?void 0:t.toString()}`);return n}function Pm({path:e,source:t,schema:n}){const[r,o]=p.useState(null),{hoverElem:i}=m3();if(n.type==="object")return x.jsx("div",{className:"grid grid-cols-[min-content_1fr] gap-2 text-left",children:Object.entries(n.items).map(([l])=>x.jsxs(p.Fragment,{children:[x.jsxs("span",{className:"text-muted",children:[l,":"]}),x.jsx("span",{children:x.jsx(Pm,{source:(t==null?void 0:t[l])??null,schema:n.items[l],path:Ca(e,l)})})]},Ca(e,l)))},e);if(n.type==="array")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):Array.isArray(t)?x.jsxs("span",{children:[x.jsx("span",{className:"text-accent",children:t.length}),x.jsx("span",{children:t.length===1?" item":" items"})]},e):x.jsx("span",{className:"px-2 bg-destructive text-destructive-foreground",children:"Unknown length"},e);if(n.type==="richtext")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):typeof t!="object"?x.jsxs("div",{className:"p-4 text-destructive-foreground bg-destructive",children:["ERROR: ",typeof t," not an object"]},e):!(Kt in t)||t[Kt]!=="richtext"?x.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: object is not richtext"},e):x.jsx($3,{children:BS(t)},e);if(n.type==="string")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):x.jsx("span",{children:t});if(n.type==="image"){if(t===null)return x.jsx("span",{className:"text-accent",children:"Empty"},e);if(typeof t!="object")return x.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: not an object"},e);if(!(hn in t)||typeof t[hn]!="string")return x.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: object is not an image"},e);const l=wn.convertFileSource(t).url;return x.jsxs("span",{onMouseOver:s=>{o({x:s.clientX,y:s.clientY})},onMouseLeave:()=>{o(null)},className:"relative flex items-center justify-start gap-1",children:[x.jsx("a",{href:l,className:"overflow-hidden underline truncate ",children:t[hn]}),r&&i&&Hr.createPortal(x.jsx("img",{className:"absolute z-[5] max-w-[10vw]",style:{left:r.x+10,top:r.y+10},src:l}),i)]},e)}else{if(n.type==="boolean")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):x.jsx("span",{className:"text-accent",children:t?"true":"false"},e);if(n.type==="number")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):x.jsx("span",{className:"text-accent",children:t.toString()});if(n.type==="keyOf")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):x.jsx("span",{className:"text-accent",children:t.toString()},e)}return x.jsxs("div",{children:["TODO: ",n.type]},e)}function w3({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o,field:i}){const[l,s]=p.useState(t!==null);return x.jsxs("div",{className:"flex flex-col gap-y-6",children:[i?x.jsxs("div",{className:"flex items-center justify-start gap-x-4",children:[x.jsx(Cp,{checked:l,onClick:()=>{s(a=>!a)}}),x.jsx("span",{children:i})]}):x.jsx(Cp,{checked:l,onClick:()=>{s(a=>!a)}}),l&&x.jsx(S3,{source:t,schema:n,path:e,setSelectedPath:r,initOnSubmit:o})]},e)}function S3({source:e,path:t,schema:n,setSelectedPath:r,initOnSubmit:o}){if(n.type==="array"){if(typeof e=="object"&&(e===null||Ks(e)))return x.jsx(iE,{source:e===null?[]:e,path:t,schema:n,setSelectedPath:r})}else if(n.type==="object"){if(typeof e=="object"&&(e===null||!Ks(e)))return x.jsx(oE,{source:e,path:t,schema:n,setSelectedPath:r,initOnSubmit:o})}else if(n.type==="richtext"||n.type==="string"||n.type==="image"||n.type==="number"||n.type==="keyOf")return x.jsx(MC,{path:t,disabled:!1,source:e,schema:n,onSubmit:o(t)},t);return x.jsxs("div",{className:"p-4 bg-destructive text-destructive-foreground",children:["ERROR: unexpected source type ",typeof e," for schema type"," ",n.type]})}function Ks(e){return Array.isArray(e)}function C3(e){const t={};return e.forEach(n=>{const r=n.split("/").filter(i=>i!=="");let o=t;r.forEach(i=>{o[i]||(o[i]={}),o=o[i]})}),t}function E3({paths:e,setSelectedModuleId:t}){const n=C3(e);return x.jsx(D_,{children:Object.entries(n).map(([r,o])=>x.jsx("div",{className:"px-4 py-2",children:x.jsx(lE,{name:r,tree:o,moduleId:`/${r}`,setSelectedModuleId:t})},`/${r}`))})}function lE({name:e,tree:t,moduleId:n,setSelectedModuleId:r}){return x.jsxs("div",{children:[x.jsx("button",{onClick:()=>{r(n)},children:e}),Object.entries(t).map(([o,i])=>x.jsx("div",{className:"px-4 py-1",children:x.jsx(lE,{name:o,tree:i,moduleId:`${n}/${o}`,setSelectedModuleId:r})},`${n}/${o}`))]})}const W0={tags:{h1:"font-bold",h2:"font-bold",h3:"font-bold",h4:"font-bold",h5:"font-bold",h6:"font-bold",p:""},classes:{bold:"font-bold",italic:"italic",lineThrough:"line-through"}};function $3({children:e}){const t=e;function n(i,l){const s=W0.tags[i];return s&&l?[l,s].join(" "):s||l}function r(i,l){const s=W0.classes[i];return s&&l?[l,s].join(" "):s||l}function o(i,l){var u,c;if(typeof i=="string")return i;if(i.tag==="p")return x.jsx("p",{className:n("p"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="img")return x.jsx("img",{className:n("img"),src:i.src},l);if(i.tag==="ul")return x.jsx("ul",{className:n("ul"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="ol")return x.jsx("ol",{className:n("ol"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="li")return x.jsx("li",{className:n("li"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="span")return x.jsx("span",{className:i.classes.map(d=>{switch(d){case"bold":return r("bold");case"line-through":return r("lineThrough");case"italic":return r("italic")}}).join(" "),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h1")return x.jsx("h1",{className:n("h1"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h2")return x.jsx("h2",{className:n("h2"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h3")return x.jsx("h3",{className:n("h3"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h4")return x.jsx("h4",{className:n("h4"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h5")return x.jsx("h5",{className:n("h5"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h6")return x.jsx("h6",{className:n("h6"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="br")return x.jsx("br",{},l);if(i.tag==="a")return x.jsx("a",{href:i.href,children:i.children.map((d,f)=>o(d,f))},l);console.error("Unknown tag",i.tag);const a=i.tag;return a!=null&&a.tag?q.createElement(a.tag,{key:l,className:(u=a.class)==null?void 0:u.join(" "),children:(c=a.children)==null?void 0:c.map(o)}):null}return x.jsx("span",{"data-val-path":t.valPath,children:t.children.map((i,l)=>o(i,l))})}const k3=p.createContext(null),Mf={didCatch:!1,error:null};class T3 extends p.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Mf}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),l=0;l<o;l++)i[l]=arguments[l];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState(Mf)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&N3(t.resetKeys,o)){var i,l;(i=(l=this.props).onReset)===null||i===void 0||i.call(l,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(Mf)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:l}=this.state;let s=t;if(i){const a={error:l,resetErrorBoundary:this.resetErrorBoundary};if(p.isValidElement(o))s=o;else if(typeof n=="function")s=n(a);else if(r)s=p.createElement(r,a);else throw l}return p.createElement(k3.Provider,{value:{didCatch:i,error:l,resetErrorBoundary:this.resetErrorBoundary}},s)}}function N3(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const sE="Collapsible",[b3,aE]=$i(sE),[R3,Om]=b3(sE),P3=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:l,...s}=e,[a=!1,u]=Pl({prop:r,defaultProp:o,onChange:l});return p.createElement(R3,{scope:n,disabled:i,contentId:wd(),open:a,onOpenToggle:p.useCallback(()=>u(c=>!c),[u])},p.createElement(De.div,ee({"data-state":Am(a),"data-disabled":i?"":void 0},s,{ref:t})))}),O3="CollapsibleTrigger",A3=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Om(O3,n);return p.createElement(De.button,ee({type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Am(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled},r,{ref:t,onClick:He(e.onClick,o.onOpenToggle)}))}),uE="CollapsibleContent",M3=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Om(uE,e.__scopeCollapsible);return p.createElement(Il,{present:n||o.open},({present:i})=>p.createElement(D3,ee({},r,{ref:t,present:i})))}),D3=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,l=Om(uE,n),[s,a]=p.useState(r),u=p.useRef(null),c=Xe(t,u),d=p.useRef(0),f=d.current,h=p.useRef(0),g=h.current,m=l.open||s,S=p.useRef(m),v=p.useRef();return p.useEffect(()=>{const y=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(y)},[]),$n(()=>{const y=u.current;if(y){v.current=v.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const _=y.getBoundingClientRect();d.current=_.height,h.current=_.width,S.current||(y.style.transitionDuration=v.current.transitionDuration,y.style.animationName=v.current.animationName),a(r)}},[l.open,r]),p.createElement(De.div,ee({"data-state":Am(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!m},i,{ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style}}),m&&o)});function Am(e){return e?"open":"closed"}const L3=P3,I3=A3,j3=M3,Bo="Accordion",z3=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Mm,F3,B3]=HS(Bo),[Od,S4]=$i(Bo,[B3,aE]),Dm=aE(),cE=q.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return q.createElement(Mm.Provider,{scope:e.__scopeAccordion},n==="multiple"?q.createElement(H3,ee({},i,{ref:t})):q.createElement(V3,ee({},o,{ref:t})))});cE.propTypes={type(e){const t=e.value||e.defaultValue;return e.type&&!["single","multiple"].includes(e.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):e.type==="multiple"&&typeof t=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):e.type==="single"&&Array.isArray(t)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[dE,W3]=Od(Bo),[fE,U3]=Od(Bo,{collapsible:!1}),V3=q.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...l}=e,[s,a]=Pl({prop:n,defaultProp:r,onChange:o});return q.createElement(dE,{scope:e.__scopeAccordion,value:s?[s]:[],onItemOpen:a,onItemClose:q.useCallback(()=>i&&a(""),[i,a])},q.createElement(fE,{scope:e.__scopeAccordion,collapsible:i},q.createElement(hE,ee({},l,{ref:t}))))}),H3=q.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l=[],s]=Pl({prop:n,defaultProp:r,onChange:o}),a=q.useCallback(c=>s((d=[])=>[...d,c]),[s]),u=q.useCallback(c=>s((d=[])=>d.filter(f=>f!==c)),[s]);return q.createElement(dE,{scope:e.__scopeAccordion,value:l,onItemOpen:a,onItemClose:u},q.createElement(fE,{scope:e.__scopeAccordion,collapsible:!0},q.createElement(hE,ee({},i,{ref:t}))))}),[K3,Ad]=Od(Bo),hE=q.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...l}=e,s=q.useRef(null),a=Xe(s,t),u=F3(n),d=bg(o)==="ltr",f=He(e.onKeyDown,h=>{var g;if(!z3.includes(h.key))return;const m=h.target,S=u().filter(M=>{var R;return!((R=M.ref.current)!==null&&R!==void 0&&R.disabled)}),v=S.findIndex(M=>M.ref.current===m),y=S.length;if(v===-1)return;h.preventDefault();let _=v;const w=0,C=y-1,$=()=>{_=v+1,_>C&&(_=w)},E=()=>{_=v-1,_<w&&(_=C)};switch(h.key){case"Home":_=w;break;case"End":_=C;break;case"ArrowRight":i==="horizontal"&&(d?$():E());break;case"ArrowDown":i==="vertical"&&$();break;case"ArrowLeft":i==="horizontal"&&(d?E():$());break;case"ArrowUp":i==="vertical"&&E();break}const T=_%y;(g=S[T].ref.current)===null||g===void 0||g.focus()});return q.createElement(K3,{scope:n,disabled:r,direction:o,orientation:i},q.createElement(Mm.Slot,{scope:n},q.createElement(De.div,ee({},l,{"data-orientation":i,ref:a,onKeyDown:r?void 0:f}))))}),bp="AccordionItem",[G3,Lm]=Od(bp),Y3=q.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=Ad(bp,n),l=W3(bp,n),s=Dm(n),a=wd(),u=r&&l.value.includes(r)||!1,c=i.disabled||e.disabled;return q.createElement(G3,{scope:n,open:u,disabled:c,triggerId:a},q.createElement(L3,ee({"data-orientation":i.orientation,"data-state":pE(u)},s,o,{ref:t,disabled:c,open:u,onOpenChange:d=>{d?l.onItemOpen(r):l.onItemClose(r)}})))}),X3="AccordionHeader",Q3=q.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Ad(Bo,n),i=Lm(X3,n);return q.createElement(De.h3,ee({"data-orientation":o.orientation,"data-state":pE(i.open),"data-disabled":i.disabled?"":void 0},r,{ref:t}))}),U0="AccordionTrigger",J3=q.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Ad(Bo,n),i=Lm(U0,n),l=U3(U0,n),s=Dm(n);return q.createElement(Mm.ItemSlot,{scope:n},q.createElement(I3,ee({"aria-disabled":i.open&&!l.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId},s,r,{ref:t})))}),Z3="AccordionContent",q3=q.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Ad(Bo,n),i=Lm(Z3,n),l=Dm(n);return q.createElement(j3,ee({role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation},l,r,{ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}}))});function pE(e){return e?"open":"closed"}const e4=cE,t4=Y3,n4=Q3,gE=J3,mE=q3,r4=e4,vE=p.forwardRef(({className:e,...t},n)=>x.jsx(t4,{ref:n,className:ot("border-b",e),...t}));vE.displayName="AccordionItem";const yE=p.forwardRef(({className:e,children:t,...n},r)=>x.jsx(n4,{className:"flex",children:x.jsxs(gE,{ref:r,className:ot("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,x.jsx(DS,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));yE.displayName=gE.displayName;const xE=p.forwardRef(({className:e,children:t,...n},r)=>x.jsx(mE,{ref:r,className:ot("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:x.jsx("div",{className:"pt-0 pb-4",children:t})}));xE.displayName=mE.displayName;/**
188
+ Showing stack trace of: 0. ${d[0].message}`,E=new Error($);throw E.stack=d[0].stack,E}f&&f.length>0&&console.warn("Val encountered validation errors:",f),p.useEffect(()=>{s(t?`/${t}`:l)},[t]);const[h,g]=p.useState(null);p.useEffect(()=>{try{new WebSocket(`${window.location.origin.replace("http://","ws://")}/_next/webpack-hmr`).addEventListener("message",E=>{let T;try{T=JSON.parse(E.data)}catch{console.error("Failed to parse HMR")}typeof(T==null?void 0:T.hash)=="string"&&(T==null?void 0:T.action)==="built"&&g(T.hash)})}catch($){console.warn("Failed to initialize HMR",$)}},[]),p.useEffect(()=>{console.log("(Re)-fetching modules"),e.getModules({patch:!0,includeSchema:!0,includeSource:!0}).then($=>{dl.isOk($)?r($.value.modules):(i("Could not load modules: "+$.error.message),console.error($.error))})},[h]);const m=Rm(),[S,v]=KP();p.useEffect(()=>{const $=E=>{console.log("popstate",E)};return window.addEventListener("popstate",$),()=>{window.removeEventListener("popstate",$)}},[]);const y=q.useRef(null),_=p.useCallback($=>async E=>{const[T,M]=wn.splitModuleIdAndModulePath($),R=await E(wn.createPatchJSONPath(M));return e.postPatches(T,R).then(j=>{if(dl.isErr(j))throw j.error;if(console.log("submitted",R),!h)return e.getModules({patch:!0,includeSchema:!0,includeSource:!0}).then(F=>{dl.isOk(F)?r(F.value.modules):(i("Could not load modules: "+F.error.message),console.error(F.error))})}).catch(j=>{console.error(j)})},[]);return x.jsx(AS.Provider,{value:{theme:S,setTheme:v,api:e,editMode:"full",session:{status:"not-asked"},highlight:!1,setHighlight:()=>{},setEditMode:()=>{},setWindowSize:()=>{}},children:x.jsxs("div",{id:"val-fullscreen-container",className:"relative font-serif antialiased","data-mode":S,children:[x.jsx("div",{className:"fixed -translate-x-1/2 z-overlay left-1/2 bottom-4",children:x.jsx(BP,{api:e})}),x.jsx("div",{id:"val-fullscreen-hover",ref:y}),x.jsx(nE.Provider,{value:{hoverElem:y==null?void 0:y.current},children:x.jsx("div",{className:"text-primary bg-background",children:x.jsxs(Ms,{children:[x.jsx("div",{className:"px-4 h-[50px] flex items-center justify-center",children:x.jsx(DC,{})}),x.jsx(As,{className:"px-4",children:n?x.jsx(E3,{paths:Object.keys(n),setSelectedModuleId:$=>{m($)}}):!o&&x.jsx("div",{className:"py-4",children:"Loading..."})}),x.jsxs("div",{className:"flex items-center justify-start w-full h-[50px] gap-2 font-serif text-xs",children:[x.jsx("button",{onClick:()=>{history.back()},children:x.jsx(RP,{})}),x.jsx("p",{children:l||"/"})]}),x.jsxs("div",{className:"p-4",children:[o&&x.jsxs("div",{className:"text-lg text-destructive-foreground",children:["ERROR: ",o]}),n&&l&&a&&u!==void 0&&c!==void 0&&x.jsx(tE.Provider,{value:n,children:x.jsx(v3,{path:l,source:u,schema:c,setSelectedPath:s,initOnSubmit:_})})]})]})})})]})})},nE=q.createContext({hoverElem:null}),m3=()=>q.useContext(nE);function v3({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o}){const[,i]=wn.splitModuleIdAndModulePath(e),l=wn.resolvePath(i,t,n);if(!l)throw Error("Could not resolve module: "+e);return x.jsx(rE,{path:e,source:l.source,schema:l.schema,setSelectedPath:r,initOnSubmit:o,top:!0})}function rE({path:e,source:t,schema:n,setSelectedPath:r,field:o,initOnSubmit:i,top:l}){return t===null||n.opt?x.jsx(w3,{path:e,source:t,schema:n,field:o,initOnSubmit:i,setSelectedPath:r}):n.type==="object"?typeof t!="object"||Ks(t)?x.jsxs("div",{children:["ERROR: expected object, but found ",typeof t]}):x.jsx(oE,{source:t,path:e,schema:n,initOnSubmit:i,setSelectedPath:r,top:l}):n.type==="array"?typeof t!="object"||!Ks(t)?x.jsxs("div",{children:["ERROR: expected array, but found ",typeof t]}):x.jsx(iE,{source:t,path:e,schema:n,setSelectedPath:r}):n.type==="record"?typeof t!="object"?x.jsxs("div",{children:["ERROR: expected object for ",n.type,", but found ",typeof t]}):Ks(t)?x.jsxs("div",{children:["ERROR: did not expect array for ",n.type]}):x.jsx(y3,{source:t,path:e,schema:n,setSelectedPath:r}):x.jsxs("div",{className:"py-2 gap-y-4",children:[x.jsx("div",{className:"text-left",children:o||e}),x.jsx(MC,{path:e,disabled:!1,source:t,schema:n,onSubmit:i(e)})]})}function oE({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o,top:i}){return x.jsx("div",{className:id("flex flex-col gap-y-8",{"border-l-2 border-border pl-6":!i}),children:Object.entries(n.items).map(([l,s])=>{const a=Ca(e,l);return x.jsx(rE,{path:a,source:t[l],schema:s,setSelectedPath:r,field:l,initOnSubmit:o},a)})},e)}function y3({path:e,source:t,schema:n,setSelectedPath:r}){const o=Rm();return x.jsx("div",{className:"flex flex-col gap-4 p-2",children:Object.entries(t).map(([i,l])=>{const s=Ca(e,i);return x.jsx("button",{onClick:()=>{r(s),o(s)},children:x.jsx(x3,{recordKey:i,path:s,source:l,schema:n.item})},s)})},e)}const Np=170;function x3({recordKey:e,path:t,source:n,schema:r}){const o=q.useRef(null),[i,l]=p.useState(!1);return p.useEffect(()=>{o.current&&o.current.getBoundingClientRect().height>=Np&&l(!0)},[]),x.jsxs(km,{ref:o,className:"relative px-4 pt-2 pb-4 overflow-hidden border gap-y-2",style:{maxHeight:Np},children:[x.jsx("div",{className:"pb-4 font-serif text-left text-accent",children:e}),x.jsx("div",{className:"text-xs",children:x.jsx(Pm,{path:t,source:n,schema:r})}),i&&x.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[20px] bg-gradient-to-b from-transparent to-background"})]},t)}function iE({path:e,source:t,schema:n,setSelectedPath:r}){const o=Rm();return x.jsx("div",{className:"flex flex-col gap-4 p-2",children:t.map((i,l)=>{const s=Ca(e,l);return x.jsx("button",{onClick:()=>{r(s),o(s)},children:x.jsx(_3,{index:l,path:s,source:i,schema:n.item},s)},s)})},e)}const B0=Np;function _3({index:e,path:t,source:n,schema:r}){const o=q.useRef(null),[i,l]=p.useState(!1);return p.useEffect(()=>{o.current&&o.current.getBoundingClientRect().height>=B0&&l(!0)},[]),x.jsxs(km,{ref:o,className:"relative px-4 pt-2 pb-4 overflow-hidden border gap-y-2",style:{maxHeight:B0},children:[x.jsx("div",{className:"pb-4 font-serif text-left uppercase text-accent",children:e+1<10?`0${e+1}`:e+1}),x.jsx("div",{className:"text-xs",children:x.jsx(Pm,{path:t,source:n,schema:r})}),i&&x.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[20px] bg-gradient-to-b from-transparent to-background"})]})}function Ca(e,t){const n=wn.createValPathOfItem(e,t);if(!n)throw Error(`Could not create val path: ${e} of ${t==null?void 0:t.toString()}`);return n}function Pm({path:e,source:t,schema:n}){const[r,o]=p.useState(null),{hoverElem:i}=m3();if(n.type==="object")return x.jsx("div",{className:"grid grid-cols-[min-content_1fr] gap-2 text-left",children:Object.entries(n.items).map(([l])=>x.jsxs(p.Fragment,{children:[x.jsxs("span",{className:"text-muted",children:[l,":"]}),x.jsx("span",{children:x.jsx(Pm,{source:(t==null?void 0:t[l])??null,schema:n.items[l],path:Ca(e,l)})})]},Ca(e,l)))},e);if(n.type==="array")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):Array.isArray(t)?x.jsxs("span",{children:[x.jsx("span",{className:"text-accent",children:t.length}),x.jsx("span",{children:t.length===1?" item":" items"})]},e):x.jsx("span",{className:"px-2 bg-destructive text-destructive-foreground",children:"Unknown length"},e);if(n.type==="richtext")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):typeof t!="object"?x.jsxs("div",{className:"p-4 text-destructive-foreground bg-destructive",children:["ERROR: ",typeof t," not an object"]},e):!(Kt in t)||t[Kt]!=="richtext"?x.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: object is not richtext"},e):x.jsx($3,{children:F_(t)},e);if(n.type==="string")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):x.jsx("span",{children:t});if(n.type==="image"){if(t===null)return x.jsx("span",{className:"text-accent",children:"Empty"},e);if(typeof t!="object")return x.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: not an object"},e);if(!(hn in t)||typeof t[hn]!="string")return x.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: object is not an image"},e);const l=wn.convertFileSource(t).url;return x.jsxs("span",{onMouseOver:s=>{o({x:s.clientX,y:s.clientY})},onMouseLeave:()=>{o(null)},className:"relative flex items-center justify-start gap-1",children:[x.jsx("a",{href:l,className:"overflow-hidden underline truncate ",children:t[hn]}),r&&i&&Hr.createPortal(x.jsx("img",{className:"absolute z-[5] max-w-[10vw]",style:{left:r.x+10,top:r.y+10},src:l}),i)]},e)}else{if(n.type==="boolean")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):x.jsx("span",{className:"text-accent",children:t?"true":"false"},e);if(n.type==="number")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):x.jsx("span",{className:"text-accent",children:t.toString()});if(n.type==="keyOf")return t===null?x.jsx("span",{className:"text-accent",children:"Empty"},e):x.jsx("span",{className:"text-accent",children:t.toString()},e)}return x.jsxs("div",{children:["TODO: ",n.type]},e)}function w3({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o,field:i}){const[l,s]=p.useState(t!==null);return x.jsxs("div",{className:"flex flex-col gap-y-6",children:[i?x.jsxs("div",{className:"flex items-center justify-start gap-x-4",children:[x.jsx(Cp,{checked:l,onClick:()=>{s(a=>!a)}}),x.jsx("span",{children:i})]}):x.jsx(Cp,{checked:l,onClick:()=>{s(a=>!a)}}),l&&x.jsx(S3,{source:t,schema:n,path:e,setSelectedPath:r,initOnSubmit:o})]},e)}function S3({source:e,path:t,schema:n,setSelectedPath:r,initOnSubmit:o}){if(n.type==="array"){if(typeof e=="object"&&(e===null||Ks(e)))return x.jsx(iE,{source:e===null?[]:e,path:t,schema:n,setSelectedPath:r})}else if(n.type==="object"){if(typeof e=="object"&&(e===null||!Ks(e)))return x.jsx(oE,{source:e,path:t,schema:n,setSelectedPath:r,initOnSubmit:o})}else if(n.type==="richtext"||n.type==="string"||n.type==="image"||n.type==="number"||n.type==="keyOf")return x.jsx(MC,{path:t,disabled:!1,source:e,schema:n,onSubmit:o(t)},t);return x.jsxs("div",{className:"p-4 bg-destructive text-destructive-foreground",children:["ERROR: unexpected source type ",typeof e," for schema type"," ",n.type]})}function Ks(e){return Array.isArray(e)}function C3(e){const t={};return e.forEach(n=>{const r=n.split("/").filter(i=>i!=="");let o=t;r.forEach(i=>{o[i]||(o[i]={}),o=o[i]})}),t}function E3({paths:e,setSelectedModuleId:t}){const n=C3(e);return x.jsx(D_,{children:Object.entries(n).map(([r,o])=>x.jsx("div",{className:"px-4 py-2",children:x.jsx(lE,{name:r,tree:o,moduleId:`/${r}`,setSelectedModuleId:t})},`/${r}`))})}function lE({name:e,tree:t,moduleId:n,setSelectedModuleId:r}){return x.jsxs("div",{children:[x.jsx("button",{onClick:()=>{r(n)},children:e}),Object.entries(t).map(([o,i])=>x.jsx("div",{className:"px-4 py-1",children:x.jsx(lE,{name:o,tree:i,moduleId:`${n}/${o}`,setSelectedModuleId:r})},`${n}/${o}`))]})}const W0={tags:{h1:"font-bold",h2:"font-bold",h3:"font-bold",h4:"font-bold",h5:"font-bold",h6:"font-bold",p:""},classes:{bold:"font-bold",italic:"italic",lineThrough:"line-through"}};function $3({children:e}){const t=e;function n(i,l){const s=W0.tags[i];return s&&l?[l,s].join(" "):s||l}function r(i,l){const s=W0.classes[i];return s&&l?[l,s].join(" "):s||l}function o(i,l){var u,c;if(typeof i=="string")return i;if(i.tag==="p")return x.jsx("p",{className:n("p"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="img")return x.jsx("img",{className:n("img"),src:i.src},l);if(i.tag==="ul")return x.jsx("ul",{className:n("ul"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="ol")return x.jsx("ol",{className:n("ol"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="li")return x.jsx("li",{className:n("li"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="span")return x.jsx("span",{className:i.classes.map(d=>{switch(d){case"bold":return r("bold");case"line-through":return r("lineThrough");case"italic":return r("italic")}}).join(" "),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h1")return x.jsx("h1",{className:n("h1"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h2")return x.jsx("h2",{className:n("h2"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h3")return x.jsx("h3",{className:n("h3"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h4")return x.jsx("h4",{className:n("h4"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h5")return x.jsx("h5",{className:n("h5"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h6")return x.jsx("h6",{className:n("h6"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="br")return x.jsx("br",{},l);if(i.tag==="a")return x.jsx("a",{href:i.href,children:i.children.map((d,f)=>o(d,f))},l);console.error("Unknown tag",i.tag);const a=i.tag;return a!=null&&a.tag?q.createElement(a.tag,{key:l,className:(u=a.class)==null?void 0:u.join(" "),children:(c=a.children)==null?void 0:c.map(o)}):null}return x.jsx("span",{"data-val-path":t.valPath,children:t.children.map((i,l)=>o(i,l))})}const k3=p.createContext(null),Mf={didCatch:!1,error:null};class T3 extends p.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Mf}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),l=0;l<o;l++)i[l]=arguments[l];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState(Mf)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&N3(t.resetKeys,o)){var i,l;(i=(l=this.props).onReset)===null||i===void 0||i.call(l,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(Mf)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:l}=this.state;let s=t;if(i){const a={error:l,resetErrorBoundary:this.resetErrorBoundary};if(p.isValidElement(o))s=o;else if(typeof n=="function")s=n(a);else if(r)s=p.createElement(r,a);else throw l}return p.createElement(k3.Provider,{value:{didCatch:i,error:l,resetErrorBoundary:this.resetErrorBoundary}},s)}}function N3(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const sE="Collapsible",[b3,aE]=$i(sE),[R3,Om]=b3(sE),P3=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:l,...s}=e,[a=!1,u]=Pl({prop:r,defaultProp:o,onChange:l});return p.createElement(R3,{scope:n,disabled:i,contentId:wd(),open:a,onOpenToggle:p.useCallback(()=>u(c=>!c),[u])},p.createElement(De.div,ee({"data-state":Am(a),"data-disabled":i?"":void 0},s,{ref:t})))}),O3="CollapsibleTrigger",A3=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Om(O3,n);return p.createElement(De.button,ee({type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Am(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled},r,{ref:t,onClick:He(e.onClick,o.onOpenToggle)}))}),uE="CollapsibleContent",M3=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Om(uE,e.__scopeCollapsible);return p.createElement(Il,{present:n||o.open},({present:i})=>p.createElement(D3,ee({},r,{ref:t,present:i})))}),D3=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,l=Om(uE,n),[s,a]=p.useState(r),u=p.useRef(null),c=Xe(t,u),d=p.useRef(0),f=d.current,h=p.useRef(0),g=h.current,m=l.open||s,S=p.useRef(m),v=p.useRef();return p.useEffect(()=>{const y=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(y)},[]),$n(()=>{const y=u.current;if(y){v.current=v.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const _=y.getBoundingClientRect();d.current=_.height,h.current=_.width,S.current||(y.style.transitionDuration=v.current.transitionDuration,y.style.animationName=v.current.animationName),a(r)}},[l.open,r]),p.createElement(De.div,ee({"data-state":Am(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!m},i,{ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style}}),m&&o)});function Am(e){return e?"open":"closed"}const L3=P3,I3=A3,j3=M3,Bo="Accordion",z3=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Mm,F3,B3]=HS(Bo),[Od,S4]=$i(Bo,[B3,aE]),Dm=aE(),cE=q.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return q.createElement(Mm.Provider,{scope:e.__scopeAccordion},n==="multiple"?q.createElement(H3,ee({},i,{ref:t})):q.createElement(V3,ee({},o,{ref:t})))});cE.propTypes={type(e){const t=e.value||e.defaultValue;return e.type&&!["single","multiple"].includes(e.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):e.type==="multiple"&&typeof t=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):e.type==="single"&&Array.isArray(t)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[dE,W3]=Od(Bo),[fE,U3]=Od(Bo,{collapsible:!1}),V3=q.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...l}=e,[s,a]=Pl({prop:n,defaultProp:r,onChange:o});return q.createElement(dE,{scope:e.__scopeAccordion,value:s?[s]:[],onItemOpen:a,onItemClose:q.useCallback(()=>i&&a(""),[i,a])},q.createElement(fE,{scope:e.__scopeAccordion,collapsible:i},q.createElement(hE,ee({},l,{ref:t}))))}),H3=q.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l=[],s]=Pl({prop:n,defaultProp:r,onChange:o}),a=q.useCallback(c=>s((d=[])=>[...d,c]),[s]),u=q.useCallback(c=>s((d=[])=>d.filter(f=>f!==c)),[s]);return q.createElement(dE,{scope:e.__scopeAccordion,value:l,onItemOpen:a,onItemClose:u},q.createElement(fE,{scope:e.__scopeAccordion,collapsible:!0},q.createElement(hE,ee({},i,{ref:t}))))}),[K3,Ad]=Od(Bo),hE=q.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...l}=e,s=q.useRef(null),a=Xe(s,t),u=F3(n),d=bg(o)==="ltr",f=He(e.onKeyDown,h=>{var g;if(!z3.includes(h.key))return;const m=h.target,S=u().filter(M=>{var R;return!((R=M.ref.current)!==null&&R!==void 0&&R.disabled)}),v=S.findIndex(M=>M.ref.current===m),y=S.length;if(v===-1)return;h.preventDefault();let _=v;const w=0,C=y-1,$=()=>{_=v+1,_>C&&(_=w)},E=()=>{_=v-1,_<w&&(_=C)};switch(h.key){case"Home":_=w;break;case"End":_=C;break;case"ArrowRight":i==="horizontal"&&(d?$():E());break;case"ArrowDown":i==="vertical"&&$();break;case"ArrowLeft":i==="horizontal"&&(d?E():$());break;case"ArrowUp":i==="vertical"&&E();break}const T=_%y;(g=S[T].ref.current)===null||g===void 0||g.focus()});return q.createElement(K3,{scope:n,disabled:r,direction:o,orientation:i},q.createElement(Mm.Slot,{scope:n},q.createElement(De.div,ee({},l,{"data-orientation":i,ref:a,onKeyDown:r?void 0:f}))))}),bp="AccordionItem",[G3,Lm]=Od(bp),Y3=q.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=Ad(bp,n),l=W3(bp,n),s=Dm(n),a=wd(),u=r&&l.value.includes(r)||!1,c=i.disabled||e.disabled;return q.createElement(G3,{scope:n,open:u,disabled:c,triggerId:a},q.createElement(L3,ee({"data-orientation":i.orientation,"data-state":pE(u)},s,o,{ref:t,disabled:c,open:u,onOpenChange:d=>{d?l.onItemOpen(r):l.onItemClose(r)}})))}),X3="AccordionHeader",Q3=q.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Ad(Bo,n),i=Lm(X3,n);return q.createElement(De.h3,ee({"data-orientation":o.orientation,"data-state":pE(i.open),"data-disabled":i.disabled?"":void 0},r,{ref:t}))}),U0="AccordionTrigger",J3=q.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Ad(Bo,n),i=Lm(U0,n),l=U3(U0,n),s=Dm(n);return q.createElement(Mm.ItemSlot,{scope:n},q.createElement(I3,ee({"aria-disabled":i.open&&!l.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId},s,r,{ref:t})))}),Z3="AccordionContent",q3=q.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Ad(Bo,n),i=Lm(Z3,n),l=Dm(n);return q.createElement(j3,ee({role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation},l,r,{ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}}))});function pE(e){return e?"open":"closed"}const e4=cE,t4=Y3,n4=Q3,gE=J3,mE=q3,r4=e4,vE=p.forwardRef(({className:e,...t},n)=>x.jsx(t4,{ref:n,className:ot("border-b",e),...t}));vE.displayName="AccordionItem";const yE=p.forwardRef(({className:e,children:t,...n},r)=>x.jsx(n4,{className:"flex",children:x.jsxs(gE,{ref:r,className:ot("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,x.jsx(FS,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));yE.displayName=gE.displayName;const xE=p.forwardRef(({className:e,children:t,...n},r)=>x.jsx(mE,{ref:r,className:ot("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:x.jsx("div",{className:"pt-0 pb-4",children:t})}));xE.displayName=mE.displayName;/**
189
189
  * React Router DOM v6.18.0
190
190
  *
191
191
  * Copyright (c) Remix Software Inc.
@@ -194,4 +194,4 @@ Showing stack trace of: 0. ${d[0].message}`,E=new Error($);throw E.stack=d[0].st
194
194
  * LICENSE.md file in the root directory of this source tree.
195
195
  *
196
196
  * @license MIT
197
- */function Bc(){return Bc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bc.apply(this,arguments)}function o4(e,t){return FM({basename:t==null?void 0:t.basename,future:Bc({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:aM({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||i4(),routes:e,mapRouteProperties:h3,window:t==null?void 0:t.window}).initialize()}function i4(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Bc({},t,{errors:l4(t.errors)})),t}function l4(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Nm(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let i=window[o.__subType];if(typeof i=="function")try{let l=new i(o.message);l.stack="",n[r]=l}catch{}}if(n[r]==null){let i=new Error(o.message);i.stack="",n[r]=i}}else n[r]=o;return n}const s4=p.createContext({isTransitioning:!1}),a4=p.createContext(new Map),u4="startTransition",V0=t1[u4];function c4(e){V0?V0(e):e()}class d4{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function f4(e){let{fallbackElement:t,router:n,future:r}=e,[o,i]=p.useState(n.state),[l,s]=p.useState(),[a,u]=p.useState({isTransitioning:!1}),[c,d]=p.useState(),[f,h]=p.useState(),[g,m]=p.useState(),S=p.useRef(new Map),{v7_startTransition:v}=r||{},y=p.useCallback(E=>{v?c4(E):E()},[v]),_=p.useCallback((E,T)=>{let{deletedFetchers:M,unstable_viewTransitionOpts:R}=T;M.forEach(j=>S.current.delete(j)),E.fetchers.forEach((j,F)=>{j.data!==void 0&&S.current.set(F,j.data)}),!R||n.window==null||typeof n.window.document.startViewTransition!="function"?y(()=>i(E)):f&&c?(c.resolve(),f.skipTransition(),m({state:E,currentLocation:R.currentLocation,nextLocation:R.nextLocation})):(s(E),u({isTransitioning:!0,currentLocation:R.currentLocation,nextLocation:R.nextLocation}))},[n.window,f,c,S,y]);p.useLayoutEffect(()=>n.subscribe(_),[n,_]),p.useEffect(()=>{a.isTransitioning&&d(new d4)},[a.isTransitioning]),p.useEffect(()=>{if(c&&l&&n.window){let E=l,T=c.promise,M=n.window.document.startViewTransition(async()=>{y(()=>i(E)),await T});M.finished.finally(()=>{d(void 0),h(void 0),s(void 0),u({isTransitioning:!1})}),h(M)}},[y,l,c,n.window]),p.useEffect(()=>{c&&l&&o.location.key===l.location.key&&c.resolve()},[c,f,o.location,l]),p.useEffect(()=>{!a.isTransitioning&&g&&(s(g.state),u({isTransitioning:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),m(void 0))},[a.isTransitioning,g]);let w=p.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:E=>n.navigate(E),push:(E,T,M)=>n.navigate(E,{state:T,preventScrollReset:M==null?void 0:M.preventScrollReset}),replace:(E,T,M)=>n.navigate(E,{replace:!0,state:T,preventScrollReset:M==null?void 0:M.preventScrollReset})}),[n]),C=n.basename||"/",$=p.useMemo(()=>({router:n,navigator:w,static:!1,basename:C}),[n,w,C]);return p.createElement(p.Fragment,null,p.createElement(Nd.Provider,{value:$},p.createElement(XC.Provider,{value:o},p.createElement(a4.Provider,{value:S.current},p.createElement(s4.Provider,{value:a},p.createElement(f3,{basename:C,location:o.location,navigationType:o.historyAction,navigator:w},o.initialized?p.createElement(h4,{routes:n.routes,state:o}):t))))),null)}function h4(e){let{routes:t,state:n}=e;return t3(t,void 0,n)}var H0;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(H0||(H0={}));var K0;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(K0||(K0={}));function p4({error:e,resetErrorBoundary:t}){return console.error(e),x.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center w-screen h-screen bg-card-foreground",children:x.jsx("div",{className:"w-full h-full p-10",children:x.jsxs("div",{className:"w-full h-full p-10 bg-card text-primary",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[x.jsx(DC,{})," encountered an error"]}),x.jsx("button",{onClick:t,children:x.jsx(RP,{})})]}),x.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),x.jsx("pre",{children:e.message}),e.stack&&x.jsx(r4,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:x.jsxs(vE,{value:"error",children:[x.jsx(yE,{children:"Stack trace:"}),x.jsx(xE,{className:"p-4 bg-popover text-popover-foreground",children:e.stack&&x.jsx("pre",{children:e.stack})})]})})]})})})}function g4(){const e=o4([{path:"/*",element:x.jsx(T3,{fallbackRender:p4,children:x.jsx(g3,{valApi:new UT("/api/val")})})}],{basename:"/api/val/static/edit"});return x.jsx(f4,{router:e})}Df.createRoot(document.getElementById("root")).render(q.createElement(q.StrictMode,null,q.createElement(g4,null)));
197
+ */function Bc(){return Bc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bc.apply(this,arguments)}function o4(e,t){return FM({basename:t==null?void 0:t.basename,future:Bc({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:aM({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||i4(),routes:e,mapRouteProperties:h3,window:t==null?void 0:t.window}).initialize()}function i4(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Bc({},t,{errors:l4(t.errors)})),t}function l4(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Nm(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let i=window[o.__subType];if(typeof i=="function")try{let l=new i(o.message);l.stack="",n[r]=l}catch{}}if(n[r]==null){let i=new Error(o.message);i.stack="",n[r]=i}}else n[r]=o;return n}const s4=p.createContext({isTransitioning:!1}),a4=p.createContext(new Map),u4="startTransition",V0=t1[u4];function c4(e){V0?V0(e):e()}class d4{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function f4(e){let{fallbackElement:t,router:n,future:r}=e,[o,i]=p.useState(n.state),[l,s]=p.useState(),[a,u]=p.useState({isTransitioning:!1}),[c,d]=p.useState(),[f,h]=p.useState(),[g,m]=p.useState(),S=p.useRef(new Map),{v7_startTransition:v}=r||{},y=p.useCallback(E=>{v?c4(E):E()},[v]),_=p.useCallback((E,T)=>{let{deletedFetchers:M,unstable_viewTransitionOpts:R}=T;M.forEach(j=>S.current.delete(j)),E.fetchers.forEach((j,F)=>{j.data!==void 0&&S.current.set(F,j.data)}),!R||n.window==null||typeof n.window.document.startViewTransition!="function"?y(()=>i(E)):f&&c?(c.resolve(),f.skipTransition(),m({state:E,currentLocation:R.currentLocation,nextLocation:R.nextLocation})):(s(E),u({isTransitioning:!0,currentLocation:R.currentLocation,nextLocation:R.nextLocation}))},[n.window,f,c,S,y]);p.useLayoutEffect(()=>n.subscribe(_),[n,_]),p.useEffect(()=>{a.isTransitioning&&d(new d4)},[a.isTransitioning]),p.useEffect(()=>{if(c&&l&&n.window){let E=l,T=c.promise,M=n.window.document.startViewTransition(async()=>{y(()=>i(E)),await T});M.finished.finally(()=>{d(void 0),h(void 0),s(void 0),u({isTransitioning:!1})}),h(M)}},[y,l,c,n.window]),p.useEffect(()=>{c&&l&&o.location.key===l.location.key&&c.resolve()},[c,f,o.location,l]),p.useEffect(()=>{!a.isTransitioning&&g&&(s(g.state),u({isTransitioning:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),m(void 0))},[a.isTransitioning,g]);let w=p.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:E=>n.navigate(E),push:(E,T,M)=>n.navigate(E,{state:T,preventScrollReset:M==null?void 0:M.preventScrollReset}),replace:(E,T,M)=>n.navigate(E,{replace:!0,state:T,preventScrollReset:M==null?void 0:M.preventScrollReset})}),[n]),C=n.basename||"/",$=p.useMemo(()=>({router:n,navigator:w,static:!1,basename:C}),[n,w,C]);return p.createElement(p.Fragment,null,p.createElement(Nd.Provider,{value:$},p.createElement(XC.Provider,{value:o},p.createElement(a4.Provider,{value:S.current},p.createElement(s4.Provider,{value:a},p.createElement(f3,{basename:C,location:o.location,navigationType:o.historyAction,navigator:w},o.initialized?p.createElement(h4,{routes:n.routes,state:o}):t))))),null)}function h4(e){let{routes:t,state:n}=e;return t3(t,void 0,n)}var H0;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(H0||(H0={}));var K0;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(K0||(K0={}));function p4({error:e,resetErrorBoundary:t}){return console.error(e),x.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center w-screen h-screen bg-card-foreground",children:x.jsx("div",{className:"w-full h-full p-10",children:x.jsxs("div",{className:"w-full h-full p-10 bg-card text-primary",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[x.jsx(DC,{})," encountered an error"]}),x.jsx("button",{onClick:t,children:x.jsx(FP,{})})]}),x.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),x.jsx("pre",{children:e.message}),e.stack&&x.jsx(r4,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:x.jsxs(vE,{value:"error",children:[x.jsx(yE,{children:"Stack trace:"}),x.jsx(xE,{className:"p-4 bg-popover text-popover-foreground",children:e.stack&&x.jsx("pre",{children:e.stack})})]})})]})})})}function g4(){const e=o4([{path:"/*",element:x.jsx(T3,{fallbackRender:p4,children:x.jsx(g3,{valApi:new UT("/api/val")})})}],{basename:"/api/val/static/edit"});return x.jsx(f4,{router:e})}Df.createRoot(document.getElementById("root")).render(q.createElement(q.StrictMode,null,q.createElement(g4,null)));