@valbuild/ui 0.41.0 → 0.42.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.
@@ -126,7 +126,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
126
126
 
127
127
  `),o=s.length,!ie.$isTextNode(r)||n>=o)s=r.getParent(),r.remove(),s==null||s.getChildrenSize()!==0||ie.$isRootNode(s)||s.remove(),n-=o+l,r=i;else{let a=r.getKey();l=e.getEditorState().read(()=>{const c=ie.$getNodeByKey(a);return ie.$isTextNode(c)&&c.isSimpleText()?c.getTextContent():null}),i=o-n;let u=s.slice(0,i);l!==null&&l!==s?(n=ie.$getPreviousSelection(),o=r,r.isSimpleText()?r.setTextContent(l):(o=ie.$createTextNode(l),r.replace(o)),ie.$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=ie.$createTextNode(u),r.replace(n)),n=0}}};const mR=Ot;var zo=mR,vR=zo,ht=he;function yR(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 TS(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function NS(e,t){for(;e!==ht.$getRoot()&&e!=null;){if(t(e))return e;e=e.getParent()}return null}vt.$splitNode=ht.$splitNode;vt.isHTMLAnchorElement=ht.isHTMLAnchorElement;vt.isHTMLElement=ht.isHTMLElement;vt.$dfs=function(e,t){let n=[];e=(e||ht.$getRoot()).getLatest(),t=t||(ht.$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}),ht.$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};vt.$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};vt.$findMatchingParent=NS;vt.$getNearestBlockElementAncestorOrThrow=function(e){let t=NS(e,n=>ht.$isElementNode(n)&&!n.isInline());return ht.$isElementNode(t)||yR(4,e.__key),t};vt.$getNearestNodeOfType=function(e,t){for(;e!=null;){if(e instanceof t)return e;e=e.getParent()}return null};vt.$insertFirst=function(e,t){let n=e.getFirstChild();n!==null?n.insertBefore(t):e.append(t)};vt.$insertNodeToNearestRoot=function(e){var t=ht.$getSelection()||ht.$getPreviousSelection();if(ht.$isRangeSelection(t)){var{focus:n}=t;if(t=n.getNode(),n=n.offset,ht.$isRootOrShadowRoot(t))n=t.getChildAtIndex(n),n==null?t.append(e):n.insertBefore(e),e.selectNext();else{let r,o;ht.$isTextNode(t)?(r=t.getParentOrThrow(),o=t.getIndexWithinParent(),0<n&&(o+=1,t.splitText(n))):(r=t,o=n),[,t]=ht.$splitNode(r,o),t.insertBefore(e),t.selectStart()}}else ht.$isNodeSelection(t)||ht.DEPRECATED_$isGridSelection(t)?(t=t.getNodes(),t[t.length-1].getTopLevelElementOrThrow().insertAfter(e)):ht.$getRoot().append(e),t=ht.$createParagraphNode(),e.insertAfter(t),t.select();return e.getLatest()};vt.$restoreEditorState=function(e,t){let n=new Map,r=e._pendingEditorState;for(let[o,i]of t._nodeMap){let l=vR.$cloneWithProperties(i);ht.$isTextNode(l)&&(l.__text=i.__text),n.set(o,l)}r&&(r._nodeMap=n),e._dirtyType=2,e=t._selection,ht.$setSelection(e===null?null:e.clone())};vt.$wrapNodeInElement=function(e,t){return t=t(),e.replace(t),t.append(e),t};vt.addClassNamesToElement=function(e,...t){t.forEach(n=>{typeof n=="string"&&(n=n.split(" ").filter(r=>r!==""),e.classList.add(...n))})};vt.isMimeType=TS;vt.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()}),TS(a,t)?u.readAsDataURL(a):l()};l()})};vt.mergeRegister=function(...e){return()=>{e.forEach(t=>t())}};vt.objectKlassEquals=function(e,t){return e!==null?Object.getPrototypeOf(e).constructor.name===t.name:!1};vt.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()}}})};vt.removeClassNamesFromElement=function(e,...t){t.forEach(n=>{typeof n=="string"&&e.classList.remove(...n.split(" "))})};const xR=vt;var Rt=xR,Pe=he,Fo=Rt;function Al(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 RS(e){let t=1;for(e=e.getParent();e!=null;){if(nt(e)){if(e=e.getParent(),we(e)){t++,e=e.getParent();continue}Al(40)}break}return t}function Sp(e){e=e.getParent(),we(e)||Al(40);let t=e;for(;t!==null;)t=t.getParent(),we(t)&&(e=t);return e}function PS(e){let t=[];e=e.getChildren().filter(nt);for(let n=0;n<e.length;n++){let r=e[n],o=r.getFirstChild();we(o)?t=t.concat(PS(o)):t.push(r)}return t}function mr(e){return nt(e)&&we(e.getFirstChild())}function wR(e){for(;e.getNextSibling()==null&&e.getPreviousSibling()==null;){let t=e.getParent();if(t==null||!nt(e)&&!we(e))break;e=t}e.remove()}function e0(e){return kn().append(e)}function OS(e,t){return nt(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function _i(e,t){e.splice(e.getChildrenSize(),0,t)}function t0(e,t){if(we(e))return e;let n=e.getPreviousSibling(),r=e.getNextSibling(),o=kn();return o.setFormat(e.getFormatType()),o.setIndent(e.getIndent()),_i(o,e.getChildren()),we(n)&&t===n.getListType()?(n.append(o),e.remove(),we(r)&&t===r.getListType()&&(_i(n,r.getChildren()),r.remove()),n):we(r)&&t===r.getListType()?(r.getFirstChildOrThrow().insertBefore(o),e.remove(),r):(t=on(t),t.append(o),e.replace(t),Zt(t),t)}function AS(e,t){var n=e.getLastChild();let r=t.getFirstChild();n&&r&&mr(n)&&mr(r)&&(AS(n.getFirstChild(),r.getFirstChild()),r.remove()),n=t.getChildren(),0<n.length&&(e.append(...n),Zt(e)),t.remove()}function Zt(e,t){if(e=t||e.getChildren(),e!==void 0)for(t=0;t<e.length;t++){let i=e[t];if(nt(i)){let l=i.getValue();var n=i,r=n.getParent(),o=1;for(r!=null&&(we(r)?o=r.getStart():Al(44)),n=n.getPreviousSiblings(),r=0;r<n.length;r++){let s=n[r];nt(s)&&!we(s.getFirstChild())&&o++}l!==o&&i.setValue(o)}}}function _R(e){if(!mr(e)){var t=e.getParent(),n=t?t.getParent():void 0,r=n?n.getParent():void 0;if(we(r)&&nt(n)&&we(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=kn();let s=on(l);o.append(s),e.getPreviousSiblings().forEach(a=>s.append(a)),i=kn(),l=on(l),i.append(l),_i(l,e.getNextSiblings()),n.insertBefore(o),n.insertAfter(i),n.replace(e)}Zt(t),Zt(r)}}}let Pd=class MS extends Pe.ElementNode{static getType(){return"listitem"}static clone(t){return new MS(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 we(r)&&r.getListType()==="check"&&r0(n,this,null),n.value=this.__value,n0(n,t.theme,this),n}updateDOM(t,n,r){let o=this.getParent();return we(o)&&o.getListType()==="check"&&r0(n,this,t),n.value=this.__value,n0(n,r.theme,this),!1}static transform(){return t=>{let n=t.getParent();we(n)&&(Zt(n),n.getListType()!=="check"&&t.getChecked()!=null&&t.setChecked(void 0))}}static importDOM(){return{li:()=>({conversion:SR,priority:0})}}static importJSON(t){let n=kn();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(Pe.$isElementNode(r)&&this.canMergeWith(r)){let o=r.getChildren();this.append(...o),r.remove()}else super.append(r)}return this}replace(t,n){if(nt(t))return super.replace(t);this.setIndent(0);let r=this.getParentOrThrow();if(!we(r))return t;if(r.__first===this.getKey())r.insertBefore(t);else if(r.__last===this.getKey())r.insertAfter(t);else{let o=on(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();we(r)||Al(39);var o=this.getNextSiblings();if(nt(t))return n=super.insertAfter(t,n),t=t.getParentOrThrow(),we(t)&&Zt(t),n;if(we(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=on(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&&mr(n)&&mr(r)?(AS(n.getFirstChild(),r.getFirstChild()),r.remove()):r&&(t=r.getParent(),we(t)&&Zt(t))}insertNewAfter(t,n=!0){return t=kn(this.__checked==null?void 0:!1),this.insertAfter(t,n),t}collapseAtStart(t){let n=Pe.$createParagraphNode();this.getChildren().forEach(l=>n.append(l));var r=this.getParentOrThrow(),o=r.getParentOrThrow();let i=nt(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(;nt(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(t){typeof t=="number"&&-1<t||Al(117);let n=this.getIndent();for(;n!==t;)if(n<t){e:{var r=new Set;if(mr(this)||r.has(this.getKey()))break e;let s=this.getParent();var o=this.getNextSibling(),i=this.getPreviousSibling();if(mr(o)&&mr(i)){if(i=i.getFirstChild(),we(i)){i.append(this);var l=o.getFirstChild();we(l)&&(l=l.getChildren(),_i(i,l),o.remove(),r.add(o.getKey())),Zt(i)}}else mr(o)?(o=o.getFirstChild(),we(o)&&(r=o.getFirstChild(),r!==null&&r.insertBefore(this),Zt(o))):mr(i)?(o=i.getFirstChild(),we(o)&&(o.append(this),Zt(o))):we(s)&&(r=kn(),l=on(s.getListType()),r.append(l),l.append(this),i?i.insertAfter(r):o?o.insertBefore(r):s.append(r),Zt(l));we(s)&&Zt(s)}n++}else _R(this),n--;return this}insertBefore(t){if(nt(t)){let n=this.getParentOrThrow();if(we(n)){let r=this.getNextSiblings();Zt(n,r)}}return super.insertBefore(t)}canInsertAfter(t){return nt(t)}canReplaceWith(t){return nt(t)}canMergeWith(t){return Pe.$isParagraphNode(t)||nt(t)}extractWithChild(t,n){if(!Pe.$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 on("bullet")}};function n0(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=we(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=>we(s))?r.push(...l):o.push(...l)),0<o.length&&Fo.removeClassNamesFromElement(e,...o),0<r.length&&Fo.addClassNamesToElement(e,...r)}function r0(e,t,n){we(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 SR(e){return e=Fo.isHTMLElement(e)&&e.getAttribute("aria-checked")==="true",{node:kn(e)}}function kn(e){return Pe.$applyNodeReplacement(new Pd(void 0,e))}function nt(e){return e instanceof Pd}let ym=class LS extends Pe.ElementNode{static getType(){return"list"}static clone(t){return new LS(t.__listType||l0[t.__tag],t.__start,t.__key)}constructor(t,n,r){super(r),this.__listType=t=l0[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,o0(n,t.theme,this),n}updateDOM(t,n,r){return t.__tag!==this.__tag?!0:(o0(n,r.theme,this),!1)}static importDOM(){return{ol:()=>({conversion:i0,priority:0}),ul:()=>({conversion:i0,priority:0})}}static importJSON(t){let n=on(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&&Fo.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(nt(n))super.append(n);else{let o=kn();we(n)||Pe.$isElementNode(n)&&(n=Pe.$createTextNode(n.getTextContent())),o.append(n),super.append(o)}}return Zt(this),this}extractWithChild(t){return nt(t)}};function o0(e,t,n){let r=[],o=[];var i=t.list;if(i!==void 0){let s=i[`${n.__tag}Depth`]||[];t=RS(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&&Fo.removeClassNamesFromElement(e,...o),0<r.length&&Fo.addClassNamesToElement(e,...r)}function ER(e){let t=[];for(let r=0;r<e.length;r++){var n=e[r];nt(n)?(t.push(n),n=n.getChildren(),1<n.length&&n.forEach(o=>{we(o)&&t.push(e0(o))})):t.push(e0(n))}return t}function i0(e){let t=e.nodeName.toLowerCase(),n=null;return t==="ol"?n=on("number",e.start):t==="ul"&&(n=Fo.isHTMLElement(e)&&e.getAttribute("__lexicallisttype")==="check"?on("check"):on("bullet")),{after:ER,node:n}}let l0={ol:"number",ul:"bullet"};function on(e,t=1){return Pe.$applyNodeReplacement(new ym(e,t))}function we(e){return e instanceof ym}let CR=Pe.createCommand("INSERT_UNORDERED_LIST_COMMAND"),$R=Pe.createCommand("INSERT_ORDERED_LIST_COMMAND"),kR=Pe.createCommand("INSERT_CHECK_LIST_COMMAND"),bR=Pe.createCommand("REMOVE_LIST_COMMAND");un.$createListItemNode=kn;un.$createListNode=on;un.$getListDepth=RS;un.$handleListInsertParagraph=function(){var e=Pe.$getSelection();if(!Pe.$isRangeSelection(e)||!e.isCollapsed()||(e=e.anchor.getNode(),!nt(e)||e.getChildrenSize()!==0))return!1;var t=Sp(e),n=e.getParent();we(n)||Al(40);let r=n.getParent(),o;if(Pe.$isRootOrShadowRoot(r))o=Pe.$createParagraphNode(),t.insertAfter(o);else if(nt(r))o=kn(),r.insertAfter(o);else return!1;if(o.select(),t=e.getNextSiblings(),0<t.length){let i=on(n.getListType());Pe.$isParagraphNode(o)?o.insertAfter(i):(n=kn(),n.append(i),o.insertAfter(n)),t.forEach(l=>{l.remove(),i.append(l)})}return wR(e),!0};un.$isListItemNode=nt;un.$isListNode=we;un.INSERT_CHECK_LIST_COMMAND=kR;un.INSERT_ORDERED_LIST_COMMAND=$R;un.INSERT_UNORDERED_LIST_COMMAND=CR;un.ListItemNode=Pd;un.ListNode=ym;un.REMOVE_LIST_COMMAND=bR;un.insertList=function(e,t){e.update(()=>{var n=Pe.$getSelection();if(Pe.$isRangeSelection(n)||Pe.DEPRECATED_$isGridSelection(n)){var r=n.getNodes();n=n.anchor.getNode();var o=n.getParent();if(OS(n,r))r=on(t),Pe.$isRootOrShadowRoot(o)?(n.replace(r),o=kn(),Pe.$isElementNode(n)&&(o.setFormat(n.getFormatType()),o.setIndent(n.getIndent())),r.append(o)):nt(n)&&(n=n.getParentOrThrow(),_i(r,n.getChildren()),n.replace(r));else for(n=new Set,o=0;o<r.length;o++){var i=r[o];if(Pe.$isElementNode(i)&&i.isEmpty()&&!n.has(i.getKey()))t0(i,t);else if(Pe.$isLeafNode(i))for(i=i.getParent();i!=null;){let s=i.getKey();if(we(i)){if(!n.has(s)){var l=on(t);_i(l,i.getChildren()),i.replace(l),Zt(l),n.add(s)}break}else{if(l=i.getParent(),Pe.$isRootOrShadowRoot(l)&&!n.has(s)){n.add(s),t0(i,t);break}i=l}}}}})};un.removeList=function(e){e.update(()=>{let t=Pe.$getSelection();if(Pe.$isRangeSelection(t)){var n=new Set,r=t.getNodes(),o=t.anchor.getNode();if(OS(o,r))n.add(Sp(o));else for(o=0;o<r.length;o++){var i=r[o];Pe.$isLeafNode(i)&&(i=Fo.$getNearestNodeOfType(i,Pd),i!=null&&n.add(Sp(i)))}for(let l of n){n=l,r=PS(l);for(let s of r)r=Pe.$createParagraphNode(),_i(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 TR=un;var yo=TR,DS={},Od={},IS=p;function NR(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 jS=IS.createContext(null);Od.LexicalComposerContext=jS;Od.createLexicalComposerContext=function(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}};Od.useLexicalComposerContext=function(){let e=IS.useContext(jS);return e==null&&NR(8),e};const RR=Od;var dr=RR,s0=dr,Ns=he,Vc=p;let zS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var PR=zS?Vc.useLayoutEffect:Vc.useEffect;let $u={tag:"history-merge"};function OR(e,t){if(t!==null){if(t===void 0)e.update(()=>{var n=Ns.$getRoot();if(n.isEmpty()){let r=Ns.$createParagraphNode();n.append(r),n=zS?document.activeElement:null,(Ns.$getSelection()!==null||n!==null&&n===e.getRootElement())&&r.select()}},$u);else if(t!==null)switch(typeof t){case"string":let n=e.parseEditorState(t);e.setEditorState(n,$u);break;case"object":e.setEditorState(t,$u);break;case"function":e.update(()=>{Ns.$getRoot().isEmpty()&&t(e)},$u)}}}DS.LexicalComposer=function({initialConfig:e,children:t}){let n=Vc.useMemo(()=>{const{theme:r,namespace:o,editor__DEPRECATED:i,nodes:l,onError:s,editorState:a}=e,u=s0.createLexicalComposerContext(null,r);let c=i||null;if(c===null){const d=Ns.createEditor({editable:e.editable,namespace:o,nodes:l,onError:f=>s(f,d),theme:r});OR(d,a),c=d}return[c,u]},[]);return PR(()=>{let r=e.editable,[o]=n;o.setEditable(r!==void 0?r:!0)},[]),Vc.createElement(s0.LexicalComposerContext.Provider,{value:n},t)};const AR=DS;var MR=AR,Xs=p;function Ep(e,t){return Ep=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ep(e,t)}function LR(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ep(e,t)}function DR(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 a0={error:null},IR=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=a0,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}LR(t,e),t.getDerivedStateFromError=function(r){return{error:r}};var n=t.prototype;return n.reset=function(){this.setState(a0)},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&&DR(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},Xs.isValidElement(o))return o;if(typeof i=="function")return i(r);if(l)return Xs.createElement(l,r);throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},t}(Xs.Component),jR=function({children:e,onError:t}){return Xs.createElement(IR,{fallback:Xs.createElement("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"}},"An error was thrown."),onError:t},e)};const zR=jR;var FR=zR;const BR=La(FR);var xm={},wm={},WR=Rt,Fe=he;function UR(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(!(Fe.$isRangeSelection(i)&&Fe.$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||Fe.$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)&&Fe.$isTextNode(t)&&t.__text.length===1&&i.anchor.offset===1?2:0):(t=s[0],e=e._nodeMap.get(t.__key),!Fe.$isTextNode(e)||!Fe.$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 HR(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=UR(o,i,s,a,e.isComposing()),f=(()=>{var h=l===null||l.editor===e,m=u.has("history-push");if(!m&&h&&u.has("history-merge"))return 0;if(o===null)return 1;var g=i._selection;if(!(0<s.size||0<a.size))return g!==null?0:2;if(m===!1&&d!==0&&d===r&&c<n+t&&h)return 0;if(s.size===1){{m=Array.from(s)[0],h=o._nodeMap.get(m),m=i._nodeMap.get(m),g=o._selection;let _=i._selection,v=!1;Fe.$isRangeSelection(g)&&Fe.$isRangeSelection(_)&&(v=g.anchor.type==="element"&&g.focus.type==="element"&&_.anchor.type==="text"&&_.focus.type==="text"),h=!v&&Fe.$isTextNode(h)&&Fe.$isTextNode(m)?h.__type===m.__type&&h.__text===m.__text&&h.__mode===m.__mode&&h.__detail===m.__detail&&h.__style===m.__style&&h.__format===m.__format&&h.__parent===m.__parent:!1}if(h)return 0}return 1})();return n=c,r=d,f}}wm.createEmptyHistoryState=function(){return{current:null,redoStack:[],undoStack:[]}};wm.registerHistory=function(e,t,n){let r=HR(e,n);n=({editorState:l,prevEditorState:s,dirtyLeaves:a,dirtyElements:u,tags:c})=>{const d=t.current,f=t.redoStack,h=t.undoStack,m=d===null?null:d.editorState;if(d===null||l!==m){if(s=r(s,l,d,a,u,c),s===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(Fe.CAN_REDO_COMMAND,!1)),d!==null&&(h.push({...d}),e.dispatchCommand(Fe.CAN_UNDO_COMMAND,!0));else if(s===2)return;t.current={editor:e,editorState:l}}};let o=WR.mergeRegister(e.registerCommand(Fe.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(Fe.CAN_REDO_COMMAND,!0)),s.length===0&&e.dispatchCommand(Fe.CAN_UNDO_COMMAND,!1),t.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:"historic"})}return!0},Fe.COMMAND_PRIORITY_EDITOR),e.registerCommand(Fe.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(Fe.CAN_UNDO_COMMAND,!0)),s=l.pop(),l.length===0&&e.dispatchCommand(Fe.CAN_REDO_COMMAND,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}return!0},Fe.COMMAND_PRIORITY_EDITOR),e.registerCommand(Fe.CLEAR_EDITOR_COMMAND,()=>(t.undoStack=[],t.redoStack=[],t.current=null,!1),Fe.COMMAND_PRIORITY_EDITOR),e.registerCommand(Fe.CLEAR_HISTORY_COMMAND,()=>(t.undoStack=[],t.redoStack=[],t.current=null,e.dispatchCommand(Fe.CAN_REDO_COMMAND,!1),e.dispatchCommand(Fe.CAN_UNDO_COMMAND,!1),!0),Fe.COMMAND_PRIORITY_EDITOR),e.registerUpdateListener(n)),i=e.registerUpdateListener(n);return()=>{o(),i()}};const VR=wm;var KR=VR,GR=dr,Cp=KR,u0=p;function YR(e,t,n=1e3){let r=u0.useMemo(()=>t||Cp.createEmptyHistoryState(),[t]);u0.useEffect(()=>Cp.registerHistory(e,r,n),[n,e,r])}xm.createEmptyHistoryState=Cp.createEmptyHistoryState;xm.HistoryPlugin=function({externalHistoryState:e}){let[t]=GR.useLexicalComposerContext();return YR(t,e),null};const XR=xm;var QR=XR,FS={},JR=dr,Qs=p,ZR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Qs.useLayoutEffect:Qs.useEffect;function qR(e){let[t]=JR.useLexicalComposerContext(),n=Qs.useMemo(()=>e(t),[t,e]),r=Qs.useRef(n.initialValueFn()),[o,i]=Qs.useState(r.current);return ZR(()=>{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 eP(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}var tP=function(){return qR(eP)};const nP=tP;var rP=nP,Go={},qt=he;function _m(e,t=!0){return e?!1:(e=BS(),t&&(e=e.trim()),e==="")}function BS(){return qt.$getRoot().getTextContent()}function WS(e){if(!_m(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}Go.$canShowPlaceholder=WS;Go.$canShowPlaceholderCurry=function(e){return()=>WS(e)};Go.$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};Go.$isRootTextContentEmpty=_m;Go.$isRootTextContentEmptyCurry=function(e,t){return()=>_m(e,t)};Go.$rootTextContent=BS;Go.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 oP=Go;var iP=oP,US={},ku=he;US.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=ku.$getSelection();if(ku.$isRangeSelection(d)){var f=d.anchor;let h=f.getNode(),m=0,g=0;ku.$isTextNode(h)&&0<=l&&0<=s&&(m=l,g=l+s,d.setTextNodeRange(h,m,h,g)),(m!==g||a!=="")&&(d.insertRawText(a),h=f.getNode()),ku.$isTextNode(h)&&(m=u,g=u+c,f=h.getTextContentSize(),m=m>f?f:m,g=g>f?f:g,d.setTextNodeRange(h,m,h,g)),r.stopImmediatePropagation()}})}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}};const lP=US;var sP=lP,Ar={},to={},Sm={},c0=zo,aP=Rt,al=he;function HS(e,t,n,r=null){let o=r!=null?t.isSelected(r):!0,i=al.$isElementNode(t)&&t.excludeFromCopy("html");var l=t;r!==null&&(l=c0.$cloneWithProperties(t),l=al.$isTextNode(l)&&r!=null?c0.$sliceSelectedTextNodeContent(r,l):l);let s=al.$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&&al.$isElementNode(t)&&h&&t.extractWithChild(f,r,"html")&&(o=!0)}return o&&!i?(aP.isHTMLElement(a)&&a.append(c),n.append(a),u&&(e=u.call(l,a))&&a.replaceWith(e)):n.append(c),o}let VS=new Set(["STYLE","SCRIPT"]);function KS(e,t,n=new Map,r){let o=[];if(VS.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(...KS(e[u],t,new Map(n),i));return l!=null&&(r=l(r)),i==null?o=o.concat(r):al.$isElementNode(i)&&i.append(...r),o}Sm.$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=al.$getRoot().getChildren();for(let o=0;o<r.length;o++)HS(e,r[o],n,t);return n.innerHTML};Sm.$generateNodesFromDOM=function(e,t){t=t.body?t.body.childNodes:[];let n=[];for(let o=0;o<t.length;o++){var r=t[o];VS.has(r.nodeName)||(r=KS(r,e),r!==null&&(n=n.concat(r)))}return n};const uP=Sm;var cP=uP,GS=cP,$p=zo,xl=Rt,de=he;function Br(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 YS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function XS(e){let t=de.$getSelection();if(t==null)throw Error("Expected valid LexicalSelection");return de.$isRangeSelection(t)&&t.isCollapsed()||t.getNodes().length===0?"":GS.$generateHtmlFromNodes(e,t)}function QS(e){let t=de.$getSelection();if(t==null)throw Error("Expected valid LexicalSelection");return de.$isRangeSelection(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(ZS(e,t))}function kp(e,t,n){(de.DEPRECATED_$isGridSelection(n)||xl.$findMatchingParent(n.anchor.getNode(),r=>de.DEPRECATED_$isGridCellNode(r))!==null&&xl.$findMatchingParent(n.focus.getNode(),r=>de.DEPRECATED_$isGridCellNode(r))!==null)&&t.length===1&&de.DEPRECATED_$isGridNode(t[0])?fP(t,n,!1,e):dP(t,n)}function dP(e,t){let n=[],r=null;for(let o=0;o<e.length;o++){let i=e[o],l=de.$isLineBreakNode(i);if(l||de.$isDecoratorNode(i)&&i.isInline()||de.$isElementNode(i)&&i.isInline()||de.$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}de.$isRangeSelection(t)?t.insertNodes(n):de.DEPRECATED_$isGridSelection(t)&&(e=t.anchor.getNode(),de.DEPRECATED_$isGridCellNode(e)||Br(41),e.append(...n))}function fP(e,t,n,r){e.length===1&&de.DEPRECATED_$isGridNode(e[0])||Br(42);var o=e[0];e=o.getChildren(),n=o.getFirstChildOrThrow().getChildrenSize();var i=o.getChildrenSize(),l=xl.$findMatchingParent(t.anchor.getNode(),h=>de.DEPRECATED_$isGridCellNode(h));t=(o=l&&xl.$findMatchingParent(l,h=>de.DEPRECATED_$isGridRowNode(h)))&&xl.$findMatchingParent(o,h=>de.DEPRECATED_$isGridNode(h)),de.DEPRECATED_$isGridCellNode(l)&&de.DEPRECATED_$isGridRowNode(o)&&de.DEPRECATED_$isGridNode(t)||Br(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];de.DEPRECATED_$isGridRowNode(d)||Br(24);var f=e[l];de.DEPRECATED_$isGridRowNode(f)||Br(24),d=d.getChildren(),f=f.getChildren();let m=0;for(let g=n;g<=i;g++){let _=d[g];de.DEPRECATED_$isGridCellNode(_)||Br(25);let v=f[m];de.DEPRECATED_$isGridCellNode(v)||Br(25),h===o&&g===n?u=_.getKey():h===s&&g===i&&(c=_.getKey());let y=_.getChildren();v.getChildren().forEach(x=>{de.$isTextNode(x)&&de.$createParagraphNode().append(x),_.append(x)}),y.forEach(x=>x.remove()),m++}l++}u&&c&&(e=de.DEPRECATED_$createGridSelection(),e.set(t.getKey(),u,c),de.$setSelection(e),r.dispatchCommand(de.SELECTION_CHANGE_COMMAND,void 0))}function JS(e,t,n,r=[]){let o=t!=null?n.isSelected(t):!0,i=de.$isElementNode(n)&&n.excludeFromCopy("html");var l=n;if(t!==null){var s=$p.$cloneWithProperties(n);l=s=de.$isTextNode(s)&&t!=null?$p.$sliceSelectedTextNodeContent(t,s):s}let a=de.$isElementNode(l)?l.getChildren():[];var u=l;s=u.exportJSON();var c=u.constructor;s.type!==c.getType()&&Br(58,c.name);let d=s.children;for(de.$isElementNode(u)&&(Array.isArray(d)||Br(59,c.name)),de.$isTextNode(l)&&(l=l.__text,0<l.length?s.text=l:o=!1),l=0;l<a.length;l++)u=a[l],c=JS(e,t,u,s.children),!o&&de.$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 ZS(e,t){let n=[],r=de.$getRoot().getChildren();for(let o=0;o<r.length;o++)JS(e,t,r[o],n);return{namespace:e._config.namespace,nodes:n}}function qS(e){let t=[];for(let n=0;n<e.length;n++){let r=de.$parseSerializedNode(e[n]);de.$isTextNode(r)&&$p.$addNodeStyle(r),t.push(r)}return t}let Bi=null;function d0(e,t){var n=YS?(e._window||window).getSelection():null;if(!n)return!1;var r=n.anchorNode;if(n=n.focusNode,r!==null&&n!==null&&!de.isSelectionWithinEditor(e,r,n)||(t.preventDefault(),t=t.clipboardData,r=de.$getSelection(),t===null||r===null))return!1;n=XS(e),e=QS(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}to.$generateJSONFromSelectedNodes=ZS;to.$generateNodesFromSerializedNodes=qS;to.$getHtmlContent=XS;to.$getLexicalContent=QS;to.$insertDataTransferForPlainText=function(e,t){e=e.getData("text/plain")||e.getData("text/uri-list"),e!=null&&t.insertRawText(e)};to.$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=qS(l.nodes);return kp(n,s,t)}}catch{}if(r=e.getData("text/html"))try{var o=new DOMParser().parseFromString(r,"text/html"),i=GS.$generateNodesFromDOM(n,o);return kp(n,i,t)}catch{}if(e=e.getData("text/plain")||e.getData("text/uri-list"),e!=null)if(de.$isRangeSelection(t))for(e=e.split(/(\r?\n|\t)/),n=e.length,o=0;o<n;o++)i=e[o],i===`
128
128
  `||i===`\r
129
- `?t.insertParagraph():i===" "?t.insertNodes([de.$createTabNode()]):t.insertText(i);else t.insertRawText(e)};to.$insertGeneratedNodes=kp;to.copyToClipboard=async function(e,t){if(Bi!==null)return!1;if(t!==null)return new Promise(l=>{e.update(()=>{l(d0(e,t))})});var n=e.getRootElement();let r=e._window==null?window.document:e._window.document,o=YS?(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(de.COPY_COMMAND,a=>(xl.objectKlassEquals(a,ClipboardEvent)&&(s(),Bi!==null&&(window.clearTimeout(Bi),Bi=null),l(d0(e,a))),!0),de.COMMAND_PRIORITY_CRITICAL);Bi=window.setTimeout(()=>{s(),Bi=null,l(!1)},50),r.execCommand("copy"),i.remove()})};const hP=to;var pP=hP,Kc=pP,bu=zo,_r=Rt,A=he;function f0(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 Zl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gP=Zl&&"documentMode"in document?document.documentMode:null,mP=Zl&&"InputEvent"in window&&!gP?"getTargetRanges"in new window.InputEvent("input"):!1,vP=Zl&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),yP=Zl&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,xP=Zl&&/^(?=.*Chrome).*/i.test(navigator.userAgent),wP=Zl&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!xP,bp=A.createCommand("DRAG_DROP_PASTE_FILE"),Em=class eE extends A.ElementNode{static getType(){return"quote"}static clone(t){return new eE(t.__key)}constructor(t){super(t)}createDOM(t){let n=document.createElement("blockquote");return _r.addClassNamesToElement(n,t.theme.quote),n}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:_P,priority:0})}}exportDOM(t){if({element:t}=super.exportDOM(t),t&&_r.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=A.$createParagraphNode();let r=this.getDirection();return t.setDirection(r),this.insertAfter(t,n),t}collapseAtStart(){let t=A.$createParagraphNode();return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}};function Cm(){return A.$applyNodeReplacement(new Em)}let $m=class tE extends A.ElementNode{static getType(){return"heading"}static clone(t){return new tE(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&&_r.addClassNamesToElement(r,t[n]),r}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:Wi,priority:0}),h2:()=>({conversion:Wi,priority:0}),h3:()=>({conversion:Wi,priority:0}),h4:()=>({conversion:Wi,priority:0}),h5:()=>({conversion:Wi,priority:0}),h6:()=>({conversion:Wi,priority:0}),p:t=>(t=t.firstChild,t!==null&&h0(t)?{conversion:()=>({node:null}),priority:3}:null),span:t=>h0(t)?{conversion:()=>({node:ul("h1")}),priority:3}:null}}exportDOM(t){if({element:t}=super.exportDOM(t),t&&_r.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=ul(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()?ul(this.getTag()):A.$createParagraphNode();let r=this.getDirection();return t.setDirection(r),this.insertAfter(t,n),t}collapseAtStart(){let t=this.isEmpty()?A.$createParagraphNode():ul(this.getTag());return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}extractWithChild(){return!0}};function h0(e){return e.nodeName.toLowerCase()==="span"?e.style.fontSize==="26pt":!1}function Wi(e){let t=e.nodeName.toLowerCase(),n=null;return(t==="h1"||t==="h2"||t==="h3"||t==="h4"||t==="h5"||t==="h6")&&(n=ul(t),e.style!==null&&n.setFormat(e.style.textAlign)),{node:n}}function _P(e){let t=Cm();return e.style!==null&&t.setFormat(e.style.textAlign),{node:t}}function ul(e){return A.$applyNodeReplacement(new $m(e))}function SP(e,t){e.preventDefault(),t.update(()=>{let n=A.$getSelection(),r=e instanceof InputEvent||e instanceof KeyboardEvent?null:e.clipboardData;r!=null&&(A.$isRangeSelection(n)||A.DEPRECATED_$isGridSelection(n))&&Kc.$insertDataTransferForRichText(r,n,t)},{tag:"paste"})}async function EP(e,t){await Kc.copyToClipboard(t,_r.objectKlassEquals(e,ClipboardEvent)?e:null),t.update(()=>{let n=A.$getSelection();A.$isRangeSelection(n)?n.removeText():A.$isNodeSelection(n)&&n.getNodes().forEach(r=>r.remove())})}function Rs(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 p0(e){var t=A.$getSelection();if(!A.$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=_r.$getNearestBlockElementAncestorOrThrow(r),o=r.getKey(),r.canIndent()&&!n.has(o)&&(n.add(o),e(r)))}return 0<n.size}function Tu(e){return e=A.$getNearestNodeFromDOMNode(e),A.$isDecoratorNode(e)}Ar.$createHeadingNode=ul;Ar.$createQuoteNode=Cm;Ar.$isHeadingNode=function(e){return e instanceof $m};Ar.$isQuoteNode=function(e){return e instanceof Em};Ar.DRAG_DROP_PASTE=bp;Ar.HeadingNode=$m;Ar.QuoteNode=Em;Ar.eventFiles=Rs;Ar.registerRichText=function(e){return _r.mergeRegister(e.registerCommand(A.CLICK_COMMAND,()=>{const t=A.$getSelection();return A.$isNodeSelection(t)?(t.clear(),!0):!1},0),e.registerCommand(A.DELETE_CHARACTER_COMMAND,t=>{const n=A.$getSelection();return A.$isRangeSelection(n)?(n.deleteCharacter(t),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.DELETE_WORD_COMMAND,t=>{const n=A.$getSelection();return A.$isRangeSelection(n)?(n.deleteWord(t),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.DELETE_LINE_COMMAND,t=>{const n=A.$getSelection();return A.$isRangeSelection(n)?(n.deleteLine(t),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.CONTROLLED_TEXT_INSERTION_COMMAND,t=>{const n=A.$getSelection();if(typeof t=="string")A.$isRangeSelection(n)?n.insertText(t):A.DEPRECATED_$isGridSelection(n);else{if(!A.$isRangeSelection(n)&&!A.DEPRECATED_$isGridSelection(n))return!1;const r=t.dataTransfer;r!=null?Kc.$insertDataTransferForRichText(r,n,e):A.$isRangeSelection(n)&&(t=t.data)&&n.insertText(t)}return!0},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.REMOVE_TEXT_COMMAND,()=>{const t=A.$getSelection();return A.$isRangeSelection(t)?(t.removeText(),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.FORMAT_TEXT_COMMAND,t=>{const n=A.$getSelection();return A.$isRangeSelection(n)?(n.formatText(t),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.FORMAT_ELEMENT_COMMAND,t=>{var n=A.$getSelection();if(!A.$isRangeSelection(n)&&!A.$isNodeSelection(n))return!1;n=n.getNodes();for(const r of n)n=_r.$findMatchingParent(r,o=>A.$isElementNode(o)&&!o.isInline()),n!==null&&n.setFormat(t);return!0},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.INSERT_LINE_BREAK_COMMAND,t=>{const n=A.$getSelection();return A.$isRangeSelection(n)?(n.insertLineBreak(t),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.INSERT_PARAGRAPH_COMMAND,()=>{const t=A.$getSelection();return A.$isRangeSelection(t)?(t.insertParagraph(),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.INSERT_TAB_COMMAND,()=>(A.$insertNodes([A.$createTabNode()]),!0),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.INDENT_CONTENT_COMMAND,()=>p0(t=>{const n=t.getIndent();t.setIndent(n+1)}),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.OUTDENT_CONTENT_COMMAND,()=>p0(t=>{const n=t.getIndent();0<n&&t.setIndent(n-1)}),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ARROW_UP_COMMAND,t=>{var n=A.$getSelection();if(A.$isNodeSelection(n)&&!Tu(t.target)){if(t=n.getNodes(),0<t.length)return t[0].selectPrevious(),!0}else if(A.$isRangeSelection(n)&&(n=A.$getAdjacentNode(n.focus,!0),!t.shiftKey&&A.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline()))return n.selectPrevious(),t.preventDefault(),!0;return!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ARROW_DOWN_COMMAND,t=>{var n=A.$getSelection();if(A.$isNodeSelection(n)){if(t=n.getNodes(),0<t.length)return t[0].selectNext(0,0),!0}else if(A.$isRangeSelection(n)){let r=n.focus;if(r.key==="root"&&r.offset===A.$getRoot().getChildrenSize())return t.preventDefault(),!0;if(n=A.$getAdjacentNode(n.focus,!1),!t.shiftKey&&A.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),t.preventDefault(),!0}return!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ARROW_LEFT_COMMAND,t=>{const n=A.$getSelection();if(A.$isNodeSelection(n)){var r=n.getNodes();if(0<r.length)return t.preventDefault(),r[0].selectPrevious(),!0}return A.$isRangeSelection(n)&&bu.$shouldOverrideDefaultCharacterSelection(n,!0)?(r=t.shiftKey,t.preventDefault(),bu.$moveCharacter(n,r,!0),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ARROW_RIGHT_COMMAND,t=>{const n=A.$getSelection();if(A.$isNodeSelection(n)&&!Tu(t.target)){var r=n.getNodes();if(0<r.length)return t.preventDefault(),r[0].selectNext(0,0),!0}return A.$isRangeSelection(n)?(r=t.shiftKey,bu.$shouldOverrideDefaultCharacterSelection(n,!1)?(t.preventDefault(),bu.$moveCharacter(n,r,!1),!0):!1):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_BACKSPACE_COMMAND,t=>{if(Tu(t.target))return!1;const n=A.$getSelection();if(!A.$isRangeSelection(n))return!1;t.preventDefault(),{anchor:t}=n;const r=t.getNode();return n.isCollapsed()&&t.offset===0&&!A.$isRootNode(r)&&0<_r.$getNearestBlockElementAncestorOrThrow(r).getIndent()?e.dispatchCommand(A.OUTDENT_CONTENT_COMMAND,void 0):e.dispatchCommand(A.DELETE_CHARACTER_COMMAND,!0)},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_DELETE_COMMAND,t=>{if(Tu(t.target))return!1;const n=A.$getSelection();return A.$isRangeSelection(n)?(t.preventDefault(),e.dispatchCommand(A.DELETE_CHARACTER_COMMAND,!1)):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ENTER_COMMAND,t=>{const n=A.$getSelection();if(!A.$isRangeSelection(n))return!1;if(t!==null){if((yP||vP||wP)&&mP)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(A.INSERT_LINE_BREAK_COMMAND,!1)}return e.dispatchCommand(A.INSERT_PARAGRAPH_COMMAND,void 0)},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ESCAPE_COMMAND,()=>{const t=A.$getSelection();return A.$isRangeSelection(t)?(e.blur(),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.DROP_COMMAND,t=>{const[,n]=Rs(t);if(0<n.length){var r=f0(t.clientX,t.clientY);if(r!==null){const{offset:i,node:l}=r;var o=A.$getNearestNodeFromDOMNode(l);if(o!==null){if(r=A.$createRangeSelection(),A.$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=A.$normalizeSelection__EXPERIMENTAL(r),A.$setSelection(r)}e.dispatchCommand(bp,n)}return t.preventDefault(),!0}return t=A.$getSelection(),!!A.$isRangeSelection(t)},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.DRAGSTART_COMMAND,t=>{[t]=Rs(t);const n=A.$getSelection();return!(t&&!A.$isRangeSelection(n))},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.DRAGOVER_COMMAND,t=>{var[n]=Rs(t);const r=A.$getSelection();return n&&!A.$isRangeSelection(r)?!1:(n=f0(t.clientX,t.clientY),n!==null&&(n=A.$getNearestNodeFromDOMNode(n.node),A.$isDecoratorNode(n)&&t.preventDefault()),!0)},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.SELECT_ALL_COMMAND,()=>(A.$selectAll(),!0),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.COPY_COMMAND,t=>(Kc.copyToClipboard(e,_r.objectKlassEquals(t,ClipboardEvent)?t:null),!0),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.CUT_COMMAND,t=>(EP(t,e),!0),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.PASTE_COMMAND,t=>{const[,n,r]=Rs(t);if(0<n.length&&!r)return e.dispatchCommand(bp,n),!0;if(A.isSelectionCapturedInDecoratorInput(t.target))return!1;const o=A.$getSelection();return A.$isRangeSelection(o)||A.DEPRECATED_$isGridSelection(o)?(SP(t,e),!0):!1},A.COMMAND_PRIORITY_EDITOR))};const CP=Ar;var Js=CP,nE=dr,$P=rP,zn=p,kP=iP,rE=Rt,g0=Nr,bP=sP,TP=Js,km=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?zn.useLayoutEffect:zn.useEffect;function m0(e){return e.getEditorState().read(kP.$canShowPlaceholderCurry(e.isComposing()))}function NP(e){let[t,n]=zn.useState(()=>m0(e));return km(()=>{function r(){let o=m0(e);n(o)}return r(),rE.mergeRegister(e.registerUpdateListener(()=>{r()}),e.registerEditableListener(()=>{r()}))},[e]),t}function RP(e,t){let[n,r]=zn.useState(()=>e.getDecorators());return km(()=>e.registerDecoratorListener(o=>{g0.flushSync(()=>{r(o)})}),[e]),zn.useEffect(()=>{r(e.getDecorators())},[e]),zn.useMemo(()=>{let o=[],i=Object.keys(n);for(let l=0;l<i.length;l++){let s=i[l],a=zn.createElement(t,{onError:c=>e._onError(c)},zn.createElement(zn.Suspense,{fallback:null},n[s])),u=e.getElementByKey(s);u!==null&&o.push(g0.createPortal(a,u,s))}return o},[t,n,e])}function PP(e){km(()=>rE.mergeRegister(TP.registerRichText(e),bP.registerDragonSupport(e)),[e])}function OP({content:e}){var[t]=nE.useLexicalComposerContext();t=NP(t);let n=$P();return t?typeof e=="function"?e(n):e:null}FS.RichTextPlugin=function({contentEditable:e,placeholder:t,ErrorBoundary:n}){let[r]=nE.useLexicalComposerContext();return n=RP(r,n),PP(r),zn.createElement(zn.Fragment,null,e,zn.createElement(OP,{content:t}),n)};const AP=FS;var MP=AP,oE={},Ir=yo,LP=dr,iE=p,DP=Rt,vs=he;function IP(e){iE.useEffect(()=>DP.mergeRegister(e.registerCommand(Ir.INSERT_ORDERED_LIST_COMMAND,()=>(Ir.insertList(e,"number"),!0),vs.COMMAND_PRIORITY_LOW),e.registerCommand(Ir.INSERT_UNORDERED_LIST_COMMAND,()=>(Ir.insertList(e,"bullet"),!0),vs.COMMAND_PRIORITY_LOW),e.registerCommand(Ir.REMOVE_LIST_COMMAND,()=>(Ir.removeList(e),!0),vs.COMMAND_PRIORITY_LOW),e.registerCommand(vs.INSERT_PARAGRAPH_COMMAND,()=>!!Ir.$handleListInsertParagraph(),vs.COMMAND_PRIORITY_LOW)),[e])}oE.ListPlugin=function(){let[e]=LP.useLexicalComposerContext();return iE.useEffect(()=>{if(!e.hasNodes([Ir.ListNode,Ir.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[e]),IP(e),null};const jP=oE;var zP=jP,lE={},no={},sE=Rt,$r=he;let FP=new Set(["http:","https:","mailto:","sms:","tel:"]);class ql extends $r.ElementNode{static getType(){return"link"}static clone(t){return new ql(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),sE.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:BP,priority:1})}}static importJSON(t){let n=Na(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(!FP.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),$r.$isElementNode(t)?(n=Na(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(!$r.$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 BP(e){let t=null;if(sE.isHTMLAnchorElement(e)){let n=e.textContent;n!==null&&n!==""&&(t=Na(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function Na(e,t){return $r.$applyNodeReplacement(new ql(e,t))}function ti(e){return e instanceof ql}class Ga extends ql{static getType(){return"autolink"}static clone(t){return new Ga(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}static importJSON(t){let n=Tp(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),$r.$isElementNode(t)?(n=Tp(this.__url,{rel:this._rel,target:this.__target,title:this.__title}),t.append(n),n):null}}function Tp(e,t){return $r.$applyNodeReplacement(new Ga(e,t))}let WP=$r.createCommand("TOGGLE_LINK_COMMAND");function UP(e,t){for(;e!==null&&(e=e.getParent())!==null&&!t(e););return e}no.$createAutoLinkNode=Tp;no.$createLinkNode=Na;no.$isAutoLinkNode=function(e){return e instanceof Ga};no.$isLinkNode=ti;no.AutoLinkNode=Ga;no.LinkNode=ql;no.TOGGLE_LINK_COMMAND=WP;no.toggleLink=function(e,t={}){let{target:n,title:r}=t,o=t.rel===void 0?"noreferrer":t.rel;if(t=$r.$getSelection(),$r.$isRangeSelection(t))if(t=t.extract(),e===null)t.forEach(l=>{if(l=l.getParent(),ti(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=ti(i)?i:UP(i,ti),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&&(!$r.$isElementNode(a)||a.isInline()))if(ti(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=Na(e,{rel:o,target:n}),ti(u)?a.getPreviousSibling()===null?u.insertBefore(s):u.insertAfter(s):a.insertBefore(s)),ti(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 HP=no;var Ml=HP,Ui=Ml,VP=dr,KP=Rt,Hi=he,GP=p;lE.LinkPlugin=function({validateUrl:e}){let[t]=VP.useLexicalComposerContext();return GP.useEffect(()=>{if(!t.hasNodes([Ui.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return KP.mergeRegister(t.registerCommand(Ui.TOGGLE_LINK_COMMAND,n=>{if(n===null)return Ui.toggleLink(n),!0;if(typeof n=="string")return e===void 0||e(n)?(Ui.toggleLink(n),!0):!1;let{url:r,target:o,rel:i,title:l}=n;return Ui.toggleLink(r,{rel:i,target:o,title:l}),!0},Hi.COMMAND_PRIORITY_LOW),e!==void 0?t.registerCommand(Hi.PASTE_COMMAND,n=>{let r=Hi.$getSelection();if(!Hi.$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=>Hi.$isElementNode(i))?!1:(t.dispatchCommand(Ui.TOGGLE_LINK_COMMAND,o),n.preventDefault(),!0):!1},Hi.COMMAND_PRIORITY_LOW):()=>{})},[t,e]),null};const YP=lE;var XP=YP;function QP({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:m=!0,style:g,tabIndex:_,"data-testid":v,...y}){const[x]=dr.useLexicalComposerContext(),[S,k]=p.useState(!1),T=p.useCallback(b=>{var D;x.setRootElement(b);const N=(D=document.getElementById("val-ui"))==null?void 0:D.shadowRoot;if(N&&"getSelection"in N){x._window=N;return}},[x]);return p.useLayoutEffect(()=>(k(x.isEditable()),x.registerEditableListener(b=>{k(b)})),[x]),w.jsx("div",{...y,"aria-activedescendant":S?e:void 0,"aria-autocomplete":S?t:"none","aria-controls":S?n:void 0,"aria-describedby":r,"aria-expanded":S&&h==="combobox"?!!o:void 0,"aria-label":i,"aria-labelledby":l,"aria-multiline":s,"aria-owns":S?a:void 0,"aria-readonly":S?void 0:!0,"aria-required":u,autoCapitalize:c,className:d,contentEditable:S,"data-testid":v,id:f,ref:T,role:h,spellCheck:m,style:g,tabIndex:_})}function JP({className:e}){return w.jsx(QP,{className:e})}class Ya extends he.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 Ya({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 aE(t)}createDOM(){return document.createElement("div")}updateDOM(){return!1}decorate(){return w.jsx(ZP,{src:this.__src,altText:this.__altText,empty:this.__empty,height:this.__height,nodeKey:this.getKey()})}}function ZP(e){return w.jsx("img",{src:e.src})}function aE(e){return new Ya(e)}function qP(){const[e]=dr.useLexicalComposerContext();return p.useEffect(()=>{e.focus()},[e]),null}const uE=he.createCommand("INSERT_IMAGE_COMMAND");function eO(){const[e]=dr.useLexicalComposerContext();return p.useEffect(()=>{if(!e.hasNodes([Ya]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Rt.mergeRegister(e.registerCommand(uE,t=>{const n=aE(t);return he.$insertNodes([n]),he.$isRootOrShadowRoot(n.getParentOrThrow())&&Rt.$wrapNodeInElement(n,he.$createParagraphNode).selectEnd(),!0},he.COMMAND_PRIORITY_EDITOR))},[e]),null}const tO=({className:e})=>w.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:[w.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),w.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]}),nO=tO,rO=({className:e})=>w.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:[w.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),w.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),w.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]}),oO=rO,iO=({className:e})=>w.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:w.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"})}),lO=iO,sO=({variant:e="primary",onClick:t,children:n,icon:r,disabled:o=!1})=>w.jsx("button",{disabled:o,className:vd("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:w.jsxs("span",{className:"flex flex-row items-center justify-center gap-2",children:[r&&r,n]})}),ni=sO,aO=({className:e})=>w.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",className:e,children:[w.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"}),w.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"})]}),uO=aO,cE=ee.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 bm(){return ee.useContext(cE)}const cO=({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}=bm(),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)}},[]),w.jsx("div",{className:"text-[12px]",ref:l,children:w.jsx(ni,{onClick:f=>{f.preventDefault(),c()},icon:w.jsx(uO,{className:`rotate-[-90deg] transition-transform duration-150 ease-in-out ${o?"":"rotate-[90deg]"}`}),children:w.jsxs("div",{className:"relative",children:[w.jsxs("span",{className:"flex flex-row items-center justify-center gap-1",children:[n,r&&r]}),o&&w.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:w.jsx("div",{className:"flex flex-col ",children:e==null?void 0:e.map((f,h)=>w.jsx("button",{onClick:m=>{m.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))})})]})})})},dO=cO,fO=new TextEncoder;function dE(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 $n.getSHA256Hash(fO.encode(l));if(s.naturalWidth&&s.naturalHeight){const u=Yg(l);t({src:l,width:s.naturalWidth,height:s.naturalHeight,filename:r==null?void 0:r.name,sha256:a,mimeType:u,fileExt:u&&Xg(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 fE(e){const t=e.anchor,n=e.focus,r=e.anchor.getNode(),o=e.focus.getNode();return r===o?r:e.isBackward()?zo.$isAtNodeEnd(n)?r:o:zo.$isAtNodeEnd(t)?r:o}function hO(){const[e]=dr.useLexicalComposerContext();return p.useEffect(()=>Rt.mergeRegister(e.registerCommand(he.CLICK_COMMAND,t=>{const n=he.$getSelection();if(he.$isRangeSelection(n)){const r=fE(n),o=Rt.$findMatchingParent(r,Ml.$isLinkNode);if(Ml.$isLinkNode(o)&&(t.metaKey||t.ctrlKey))return window.open(o.getURL(),"_blank"),!0}return!1},he.COMMAND_PRIORITY_LOW)),[]),null}var hE={exports:{}},pO="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",gO=pO,mO=gO;function pE(){}function gE(){}gE.resetWarningCache=pE;var vO=function(){function e(r,o,i,l,s,a){if(a!==mO){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:gE,resetWarningCache:pE};return n.PropTypes=n,n};hE.exports=vO();var yO=hE.exports;const Bn=La(yO);function Np(){return Np=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},Np.apply(this,arguments)}function xO(e,t){if(e==null)return{};var n=wO(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 wO(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 Tm=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=xO(e,["color","size"]);return ee.createElement("svg",Np({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),ee.createElement("polyline",{points:"20 6 9 17 4 12"}))});Tm.propTypes={color:Bn.string,size:Bn.oneOfType([Bn.string,Bn.number])};Tm.displayName="Check";const _O=Tm;function Rp(){return Rp=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},Rp.apply(this,arguments)}function SO(e,t){if(e==null)return{};var n=EO(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 EO(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 Nm=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=SO(e,["color","size"]);return ee.createElement("svg",Rp({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),ee.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"}),ee.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"}))});Nm.propTypes={color:Bn.string,size:Bn.oneOfType([Bn.string,Bn.number])};Nm.displayName="Link";const CO=Nm;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 $O(e,t){if(e==null)return{};var n=kO(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 kO(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 Rm=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=$O(e,["color","size"]);return ee.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),ee.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ee.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))});Rm.propTypes={color:Bn.string,size:Bn.oneOfType([Bn.string,Bn.number])};Rm.displayName="X";const bO=Rm,TO=({fontSizes:e,fontsFamilies:t,onEditor:n,colors:r})=>{const[o]=dr.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,m]=p.useState(!1),[g,_]=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[x,S]=p.useState(null),k=M=>{o.dispatchCommand(Ml.TOGGLE_LINK_COMMAND,M)},T={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"},b={};for(const M in T)b[T[M]]=M;const N=p.useCallback(()=>{const M=he.$getSelection();if(he.$isRangeSelection(M)){const j=M.anchor.getNode();let B=j.getKey()==="root"?j:Rt.$findMatchingParent(j,$=>{const E=$.getParent();return E!==null&&he.$isRootOrShadowRoot(E)});B===null&&(B=j.getTopLevelElementOrThrow());const re=fE(M),V=Rt.$findMatchingParent(re,Ml.$isLinkNode);if(V!==null){const $=V.getURL();S($)}else S(null);const Y=B.getKey(),C=i.getElementByKey(Y);if(c(M.hasFormat("bold")),f(M.hasFormat("italic")),m(M.hasFormat("strikethrough")),_(M.hasFormat("underline")),C!==null)if(a(Y),yo.$isListNode(B)){const $=Rt.$getNearestNodeOfType(j,yo.ListNode),E=$?$.getListType():B.getListType();y(E)}else{const $=Js.$isHeadingNode(B)?B.getTag():B.getType();$ in T&&y($)}}},[i]);p.useEffect(()=>Rt.mergeRegister(o.registerUpdateListener(({editorState:M})=>{M.read(()=>{N()})})),[N,i,o]),p.useEffect(()=>o.registerCommand(he.SELECTION_CHANGE_COMMAND,(M,j)=>(N(),l(j),!1),he.COMMAND_PRIORITY_CRITICAL),[o,N]);const D=M=>{["h1","h2","h3","h4","h5","h6"].includes(M)?v!==M&&o.update(()=>{const j=he.$getSelection();he.$isRangeSelection(j)&&zo.$setBlocksType(j,()=>Js.$createHeadingNode(M))}):M==="paragraph"&&v!=="paragraph"?o.update(()=>{const j=he.$getSelection();(he.$isRangeSelection(j)||he.DEPRECATED_$isGridSelection(j))&&zo.$setBlocksType(j,()=>he.$createParagraphNode())}):M==="number"&&v!=="number"?o.dispatchCommand(yo.INSERT_ORDERED_LIST_COMMAND,void 0):M==="bullet"&&v!=="bullet"?o.dispatchCommand(yo.INSERT_UNORDERED_LIST_COMMAND,void 0):o.dispatchCommand(yo.REMOVE_LIST_COMMAND,void 0)};return p.useCallback(()=>{o.update(()=>{const M=he.$getSelection();if(he.$isRangeSelection(M)){const j=M.anchor,B=M.focus,re=M.getNodes();if(j.key===B.key&&j.offset===B.offset)return;re.forEach((V,Y)=>{he.$isTextNode(V)?(Y===0&&j.offset!==0&&(V=V.splitText(j.offset)[1]||V),Y===re.length-1&&(V=V.splitText(B.offset)[0]||V),V.__style!==""&&V.setStyle(""),V.__format!==0&&(V.setFormat(0),Rt.$getNearestBlockElementAncestorOrThrow(V).setFormat(""))):Js.$isHeadingNode(V)&&V.replace(he.$createParagraphNode(),!0)})}})},[i]),w.jsxs("div",{className:"sticky top-0 border-b bg-background border-highlight flex flex-col",children:[w.jsxs("div",{className:"flex flex-row gap-1",children:[w.jsx(dO,{options:Object.values(T),label:T[v]??v+" (not supported)",onChange:M=>{D(b[M])}}),w.jsx(ni,{variant:"primary",onClick:M=>{M.preventDefault(),o.dispatchCommand(he.FORMAT_TEXT_COMMAND,"bold")},active:u,icon:w.jsx(nO,{className:`${u&&"stroke-[3px]"}`})}),w.jsx(ni,{active:h,onClick:M=>{M.preventDefault(),o.dispatchCommand(he.FORMAT_TEXT_COMMAND,"strikethrough")},icon:w.jsx(lO,{className:`${h&&"stroke-[2px]"}`})}),w.jsx(ni,{active:d,onClick:M=>{M.preventDefault(),o.dispatchCommand(he.FORMAT_TEXT_COMMAND,"italic")},icon:w.jsx(oO,{className:`${d&&"stroke-[3px]"}`})}),w.jsx(ni,{active:x!==null,onClick:M=>{M.preventDefault(),S(""),k("")},icon:w.jsx(CO,{width:12,height:12,className:`${x!==null&&"stroke-[3px]"}`})}),w.jsxs("label",{className:"flex items-center justify-center cursor-pointer",children:[w.jsx(l_,{}),w.jsx("input",{type:"file",hidden:!0,onChange:M=>{M.preventDefault(),dE(M).then(j=>{o.dispatchCommand(uE,{...j})}).catch(j=>{console.error("Error reading image",j)})}})]})]}),x!==null&&w.jsxs("div",{className:"flex flex-row p-2",children:[w.jsx("input",{type:"text",placeholder:"Enter URL",className:"w-1/3 text-primary bg-background px-2",value:x,onChange:M=>{M.preventDefault(),S(M.target.value)}}),w.jsx(ni,{variant:"primary",onClick:M=>{M.preventDefault(),k(x||null)},icon:w.jsx(_O,{size:14})}),w.jsx(ni,{variant:"primary",onClick:M=>{M.preventDefault(),k(null)},icon:w.jsx(bO,{size:14})})]})]})},NO=TO;function RO(e){console.error(e)}const PO=28,OO=({richtext:e,onEditor:t})=>{const{windowSize:n}=bm(),o={namespace:"val",editorState:i=>{i.setEditorState(i.parseEditorState({root:_2(v_(e))}))},nodes:[Js.HeadingNode,Ya,yo.ListNode,yo.ListItemNode,Ml.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:RO};return w.jsxs(MR.LexicalComposer,{initialConfig:o,children:[w.jsx(qP,{}),w.jsx(NO,{onEditor:t}),w.jsx(MP.RichTextPlugin,{contentEditable:w.jsx("div",{className:"font-sans border-b text-primary border-highlight",style:{minHeight:n!=null&&n.innerHeight?(n==null?void 0:n.innerHeight)-PO:void 0},children:w.jsx(JP,{className:"p-4 outline-none bg-fill"})}),placeholder:w.jsx("div",{className:"",children:"Enter some text..."}),ErrorBoundary:BR}),w.jsx(XP.LinkPlugin,{}),w.jsx(hO,{}),w.jsx(zP.ListPlugin,{}),w.jsx(eO,{}),w.jsx(QR.HistoryPlugin,{})]})};var AO={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 MO=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),An=(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,...AO,width:o,height:o,stroke:r,strokeWidth:l?Number(i)*24/Number(o):i,className:`lucide lucide-${MO(e)}`,...a},[...t.map(([c,d])=>p.createElement(c,d)),...(Array.isArray(s)?s:[s])||[]]));return n.displayName=`${e}`,n},LO=An("Check",[["polyline",{points:"20 6 9 17 4 12",key:"10jjfj"}]]),mE=An("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),DO=An("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),v0=An("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"}]]),IO=An("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"}]]),jO=An("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"}]]),zO=An("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),FO=An("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]),BO=An("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]),WO=An("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),UO=An("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]),HO=An("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"}]]),VO=An("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Pm="p-1 border rounded-full shadow border-accent",y0="valbuild:urlBeforeNavigation";function KO({api:e}){const{theme:t,setTheme:n,editMode:r,setEditMode:o,session:i}=bm();if(i.status==="success"&&i.data.mode==="unauthorized")return w.jsxs(x0,{href:e.getLoginUrl(window.location.href),children:[w.jsx("span",{children:"Login"}),w.jsx(v0,{size:18})]});if(i.status==="success"&&!i.data.enabled)return w.jsxs(x0,{href:e.getEnableUrl(window.location.href),children:[w.jsx("span",{children:"Enable"}),w.jsx(v0,{size:18})]});const[l,s]=p.useState();return p.useEffect(()=>{i.status==="success"&&i.data.mode==="proxy"&&e.getPatches({}).then(a=>{if(Fs.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]),w.jsxs(GO,{children:[w.jsx(Nu,{active:r==="hover",onClick:()=>{o(a=>a==="hover"?"off":"hover")},children:w.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:r==="hover"?w.jsx(FO,{size:18}):w.jsx(BO,{size:18})})}),w.jsx(Nu,{onClick:()=>{n(t==="dark"?"light":"dark")},children:w.jsxs("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:[t==="dark"&&w.jsx(HO,{size:15}),t==="light"&&w.jsx(zO,{size:15})]})}),w.jsx(Nu,{active:r==="full",onClick:()=>{if(r!=="full")localStorage.setItem(y0,window.location.href),window.location.href=e.getEditUrl();else if(r==="full"){const a=localStorage.getItem(y0);window.location.href=a||"/"}},children:w.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:r==="full"?w.jsx(jO,{size:15}):w.jsx(IO,{size:15})})}),l&&w.jsx(Nu,{onClick:()=>{},children:w.jsxs("div",{className:"relative h-[24px] w-[24px] flex justify-center items-center",children:[w.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}),w.jsx(UO,{size:18})]})}),w.jsx("a",{className:Pm,href:e.getDisableUrl(window.location.href),children:w.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:w.jsx(WO,{size:18})})})]})}function x0({href:e,children:t}){return w.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:w.jsx("a",{className:Pm,href:e,children:w.jsx("div",{className:"flex items-center justify-center px-2 gap-x-2",children:t})})})}function GO({children:e}){return w.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 Nu({active:e,onClick:t,children:n}){return w.jsx("button",{className:vd(Pm,{"bg-accent drop-shadow-[0px_0px_12px_rgba(56,205,152,0.60)]":e}),onClick:t,children:n})}const w0=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,_0=qw,YO=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return _0(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=w0(c)||w0(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(m=>{let[g,_]=m;return Array.isArray(_)?_.includes({...i,...s}[g]):{...i,...s}[g]===_})?[...u,d,f]:u},[]);return _0(e,l,a,n==null?void 0:n.class,n==null?void 0:n.className)},XO=YO("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"}}),es=p.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const l=r?Rl:"button";return w.jsx(l,{className:ut(XO({variant:t,size:n,className:e})),ref:i,...o})});es.displayName="Button";function QO(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 Om=p.forwardRef(({className:e,type:t,...n},r)=>w.jsx("input",{type:t,className:ut("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Om.displayName="Input";function vE(e){const t=e+"CollectionProvider",[n,r]=Ni(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=h=>{const{scope:m,children:g}=h,_=ee.useRef(null),v=ee.useRef(new Map).current;return ee.createElement(o,{scope:m,itemMap:v,collectionRef:_},g)},s=e+"CollectionSlot",a=ee.forwardRef((h,m)=>{const{scope:g,children:_}=h,v=i(s,g),y=Ze(m,v.collectionRef);return ee.createElement(Rl,{ref:y},_)}),u=e+"CollectionItemSlot",c="data-radix-collection-item",d=ee.forwardRef((h,m)=>{const{scope:g,children:_,...v}=h,y=ee.useRef(null),x=Ze(m,y),S=i(u,g);return ee.useEffect(()=>(S.itemMap.set(y,{ref:y,...v}),()=>void S.itemMap.delete(y))),ee.createElement(Rl,{[c]:"",ref:x},_)});function f(h){const m=i(e+"CollectionConsumer",h);return ee.useCallback(()=>{const _=m.collectionRef.current;if(!_)return[];const v=Array.from(_.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((S,k)=>v.indexOf(S.ref.current)-v.indexOf(k.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:l,Slot:a,ItemSlot:d},f,r]}function JO(e,t=globalThis==null?void 0:globalThis.document){const n=Ht(e);p.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const Op="dismissableLayer.update",ZO="dismissableLayer.pointerDownOutside",qO="dismissableLayer.focusOutside";let S0;const e5=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),t5=p.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:s,onDismiss:a,...u}=e,c=p.useContext(e5),[d,f]=p.useState(null),h=(n=d==null?void 0:d.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,m]=p.useState({}),g=Ze(t,N=>f(N)),_=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=_.indexOf(v),x=d?_.indexOf(d):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,k=x>=y,T=n5(N=>{const D=N.target,M=[...c.branches].some(j=>j.contains(D));!k||M||(i==null||i(N),s==null||s(N),N.defaultPrevented||a==null||a())},h),b=r5(N=>{const D=N.target;[...c.branches].some(j=>j.contains(D))||(l==null||l(N),s==null||s(N),N.defaultPrevented||a==null||a())},h);return JO(N=>{x===c.layers.size-1&&(o==null||o(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},h),p.useEffect(()=>{if(d)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(S0=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),E0(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=S0)}},[d,h,r,c]),p.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),E0())},[d,c]),p.useEffect(()=>{const N=()=>m({});return document.addEventListener(Op,N),()=>document.removeEventListener(Op,N)},[]),p.createElement(Ie.div,te({},u,{ref:g,style:{pointerEvents:S?k?"auto":"none":void 0,...e.style},onFocusCapture:Ge(e.onFocusCapture,b.onFocusCapture),onBlurCapture:Ge(e.onBlurCapture,b.onBlurCapture),onPointerDownCapture:Ge(e.onPointerDownCapture,T.onPointerDownCapture)}))});function n5(e,t=globalThis==null?void 0:globalThis.document){const n=Ht(e),r=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const i=s=>{if(s.target&&!r.current){let c=function(){yE(ZO,n,u,{discrete:!0})};var a=c;const u={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function r5(e,t=globalThis==null?void 0:globalThis.document){const n=Ht(e),r=p.useRef(!1);return p.useEffect(()=>{const o=i=>{i.target&&!r.current&&yE(qO,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function E0(){const e=new CustomEvent(Op);document.dispatchEvent(e)}function yE(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?IT(o,i):o.dispatchEvent(i)}let Df=0;function o5(){p.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:C0()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:C0()),Df++,()=>{Df===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Df--}},[])}function C0(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}const If="focusScope.autoFocusOnMount",jf="focusScope.autoFocusOnUnmount",$0={bubbles:!1,cancelable:!0},i5=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...l}=e,[s,a]=p.useState(null),u=Ht(o),c=Ht(i),d=p.useRef(null),f=Ze(t,g=>a(g)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let y=function(T){if(h.paused||!s)return;const b=T.target;s.contains(b)?d.current=b:co(d.current,{select:!0})},x=function(T){if(h.paused||!s)return;const b=T.relatedTarget;b!==null&&(s.contains(b)||co(d.current,{select:!0}))},S=function(T){if(document.activeElement===document.body)for(const N of T)N.removedNodes.length>0&&co(s)};var g=y,_=x,v=S;document.addEventListener("focusin",y),document.addEventListener("focusout",x);const k=new MutationObserver(S);return s&&k.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),k.disconnect()}}},[r,s,h.paused]),p.useEffect(()=>{if(s){b0.add(h);const g=document.activeElement;if(!s.contains(g)){const v=new CustomEvent(If,$0);s.addEventListener(If,u),s.dispatchEvent(v),v.defaultPrevented||(l5(d5(xE(s)),{select:!0}),document.activeElement===g&&co(s))}return()=>{s.removeEventListener(If,u),setTimeout(()=>{const v=new CustomEvent(jf,$0);s.addEventListener(jf,c),s.dispatchEvent(v),v.defaultPrevented||co(g??document.body,{select:!0}),s.removeEventListener(jf,c),b0.remove(h)},0)}}},[s,u,c,h]);const m=p.useCallback(g=>{if(!n&&!r||h.paused)return;const _=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(_&&v){const y=g.currentTarget,[x,S]=s5(y);x&&S?!g.shiftKey&&v===S?(g.preventDefault(),n&&co(x,{select:!0})):g.shiftKey&&v===x&&(g.preventDefault(),n&&co(S,{select:!0})):v===y&&g.preventDefault()}},[n,r,h.paused]);return p.createElement(Ie.div,te({tabIndex:-1},l,{ref:f,onKeyDown:m}))});function l5(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(co(r,{select:t}),document.activeElement!==n)return}function s5(e){const t=xE(e),n=k0(t,e),r=k0(t.reverse(),e);return[n,r]}function xE(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function k0(e,t){for(const n of e)if(!a5(n,{upTo:t}))return n}function a5(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function u5(e){return e instanceof HTMLInputElement&&"select"in e}function co(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&u5(e)&&t&&e.select()}}const b0=c5();function c5(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=T0(e,t),e.unshift(t)},remove(t){var n;e=T0(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function T0(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function d5(e){return e.filter(t=>t.tagName!=="A")}const f5=C1.useId||(()=>{});let h5=0;function Ad(e){const[t,n]=p.useState(f5());return Nn(()=>{e||n(r=>r??String(h5++))},[e]),e||(t?`radix-${t}`:"")}const p5=["top","right","bottom","left"],Bo=Math.min,Sn=Math.max,Gc=Math.round,Ru=Math.floor,Wo=e=>({x:e,y:e}),g5={left:"right",right:"left",bottom:"top",top:"bottom"},m5={start:"end",end:"start"};function Ap(e,t,n){return Sn(e,Bo(t,n))}function Xr(e,t){return typeof e=="function"?e(t):e}function Qr(e){return e.split("-")[0]}function ts(e){return e.split("-")[1]}function Am(e){return e==="x"?"y":"x"}function Mm(e){return e==="y"?"height":"width"}function ns(e){return["top","bottom"].includes(Qr(e))?"y":"x"}function Lm(e){return Am(ns(e))}function v5(e,t,n){n===void 0&&(n=!1);const r=ts(e),o=Lm(e),i=Mm(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=Yc(l)),[l,Yc(l)]}function y5(e){const t=Yc(e);return[Mp(e),t,Mp(t)]}function Mp(e){return e.replace(/start|end/g,t=>m5[t])}function x5(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}function w5(e,t,n,r){const o=ts(e);let i=x5(Qr(e),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),t&&(i=i.concat(i.map(Mp)))),i}function Yc(e){return e.replace(/left|right|bottom|top/g,t=>g5[t])}function _5(e){return{top:0,right:0,bottom:0,left:0,...e}}function wE(e){return typeof e!="number"?_5(e):{top:e,right:e,bottom:e,left:e}}function Xc(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function N0(e,t,n){let{reference:r,floating:o}=e;const i=ns(t),l=Lm(t),s=Mm(l),a=Qr(t),u=i==="y",c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[s]/2-o[s]/2;let h;switch(a){case"top":h={x:c,y:r.y-o.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(ts(t)){case"start":h[l]-=f*(n&&u?-1:1);break;case"end":h[l]+=f*(n&&u?-1:1);break}return h}const S5=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,s=i.filter(Boolean),a=await(l.isRTL==null?void 0:l.isRTL(t));let u=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=N0(u,r,a),f=r,h={},m=0;for(let g=0;g<s.length;g++){const{name:_,fn:v}=s[g],{x:y,y:x,data:S,reset:k}=await v({x:c,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:u,platform:l,elements:{reference:e,floating:t}});if(c=y??c,d=x??d,h={...h,[_]:{...h[_],...S}},k&&m<=50){m++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(u=k.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:c,y:d}=N0(u,f,a)),g=-1;continue}}return{x:c,y:d,placement:f,strategy:o,middlewareData:h}};async function Ra(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:l,elements:s,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Xr(t,e),m=wE(h),_=s[f?d==="floating"?"reference":"floating":d],v=Xc(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(_)))==null||n?_:_.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:a})),y=d==="floating"?{...l.floating,x:r,y:o}:l.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),S=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},k=Xc(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:x,strategy:a}):y);return{top:(v.top-k.top+m.top)/S.y,bottom:(k.bottom-v.bottom+m.bottom)/S.y,left:(v.left-k.left+m.left)/S.x,right:(k.right-v.right+m.right)/S.x}}const R0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:s,middlewareData:a}=t,{element:u,padding:c=0}=Xr(e,t)||{};if(u==null)return{};const d=wE(c),f={x:n,y:r},h=Lm(o),m=Mm(h),g=await l.getDimensions(u),_=h==="y",v=_?"top":"left",y=_?"bottom":"right",x=_?"clientHeight":"clientWidth",S=i.reference[m]+i.reference[h]-f[h]-i.floating[m],k=f[h]-i.reference[h],T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u));let b=T?T[x]:0;(!b||!await(l.isElement==null?void 0:l.isElement(T)))&&(b=s.floating[x]||i.floating[m]);const N=S/2-k/2,D=b/2-g[m]/2-1,M=Bo(d[v],D),j=Bo(d[y],D),B=M,re=b-g[m]-j,V=b/2-g[m]/2+N,Y=Ap(B,V,re),C=!a.arrow&&ts(o)!=null&&V!=Y&&i.reference[m]/2-(V<B?M:j)-g[m]/2<0,$=C?V<B?V-B:V-re:0;return{[h]:f[h]+$,data:{[h]:Y,centerOffset:V-Y-$,...C&&{alignmentOffset:$}},reset:C}}}),E5=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:s,platform:a,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,..._}=Xr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=Qr(o),y=Qr(s)===s,x=await(a.isRTL==null?void 0:a.isRTL(u.floating)),S=f||(y||!g?[Yc(s)]:y5(s));!f&&m!=="none"&&S.push(...w5(s,g,m,x));const k=[s,...S],T=await Ra(t,_),b=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&b.push(T[v]),d){const B=v5(o,l,x);b.push(T[B[0]],T[B[1]])}if(N=[...N,{placement:o,overflows:b}],!b.every(B=>B<=0)){var D,M;const B=(((D=i.flip)==null?void 0:D.index)||0)+1,re=k[B];if(re)return{data:{index:B,overflows:N},reset:{placement:re}};let V=(M=N.filter(Y=>Y.overflows[0]<=0).sort((Y,C)=>Y.overflows[1]-C.overflows[1])[0])==null?void 0:M.placement;if(!V)switch(h){case"bestFit":{var j;const Y=(j=N.map(C=>[C.placement,C.overflows.filter($=>$>0).reduce(($,E)=>$+E,0)]).sort((C,$)=>C[1]-$[1])[0])==null?void 0:j[0];Y&&(V=Y);break}case"initialPlacement":V=s;break}if(o!==V)return{reset:{placement:V}}}return{}}}};function P0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function O0(e){return p5.some(t=>e[t]>=0)}const C5=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Xr(e,t);switch(r){case"referenceHidden":{const i=await Ra(t,{...o,elementContext:"reference"}),l=P0(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:O0(l)}}}case"escaped":{const i=await Ra(t,{...o,altBoundary:!0}),l=P0(i,n.floating);return{data:{escapedOffsets:l,escaped:O0(l)}}}default:return{}}}}};async function $5(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=Qr(n),s=ts(n),a=ns(n)==="y",u=["left","top"].includes(l)?-1:1,c=i&&a?-1:1,d=Xr(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&typeof m=="number"&&(h=s==="end"?m*-1:m),a?{x:h*c,y:f*u}:{x:f*u,y:h*c}}const k5=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await $5(t,e);return{x:n+o.x,y:r+o.y,data:o}}}},b5=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:s={fn:_=>{let{x:v,y}=_;return{x:v,y}}},...a}=Xr(e,t),u={x:n,y:r},c=await Ra(t,a),d=ns(Qr(o)),f=Am(d);let h=u[f],m=u[d];if(i){const _=f==="y"?"top":"left",v=f==="y"?"bottom":"right",y=h+c[_],x=h-c[v];h=Ap(y,h,x)}if(l){const _=d==="y"?"top":"left",v=d==="y"?"bottom":"right",y=m+c[_],x=m-c[v];m=Ap(y,m,x)}const g=s.fn({...t,[f]:h,[d]:m});return{...g,data:{x:g.x-n,y:g.y-r}}}}},T5=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:l}=t,{offset:s=0,mainAxis:a=!0,crossAxis:u=!0}=Xr(e,t),c={x:n,y:r},d=ns(o),f=Am(d);let h=c[f],m=c[d];const g=Xr(s,t),_=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const x=f==="y"?"height":"width",S=i.reference[f]-i.floating[x]+_.mainAxis,k=i.reference[f]+i.reference[x]-_.mainAxis;h<S?h=S:h>k&&(h=k)}if(u){var v,y;const x=f==="y"?"width":"height",S=["top","left"].includes(Qr(o)),k=i.reference[d]-i.floating[x]+(S&&((v=l.offset)==null?void 0:v[d])||0)+(S?0:_.crossAxis),T=i.reference[d]+i.reference[x]+(S?0:((y=l.offset)==null?void 0:y[d])||0)-(S?_.crossAxis:0);m<k?m=k:m>T&&(m=T)}return{[f]:h,[d]:m}}}},N5=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:l=()=>{},...s}=Xr(e,t),a=await Ra(t,s),u=Qr(n),c=ts(n),d=ns(n)==="y",{width:f,height:h}=r.floating;let m,g;u==="top"||u==="bottom"?(m=u,g=c===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(g=u,m=c==="end"?"top":"bottom");const _=h-a[m],v=f-a[g],y=!t.middlewareData.shift;let x=_,S=v;if(d){const T=f-a.left-a.right;S=c||y?Bo(v,T):T}else{const T=h-a.top-a.bottom;x=c||y?Bo(_,T):T}if(y&&!c){const T=Sn(a.left,0),b=Sn(a.right,0),N=Sn(a.top,0),D=Sn(a.bottom,0);d?S=f-2*(T!==0||b!==0?T+b:Sn(a.left,a.right)):x=h-2*(N!==0||D!==0?N+D:Sn(a.top,a.bottom))}await l({...t,availableWidth:S,availableHeight:x});const k=await o.getDimensions(i.floating);return f!==k.width||h!==k.height?{reset:{rects:!0}}:{}}}};function Uo(e){return _E(e)?(e.nodeName||"").toLowerCase():"#document"}function bn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ro(e){var t;return(t=(_E(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _E(e){return e instanceof Node||e instanceof bn(e).Node}function Jr(e){return e instanceof Element||e instanceof bn(e).Element}function Tr(e){return e instanceof HTMLElement||e instanceof bn(e).HTMLElement}function A0(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof bn(e).ShadowRoot}function Xa(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Vn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function R5(e){return["table","td","th"].includes(Uo(e))}function Dm(e){const t=Im(),n=Vn(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function P5(e){let t=Ll(e);for(;Tr(t)&&!Md(t);){if(Dm(t))return t;t=Ll(t)}return null}function Im(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Md(e){return["html","body","#document"].includes(Uo(e))}function Vn(e){return bn(e).getComputedStyle(e)}function Ld(e){return Jr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ll(e){if(Uo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||A0(e)&&e.host||ro(e);return A0(t)?t.host:t}function SE(e){const t=Ll(e);return Md(t)?e.ownerDocument?e.ownerDocument.body:e.body:Tr(t)&&Xa(t)?t:SE(t)}function Pa(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=SE(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),l=bn(o);return i?t.concat(l,l.visualViewport||[],Xa(o)?o:[],l.frameElement&&n?Pa(l.frameElement):[]):t.concat(o,Pa(o,[],n))}function EE(e){const t=Vn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Tr(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,s=Gc(n)!==i||Gc(r)!==l;return s&&(n=i,r=l),{width:n,height:r,$:s}}function jm(e){return Jr(e)?e:e.contextElement}function wl(e){const t=jm(e);if(!Tr(t))return Wo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=EE(t);let l=(i?Gc(n.width):n.width)/r,s=(i?Gc(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!s||!Number.isFinite(s))&&(s=1),{x:l,y:s}}const O5=Wo(0);function CE(e){const t=bn(e);return!Im()||!t.visualViewport?O5:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function A5(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==bn(e)?!1:t}function Si(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=jm(e);let l=Wo(1);t&&(r?Jr(r)&&(l=wl(r)):l=wl(e));const s=A5(i,n,r)?CE(i):Wo(0);let a=(o.left+s.x)/l.x,u=(o.top+s.y)/l.y,c=o.width/l.x,d=o.height/l.y;if(i){const f=bn(i),h=r&&Jr(r)?bn(r):r;let m=f.frameElement;for(;m&&r&&h!==f;){const g=wl(m),_=m.getBoundingClientRect(),v=Vn(m),y=_.left+(m.clientLeft+parseFloat(v.paddingLeft))*g.x,x=_.top+(m.clientTop+parseFloat(v.paddingTop))*g.y;a*=g.x,u*=g.y,c*=g.x,d*=g.y,a+=y,u+=x,m=bn(m).frameElement}}return Xc({width:c,height:d,x:a,y:u})}function M5(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Tr(n),i=ro(n);if(n===i)return t;let l={scrollLeft:0,scrollTop:0},s=Wo(1);const a=Wo(0);if((o||!o&&r!=="fixed")&&((Uo(n)!=="body"||Xa(i))&&(l=Ld(n)),Tr(n))){const u=Si(n);s=wl(n),a.x=u.x+n.clientLeft,a.y=u.y+n.clientTop}return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-l.scrollLeft*s.x+a.x,y:t.y*s.y-l.scrollTop*s.y+a.y}}function L5(e){return Array.from(e.getClientRects())}function $E(e){return Si(ro(e)).left+Ld(e).scrollLeft}function D5(e){const t=ro(e),n=Ld(e),r=e.ownerDocument.body,o=Sn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Sn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+$E(e);const s=-n.scrollTop;return Vn(r).direction==="rtl"&&(l+=Sn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:s}}function I5(e,t){const n=bn(e),r=ro(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,s=0,a=0;if(o){i=o.width,l=o.height;const u=Im();(!u||u&&t==="fixed")&&(s=o.offsetLeft,a=o.offsetTop)}return{width:i,height:l,x:s,y:a}}function j5(e,t){const n=Si(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Tr(e)?wl(e):Wo(1),l=e.clientWidth*i.x,s=e.clientHeight*i.y,a=o*i.x,u=r*i.y;return{width:l,height:s,x:a,y:u}}function M0(e,t,n){let r;if(t==="viewport")r=I5(e,n);else if(t==="document")r=D5(ro(e));else if(Jr(t))r=j5(t,n);else{const o=CE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Xc(r)}function kE(e,t){const n=Ll(e);return n===t||!Jr(n)||Md(n)?!1:Vn(n).position==="fixed"||kE(n,t)}function z5(e,t){const n=t.get(e);if(n)return n;let r=Pa(e,[],!1).filter(s=>Jr(s)&&Uo(s)!=="body"),o=null;const i=Vn(e).position==="fixed";let l=i?Ll(e):e;for(;Jr(l)&&!Md(l);){const s=Vn(l),a=Dm(l);!a&&s.position==="fixed"&&(o=null),(i?!a&&!o:!a&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Xa(l)&&!a&&kE(e,l))?r=r.filter(c=>c!==l):o=s,l=Ll(l)}return t.set(e,r),r}function F5(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?z5(t,this._c):[].concat(n),r],s=l[0],a=l.reduce((u,c)=>{const d=M0(t,c,o);return u.top=Sn(d.top,u.top),u.right=Bo(d.right,u.right),u.bottom=Bo(d.bottom,u.bottom),u.left=Sn(d.left,u.left),u},M0(t,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function B5(e){return EE(e)}function W5(e,t,n){const r=Tr(t),o=ro(t),i=n==="fixed",l=Si(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=Wo(0);if(r||!r&&!i)if((Uo(t)!=="body"||Xa(o))&&(s=Ld(t)),r){const u=Si(t,!0,i,t);a.x=u.x+t.clientLeft,a.y=u.y+t.clientTop}else o&&(a.x=$E(o));return{x:l.left+s.scrollLeft-a.x,y:l.top+s.scrollTop-a.y,width:l.width,height:l.height}}function L0(e,t){return!Tr(e)||Vn(e).position==="fixed"?null:t?t(e):e.offsetParent}function bE(e,t){const n=bn(e);if(!Tr(e))return n;let r=L0(e,t);for(;r&&R5(r)&&Vn(r).position==="static";)r=L0(r,t);return r&&(Uo(r)==="html"||Uo(r)==="body"&&Vn(r).position==="static"&&!Dm(r))?n:r||P5(e)||n}const U5=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||bE,i=this.getDimensions;return{reference:W5(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function H5(e){return Vn(e).direction==="rtl"}const V5={convertOffsetParentRelativeRectToViewportRelativeRect:M5,getDocumentElement:ro,getClippingRect:F5,getOffsetParent:bE,getElementRects:U5,getClientRects:L5,getDimensions:B5,getScale:wl,isElement:Jr,isRTL:H5};function K5(e,t){let n=null,r;const o=ro(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function l(s,a){s===void 0&&(s=!1),a===void 0&&(a=1),i();const{left:u,top:c,width:d,height:f}=e.getBoundingClientRect();if(s||t(),!d||!f)return;const h=Ru(c),m=Ru(o.clientWidth-(u+d)),g=Ru(o.clientHeight-(c+f)),_=Ru(u),y={rootMargin:-h+"px "+-m+"px "+-g+"px "+-_+"px",threshold:Sn(0,Bo(1,a))||1};let x=!0;function S(k){const T=k[0].intersectionRatio;if(T!==a){if(!x)return l();T?l(!1,T):r=setTimeout(()=>{l(!1,1e-7)},100)}x=!1}try{n=new IntersectionObserver(S,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(e)}return l(!0),i}function G5(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=jm(e),c=o||i?[...u?Pa(u):[],...Pa(t)]:[];c.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const d=u&&s?K5(u,n):null;let f=-1,h=null;l&&(h=new ResizeObserver(v=>{let[y]=v;y&&y.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{h&&h.observe(t)})),n()}),u&&!a&&h.observe(u),h.observe(t));let m,g=a?Si(e):null;a&&_();function _(){const v=Si(e);g&&(v.x!==g.x||v.y!==g.y||v.width!==g.width||v.height!==g.height)&&n(),g=v,m=requestAnimationFrame(_)}return n(),()=>{c.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),d&&d(),h&&h.disconnect(),h=null,a&&cancelAnimationFrame(m)}}const Y5=(e,t,n)=>{const r=new Map,o={platform:V5,...n},i={...o.platform,_c:r};return S5(e,t,{...o,platform:i})},X5=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?R0({element:r.current,padding:o}).fn(n):{}:r?R0({element:r,padding:o}).fn(n):{}}}};var qu=typeof document<"u"?p.useLayoutEffect:p.useEffect;function Qc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Qc(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Qc(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function TE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function D0(e,t){const n=TE(e);return Math.round(t*n)/n}function I0(e){const t=p.useRef(e);return qu(()=>{t.current=e}),t}function Q5(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:l}={},transform:s=!0,whileElementsMounted:a,open:u}=e,[c,d]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=p.useState(r);Qc(f,r)||h(r);const[m,g]=p.useState(null),[_,v]=p.useState(null),y=p.useCallback(C=>{C!=T.current&&(T.current=C,g(C))},[g]),x=p.useCallback(C=>{C!==b.current&&(b.current=C,v(C))},[v]),S=i||m,k=l||_,T=p.useRef(null),b=p.useRef(null),N=p.useRef(c),D=I0(a),M=I0(o),j=p.useCallback(()=>{if(!T.current||!b.current)return;const C={placement:t,strategy:n,middleware:f};M.current&&(C.platform=M.current),Y5(T.current,b.current,C).then($=>{const E={...$,isPositioned:!0};B.current&&!Qc(N.current,E)&&(N.current=E,Nr.flushSync(()=>{d(E)}))})},[f,t,n,M]);qu(()=>{u===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,d(C=>({...C,isPositioned:!1})))},[u]);const B=p.useRef(!1);qu(()=>(B.current=!0,()=>{B.current=!1}),[]),qu(()=>{if(S&&(T.current=S),k&&(b.current=k),S&&k){if(D.current)return D.current(S,k,j);j()}},[S,k,j,D]);const re=p.useMemo(()=>({reference:T,floating:b,setReference:y,setFloating:x}),[y,x]),V=p.useMemo(()=>({reference:S,floating:k}),[S,k]),Y=p.useMemo(()=>{const C={position:n,left:0,top:0};if(!V.floating)return C;const $=D0(V.floating,c.x),E=D0(V.floating,c.y);return s?{...C,transform:"translate("+$+"px, "+E+"px)",...TE(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:E}},[n,s,V.floating,c.x,c.y]);return p.useMemo(()=>({...c,update:j,refs:re,elements:V,floatingStyles:Y}),[c,j,re,V,Y])}function NE(e){const[t,n]=p.useState(void 0);return Nn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let l,s;if("borderBoxSize"in i){const a=i.borderBoxSize,u=Array.isArray(a)?a[0]:a;l=u.inlineSize,s=u.blockSize}else l=e.offsetWidth,s=e.offsetHeight;n({width:l,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const RE="Popper",[PE,OE]=Ni(RE),[J5,AE]=PE(RE),Z5=e=>{const{__scopePopper:t,children:n}=e,[r,o]=p.useState(null);return p.createElement(J5,{scope:t,anchor:r,onAnchorChange:o},n)},q5="PopperAnchor",e3=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=AE(q5,n),l=p.useRef(null),s=Ze(t,l);return p.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||l.current)}),r?null:p.createElement(Ie.div,te({},o,{ref:s}))}),ME="PopperContent",[t3,dL]=PE(ME),n3=p.forwardRef((e,t)=>{var n,r,o,i,l,s,a,u;const{__scopePopper:c,side:d="bottom",sideOffset:f=0,align:h="center",alignOffset:m=0,arrowPadding:g=0,avoidCollisions:_=!0,collisionBoundary:v=[],collisionPadding:y=0,sticky:x="partial",hideWhenDetached:S=!1,updatePositionStrategy:k="optimized",onPlaced:T,...b}=e,N=AE(ME,c),[D,M]=p.useState(null),j=Ze(t,cn=>M(cn)),[B,re]=p.useState(null),V=NE(B),Y=(n=V==null?void 0:V.width)!==null&&n!==void 0?n:0,C=(r=V==null?void 0:V.height)!==null&&r!==void 0?r:0,$=d+(h!=="center"?"-"+h:""),E=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},O=Array.isArray(v)?v:[v],R=O.length>0,F={padding:E,boundary:O.filter(r3),altBoundary:R},{refs:H,floatingStyles:ae,placement:oe,isPositioned:$e,middlewareData:_e}=Q5({strategy:"fixed",placement:$,whileElementsMounted:(...cn)=>G5(...cn,{animationFrame:k==="always"}),elements:{reference:N.anchor},middleware:[k5({mainAxis:f+C,alignmentAxis:m}),_&&b5({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?T5():void 0,...F}),_&&E5({...F}),N5({...F,apply:({elements:cn,rects:Gn,availableWidth:Re,availableHeight:yt})=>{const{width:qe,height:Yt}=Gn.reference,dn=cn.floating.style;dn.setProperty("--radix-popper-available-width",`${Re}px`),dn.setProperty("--radix-popper-available-height",`${yt}px`),dn.setProperty("--radix-popper-anchor-width",`${qe}px`),dn.setProperty("--radix-popper-anchor-height",`${Yt}px`)}}),B&&X5({element:B,padding:g}),o3({arrowWidth:Y,arrowHeight:C}),S&&C5({strategy:"referenceHidden",...F})]}),[Q,Ne]=LE(oe),ye=Ht(T);Nn(()=>{$e&&(ye==null||ye())},[$e,ye]);const Se=(o=_e.arrow)===null||o===void 0?void 0:o.x,pe=(i=_e.arrow)===null||i===void 0?void 0:i.y,Te=((l=_e.arrow)===null||l===void 0?void 0:l.centerOffset)!==0,[We,At]=p.useState();return Nn(()=>{D&&At(window.getComputedStyle(D).zIndex)},[D]),p.createElement("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...ae,transform:$e?ae.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:We,"--radix-popper-transform-origin":[(s=_e.transformOrigin)===null||s===void 0?void 0:s.x,(a=_e.transformOrigin)===null||a===void 0?void 0:a.y].join(" ")},dir:e.dir},p.createElement(t3,{scope:c,placedSide:Q,onArrowChange:re,arrowX:Se,arrowY:pe,shouldHideArrow:Te},p.createElement(Ie.div,te({"data-side":Q,"data-align":Ne},b,{ref:j,style:{...b.style,animation:$e?void 0:"none",opacity:(u=_e.hide)!==null&&u!==void 0&&u.referenceHidden?0:void 0}}))))});function r3(e){return e!==null}const o3=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,l;const{placement:s,rects:a,middlewareData:u}=t,d=((n=u.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,f=d?0:e.arrowWidth,h=d?0:e.arrowHeight,[m,g]=LE(s),_={start:"0%",center:"50%",end:"100%"}[g],v=((r=(o=u.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+f/2,y=((i=(l=u.arrow)===null||l===void 0?void 0:l.y)!==null&&i!==void 0?i:0)+h/2;let x="",S="";return m==="bottom"?(x=d?_:`${v}px`,S=`${-h}px`):m==="top"?(x=d?_:`${v}px`,S=`${a.floating.height+h}px`):m==="right"?(x=`${-h}px`,S=d?_:`${y}px`):m==="left"&&(x=`${a.floating.width+h}px`,S=d?_:`${y}px`),{data:{x,y:S}}}});function LE(e){const[t,n="center"]=e.split("-");return[t,n]}const i3=Z5,l3=e3,s3=n3,a3=p.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?Tw.createPortal(p.createElement(Ie.div,te({},o,{ref:t})),r):null});function Dl({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=u3({defaultProp:t,onChange:n}),i=e!==void 0,l=i?e:r,s=Ht(n),a=p.useCallback(u=>{if(i){const d=typeof u=="function"?u(e):u;d!==e&&s(d)}else o(u)},[i,e,o,s]);return[l,a]}function u3({defaultProp:e,onChange:t}){const n=p.useState(e),[r]=n,o=p.useRef(r),i=Ht(t);return p.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function DE(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}const c3=p.forwardRef((e,t)=>p.createElement(Ie.span,te({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}})));var d3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Vi=new WeakMap,Pu=new WeakMap,Ou={},zf=0,IE=function(e){return e&&(e.host||IE(e.parentNode))},f3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=IE(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},h3=function(e,t,n,r){var o=f3(t,Array.isArray(e)?e:[e]);Ou[n]||(Ou[n]=new WeakMap);var i=Ou[n],l=[],s=new Set,a=new Set(o),u=function(d){!d||s.has(d)||(s.add(d),u(d.parentNode))};o.forEach(u);var c=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else{var h=f.getAttribute(r),m=h!==null&&h!=="false",g=(Vi.get(f)||0)+1,_=(i.get(f)||0)+1;Vi.set(f,g),i.set(f,_),l.push(f),g===1&&m&&Pu.set(f,!0),_===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}})};return c(t),s.clear(),zf++,function(){l.forEach(function(d){var f=Vi.get(d)-1,h=i.get(d)-1;Vi.set(d,f),i.set(d,h),f||(Pu.has(d)||d.removeAttribute(r),Pu.delete(d)),h||d.removeAttribute(n)}),zf--,zf||(Vi=new WeakMap,Vi=new WeakMap,Pu=new WeakMap,Ou={})}},p3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||d3(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),h3(r,o,n,"aria-hidden")):function(){return null}},yr=function(){return yr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},yr.apply(this,arguments)};function jE(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function g3(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var ec="right-scroll-bar-position",tc="width-before-scroll-bar",m3="with-scroll-bars-hidden",v3="--removed-body-scroll-bar-size";function y3(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function x3(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function w3(e,t){return x3(t||null,function(n){return e.forEach(function(r){return y3(r,n)})})}function _3(e){return e}function S3(e,t){t===void 0&&(t=_3);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var l=t(i,r);return n.push(l),function(){n=n.filter(function(s){return s!==l})}},assignSyncMedium:function(i){for(r=!0;n.length;){var l=n;n=[],l.forEach(i)}n={push:function(s){return i(s)},filter:function(){return n}}},assignMedium:function(i){r=!0;var l=[];if(n.length){var s=n;n=[],s.forEach(i),l=n}var a=function(){var c=l;l=[],c.forEach(i)},u=function(){return Promise.resolve().then(a)};u(),n={push:function(c){l.push(c),u()},filter:function(c){return l=l.filter(c),n}}}};return o}function E3(e){e===void 0&&(e={});var t=S3(null);return t.options=yr({async:!0,ssr:!1},e),t}var zE=function(e){var t=e.sideCar,n=jE(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return p.createElement(r,yr({},n))};zE.isSideCarExport=!0;function C3(e,t){return e.useMedium(t),zE}var FE=E3(),Ff=function(){},Dd=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:Ff,onWheelCapture:Ff,onTouchMoveCapture:Ff}),o=r[0],i=r[1],l=e.forwardProps,s=e.children,a=e.className,u=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,h=e.noIsolation,m=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?"div":_,y=jE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),x=f,S=w3([n,t]),k=yr(yr({},y),o);return p.createElement(p.Fragment,null,c&&p.createElement(x,{sideCar:FE,removeScrollBar:u,shards:d,noIsolation:h,inert:m,setCallbacks:i,allowPinchZoom:!!g,lockRef:n}),l?p.cloneElement(p.Children.only(s),yr(yr({},k),{ref:S})):p.createElement(v,yr({},k,{className:a,ref:S}),s))});Dd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Dd.classNames={fullWidth:tc,zeroRight:ec};var j0,$3=function(){if(j0)return j0;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function k3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=$3();return t&&e.setAttribute("nonce",t),e}function b3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function T3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var N3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=k3())&&(b3(t,n),T3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},R3=function(){var e=N3();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},BE=function(){var e=R3(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},P3={left:0,top:0,right:0,gap:0},Bf=function(e){return parseInt(e||"",10)||0},O3=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Bf(n),Bf(r),Bf(o)]},A3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return P3;var t=O3(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},M3=BE(),L3=function(e,t,n,r){var o=e.left,i=e.top,l=e.right,s=e.gap;return n===void 0&&(n="margin"),`
129
+ `?t.insertParagraph():i===" "?t.insertNodes([de.$createTabNode()]):t.insertText(i);else t.insertRawText(e)};to.$insertGeneratedNodes=kp;to.copyToClipboard=async function(e,t){if(Bi!==null)return!1;if(t!==null)return new Promise(l=>{e.update(()=>{l(d0(e,t))})});var n=e.getRootElement();let r=e._window==null?window.document:e._window.document,o=YS?(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(de.COPY_COMMAND,a=>(xl.objectKlassEquals(a,ClipboardEvent)&&(s(),Bi!==null&&(window.clearTimeout(Bi),Bi=null),l(d0(e,a))),!0),de.COMMAND_PRIORITY_CRITICAL);Bi=window.setTimeout(()=>{s(),Bi=null,l(!1)},50),r.execCommand("copy"),i.remove()})};const hP=to;var pP=hP,Kc=pP,bu=zo,_r=Rt,A=he;function f0(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 Zl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gP=Zl&&"documentMode"in document?document.documentMode:null,mP=Zl&&"InputEvent"in window&&!gP?"getTargetRanges"in new window.InputEvent("input"):!1,vP=Zl&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),yP=Zl&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,xP=Zl&&/^(?=.*Chrome).*/i.test(navigator.userAgent),wP=Zl&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!xP,bp=A.createCommand("DRAG_DROP_PASTE_FILE"),Em=class eE extends A.ElementNode{static getType(){return"quote"}static clone(t){return new eE(t.__key)}constructor(t){super(t)}createDOM(t){let n=document.createElement("blockquote");return _r.addClassNamesToElement(n,t.theme.quote),n}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:_P,priority:0})}}exportDOM(t){if({element:t}=super.exportDOM(t),t&&_r.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=A.$createParagraphNode();let r=this.getDirection();return t.setDirection(r),this.insertAfter(t,n),t}collapseAtStart(){let t=A.$createParagraphNode();return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}};function Cm(){return A.$applyNodeReplacement(new Em)}let $m=class tE extends A.ElementNode{static getType(){return"heading"}static clone(t){return new tE(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&&_r.addClassNamesToElement(r,t[n]),r}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:Wi,priority:0}),h2:()=>({conversion:Wi,priority:0}),h3:()=>({conversion:Wi,priority:0}),h4:()=>({conversion:Wi,priority:0}),h5:()=>({conversion:Wi,priority:0}),h6:()=>({conversion:Wi,priority:0}),p:t=>(t=t.firstChild,t!==null&&h0(t)?{conversion:()=>({node:null}),priority:3}:null),span:t=>h0(t)?{conversion:()=>({node:ul("h1")}),priority:3}:null}}exportDOM(t){if({element:t}=super.exportDOM(t),t&&_r.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=ul(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()?ul(this.getTag()):A.$createParagraphNode();let r=this.getDirection();return t.setDirection(r),this.insertAfter(t,n),t}collapseAtStart(){let t=this.isEmpty()?A.$createParagraphNode():ul(this.getTag());return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}extractWithChild(){return!0}};function h0(e){return e.nodeName.toLowerCase()==="span"?e.style.fontSize==="26pt":!1}function Wi(e){let t=e.nodeName.toLowerCase(),n=null;return(t==="h1"||t==="h2"||t==="h3"||t==="h4"||t==="h5"||t==="h6")&&(n=ul(t),e.style!==null&&n.setFormat(e.style.textAlign)),{node:n}}function _P(e){let t=Cm();return e.style!==null&&t.setFormat(e.style.textAlign),{node:t}}function ul(e){return A.$applyNodeReplacement(new $m(e))}function SP(e,t){e.preventDefault(),t.update(()=>{let n=A.$getSelection(),r=e instanceof InputEvent||e instanceof KeyboardEvent?null:e.clipboardData;r!=null&&(A.$isRangeSelection(n)||A.DEPRECATED_$isGridSelection(n))&&Kc.$insertDataTransferForRichText(r,n,t)},{tag:"paste"})}async function EP(e,t){await Kc.copyToClipboard(t,_r.objectKlassEquals(e,ClipboardEvent)?e:null),t.update(()=>{let n=A.$getSelection();A.$isRangeSelection(n)?n.removeText():A.$isNodeSelection(n)&&n.getNodes().forEach(r=>r.remove())})}function Rs(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 p0(e){var t=A.$getSelection();if(!A.$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=_r.$getNearestBlockElementAncestorOrThrow(r),o=r.getKey(),r.canIndent()&&!n.has(o)&&(n.add(o),e(r)))}return 0<n.size}function Tu(e){return e=A.$getNearestNodeFromDOMNode(e),A.$isDecoratorNode(e)}Ar.$createHeadingNode=ul;Ar.$createQuoteNode=Cm;Ar.$isHeadingNode=function(e){return e instanceof $m};Ar.$isQuoteNode=function(e){return e instanceof Em};Ar.DRAG_DROP_PASTE=bp;Ar.HeadingNode=$m;Ar.QuoteNode=Em;Ar.eventFiles=Rs;Ar.registerRichText=function(e){return _r.mergeRegister(e.registerCommand(A.CLICK_COMMAND,()=>{const t=A.$getSelection();return A.$isNodeSelection(t)?(t.clear(),!0):!1},0),e.registerCommand(A.DELETE_CHARACTER_COMMAND,t=>{const n=A.$getSelection();return A.$isRangeSelection(n)?(n.deleteCharacter(t),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.DELETE_WORD_COMMAND,t=>{const n=A.$getSelection();return A.$isRangeSelection(n)?(n.deleteWord(t),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.DELETE_LINE_COMMAND,t=>{const n=A.$getSelection();return A.$isRangeSelection(n)?(n.deleteLine(t),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.CONTROLLED_TEXT_INSERTION_COMMAND,t=>{const n=A.$getSelection();if(typeof t=="string")A.$isRangeSelection(n)?n.insertText(t):A.DEPRECATED_$isGridSelection(n);else{if(!A.$isRangeSelection(n)&&!A.DEPRECATED_$isGridSelection(n))return!1;const r=t.dataTransfer;r!=null?Kc.$insertDataTransferForRichText(r,n,e):A.$isRangeSelection(n)&&(t=t.data)&&n.insertText(t)}return!0},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.REMOVE_TEXT_COMMAND,()=>{const t=A.$getSelection();return A.$isRangeSelection(t)?(t.removeText(),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.FORMAT_TEXT_COMMAND,t=>{const n=A.$getSelection();return A.$isRangeSelection(n)?(n.formatText(t),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.FORMAT_ELEMENT_COMMAND,t=>{var n=A.$getSelection();if(!A.$isRangeSelection(n)&&!A.$isNodeSelection(n))return!1;n=n.getNodes();for(const r of n)n=_r.$findMatchingParent(r,o=>A.$isElementNode(o)&&!o.isInline()),n!==null&&n.setFormat(t);return!0},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.INSERT_LINE_BREAK_COMMAND,t=>{const n=A.$getSelection();return A.$isRangeSelection(n)?(n.insertLineBreak(t),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.INSERT_PARAGRAPH_COMMAND,()=>{const t=A.$getSelection();return A.$isRangeSelection(t)?(t.insertParagraph(),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.INSERT_TAB_COMMAND,()=>(A.$insertNodes([A.$createTabNode()]),!0),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.INDENT_CONTENT_COMMAND,()=>p0(t=>{const n=t.getIndent();t.setIndent(n+1)}),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.OUTDENT_CONTENT_COMMAND,()=>p0(t=>{const n=t.getIndent();0<n&&t.setIndent(n-1)}),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ARROW_UP_COMMAND,t=>{var n=A.$getSelection();if(A.$isNodeSelection(n)&&!Tu(t.target)){if(t=n.getNodes(),0<t.length)return t[0].selectPrevious(),!0}else if(A.$isRangeSelection(n)&&(n=A.$getAdjacentNode(n.focus,!0),!t.shiftKey&&A.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline()))return n.selectPrevious(),t.preventDefault(),!0;return!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ARROW_DOWN_COMMAND,t=>{var n=A.$getSelection();if(A.$isNodeSelection(n)){if(t=n.getNodes(),0<t.length)return t[0].selectNext(0,0),!0}else if(A.$isRangeSelection(n)){let r=n.focus;if(r.key==="root"&&r.offset===A.$getRoot().getChildrenSize())return t.preventDefault(),!0;if(n=A.$getAdjacentNode(n.focus,!1),!t.shiftKey&&A.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),t.preventDefault(),!0}return!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ARROW_LEFT_COMMAND,t=>{const n=A.$getSelection();if(A.$isNodeSelection(n)){var r=n.getNodes();if(0<r.length)return t.preventDefault(),r[0].selectPrevious(),!0}return A.$isRangeSelection(n)&&bu.$shouldOverrideDefaultCharacterSelection(n,!0)?(r=t.shiftKey,t.preventDefault(),bu.$moveCharacter(n,r,!0),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ARROW_RIGHT_COMMAND,t=>{const n=A.$getSelection();if(A.$isNodeSelection(n)&&!Tu(t.target)){var r=n.getNodes();if(0<r.length)return t.preventDefault(),r[0].selectNext(0,0),!0}return A.$isRangeSelection(n)?(r=t.shiftKey,bu.$shouldOverrideDefaultCharacterSelection(n,!1)?(t.preventDefault(),bu.$moveCharacter(n,r,!1),!0):!1):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_BACKSPACE_COMMAND,t=>{if(Tu(t.target))return!1;const n=A.$getSelection();if(!A.$isRangeSelection(n))return!1;t.preventDefault(),{anchor:t}=n;const r=t.getNode();return n.isCollapsed()&&t.offset===0&&!A.$isRootNode(r)&&0<_r.$getNearestBlockElementAncestorOrThrow(r).getIndent()?e.dispatchCommand(A.OUTDENT_CONTENT_COMMAND,void 0):e.dispatchCommand(A.DELETE_CHARACTER_COMMAND,!0)},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_DELETE_COMMAND,t=>{if(Tu(t.target))return!1;const n=A.$getSelection();return A.$isRangeSelection(n)?(t.preventDefault(),e.dispatchCommand(A.DELETE_CHARACTER_COMMAND,!1)):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ENTER_COMMAND,t=>{const n=A.$getSelection();if(!A.$isRangeSelection(n))return!1;if(t!==null){if((yP||vP||wP)&&mP)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(A.INSERT_LINE_BREAK_COMMAND,!1)}return e.dispatchCommand(A.INSERT_PARAGRAPH_COMMAND,void 0)},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.KEY_ESCAPE_COMMAND,()=>{const t=A.$getSelection();return A.$isRangeSelection(t)?(e.blur(),!0):!1},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.DROP_COMMAND,t=>{const[,n]=Rs(t);if(0<n.length){var r=f0(t.clientX,t.clientY);if(r!==null){const{offset:i,node:l}=r;var o=A.$getNearestNodeFromDOMNode(l);if(o!==null){if(r=A.$createRangeSelection(),A.$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=A.$normalizeSelection__EXPERIMENTAL(r),A.$setSelection(r)}e.dispatchCommand(bp,n)}return t.preventDefault(),!0}return t=A.$getSelection(),!!A.$isRangeSelection(t)},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.DRAGSTART_COMMAND,t=>{[t]=Rs(t);const n=A.$getSelection();return!(t&&!A.$isRangeSelection(n))},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.DRAGOVER_COMMAND,t=>{var[n]=Rs(t);const r=A.$getSelection();return n&&!A.$isRangeSelection(r)?!1:(n=f0(t.clientX,t.clientY),n!==null&&(n=A.$getNearestNodeFromDOMNode(n.node),A.$isDecoratorNode(n)&&t.preventDefault()),!0)},A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.SELECT_ALL_COMMAND,()=>(A.$selectAll(),!0),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.COPY_COMMAND,t=>(Kc.copyToClipboard(e,_r.objectKlassEquals(t,ClipboardEvent)?t:null),!0),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.CUT_COMMAND,t=>(EP(t,e),!0),A.COMMAND_PRIORITY_EDITOR),e.registerCommand(A.PASTE_COMMAND,t=>{const[,n,r]=Rs(t);if(0<n.length&&!r)return e.dispatchCommand(bp,n),!0;if(A.isSelectionCapturedInDecoratorInput(t.target))return!1;const o=A.$getSelection();return A.$isRangeSelection(o)||A.DEPRECATED_$isGridSelection(o)?(SP(t,e),!0):!1},A.COMMAND_PRIORITY_EDITOR))};const CP=Ar;var Js=CP,nE=dr,$P=rP,zn=p,kP=iP,rE=Rt,g0=Nr,bP=sP,TP=Js,km=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?zn.useLayoutEffect:zn.useEffect;function m0(e){return e.getEditorState().read(kP.$canShowPlaceholderCurry(e.isComposing()))}function NP(e){let[t,n]=zn.useState(()=>m0(e));return km(()=>{function r(){let o=m0(e);n(o)}return r(),rE.mergeRegister(e.registerUpdateListener(()=>{r()}),e.registerEditableListener(()=>{r()}))},[e]),t}function RP(e,t){let[n,r]=zn.useState(()=>e.getDecorators());return km(()=>e.registerDecoratorListener(o=>{g0.flushSync(()=>{r(o)})}),[e]),zn.useEffect(()=>{r(e.getDecorators())},[e]),zn.useMemo(()=>{let o=[],i=Object.keys(n);for(let l=0;l<i.length;l++){let s=i[l],a=zn.createElement(t,{onError:c=>e._onError(c)},zn.createElement(zn.Suspense,{fallback:null},n[s])),u=e.getElementByKey(s);u!==null&&o.push(g0.createPortal(a,u,s))}return o},[t,n,e])}function PP(e){km(()=>rE.mergeRegister(TP.registerRichText(e),bP.registerDragonSupport(e)),[e])}function OP({content:e}){var[t]=nE.useLexicalComposerContext();t=NP(t);let n=$P();return t?typeof e=="function"?e(n):e:null}FS.RichTextPlugin=function({contentEditable:e,placeholder:t,ErrorBoundary:n}){let[r]=nE.useLexicalComposerContext();return n=RP(r,n),PP(r),zn.createElement(zn.Fragment,null,e,zn.createElement(OP,{content:t}),n)};const AP=FS;var MP=AP,oE={},Ir=yo,LP=dr,iE=p,DP=Rt,vs=he;function IP(e){iE.useEffect(()=>DP.mergeRegister(e.registerCommand(Ir.INSERT_ORDERED_LIST_COMMAND,()=>(Ir.insertList(e,"number"),!0),vs.COMMAND_PRIORITY_LOW),e.registerCommand(Ir.INSERT_UNORDERED_LIST_COMMAND,()=>(Ir.insertList(e,"bullet"),!0),vs.COMMAND_PRIORITY_LOW),e.registerCommand(Ir.REMOVE_LIST_COMMAND,()=>(Ir.removeList(e),!0),vs.COMMAND_PRIORITY_LOW),e.registerCommand(vs.INSERT_PARAGRAPH_COMMAND,()=>!!Ir.$handleListInsertParagraph(),vs.COMMAND_PRIORITY_LOW)),[e])}oE.ListPlugin=function(){let[e]=LP.useLexicalComposerContext();return iE.useEffect(()=>{if(!e.hasNodes([Ir.ListNode,Ir.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[e]),IP(e),null};const jP=oE;var zP=jP,lE={},no={},sE=Rt,$r=he;let FP=new Set(["http:","https:","mailto:","sms:","tel:"]);class ql extends $r.ElementNode{static getType(){return"link"}static clone(t){return new ql(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),sE.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:BP,priority:1})}}static importJSON(t){let n=Na(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(!FP.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),$r.$isElementNode(t)?(n=Na(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(!$r.$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 BP(e){let t=null;if(sE.isHTMLAnchorElement(e)){let n=e.textContent;n!==null&&n!==""&&(t=Na(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function Na(e,t){return $r.$applyNodeReplacement(new ql(e,t))}function ti(e){return e instanceof ql}class Ga extends ql{static getType(){return"autolink"}static clone(t){return new Ga(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}static importJSON(t){let n=Tp(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),$r.$isElementNode(t)?(n=Tp(this.__url,{rel:this._rel,target:this.__target,title:this.__title}),t.append(n),n):null}}function Tp(e,t){return $r.$applyNodeReplacement(new Ga(e,t))}let WP=$r.createCommand("TOGGLE_LINK_COMMAND");function UP(e,t){for(;e!==null&&(e=e.getParent())!==null&&!t(e););return e}no.$createAutoLinkNode=Tp;no.$createLinkNode=Na;no.$isAutoLinkNode=function(e){return e instanceof Ga};no.$isLinkNode=ti;no.AutoLinkNode=Ga;no.LinkNode=ql;no.TOGGLE_LINK_COMMAND=WP;no.toggleLink=function(e,t={}){let{target:n,title:r}=t,o=t.rel===void 0?"noreferrer":t.rel;if(t=$r.$getSelection(),$r.$isRangeSelection(t))if(t=t.extract(),e===null)t.forEach(l=>{if(l=l.getParent(),ti(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=ti(i)?i:UP(i,ti),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&&(!$r.$isElementNode(a)||a.isInline()))if(ti(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=Na(e,{rel:o,target:n}),ti(u)?a.getPreviousSibling()===null?u.insertBefore(s):u.insertAfter(s):a.insertBefore(s)),ti(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 HP=no;var Ml=HP,Ui=Ml,VP=dr,KP=Rt,Hi=he,GP=p;lE.LinkPlugin=function({validateUrl:e}){let[t]=VP.useLexicalComposerContext();return GP.useEffect(()=>{if(!t.hasNodes([Ui.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return KP.mergeRegister(t.registerCommand(Ui.TOGGLE_LINK_COMMAND,n=>{if(n===null)return Ui.toggleLink(n),!0;if(typeof n=="string")return e===void 0||e(n)?(Ui.toggleLink(n),!0):!1;let{url:r,target:o,rel:i,title:l}=n;return Ui.toggleLink(r,{rel:i,target:o,title:l}),!0},Hi.COMMAND_PRIORITY_LOW),e!==void 0?t.registerCommand(Hi.PASTE_COMMAND,n=>{let r=Hi.$getSelection();if(!Hi.$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=>Hi.$isElementNode(i))?!1:(t.dispatchCommand(Ui.TOGGLE_LINK_COMMAND,o),n.preventDefault(),!0):!1},Hi.COMMAND_PRIORITY_LOW):()=>{})},[t,e]),null};const YP=lE;var XP=YP;function QP({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:m=!0,style:g,tabIndex:_,"data-testid":v,...y}){const[x]=dr.useLexicalComposerContext(),[S,k]=p.useState(!1),T=p.useCallback(b=>{var D;x.setRootElement(b);const N=(D=document.getElementById("val-ui"))==null?void 0:D.shadowRoot;if(N&&"getSelection"in N){x._window=N;return}},[x]);return p.useLayoutEffect(()=>(k(x.isEditable()),x.registerEditableListener(b=>{k(b)})),[x]),w.jsx("div",{...y,"aria-activedescendant":S?e:void 0,"aria-autocomplete":S?t:"none","aria-controls":S?n:void 0,"aria-describedby":r,"aria-expanded":S&&h==="combobox"?!!o:void 0,"aria-label":i,"aria-labelledby":l,"aria-multiline":s,"aria-owns":S?a:void 0,"aria-readonly":S?void 0:!0,"aria-required":u,autoCapitalize:c,className:d,contentEditable:S,"data-testid":v,id:f,ref:T,role:h,spellCheck:m,style:g,tabIndex:_})}function JP({className:e}){return w.jsx(QP,{className:e})}class Ya extends he.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 Ya({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 aE(t)}createDOM(){return document.createElement("div")}updateDOM(){return!1}decorate(){return w.jsx(ZP,{src:this.__src,altText:this.__altText,empty:this.__empty,height:this.__height,nodeKey:this.getKey()})}}function ZP(e){return w.jsx("img",{src:e.src})}function aE(e){return new Ya(e)}function qP(){const[e]=dr.useLexicalComposerContext();return p.useEffect(()=>{e.focus()},[e]),null}const uE=he.createCommand("INSERT_IMAGE_COMMAND");function eO(){const[e]=dr.useLexicalComposerContext();return p.useEffect(()=>{if(!e.hasNodes([Ya]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Rt.mergeRegister(e.registerCommand(uE,t=>{const n=aE(t);return he.$insertNodes([n]),he.$isRootOrShadowRoot(n.getParentOrThrow())&&Rt.$wrapNodeInElement(n,he.$createParagraphNode).selectEnd(),!0},he.COMMAND_PRIORITY_EDITOR))},[e]),null}const tO=({className:e})=>w.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:[w.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),w.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]}),nO=tO,rO=({className:e})=>w.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:[w.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),w.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),w.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]}),oO=rO,iO=({className:e})=>w.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:w.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"})}),lO=iO,sO=({variant:e="primary",onClick:t,children:n,icon:r,disabled:o=!1})=>w.jsx("button",{disabled:o,className:vd("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:w.jsxs("span",{className:"flex flex-row items-center justify-center gap-2",children:[r&&r,n]})}),ni=sO,aO=({className:e})=>w.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",className:e,children:[w.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"}),w.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"})]}),uO=aO,cE=ee.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 bm(){return ee.useContext(cE)}const cO=({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}=bm(),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)}},[]),w.jsx("div",{className:"text-[12px]",ref:l,children:w.jsx(ni,{onClick:f=>{f.preventDefault(),c()},icon:w.jsx(uO,{className:`rotate-[-90deg] transition-transform duration-150 ease-in-out ${o?"":"rotate-[90deg]"}`}),children:w.jsxs("div",{className:"relative",children:[w.jsxs("span",{className:"flex flex-row items-center justify-center gap-1",children:[n,r&&r]}),o&&w.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:w.jsx("div",{className:"flex flex-col ",children:e==null?void 0:e.map((f,h)=>w.jsx("button",{onClick:m=>{m.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))})})]})})})},dO=cO,fO=new TextEncoder;function dE(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 $n.getSHA256Hash(fO.encode(l));if(s.naturalWidth&&s.naturalHeight){const u=Yg(l);t({src:l,width:s.naturalWidth,height:s.naturalHeight,filename:r==null?void 0:r.name,sha256:a,mimeType:u,fileExt:u&&Xg(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 fE(e){const t=e.anchor,n=e.focus,r=e.anchor.getNode(),o=e.focus.getNode();return r===o?r:e.isBackward()?zo.$isAtNodeEnd(n)?r:o:zo.$isAtNodeEnd(t)?r:o}function hO(){const[e]=dr.useLexicalComposerContext();return p.useEffect(()=>Rt.mergeRegister(e.registerCommand(he.CLICK_COMMAND,t=>{const n=he.$getSelection();if(he.$isRangeSelection(n)){const r=fE(n),o=Rt.$findMatchingParent(r,Ml.$isLinkNode);if(Ml.$isLinkNode(o)&&(t.metaKey||t.ctrlKey))return window.open(o.getURL(),"_blank"),!0}return!1},he.COMMAND_PRIORITY_LOW)),[]),null}var hE={exports:{}},pO="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",gO=pO,mO=gO;function pE(){}function gE(){}gE.resetWarningCache=pE;var vO=function(){function e(r,o,i,l,s,a){if(a!==mO){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:gE,resetWarningCache:pE};return n.PropTypes=n,n};hE.exports=vO();var yO=hE.exports;const Bn=La(yO);function Np(){return Np=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},Np.apply(this,arguments)}function xO(e,t){if(e==null)return{};var n=wO(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 wO(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 Tm=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=xO(e,["color","size"]);return ee.createElement("svg",Np({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),ee.createElement("polyline",{points:"20 6 9 17 4 12"}))});Tm.propTypes={color:Bn.string,size:Bn.oneOfType([Bn.string,Bn.number])};Tm.displayName="Check";const _O=Tm;function Rp(){return Rp=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},Rp.apply(this,arguments)}function SO(e,t){if(e==null)return{};var n=EO(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 EO(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 Nm=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=SO(e,["color","size"]);return ee.createElement("svg",Rp({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),ee.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"}),ee.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"}))});Nm.propTypes={color:Bn.string,size:Bn.oneOfType([Bn.string,Bn.number])};Nm.displayName="Link";const CO=Nm;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 $O(e,t){if(e==null)return{};var n=kO(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 kO(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 Rm=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=$O(e,["color","size"]);return ee.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),ee.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ee.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))});Rm.propTypes={color:Bn.string,size:Bn.oneOfType([Bn.string,Bn.number])};Rm.displayName="X";const bO=Rm,TO=({fontSizes:e,fontsFamilies:t,onEditor:n,colors:r})=>{const[o]=dr.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,m]=p.useState(!1),[g,_]=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[x,S]=p.useState(null),k=M=>{o.dispatchCommand(Ml.TOGGLE_LINK_COMMAND,M)},T={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"},b={};for(const M in T)b[T[M]]=M;const N=p.useCallback(()=>{const M=he.$getSelection();if(he.$isRangeSelection(M)){const j=M.anchor.getNode();let B=j.getKey()==="root"?j:Rt.$findMatchingParent(j,$=>{const E=$.getParent();return E!==null&&he.$isRootOrShadowRoot(E)});B===null&&(B=j.getTopLevelElementOrThrow());const re=fE(M),V=Rt.$findMatchingParent(re,Ml.$isLinkNode);if(V!==null){const $=V.getURL();S($)}else S(null);const Y=B.getKey(),C=i.getElementByKey(Y);if(c(M.hasFormat("bold")),f(M.hasFormat("italic")),m(M.hasFormat("strikethrough")),_(M.hasFormat("underline")),C!==null)if(a(Y),yo.$isListNode(B)){const $=Rt.$getNearestNodeOfType(j,yo.ListNode),E=$?$.getListType():B.getListType();y(E)}else{const $=Js.$isHeadingNode(B)?B.getTag():B.getType();$ in T&&y($)}}},[i]);p.useEffect(()=>Rt.mergeRegister(o.registerUpdateListener(({editorState:M})=>{M.read(()=>{N()})})),[N,i,o]),p.useEffect(()=>o.registerCommand(he.SELECTION_CHANGE_COMMAND,(M,j)=>(N(),l(j),!1),he.COMMAND_PRIORITY_CRITICAL),[o,N]);const D=M=>{["h1","h2","h3","h4","h5","h6"].includes(M)?v!==M&&o.update(()=>{const j=he.$getSelection();he.$isRangeSelection(j)&&zo.$setBlocksType(j,()=>Js.$createHeadingNode(M))}):M==="paragraph"&&v!=="paragraph"?o.update(()=>{const j=he.$getSelection();(he.$isRangeSelection(j)||he.DEPRECATED_$isGridSelection(j))&&zo.$setBlocksType(j,()=>he.$createParagraphNode())}):M==="number"&&v!=="number"?o.dispatchCommand(yo.INSERT_ORDERED_LIST_COMMAND,void 0):M==="bullet"&&v!=="bullet"?o.dispatchCommand(yo.INSERT_UNORDERED_LIST_COMMAND,void 0):o.dispatchCommand(yo.REMOVE_LIST_COMMAND,void 0)};return p.useCallback(()=>{o.update(()=>{const M=he.$getSelection();if(he.$isRangeSelection(M)){const j=M.anchor,B=M.focus,re=M.getNodes();if(j.key===B.key&&j.offset===B.offset)return;re.forEach((V,Y)=>{he.$isTextNode(V)?(Y===0&&j.offset!==0&&(V=V.splitText(j.offset)[1]||V),Y===re.length-1&&(V=V.splitText(B.offset)[0]||V),V.__style!==""&&V.setStyle(""),V.__format!==0&&(V.setFormat(0),Rt.$getNearestBlockElementAncestorOrThrow(V).setFormat(""))):Js.$isHeadingNode(V)&&V.replace(he.$createParagraphNode(),!0)})}})},[i]),w.jsxs("div",{className:"sticky top-0 border-b bg-background border-highlight flex flex-col",children:[w.jsxs("div",{className:"flex flex-row gap-1",children:[w.jsx(dO,{options:Object.values(T),label:T[v]??v+" (not supported)",onChange:M=>{D(b[M])}}),w.jsx(ni,{variant:"primary",onClick:M=>{M.preventDefault(),o.dispatchCommand(he.FORMAT_TEXT_COMMAND,"bold")},active:u,icon:w.jsx(nO,{className:`${u&&"stroke-[3px]"}`})}),w.jsx(ni,{active:h,onClick:M=>{M.preventDefault(),o.dispatchCommand(he.FORMAT_TEXT_COMMAND,"strikethrough")},icon:w.jsx(lO,{className:`${h&&"stroke-[2px]"}`})}),w.jsx(ni,{active:d,onClick:M=>{M.preventDefault(),o.dispatchCommand(he.FORMAT_TEXT_COMMAND,"italic")},icon:w.jsx(oO,{className:`${d&&"stroke-[3px]"}`})}),w.jsx(ni,{active:x!==null,onClick:M=>{M.preventDefault(),S(""),k("")},icon:w.jsx(CO,{width:12,height:12,className:`${x!==null&&"stroke-[3px]"}`})}),w.jsxs("label",{className:"flex items-center justify-center cursor-pointer",children:[w.jsx(l_,{}),w.jsx("input",{type:"file",hidden:!0,onChange:M=>{M.preventDefault(),dE(M).then(j=>{o.dispatchCommand(uE,{...j})}).catch(j=>{console.error("Error reading image",j)})}})]})]}),x!==null&&w.jsxs("div",{className:"flex flex-row p-2",children:[w.jsx("input",{type:"text",placeholder:"Enter URL",className:"w-1/3 text-primary bg-background px-2",value:x,onChange:M=>{M.preventDefault(),S(M.target.value)}}),w.jsx(ni,{variant:"primary",onClick:M=>{M.preventDefault(),k(x||null)},icon:w.jsx(_O,{size:14})}),w.jsx(ni,{variant:"primary",onClick:M=>{M.preventDefault(),k(null)},icon:w.jsx(bO,{size:14})})]})]})},NO=TO;function RO(e){console.error(e)}const PO=28,OO=({richtext:e,onEditor:t})=>{const{windowSize:n}=bm(),o={namespace:"val",editorState:i=>{i.setEditorState(i.parseEditorState({root:_2(v_(e))}))},nodes:[Js.HeadingNode,Ya,yo.ListNode,yo.ListItemNode,Ml.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:RO};return w.jsxs(MR.LexicalComposer,{initialConfig:o,children:[w.jsx(qP,{}),w.jsx(NO,{onEditor:t}),w.jsx(MP.RichTextPlugin,{contentEditable:w.jsx("div",{className:"font-sans border-b text-primary border-highlight",style:{minHeight:n!=null&&n.innerHeight?(n==null?void 0:n.innerHeight)-PO:void 0},children:w.jsx(JP,{className:"p-4 outline-none bg-fill"})}),placeholder:w.jsx("div",{className:"",children:"Enter some text..."}),ErrorBoundary:BR}),w.jsx(XP.LinkPlugin,{}),w.jsx(hO,{}),w.jsx(zP.ListPlugin,{}),w.jsx(eO,{}),w.jsx(QR.HistoryPlugin,{})]})};var AO={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 MO=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),An=(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,...AO,width:o,height:o,stroke:r,strokeWidth:l?Number(i)*24/Number(o):i,className:`lucide lucide-${MO(e)}`,...a},[...t.map(([c,d])=>p.createElement(c,d)),...(Array.isArray(s)?s:[s])||[]]));return n.displayName=`${e}`,n},LO=An("Check",[["polyline",{points:"20 6 9 17 4 12",key:"10jjfj"}]]),mE=An("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),DO=An("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),v0=An("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"}]]),IO=An("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"}]]),jO=An("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"}]]),zO=An("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),FO=An("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]),BO=An("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]),WO=An("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),UO=An("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]),HO=An("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"}]]),VO=An("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Pm="p-1 border rounded-full shadow border-accent",y0="valbuild:urlBeforeNavigation";function KO({api:e}){const{theme:t,setTheme:n,editMode:r,setEditMode:o,session:i}=bm();if(i.status==="success"&&i.data.mode==="unauthorized")return w.jsxs(x0,{href:e.getLoginUrl(window.location.href),children:[w.jsx("span",{children:"Login"}),w.jsx(v0,{size:18})]});if(i.status==="success"&&!i.data.enabled)return w.jsxs(x0,{href:e.getEnableUrl(window.location.href),children:[w.jsx("span",{children:"Enable"}),w.jsx(v0,{size:18})]});const[l,s]=p.useState();return p.useEffect(()=>{i.status==="success"&&i.data.mode==="proxy"&&e.getPatches({}).then(a=>{if(Fs.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]),w.jsxs(GO,{children:[w.jsx(Nu,{active:r==="hover",onClick:()=>{o(a=>a==="hover"?"off":"hover")},children:w.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:r==="hover"?w.jsx(FO,{size:18}):w.jsx(BO,{size:18})})}),w.jsx(Nu,{onClick:()=>{n(t==="dark"?"light":"dark")},children:w.jsxs("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:[t==="dark"&&w.jsx(HO,{size:15}),t==="light"&&w.jsx(zO,{size:15})]})}),w.jsx(Nu,{active:r==="full",onClick:()=>{if(r!=="full")localStorage.setItem(y0,window.location.href),window.location.href=e.getEditUrl();else if(r==="full"){const a=localStorage.getItem(y0);window.location.href=a||"/"}},children:w.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:r==="full"?w.jsx(jO,{size:15}):w.jsx(IO,{size:15})})}),l&&w.jsx(Nu,{onClick:()=>{},children:w.jsxs("div",{className:"relative h-[24px] w-[24px] flex justify-center items-center",children:[w.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}),w.jsx(UO,{size:18})]})}),w.jsx("a",{className:Pm,href:e.getDisableUrl(window.location.href),children:w.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:w.jsx(WO,{size:18})})})]})}function x0({href:e,children:t}){return w.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:w.jsx("a",{className:Pm,href:e,children:w.jsx("div",{className:"flex items-center justify-center px-2 gap-x-2",children:t})})})}function GO({children:e}){return w.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 Nu({active:e,onClick:t,children:n}){return w.jsx("button",{className:vd(Pm,{"bg-accent drop-shadow-[0px_0px_12px_rgba(56,205,152,0.60)]":e}),onClick:t,children:n})}function YO(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 w0=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,_0=qw,XO=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return _0(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=w0(c)||w0(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(m=>{let[g,_]=m;return Array.isArray(_)?_.includes({...i,...s}[g]):{...i,...s}[g]===_})?[...u,d,f]:u},[]);return _0(e,l,a,n==null?void 0:n.class,n==null?void 0:n.className)},QO=XO("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"}}),es=p.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const l=r?Rl:"button";return w.jsx(l,{className:ut(QO({variant:t,size:n,className:e})),ref:i,...o})});es.displayName="Button";const Om=p.forwardRef(({className:e,type:t,...n},r)=>w.jsx("input",{type:t,className:ut("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Om.displayName="Input";function vE(e){const t=e+"CollectionProvider",[n,r]=Ni(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=h=>{const{scope:m,children:g}=h,_=ee.useRef(null),v=ee.useRef(new Map).current;return ee.createElement(o,{scope:m,itemMap:v,collectionRef:_},g)},s=e+"CollectionSlot",a=ee.forwardRef((h,m)=>{const{scope:g,children:_}=h,v=i(s,g),y=Ze(m,v.collectionRef);return ee.createElement(Rl,{ref:y},_)}),u=e+"CollectionItemSlot",c="data-radix-collection-item",d=ee.forwardRef((h,m)=>{const{scope:g,children:_,...v}=h,y=ee.useRef(null),x=Ze(m,y),S=i(u,g);return ee.useEffect(()=>(S.itemMap.set(y,{ref:y,...v}),()=>void S.itemMap.delete(y))),ee.createElement(Rl,{[c]:"",ref:x},_)});function f(h){const m=i(e+"CollectionConsumer",h);return ee.useCallback(()=>{const _=m.collectionRef.current;if(!_)return[];const v=Array.from(_.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((S,k)=>v.indexOf(S.ref.current)-v.indexOf(k.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:l,Slot:a,ItemSlot:d},f,r]}function JO(e,t=globalThis==null?void 0:globalThis.document){const n=Ht(e);p.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const Op="dismissableLayer.update",ZO="dismissableLayer.pointerDownOutside",qO="dismissableLayer.focusOutside";let S0;const e5=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),t5=p.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:s,onDismiss:a,...u}=e,c=p.useContext(e5),[d,f]=p.useState(null),h=(n=d==null?void 0:d.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,m]=p.useState({}),g=Ze(t,N=>f(N)),_=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=_.indexOf(v),x=d?_.indexOf(d):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,k=x>=y,T=n5(N=>{const D=N.target,M=[...c.branches].some(j=>j.contains(D));!k||M||(i==null||i(N),s==null||s(N),N.defaultPrevented||a==null||a())},h),b=r5(N=>{const D=N.target;[...c.branches].some(j=>j.contains(D))||(l==null||l(N),s==null||s(N),N.defaultPrevented||a==null||a())},h);return JO(N=>{x===c.layers.size-1&&(o==null||o(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},h),p.useEffect(()=>{if(d)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(S0=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),E0(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=S0)}},[d,h,r,c]),p.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),E0())},[d,c]),p.useEffect(()=>{const N=()=>m({});return document.addEventListener(Op,N),()=>document.removeEventListener(Op,N)},[]),p.createElement(Ie.div,te({},u,{ref:g,style:{pointerEvents:S?k?"auto":"none":void 0,...e.style},onFocusCapture:Ge(e.onFocusCapture,b.onFocusCapture),onBlurCapture:Ge(e.onBlurCapture,b.onBlurCapture),onPointerDownCapture:Ge(e.onPointerDownCapture,T.onPointerDownCapture)}))});function n5(e,t=globalThis==null?void 0:globalThis.document){const n=Ht(e),r=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const i=s=>{if(s.target&&!r.current){let c=function(){yE(ZO,n,u,{discrete:!0})};var a=c;const u={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function r5(e,t=globalThis==null?void 0:globalThis.document){const n=Ht(e),r=p.useRef(!1);return p.useEffect(()=>{const o=i=>{i.target&&!r.current&&yE(qO,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function E0(){const e=new CustomEvent(Op);document.dispatchEvent(e)}function yE(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?IT(o,i):o.dispatchEvent(i)}let Df=0;function o5(){p.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:C0()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:C0()),Df++,()=>{Df===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Df--}},[])}function C0(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}const If="focusScope.autoFocusOnMount",jf="focusScope.autoFocusOnUnmount",$0={bubbles:!1,cancelable:!0},i5=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...l}=e,[s,a]=p.useState(null),u=Ht(o),c=Ht(i),d=p.useRef(null),f=Ze(t,g=>a(g)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let y=function(T){if(h.paused||!s)return;const b=T.target;s.contains(b)?d.current=b:co(d.current,{select:!0})},x=function(T){if(h.paused||!s)return;const b=T.relatedTarget;b!==null&&(s.contains(b)||co(d.current,{select:!0}))},S=function(T){if(document.activeElement===document.body)for(const N of T)N.removedNodes.length>0&&co(s)};var g=y,_=x,v=S;document.addEventListener("focusin",y),document.addEventListener("focusout",x);const k=new MutationObserver(S);return s&&k.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),k.disconnect()}}},[r,s,h.paused]),p.useEffect(()=>{if(s){b0.add(h);const g=document.activeElement;if(!s.contains(g)){const v=new CustomEvent(If,$0);s.addEventListener(If,u),s.dispatchEvent(v),v.defaultPrevented||(l5(d5(xE(s)),{select:!0}),document.activeElement===g&&co(s))}return()=>{s.removeEventListener(If,u),setTimeout(()=>{const v=new CustomEvent(jf,$0);s.addEventListener(jf,c),s.dispatchEvent(v),v.defaultPrevented||co(g??document.body,{select:!0}),s.removeEventListener(jf,c),b0.remove(h)},0)}}},[s,u,c,h]);const m=p.useCallback(g=>{if(!n&&!r||h.paused)return;const _=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(_&&v){const y=g.currentTarget,[x,S]=s5(y);x&&S?!g.shiftKey&&v===S?(g.preventDefault(),n&&co(x,{select:!0})):g.shiftKey&&v===x&&(g.preventDefault(),n&&co(S,{select:!0})):v===y&&g.preventDefault()}},[n,r,h.paused]);return p.createElement(Ie.div,te({tabIndex:-1},l,{ref:f,onKeyDown:m}))});function l5(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(co(r,{select:t}),document.activeElement!==n)return}function s5(e){const t=xE(e),n=k0(t,e),r=k0(t.reverse(),e);return[n,r]}function xE(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function k0(e,t){for(const n of e)if(!a5(n,{upTo:t}))return n}function a5(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function u5(e){return e instanceof HTMLInputElement&&"select"in e}function co(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&u5(e)&&t&&e.select()}}const b0=c5();function c5(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=T0(e,t),e.unshift(t)},remove(t){var n;e=T0(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function T0(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function d5(e){return e.filter(t=>t.tagName!=="A")}const f5=C1.useId||(()=>{});let h5=0;function Ad(e){const[t,n]=p.useState(f5());return Nn(()=>{e||n(r=>r??String(h5++))},[e]),e||(t?`radix-${t}`:"")}const p5=["top","right","bottom","left"],Bo=Math.min,Sn=Math.max,Gc=Math.round,Ru=Math.floor,Wo=e=>({x:e,y:e}),g5={left:"right",right:"left",bottom:"top",top:"bottom"},m5={start:"end",end:"start"};function Ap(e,t,n){return Sn(e,Bo(t,n))}function Xr(e,t){return typeof e=="function"?e(t):e}function Qr(e){return e.split("-")[0]}function ts(e){return e.split("-")[1]}function Am(e){return e==="x"?"y":"x"}function Mm(e){return e==="y"?"height":"width"}function ns(e){return["top","bottom"].includes(Qr(e))?"y":"x"}function Lm(e){return Am(ns(e))}function v5(e,t,n){n===void 0&&(n=!1);const r=ts(e),o=Lm(e),i=Mm(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=Yc(l)),[l,Yc(l)]}function y5(e){const t=Yc(e);return[Mp(e),t,Mp(t)]}function Mp(e){return e.replace(/start|end/g,t=>m5[t])}function x5(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}function w5(e,t,n,r){const o=ts(e);let i=x5(Qr(e),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),t&&(i=i.concat(i.map(Mp)))),i}function Yc(e){return e.replace(/left|right|bottom|top/g,t=>g5[t])}function _5(e){return{top:0,right:0,bottom:0,left:0,...e}}function wE(e){return typeof e!="number"?_5(e):{top:e,right:e,bottom:e,left:e}}function Xc(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function N0(e,t,n){let{reference:r,floating:o}=e;const i=ns(t),l=Lm(t),s=Mm(l),a=Qr(t),u=i==="y",c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[s]/2-o[s]/2;let h;switch(a){case"top":h={x:c,y:r.y-o.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(ts(t)){case"start":h[l]-=f*(n&&u?-1:1);break;case"end":h[l]+=f*(n&&u?-1:1);break}return h}const S5=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,s=i.filter(Boolean),a=await(l.isRTL==null?void 0:l.isRTL(t));let u=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=N0(u,r,a),f=r,h={},m=0;for(let g=0;g<s.length;g++){const{name:_,fn:v}=s[g],{x:y,y:x,data:S,reset:k}=await v({x:c,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:u,platform:l,elements:{reference:e,floating:t}});if(c=y??c,d=x??d,h={...h,[_]:{...h[_],...S}},k&&m<=50){m++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(u=k.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:c,y:d}=N0(u,f,a)),g=-1;continue}}return{x:c,y:d,placement:f,strategy:o,middlewareData:h}};async function Ra(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:l,elements:s,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Xr(t,e),m=wE(h),_=s[f?d==="floating"?"reference":"floating":d],v=Xc(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(_)))==null||n?_:_.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:a})),y=d==="floating"?{...l.floating,x:r,y:o}:l.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),S=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},k=Xc(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:x,strategy:a}):y);return{top:(v.top-k.top+m.top)/S.y,bottom:(k.bottom-v.bottom+m.bottom)/S.y,left:(v.left-k.left+m.left)/S.x,right:(k.right-v.right+m.right)/S.x}}const R0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:s,middlewareData:a}=t,{element:u,padding:c=0}=Xr(e,t)||{};if(u==null)return{};const d=wE(c),f={x:n,y:r},h=Lm(o),m=Mm(h),g=await l.getDimensions(u),_=h==="y",v=_?"top":"left",y=_?"bottom":"right",x=_?"clientHeight":"clientWidth",S=i.reference[m]+i.reference[h]-f[h]-i.floating[m],k=f[h]-i.reference[h],T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u));let b=T?T[x]:0;(!b||!await(l.isElement==null?void 0:l.isElement(T)))&&(b=s.floating[x]||i.floating[m]);const N=S/2-k/2,D=b/2-g[m]/2-1,M=Bo(d[v],D),j=Bo(d[y],D),B=M,re=b-g[m]-j,V=b/2-g[m]/2+N,Y=Ap(B,V,re),C=!a.arrow&&ts(o)!=null&&V!=Y&&i.reference[m]/2-(V<B?M:j)-g[m]/2<0,$=C?V<B?V-B:V-re:0;return{[h]:f[h]+$,data:{[h]:Y,centerOffset:V-Y-$,...C&&{alignmentOffset:$}},reset:C}}}),E5=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:s,platform:a,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,..._}=Xr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=Qr(o),y=Qr(s)===s,x=await(a.isRTL==null?void 0:a.isRTL(u.floating)),S=f||(y||!g?[Yc(s)]:y5(s));!f&&m!=="none"&&S.push(...w5(s,g,m,x));const k=[s,...S],T=await Ra(t,_),b=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&b.push(T[v]),d){const B=v5(o,l,x);b.push(T[B[0]],T[B[1]])}if(N=[...N,{placement:o,overflows:b}],!b.every(B=>B<=0)){var D,M;const B=(((D=i.flip)==null?void 0:D.index)||0)+1,re=k[B];if(re)return{data:{index:B,overflows:N},reset:{placement:re}};let V=(M=N.filter(Y=>Y.overflows[0]<=0).sort((Y,C)=>Y.overflows[1]-C.overflows[1])[0])==null?void 0:M.placement;if(!V)switch(h){case"bestFit":{var j;const Y=(j=N.map(C=>[C.placement,C.overflows.filter($=>$>0).reduce(($,E)=>$+E,0)]).sort((C,$)=>C[1]-$[1])[0])==null?void 0:j[0];Y&&(V=Y);break}case"initialPlacement":V=s;break}if(o!==V)return{reset:{placement:V}}}return{}}}};function P0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function O0(e){return p5.some(t=>e[t]>=0)}const C5=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Xr(e,t);switch(r){case"referenceHidden":{const i=await Ra(t,{...o,elementContext:"reference"}),l=P0(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:O0(l)}}}case"escaped":{const i=await Ra(t,{...o,altBoundary:!0}),l=P0(i,n.floating);return{data:{escapedOffsets:l,escaped:O0(l)}}}default:return{}}}}};async function $5(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=Qr(n),s=ts(n),a=ns(n)==="y",u=["left","top"].includes(l)?-1:1,c=i&&a?-1:1,d=Xr(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&typeof m=="number"&&(h=s==="end"?m*-1:m),a?{x:h*c,y:f*u}:{x:f*u,y:h*c}}const k5=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await $5(t,e);return{x:n+o.x,y:r+o.y,data:o}}}},b5=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:s={fn:_=>{let{x:v,y}=_;return{x:v,y}}},...a}=Xr(e,t),u={x:n,y:r},c=await Ra(t,a),d=ns(Qr(o)),f=Am(d);let h=u[f],m=u[d];if(i){const _=f==="y"?"top":"left",v=f==="y"?"bottom":"right",y=h+c[_],x=h-c[v];h=Ap(y,h,x)}if(l){const _=d==="y"?"top":"left",v=d==="y"?"bottom":"right",y=m+c[_],x=m-c[v];m=Ap(y,m,x)}const g=s.fn({...t,[f]:h,[d]:m});return{...g,data:{x:g.x-n,y:g.y-r}}}}},T5=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:l}=t,{offset:s=0,mainAxis:a=!0,crossAxis:u=!0}=Xr(e,t),c={x:n,y:r},d=ns(o),f=Am(d);let h=c[f],m=c[d];const g=Xr(s,t),_=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const x=f==="y"?"height":"width",S=i.reference[f]-i.floating[x]+_.mainAxis,k=i.reference[f]+i.reference[x]-_.mainAxis;h<S?h=S:h>k&&(h=k)}if(u){var v,y;const x=f==="y"?"width":"height",S=["top","left"].includes(Qr(o)),k=i.reference[d]-i.floating[x]+(S&&((v=l.offset)==null?void 0:v[d])||0)+(S?0:_.crossAxis),T=i.reference[d]+i.reference[x]+(S?0:((y=l.offset)==null?void 0:y[d])||0)-(S?_.crossAxis:0);m<k?m=k:m>T&&(m=T)}return{[f]:h,[d]:m}}}},N5=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:l=()=>{},...s}=Xr(e,t),a=await Ra(t,s),u=Qr(n),c=ts(n),d=ns(n)==="y",{width:f,height:h}=r.floating;let m,g;u==="top"||u==="bottom"?(m=u,g=c===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(g=u,m=c==="end"?"top":"bottom");const _=h-a[m],v=f-a[g],y=!t.middlewareData.shift;let x=_,S=v;if(d){const T=f-a.left-a.right;S=c||y?Bo(v,T):T}else{const T=h-a.top-a.bottom;x=c||y?Bo(_,T):T}if(y&&!c){const T=Sn(a.left,0),b=Sn(a.right,0),N=Sn(a.top,0),D=Sn(a.bottom,0);d?S=f-2*(T!==0||b!==0?T+b:Sn(a.left,a.right)):x=h-2*(N!==0||D!==0?N+D:Sn(a.top,a.bottom))}await l({...t,availableWidth:S,availableHeight:x});const k=await o.getDimensions(i.floating);return f!==k.width||h!==k.height?{reset:{rects:!0}}:{}}}};function Uo(e){return _E(e)?(e.nodeName||"").toLowerCase():"#document"}function bn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ro(e){var t;return(t=(_E(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _E(e){return e instanceof Node||e instanceof bn(e).Node}function Jr(e){return e instanceof Element||e instanceof bn(e).Element}function Tr(e){return e instanceof HTMLElement||e instanceof bn(e).HTMLElement}function A0(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof bn(e).ShadowRoot}function Xa(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Vn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function R5(e){return["table","td","th"].includes(Uo(e))}function Dm(e){const t=Im(),n=Vn(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function P5(e){let t=Ll(e);for(;Tr(t)&&!Md(t);){if(Dm(t))return t;t=Ll(t)}return null}function Im(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Md(e){return["html","body","#document"].includes(Uo(e))}function Vn(e){return bn(e).getComputedStyle(e)}function Ld(e){return Jr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ll(e){if(Uo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||A0(e)&&e.host||ro(e);return A0(t)?t.host:t}function SE(e){const t=Ll(e);return Md(t)?e.ownerDocument?e.ownerDocument.body:e.body:Tr(t)&&Xa(t)?t:SE(t)}function Pa(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=SE(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),l=bn(o);return i?t.concat(l,l.visualViewport||[],Xa(o)?o:[],l.frameElement&&n?Pa(l.frameElement):[]):t.concat(o,Pa(o,[],n))}function EE(e){const t=Vn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Tr(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,s=Gc(n)!==i||Gc(r)!==l;return s&&(n=i,r=l),{width:n,height:r,$:s}}function jm(e){return Jr(e)?e:e.contextElement}function wl(e){const t=jm(e);if(!Tr(t))return Wo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=EE(t);let l=(i?Gc(n.width):n.width)/r,s=(i?Gc(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!s||!Number.isFinite(s))&&(s=1),{x:l,y:s}}const O5=Wo(0);function CE(e){const t=bn(e);return!Im()||!t.visualViewport?O5:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function A5(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==bn(e)?!1:t}function Si(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=jm(e);let l=Wo(1);t&&(r?Jr(r)&&(l=wl(r)):l=wl(e));const s=A5(i,n,r)?CE(i):Wo(0);let a=(o.left+s.x)/l.x,u=(o.top+s.y)/l.y,c=o.width/l.x,d=o.height/l.y;if(i){const f=bn(i),h=r&&Jr(r)?bn(r):r;let m=f.frameElement;for(;m&&r&&h!==f;){const g=wl(m),_=m.getBoundingClientRect(),v=Vn(m),y=_.left+(m.clientLeft+parseFloat(v.paddingLeft))*g.x,x=_.top+(m.clientTop+parseFloat(v.paddingTop))*g.y;a*=g.x,u*=g.y,c*=g.x,d*=g.y,a+=y,u+=x,m=bn(m).frameElement}}return Xc({width:c,height:d,x:a,y:u})}function M5(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Tr(n),i=ro(n);if(n===i)return t;let l={scrollLeft:0,scrollTop:0},s=Wo(1);const a=Wo(0);if((o||!o&&r!=="fixed")&&((Uo(n)!=="body"||Xa(i))&&(l=Ld(n)),Tr(n))){const u=Si(n);s=wl(n),a.x=u.x+n.clientLeft,a.y=u.y+n.clientTop}return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-l.scrollLeft*s.x+a.x,y:t.y*s.y-l.scrollTop*s.y+a.y}}function L5(e){return Array.from(e.getClientRects())}function $E(e){return Si(ro(e)).left+Ld(e).scrollLeft}function D5(e){const t=ro(e),n=Ld(e),r=e.ownerDocument.body,o=Sn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Sn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+$E(e);const s=-n.scrollTop;return Vn(r).direction==="rtl"&&(l+=Sn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:s}}function I5(e,t){const n=bn(e),r=ro(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,s=0,a=0;if(o){i=o.width,l=o.height;const u=Im();(!u||u&&t==="fixed")&&(s=o.offsetLeft,a=o.offsetTop)}return{width:i,height:l,x:s,y:a}}function j5(e,t){const n=Si(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Tr(e)?wl(e):Wo(1),l=e.clientWidth*i.x,s=e.clientHeight*i.y,a=o*i.x,u=r*i.y;return{width:l,height:s,x:a,y:u}}function M0(e,t,n){let r;if(t==="viewport")r=I5(e,n);else if(t==="document")r=D5(ro(e));else if(Jr(t))r=j5(t,n);else{const o=CE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Xc(r)}function kE(e,t){const n=Ll(e);return n===t||!Jr(n)||Md(n)?!1:Vn(n).position==="fixed"||kE(n,t)}function z5(e,t){const n=t.get(e);if(n)return n;let r=Pa(e,[],!1).filter(s=>Jr(s)&&Uo(s)!=="body"),o=null;const i=Vn(e).position==="fixed";let l=i?Ll(e):e;for(;Jr(l)&&!Md(l);){const s=Vn(l),a=Dm(l);!a&&s.position==="fixed"&&(o=null),(i?!a&&!o:!a&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Xa(l)&&!a&&kE(e,l))?r=r.filter(c=>c!==l):o=s,l=Ll(l)}return t.set(e,r),r}function F5(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?z5(t,this._c):[].concat(n),r],s=l[0],a=l.reduce((u,c)=>{const d=M0(t,c,o);return u.top=Sn(d.top,u.top),u.right=Bo(d.right,u.right),u.bottom=Bo(d.bottom,u.bottom),u.left=Sn(d.left,u.left),u},M0(t,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function B5(e){return EE(e)}function W5(e,t,n){const r=Tr(t),o=ro(t),i=n==="fixed",l=Si(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=Wo(0);if(r||!r&&!i)if((Uo(t)!=="body"||Xa(o))&&(s=Ld(t)),r){const u=Si(t,!0,i,t);a.x=u.x+t.clientLeft,a.y=u.y+t.clientTop}else o&&(a.x=$E(o));return{x:l.left+s.scrollLeft-a.x,y:l.top+s.scrollTop-a.y,width:l.width,height:l.height}}function L0(e,t){return!Tr(e)||Vn(e).position==="fixed"?null:t?t(e):e.offsetParent}function bE(e,t){const n=bn(e);if(!Tr(e))return n;let r=L0(e,t);for(;r&&R5(r)&&Vn(r).position==="static";)r=L0(r,t);return r&&(Uo(r)==="html"||Uo(r)==="body"&&Vn(r).position==="static"&&!Dm(r))?n:r||P5(e)||n}const U5=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||bE,i=this.getDimensions;return{reference:W5(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function H5(e){return Vn(e).direction==="rtl"}const V5={convertOffsetParentRelativeRectToViewportRelativeRect:M5,getDocumentElement:ro,getClippingRect:F5,getOffsetParent:bE,getElementRects:U5,getClientRects:L5,getDimensions:B5,getScale:wl,isElement:Jr,isRTL:H5};function K5(e,t){let n=null,r;const o=ro(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function l(s,a){s===void 0&&(s=!1),a===void 0&&(a=1),i();const{left:u,top:c,width:d,height:f}=e.getBoundingClientRect();if(s||t(),!d||!f)return;const h=Ru(c),m=Ru(o.clientWidth-(u+d)),g=Ru(o.clientHeight-(c+f)),_=Ru(u),y={rootMargin:-h+"px "+-m+"px "+-g+"px "+-_+"px",threshold:Sn(0,Bo(1,a))||1};let x=!0;function S(k){const T=k[0].intersectionRatio;if(T!==a){if(!x)return l();T?l(!1,T):r=setTimeout(()=>{l(!1,1e-7)},100)}x=!1}try{n=new IntersectionObserver(S,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(e)}return l(!0),i}function G5(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=jm(e),c=o||i?[...u?Pa(u):[],...Pa(t)]:[];c.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const d=u&&s?K5(u,n):null;let f=-1,h=null;l&&(h=new ResizeObserver(v=>{let[y]=v;y&&y.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{h&&h.observe(t)})),n()}),u&&!a&&h.observe(u),h.observe(t));let m,g=a?Si(e):null;a&&_();function _(){const v=Si(e);g&&(v.x!==g.x||v.y!==g.y||v.width!==g.width||v.height!==g.height)&&n(),g=v,m=requestAnimationFrame(_)}return n(),()=>{c.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),d&&d(),h&&h.disconnect(),h=null,a&&cancelAnimationFrame(m)}}const Y5=(e,t,n)=>{const r=new Map,o={platform:V5,...n},i={...o.platform,_c:r};return S5(e,t,{...o,platform:i})},X5=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?R0({element:r.current,padding:o}).fn(n):{}:r?R0({element:r,padding:o}).fn(n):{}}}};var qu=typeof document<"u"?p.useLayoutEffect:p.useEffect;function Qc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Qc(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Qc(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function TE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function D0(e,t){const n=TE(e);return Math.round(t*n)/n}function I0(e){const t=p.useRef(e);return qu(()=>{t.current=e}),t}function Q5(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:l}={},transform:s=!0,whileElementsMounted:a,open:u}=e,[c,d]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=p.useState(r);Qc(f,r)||h(r);const[m,g]=p.useState(null),[_,v]=p.useState(null),y=p.useCallback(C=>{C!=T.current&&(T.current=C,g(C))},[g]),x=p.useCallback(C=>{C!==b.current&&(b.current=C,v(C))},[v]),S=i||m,k=l||_,T=p.useRef(null),b=p.useRef(null),N=p.useRef(c),D=I0(a),M=I0(o),j=p.useCallback(()=>{if(!T.current||!b.current)return;const C={placement:t,strategy:n,middleware:f};M.current&&(C.platform=M.current),Y5(T.current,b.current,C).then($=>{const E={...$,isPositioned:!0};B.current&&!Qc(N.current,E)&&(N.current=E,Nr.flushSync(()=>{d(E)}))})},[f,t,n,M]);qu(()=>{u===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,d(C=>({...C,isPositioned:!1})))},[u]);const B=p.useRef(!1);qu(()=>(B.current=!0,()=>{B.current=!1}),[]),qu(()=>{if(S&&(T.current=S),k&&(b.current=k),S&&k){if(D.current)return D.current(S,k,j);j()}},[S,k,j,D]);const re=p.useMemo(()=>({reference:T,floating:b,setReference:y,setFloating:x}),[y,x]),V=p.useMemo(()=>({reference:S,floating:k}),[S,k]),Y=p.useMemo(()=>{const C={position:n,left:0,top:0};if(!V.floating)return C;const $=D0(V.floating,c.x),E=D0(V.floating,c.y);return s?{...C,transform:"translate("+$+"px, "+E+"px)",...TE(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:E}},[n,s,V.floating,c.x,c.y]);return p.useMemo(()=>({...c,update:j,refs:re,elements:V,floatingStyles:Y}),[c,j,re,V,Y])}function NE(e){const[t,n]=p.useState(void 0);return Nn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let l,s;if("borderBoxSize"in i){const a=i.borderBoxSize,u=Array.isArray(a)?a[0]:a;l=u.inlineSize,s=u.blockSize}else l=e.offsetWidth,s=e.offsetHeight;n({width:l,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const RE="Popper",[PE,OE]=Ni(RE),[J5,AE]=PE(RE),Z5=e=>{const{__scopePopper:t,children:n}=e,[r,o]=p.useState(null);return p.createElement(J5,{scope:t,anchor:r,onAnchorChange:o},n)},q5="PopperAnchor",e3=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=AE(q5,n),l=p.useRef(null),s=Ze(t,l);return p.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||l.current)}),r?null:p.createElement(Ie.div,te({},o,{ref:s}))}),ME="PopperContent",[t3,dL]=PE(ME),n3=p.forwardRef((e,t)=>{var n,r,o,i,l,s,a,u;const{__scopePopper:c,side:d="bottom",sideOffset:f=0,align:h="center",alignOffset:m=0,arrowPadding:g=0,avoidCollisions:_=!0,collisionBoundary:v=[],collisionPadding:y=0,sticky:x="partial",hideWhenDetached:S=!1,updatePositionStrategy:k="optimized",onPlaced:T,...b}=e,N=AE(ME,c),[D,M]=p.useState(null),j=Ze(t,cn=>M(cn)),[B,re]=p.useState(null),V=NE(B),Y=(n=V==null?void 0:V.width)!==null&&n!==void 0?n:0,C=(r=V==null?void 0:V.height)!==null&&r!==void 0?r:0,$=d+(h!=="center"?"-"+h:""),E=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},O=Array.isArray(v)?v:[v],R=O.length>0,F={padding:E,boundary:O.filter(r3),altBoundary:R},{refs:H,floatingStyles:ae,placement:oe,isPositioned:$e,middlewareData:_e}=Q5({strategy:"fixed",placement:$,whileElementsMounted:(...cn)=>G5(...cn,{animationFrame:k==="always"}),elements:{reference:N.anchor},middleware:[k5({mainAxis:f+C,alignmentAxis:m}),_&&b5({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?T5():void 0,...F}),_&&E5({...F}),N5({...F,apply:({elements:cn,rects:Gn,availableWidth:Re,availableHeight:yt})=>{const{width:qe,height:Yt}=Gn.reference,dn=cn.floating.style;dn.setProperty("--radix-popper-available-width",`${Re}px`),dn.setProperty("--radix-popper-available-height",`${yt}px`),dn.setProperty("--radix-popper-anchor-width",`${qe}px`),dn.setProperty("--radix-popper-anchor-height",`${Yt}px`)}}),B&&X5({element:B,padding:g}),o3({arrowWidth:Y,arrowHeight:C}),S&&C5({strategy:"referenceHidden",...F})]}),[Q,Ne]=LE(oe),ye=Ht(T);Nn(()=>{$e&&(ye==null||ye())},[$e,ye]);const Se=(o=_e.arrow)===null||o===void 0?void 0:o.x,pe=(i=_e.arrow)===null||i===void 0?void 0:i.y,Te=((l=_e.arrow)===null||l===void 0?void 0:l.centerOffset)!==0,[We,At]=p.useState();return Nn(()=>{D&&At(window.getComputedStyle(D).zIndex)},[D]),p.createElement("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...ae,transform:$e?ae.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:We,"--radix-popper-transform-origin":[(s=_e.transformOrigin)===null||s===void 0?void 0:s.x,(a=_e.transformOrigin)===null||a===void 0?void 0:a.y].join(" ")},dir:e.dir},p.createElement(t3,{scope:c,placedSide:Q,onArrowChange:re,arrowX:Se,arrowY:pe,shouldHideArrow:Te},p.createElement(Ie.div,te({"data-side":Q,"data-align":Ne},b,{ref:j,style:{...b.style,animation:$e?void 0:"none",opacity:(u=_e.hide)!==null&&u!==void 0&&u.referenceHidden?0:void 0}}))))});function r3(e){return e!==null}const o3=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,l;const{placement:s,rects:a,middlewareData:u}=t,d=((n=u.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,f=d?0:e.arrowWidth,h=d?0:e.arrowHeight,[m,g]=LE(s),_={start:"0%",center:"50%",end:"100%"}[g],v=((r=(o=u.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+f/2,y=((i=(l=u.arrow)===null||l===void 0?void 0:l.y)!==null&&i!==void 0?i:0)+h/2;let x="",S="";return m==="bottom"?(x=d?_:`${v}px`,S=`${-h}px`):m==="top"?(x=d?_:`${v}px`,S=`${a.floating.height+h}px`):m==="right"?(x=`${-h}px`,S=d?_:`${y}px`):m==="left"&&(x=`${a.floating.width+h}px`,S=d?_:`${y}px`),{data:{x,y:S}}}});function LE(e){const[t,n="center"]=e.split("-");return[t,n]}const i3=Z5,l3=e3,s3=n3,a3=p.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?Tw.createPortal(p.createElement(Ie.div,te({},o,{ref:t})),r):null});function Dl({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=u3({defaultProp:t,onChange:n}),i=e!==void 0,l=i?e:r,s=Ht(n),a=p.useCallback(u=>{if(i){const d=typeof u=="function"?u(e):u;d!==e&&s(d)}else o(u)},[i,e,o,s]);return[l,a]}function u3({defaultProp:e,onChange:t}){const n=p.useState(e),[r]=n,o=p.useRef(r),i=Ht(t);return p.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function DE(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}const c3=p.forwardRef((e,t)=>p.createElement(Ie.span,te({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}})));var d3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Vi=new WeakMap,Pu=new WeakMap,Ou={},zf=0,IE=function(e){return e&&(e.host||IE(e.parentNode))},f3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=IE(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},h3=function(e,t,n,r){var o=f3(t,Array.isArray(e)?e:[e]);Ou[n]||(Ou[n]=new WeakMap);var i=Ou[n],l=[],s=new Set,a=new Set(o),u=function(d){!d||s.has(d)||(s.add(d),u(d.parentNode))};o.forEach(u);var c=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else{var h=f.getAttribute(r),m=h!==null&&h!=="false",g=(Vi.get(f)||0)+1,_=(i.get(f)||0)+1;Vi.set(f,g),i.set(f,_),l.push(f),g===1&&m&&Pu.set(f,!0),_===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}})};return c(t),s.clear(),zf++,function(){l.forEach(function(d){var f=Vi.get(d)-1,h=i.get(d)-1;Vi.set(d,f),i.set(d,h),f||(Pu.has(d)||d.removeAttribute(r),Pu.delete(d)),h||d.removeAttribute(n)}),zf--,zf||(Vi=new WeakMap,Vi=new WeakMap,Pu=new WeakMap,Ou={})}},p3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||d3(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),h3(r,o,n,"aria-hidden")):function(){return null}},yr=function(){return yr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},yr.apply(this,arguments)};function jE(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function g3(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var ec="right-scroll-bar-position",tc="width-before-scroll-bar",m3="with-scroll-bars-hidden",v3="--removed-body-scroll-bar-size";function y3(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function x3(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function w3(e,t){return x3(t||null,function(n){return e.forEach(function(r){return y3(r,n)})})}function _3(e){return e}function S3(e,t){t===void 0&&(t=_3);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var l=t(i,r);return n.push(l),function(){n=n.filter(function(s){return s!==l})}},assignSyncMedium:function(i){for(r=!0;n.length;){var l=n;n=[],l.forEach(i)}n={push:function(s){return i(s)},filter:function(){return n}}},assignMedium:function(i){r=!0;var l=[];if(n.length){var s=n;n=[],s.forEach(i),l=n}var a=function(){var c=l;l=[],c.forEach(i)},u=function(){return Promise.resolve().then(a)};u(),n={push:function(c){l.push(c),u()},filter:function(c){return l=l.filter(c),n}}}};return o}function E3(e){e===void 0&&(e={});var t=S3(null);return t.options=yr({async:!0,ssr:!1},e),t}var zE=function(e){var t=e.sideCar,n=jE(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return p.createElement(r,yr({},n))};zE.isSideCarExport=!0;function C3(e,t){return e.useMedium(t),zE}var FE=E3(),Ff=function(){},Dd=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:Ff,onWheelCapture:Ff,onTouchMoveCapture:Ff}),o=r[0],i=r[1],l=e.forwardProps,s=e.children,a=e.className,u=e.removeScrollBar,c=e.enabled,d=e.shards,f=e.sideCar,h=e.noIsolation,m=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?"div":_,y=jE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),x=f,S=w3([n,t]),k=yr(yr({},y),o);return p.createElement(p.Fragment,null,c&&p.createElement(x,{sideCar:FE,removeScrollBar:u,shards:d,noIsolation:h,inert:m,setCallbacks:i,allowPinchZoom:!!g,lockRef:n}),l?p.cloneElement(p.Children.only(s),yr(yr({},k),{ref:S})):p.createElement(v,yr({},k,{className:a,ref:S}),s))});Dd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Dd.classNames={fullWidth:tc,zeroRight:ec};var j0,$3=function(){if(j0)return j0;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function k3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=$3();return t&&e.setAttribute("nonce",t),e}function b3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function T3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var N3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=k3())&&(b3(t,n),T3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},R3=function(){var e=N3();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},BE=function(){var e=R3(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},P3={left:0,top:0,right:0,gap:0},Bf=function(e){return parseInt(e||"",10)||0},O3=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Bf(n),Bf(r),Bf(o)]},A3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return P3;var t=O3(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},M3=BE(),L3=function(e,t,n,r){var o=e.left,i=e.top,l=e.right,s=e.gap;return n===void 0&&(n="margin"),`
130
130
  .`.concat(m3,` {
131
131
  overflow: hidden `).concat(r,`;
132
132
  padding-right: `).concat(s,"px ").concat(r,`;
@@ -166,7 +166,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
166
166
  `)},D3=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,i=p.useMemo(function(){return A3(o)},[o]);return p.createElement(M3,{styles:L3(i,!t,o,n?"":"!important")})},Lp=!1;if(typeof window<"u")try{var Au=Object.defineProperty({},"passive",{get:function(){return Lp=!0,!0}});window.addEventListener("test",Au,Au),window.removeEventListener("test",Au,Au)}catch{Lp=!1}var Ki=Lp?{passive:!1}:!1,I3=function(e){return e.tagName==="TEXTAREA"},WE=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!I3(e)&&n[t]==="visible")},j3=function(e){return WE(e,"overflowY")},z3=function(e){return WE(e,"overflowX")},z0=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=UE(e,n);if(r){var o=HE(e,n),i=o[1],l=o[2];if(i>l)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},F3=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},B3=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},UE=function(e,t){return e==="v"?j3(t):z3(t)},HE=function(e,t){return e==="v"?F3(t):B3(t)},W3=function(e,t){return e==="h"&&t==="rtl"?-1:1},U3=function(e,t,n,r,o){var i=W3(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=HE(e,s),m=h[0],g=h[1],_=h[2],v=g-_-i*m;(m||v)&&UE(e,s)&&(d+=v,f+=m),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},Mu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},F0=function(e){return[e.deltaX,e.deltaY]},B0=function(e){return e&&"current"in e?e.current:e},H3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},V3=function(e){return`
167
167
  .block-interactivity-`.concat(e,` {pointer-events: none;}
168
168
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
169
- `)},K3=0,Gi=[];function G3(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),o=p.useState(K3++)[0],i=p.useState(function(){return BE()})[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 g=g3([e.lockRef.current],(e.shards||[]).map(B0),!0).filter(Boolean);return g.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),g.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=p.useCallback(function(g,_){if("touches"in g&&g.touches.length===2)return!l.current.allowPinchZoom;var v=Mu(g),y=n.current,x="deltaX"in g?g.deltaX:y[0]-v[0],S="deltaY"in g?g.deltaY:y[1]-v[1],k,T=g.target,b=Math.abs(x)>Math.abs(S)?"h":"v";if("touches"in g&&b==="h"&&T.type==="range")return!1;var N=z0(b,T);if(!N)return!0;if(N?k=b:(k=b==="v"?"h":"v",N=z0(b,T)),!N)return!1;if(!r.current&&"changedTouches"in g&&(x||S)&&(r.current=k),!k)return!0;var D=r.current||k;return U3(D,_,g,D==="h"?x:S,!0)},[]),a=p.useCallback(function(g){var _=g;if(!(!Gi.length||Gi[Gi.length-1]!==i)){var v="deltaY"in _?F0(_):Mu(_),y=t.current.filter(function(k){return k.name===_.type&&k.target===_.target&&H3(k.delta,v)})[0];if(y&&y.should){_.cancelable&&_.preventDefault();return}if(!y){var x=(l.current.shards||[]).map(B0).filter(Boolean).filter(function(k){return k.contains(_.target)}),S=x.length>0?s(_,x[0]):!l.current.noIsolation;S&&_.cancelable&&_.preventDefault()}}},[]),u=p.useCallback(function(g,_,v,y){var x={name:g,delta:_,target:v,should:y};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(S){return S!==x})},1)},[]),c=p.useCallback(function(g){n.current=Mu(g),r.current=void 0},[]),d=p.useCallback(function(g){u(g.type,F0(g),g.target,s(g,e.lockRef.current))},[]),f=p.useCallback(function(g){u(g.type,Mu(g),g.target,s(g,e.lockRef.current))},[]);p.useEffect(function(){return Gi.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Ki),document.addEventListener("touchmove",a,Ki),document.addEventListener("touchstart",c,Ki),function(){Gi=Gi.filter(function(g){return g!==i}),document.removeEventListener("wheel",a,Ki),document.removeEventListener("touchmove",a,Ki),document.removeEventListener("touchstart",c,Ki)}},[]);var h=e.removeScrollBar,m=e.inert;return p.createElement(p.Fragment,null,m?p.createElement(i,{styles:V3(o)}):null,h?p.createElement(D3,{gapMode:"margin"}):null)}const Y3=C3(FE,G3);var VE=p.forwardRef(function(e,t){return p.createElement(Dd,yr({},e,{ref:t,sideCar:Y3}))});VE.classNames=Dd.classNames;const X3=VE,Q3=[" ","Enter","ArrowUp","ArrowDown"],J3=[" ","Enter"],Id="Select",[jd,zm,Z3]=vE(Id),[rs,fL]=Ni(Id,[Z3,OE]),Fm=OE(),[q3,Mi]=rs(Id),[eA,tA]=rs(Id),nA=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,m=Fm(t),[g,_]=p.useState(null),[v,y]=p.useState(null),[x,S]=p.useState(!1),k=Wg(u),[T=!1,b]=Dl({prop:r,defaultProp:o,onChange:i}),[N,D]=Dl({prop:l,defaultProp:s,onChange:a}),M=p.useRef(null),j=g?!!g.closest("form"):!0,[B,re]=p.useState(new Set),V=Array.from(B).map(Y=>Y.props.value).join(";");return p.createElement(i3,m,p.createElement(q3,{required:h,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Ad(),value:N,onValueChange:D,open:T,onOpenChange:b,dir:k,triggerPointerDownPosRef:M,disabled:f},p.createElement(jd.Provider,{scope:t},p.createElement(eA,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(Y=>{re(C=>new Set(C).add(Y))},[]),onNativeOptionRemove:p.useCallback(Y=>{re(C=>{const $=new Set(C);return $.delete(Y),$})},[])},n)),j?p.createElement(XE,{key:V,"aria-hidden":!0,required:h,tabIndex:-1,name:c,autoComplete:d,value:N,onChange:Y=>D(Y.target.value),disabled:f},N===void 0?p.createElement("option",{value:""}):null,Array.from(B)):null))},rA="SelectTrigger",oA=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=Fm(n),l=Mi(rA,n),s=l.disabled||r,a=Ze(t,l.onTriggerChange),u=zm(n),[c,d,f]=QE(m=>{const g=u().filter(y=>!y.disabled),_=g.find(y=>y.value===l.value),v=JE(g,m,_);v!==void 0&&l.onValueChange(v.value)}),h=()=>{s||(l.onOpenChange(!0),f())};return p.createElement(l3,te({asChild:!0},i),p.createElement(Ie.button,te({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":YE(l.value)?"":void 0},o,{ref:a,onClick:Ge(o.onClick,m=>{m.currentTarget.focus()}),onPointerDown:Ge(o.onPointerDown,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&g.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&(h(),l.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)},m.preventDefault())}),onKeyDown:Ge(o.onKeyDown,m=>{const g=c.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&d(m.key),!(g&&m.key===" ")&&Q3.includes(m.key)&&(h(),m.preventDefault())})})))}),iA="SelectValue",lA=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:l="",...s}=e,a=Mi(iA,n),{onValueNodeHasChildrenChange:u}=a,c=i!==void 0,d=Ze(t,a.onValueNodeChange);return Nn(()=>{u(c)},[u,c]),p.createElement(Ie.span,te({},s,{ref:d,style:{pointerEvents:"none"}}),YE(a.value)?p.createElement(p.Fragment,null,l):i)}),sA=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.createElement(Ie.span,te({"aria-hidden":!0},o,{ref:t}),r||"▼")}),aA=e=>p.createElement(a3,te({asChild:!0},e)),Il="SelectContent",uA=p.forwardRef((e,t)=>{const n=Mi(Il,e.__scopeSelect),[r,o]=p.useState();if(Nn(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Nr.createPortal(p.createElement(KE,{scope:e.__scopeSelect},p.createElement(jd.Slot,{scope:e.__scopeSelect},p.createElement("div",null,e.children))),i):null}return p.createElement(cA,te({},e,{ref:t}))}),jr=10,[KE,zd]=rs(Il),cA=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:m,hideWhenDetached:g,avoidCollisions:_,...v}=e,y=Mi(Il,n),[x,S]=p.useState(null),[k,T]=p.useState(null),b=Ze(t,Q=>S(Q)),[N,D]=p.useState(null),[M,j]=p.useState(null),B=zm(n),[re,V]=p.useState(!1),Y=p.useRef(!1);p.useEffect(()=>{if(x)return p3(x)},[x]),o5();const C=p.useCallback(Q=>{const[Ne,...ye]=B().map(Te=>Te.ref.current),[Se]=ye.slice(-1),pe=document.activeElement;for(const Te of Q)if(Te===pe||(Te==null||Te.scrollIntoView({block:"nearest"}),Te===Ne&&k&&(k.scrollTop=0),Te===Se&&k&&(k.scrollTop=k.scrollHeight),Te==null||Te.focus(),document.activeElement!==pe))return},[B,k]),$=p.useCallback(()=>C([N,x]),[C,N,x]);p.useEffect(()=>{re&&$()},[re,$]);const{onOpenChange:E,triggerPointerDownPosRef:O}=y;p.useEffect(()=>{if(x){let Q={x:0,y:0};const Ne=Se=>{var pe,Te,We,At;Q={x:Math.abs(Math.round(Se.pageX)-((pe=(Te=O.current)===null||Te===void 0?void 0:Te.x)!==null&&pe!==void 0?pe:0)),y:Math.abs(Math.round(Se.pageY)-((We=(At=O.current)===null||At===void 0?void 0:At.y)!==null&&We!==void 0?We:0))}},ye=Se=>{Q.x<=10&&Q.y<=10?Se.preventDefault():x.contains(Se.target)||E(!1),document.removeEventListener("pointermove",Ne),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",Ne),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ne),document.removeEventListener("pointerup",ye,{capture:!0})}}},[x,E,O]),p.useEffect(()=>{const Q=()=>E(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[E]);const[R,F]=QE(Q=>{const Ne=B().filter(pe=>!pe.disabled),ye=Ne.find(pe=>pe.ref.current===document.activeElement),Se=JE(Ne,Q,ye);Se&&setTimeout(()=>Se.ref.current.focus())}),H=p.useCallback((Q,Ne,ye)=>{const Se=!Y.current&&!ye;(y.value!==void 0&&y.value===Ne||Se)&&(D(Q),Se&&(Y.current=!0))},[y.value]),ae=p.useCallback(()=>x==null?void 0:x.focus(),[x]),oe=p.useCallback((Q,Ne,ye)=>{const Se=!Y.current&&!ye;(y.value!==void 0&&y.value===Ne||Se)&&j(Q)},[y.value]),$e=r==="popper"?W0:dA,_e=$e===W0?{side:s,sideOffset:a,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:m,hideWhenDetached:g,avoidCollisions:_}:{};return p.createElement(KE,{scope:n,content:x,viewport:k,onViewportChange:T,itemRefCallback:H,selectedItem:N,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:$,selectedItemText:M,position:r,isPositioned:re,searchRef:R},p.createElement(X3,{as:Rl,allowPinchZoom:!0},p.createElement(i5,{asChild:!0,trapped:y.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:Ge(o,Q=>{var Ne;(Ne=y.trigger)===null||Ne===void 0||Ne.focus({preventScroll:!0}),Q.preventDefault()})},p.createElement(t5,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>y.onOpenChange(!1)},p.createElement($e,te({role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:Q=>Q.preventDefault()},v,_e,{onPlaced:()=>V(!0),ref:b,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Ge(v.onKeyDown,Q=>{const Ne=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!Ne&&Q.key.length===1&&F(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let Se=B().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(Se=Se.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const pe=Q.target,Te=Se.indexOf(pe);Se=Se.slice(Te+1)}setTimeout(()=>C(Se)),Q.preventDefault()}})}))))))}),dA=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Mi(Il,n),l=zd(Il,n),[s,a]=p.useState(null),[u,c]=p.useState(null),d=Ze(t,b=>c(b)),f=zm(n),h=p.useRef(!1),m=p.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:v,focusSelectedItem:y}=l,x=p.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&u&&g&&_&&v){const b=i.trigger.getBoundingClientRect(),N=u.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),M=v.getBoundingClientRect();if(i.dir!=="rtl"){const pe=M.left-N.left,Te=D.left-pe,We=b.left-Te,At=b.width+We,cn=Math.max(At,N.width),Gn=window.innerWidth-jr,Re=Hh(Te,[jr,Gn-cn]);s.style.minWidth=At+"px",s.style.left=Re+"px"}else{const pe=N.right-M.right,Te=window.innerWidth-D.right-pe,We=window.innerWidth-b.right-Te,At=b.width+We,cn=Math.max(At,N.width),Gn=window.innerWidth-jr,Re=Hh(Te,[jr,Gn-cn]);s.style.minWidth=At+"px",s.style.right=Re+"px"}const j=f(),B=window.innerHeight-jr*2,re=g.scrollHeight,V=window.getComputedStyle(u),Y=parseInt(V.borderTopWidth,10),C=parseInt(V.paddingTop,10),$=parseInt(V.borderBottomWidth,10),E=parseInt(V.paddingBottom,10),O=Y+C+re+E+$,R=Math.min(_.offsetHeight*5,O),F=window.getComputedStyle(g),H=parseInt(F.paddingTop,10),ae=parseInt(F.paddingBottom,10),oe=b.top+b.height/2-jr,$e=B-oe,_e=_.offsetHeight/2,Q=_.offsetTop+_e,Ne=Y+C+Q,ye=O-Ne;if(Ne<=oe){const pe=_===j[j.length-1].ref.current;s.style.bottom="0px";const Te=u.clientHeight-g.offsetTop-g.offsetHeight,We=Math.max($e,_e+(pe?ae:0)+Te+$),At=Ne+We;s.style.height=At+"px"}else{const pe=_===j[0].ref.current;s.style.top="0px";const We=Math.max(oe,Y+g.offsetTop+(pe?H:0)+_e)+ye;s.style.height=We+"px",g.scrollTop=Ne-oe+g.offsetTop}s.style.margin=`${jr}px 0`,s.style.minHeight=R+"px",s.style.maxHeight=B+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[f,i.trigger,i.valueNode,s,u,g,_,v,i.dir,r]);Nn(()=>x(),[x]);const[S,k]=p.useState();Nn(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const T=p.useCallback(b=>{b&&m.current===!0&&(x(),y==null||y(),m.current=!1)},[x,y]);return p.createElement(fA,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:T},p.createElement("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S}},p.createElement(Ie.div,te({},o,{ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}}))))}),W0=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=jr,...i}=e,l=Fm(n);return p.createElement(s3,te({},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)"}}))}),[fA,hA]=rs(Il,{}),U0="SelectViewport",pA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=zd(U0,n),i=hA(U0,n),l=Ze(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(jd.Slot,{scope:n},p.createElement(Ie.div,te({"data-radix-select-viewport":"",role:"presentation"},r,{ref:l,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:Ge(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-jr*2,m=parseFloat(c.style.minHeight),g=parseFloat(c.style.height),_=Math.max(m,g);if(_<h){const v=_+f,y=Math.min(h,v),x=v-y;c.style.height=y+"px",c.style.bottom==="0px"&&(u.scrollTop=x>0?x:0,c.style.justifyContent="flex-end")}}}s.current=u.scrollTop})}))))}),gA="SelectGroup",[hL,mA]=rs(gA),vA="SelectLabel",yA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=mA(vA,n);return p.createElement(Ie.div,te({id:o.id},r,{ref:t}))}),Dp="SelectItem",[xA,GE]=rs(Dp),wA=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...l}=e,s=Mi(Dp,n),a=zd(Dp,n),u=s.value===r,[c,d]=p.useState(i??""),[f,h]=p.useState(!1),m=Ze(t,v=>{var y;return(y=a.itemRefCallback)===null||y===void 0?void 0:y.call(a,v,r,o)}),g=Ad(),_=()=>{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(xA,{scope:n,value:r,disabled:o,textId:g,isSelected:u,onItemTextChange:p.useCallback(v=>{d(y=>{var x;return y||((x=v==null?void 0:v.textContent)!==null&&x!==void 0?x:"").trim()})},[])},p.createElement(jd.ItemSlot,{scope:n,value:r,disabled:o,textValue:c},p.createElement(Ie.div,te({role:"option","aria-labelledby":g,"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:m,onFocus:Ge(l.onFocus,()=>h(!0)),onBlur:Ge(l.onBlur,()=>h(!1)),onPointerUp:Ge(l.onPointerUp,_),onPointerMove:Ge(l.onPointerMove,v=>{if(o){var y;(y=a.onItemLeave)===null||y===void 0||y.call(a)}else v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ge(l.onPointerLeave,v=>{if(v.currentTarget===document.activeElement){var y;(y=a.onItemLeave)===null||y===void 0||y.call(a)}}),onKeyDown:Ge(l.onKeyDown,v=>{var y;((y=a.searchRef)===null||y===void 0?void 0:y.current)!==""&&v.key===" "||(J3.includes(v.key)&&_(),v.key===" "&&v.preventDefault())})}))))}),Lu="SelectItemText",_A=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,l=Mi(Lu,n),s=zd(Lu,n),a=GE(Lu,n),u=tA(Lu,n),[c,d]=p.useState(null),f=Ze(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,m=p.useMemo(()=>p.createElement("option",{key:a.value,value:a.value,disabled:a.disabled},h),[a.disabled,a.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return Nn(()=>(g(m),()=>_(m)),[g,_,m]),p.createElement(p.Fragment,null,p.createElement(Ie.span,te({id:a.textId},i,{ref:f})),a.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Nr.createPortal(i.children,l.valueNode):null)}),SA="SelectItemIndicator",EA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return GE(SA,n).isSelected?p.createElement(Ie.span,te({"aria-hidden":!0},r,{ref:t})):null}),CA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.createElement(Ie.div,te({"aria-hidden":!0},r,{ref:t}))});function YE(e){return e===""||e===void 0}const XE=p.forwardRef((e,t)=>{const{value:n,...r}=e,o=p.useRef(null),i=Ze(t,o),l=DE(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(c3,{asChild:!0},p.createElement("select",te({},r,{ref:i,defaultValue:n})))});XE.displayName="BubbleSelect";function QE(e){const t=Ht(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 JE(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=$A(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 $A(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const kA=nA,ZE=oA,bA=lA,TA=sA,NA=aA,qE=uA,RA=pA,eC=yA,tC=wA,PA=_A,OA=EA,nC=CA,AA=kA,MA=bA,rC=p.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(ZE,{ref:r,className:ut("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,w.jsx(TA,{asChild:!0,children:w.jsx(mE,{className:"w-4 h-4 opacity-50"})})]}));rC.displayName=ZE.displayName;const oC=p.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>w.jsx(NA,{children:w.jsx(qE,{ref:o,className:ut("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:w.jsx(RA,{className:ut("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));oC.displayName=qE.displayName;const LA=p.forwardRef(({className:e,...t},n)=>w.jsx(eC,{ref:n,className:ut("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));LA.displayName=eC.displayName;const iC=p.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(tC,{ref:r,className:ut("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:[w.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(OA,{children:w.jsx(LO,{className:"w-4 h-4"})})}),w.jsx(PA,{children:t})]}));iC.displayName=tC.displayName;const DA=p.forwardRef(({className:e,...t},n)=>w.jsx(nC,{ref:n,className:ut("-mx-1 my-1 h-px bg-muted",e),...t}));DA.displayName=nC.displayName;function lC({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"?w.jsx(zA,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||n===null)&&(r==null?void 0:r.type)==="number"?w.jsx(G0,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="keyOf"?w.jsx(K0,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i,selector:r.selector}):(typeof n=="number"||n===null)&&(r==null?void 0:r.type)==="number"?w.jsx(G0,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="keyOf"?w.jsx(K0,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i,selector:r.selector}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="richtext"?w.jsx(jA,{registerPatchCallback:o,onSubmit:i,defaultValue:n}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="image"?w.jsx(IA,{path:e,registerPatchCallback:o,onSubmit:i,defaultValue:n}):w.jsxs("div",{children:["Unsupported schema: ",r.type]})}function H0(e,t,n,r){if(!t||!r)return[];const o=r.sha256.slice(0,5),i=function(){const l=Yg(t)??"unknown",s=Xg(l);return n?`/public/${n.split(".").slice(0,-1).join(".")||n}_${o}.${s}`:`/public/${r.sha256}.${s}`}();return[{value:{[vn]:i,[Kt]:"file",metadata:r},op:"replace",path:e},{value:t,op:"file",path:e,filePath:i}]}function IA({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&&$n.convertFileSource(t).url)},[t]),p.useEffect(()=>{r&&r(async f=>H0(f,(o==null?void 0:o.src)??null,(o==null?void 0:o.filename)??null,a))},[o,t]),w.jsxs("div",{className:"max-w-4xl p-4",children:[w.jsxs("label",{htmlFor:`img_input:${e}`,className:"",children:[o||c?w.jsx("img",{src:(o==null?void 0:o.src)||c}):w.jsx("div",{children:"Empty"}),w.jsx("input",{id:`img_input:${e}`,type:"file",hidden:!0,onChange:f=>{dE(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&&w.jsx("div",{children:o&&w.jsx(es,{disabled:l,onClick:()=>{s(!0),n(f=>Promise.resolve(H0(f,o.src,o.filename??null,a))).finally(()=>{s(!1),i(null),u(void 0)})},children:l?"Saving...":"Submit"})})]},e)}async function V0(e,t){const{templateStrings:n,exprs:r,files:o}=t?await c2(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 jA({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=>V0(u,r))},[r]),w.jsxs("div",{className:"p-4 border rounded border-card",children:[w.jsx(OO,{onEditor:u=>{o(u)},richtext:e||{children:[],[Kt]:"root"}}),t&&w.jsx("div",{children:i&&w.jsx(es,{disabled:s||!r,onClick:()=>{r&&(a(!0),t(u=>V0(u,r)).finally(()=>{a(!1),l(!1)}))},children:s?"Saving...":"Submit"})})]})}function K0({disabled:e,defaultValue:t,registerPatchCallback:n,onSubmit:r,selector:o}){const i=lM(o),s=(h=>Array.isArray(h.moduleSource)?{type:"number",values:Object.keys(h.moduleSource).map(m=>parseInt(m))}:{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]),w.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[w.jsxs(AA,{defaultValue:a.toString(),disabled:c,onValueChange:h=>{u(f(h))},children:[w.jsx(rC,{children:w.jsx(MA,{placeholder:"Select a value"})}),w.jsx(oC,{children:s.values.map(h=>w.jsx(iC,{value:h.toString(),children:h.toString()},h))})]}),r&&w.jsx("div",{children:t!==a&&w.jsx(es,{disabled:c,onClick:()=>{d(!0),r(async h=>[{op:"replace",path:h,value:a}]).finally(()=>{d(!1)})},children:c?"Saving...":"Submit"})})]})}function G0({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}]})},[]),w.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[w.jsx(Om,{ref:a,disabled:l,defaultValue:o??0,onChange:u=>i(Number(u.target.value)),type:"number"}),r&&w.jsx("div",{children:t!==o&&w.jsx(es,{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 zA({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)||""}]})},[]),w.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[w.jsx(Om,{ref:a,disabled:l,defaultValue:o??"",onChange:u=>i(u.target.value)}),r&&w.jsx("div",{children:t!==o&&w.jsx(es,{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 FA=({className:e})=>w.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[w.jsx("g",{filter:"url(#filter0_d_21_1677)",children:w.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"})}),w.jsx("g",{filter:"url(#filter1_i_21_1677)",children:w.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),w.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"}),w.jsxs("defs",{children:[w.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[w.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),w.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"}),w.jsx("feOffset",{}),w.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),w.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),w.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"}),w.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),w.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),w.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[w.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),w.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),w.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"}),w.jsx("feOffset",{}),w.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),w.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),w.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"}),w.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]}),sC=FA,aC="Switch",[BA,pL]=Ni(aC),[WA,UA]=BA(aC),HA=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=Ze(t,y=>f(y)),m=p.useRef(!1),g=d?!!d.closest("form"):!0,[_=!1,v]=Dl({prop:o,defaultProp:i,onChange:u});return p.createElement(WA,{scope:n,checked:_,disabled:s},p.createElement(Ie.button,te({type:"button",role:"switch","aria-checked":_,"aria-required":l,"data-state":uC(_),"data-disabled":s?"":void 0,disabled:s,value:a},c,{ref:h,onClick:Ge(e.onClick,y=>{v(x=>!x),g&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})),g&&p.createElement(GA,{control:d,bubbles:!m.current,name:r,value:a,checked:_,required:l,disabled:s,style:{transform:"translateX(-100%)"}}))}),VA="SwitchThumb",KA=p.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=UA(VA,n);return p.createElement(Ie.span,te({"data-state":uC(o.checked),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),GA=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=p.useRef(null),l=DE(n),s=NE(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",te({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 uC(e){return e?"checked":"unchecked"}const cC=HA,YA=KA,Ip=p.forwardRef(({className:e,...t},n)=>w.jsx(cC,{className:ut("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:w.jsx(YA,{className:ut("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")})}));Ip.displayName=cC.displayName;const Bm=p.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:ut("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Bm.displayName="Card";const XA=p.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:ut("flex flex-col space-y-1.5 p-6",e),...t}));XA.displayName="CardHeader";const QA=p.forwardRef(({className:e,...t},n)=>w.jsx("h3",{ref:n,className:ut("text-2xl font-semibold leading-none tracking-tight",e),...t}));QA.displayName="CardTitle";const JA=p.forwardRef(({className:e,...t},n)=>w.jsx("p",{ref:n,className:ut("text-sm text-muted-foreground",e),...t}));JA.displayName="CardDescription";const ZA=p.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:ut("p-6 pt-0",e),...t}));ZA.displayName="CardContent";const qA=p.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:ut("flex items-center p-6 pt-0",e),...t}));qA.displayName="CardFooter";/**
169
+ `)},K3=0,Gi=[];function G3(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),o=p.useState(K3++)[0],i=p.useState(function(){return BE()})[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 g=g3([e.lockRef.current],(e.shards||[]).map(B0),!0).filter(Boolean);return g.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),g.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=p.useCallback(function(g,_){if("touches"in g&&g.touches.length===2)return!l.current.allowPinchZoom;var v=Mu(g),y=n.current,x="deltaX"in g?g.deltaX:y[0]-v[0],S="deltaY"in g?g.deltaY:y[1]-v[1],k,T=g.target,b=Math.abs(x)>Math.abs(S)?"h":"v";if("touches"in g&&b==="h"&&T.type==="range")return!1;var N=z0(b,T);if(!N)return!0;if(N?k=b:(k=b==="v"?"h":"v",N=z0(b,T)),!N)return!1;if(!r.current&&"changedTouches"in g&&(x||S)&&(r.current=k),!k)return!0;var D=r.current||k;return U3(D,_,g,D==="h"?x:S,!0)},[]),a=p.useCallback(function(g){var _=g;if(!(!Gi.length||Gi[Gi.length-1]!==i)){var v="deltaY"in _?F0(_):Mu(_),y=t.current.filter(function(k){return k.name===_.type&&k.target===_.target&&H3(k.delta,v)})[0];if(y&&y.should){_.cancelable&&_.preventDefault();return}if(!y){var x=(l.current.shards||[]).map(B0).filter(Boolean).filter(function(k){return k.contains(_.target)}),S=x.length>0?s(_,x[0]):!l.current.noIsolation;S&&_.cancelable&&_.preventDefault()}}},[]),u=p.useCallback(function(g,_,v,y){var x={name:g,delta:_,target:v,should:y};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(S){return S!==x})},1)},[]),c=p.useCallback(function(g){n.current=Mu(g),r.current=void 0},[]),d=p.useCallback(function(g){u(g.type,F0(g),g.target,s(g,e.lockRef.current))},[]),f=p.useCallback(function(g){u(g.type,Mu(g),g.target,s(g,e.lockRef.current))},[]);p.useEffect(function(){return Gi.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Ki),document.addEventListener("touchmove",a,Ki),document.addEventListener("touchstart",c,Ki),function(){Gi=Gi.filter(function(g){return g!==i}),document.removeEventListener("wheel",a,Ki),document.removeEventListener("touchmove",a,Ki),document.removeEventListener("touchstart",c,Ki)}},[]);var h=e.removeScrollBar,m=e.inert;return p.createElement(p.Fragment,null,m?p.createElement(i,{styles:V3(o)}):null,h?p.createElement(D3,{gapMode:"margin"}):null)}const Y3=C3(FE,G3);var VE=p.forwardRef(function(e,t){return p.createElement(Dd,yr({},e,{ref:t,sideCar:Y3}))});VE.classNames=Dd.classNames;const X3=VE,Q3=[" ","Enter","ArrowUp","ArrowDown"],J3=[" ","Enter"],Id="Select",[jd,zm,Z3]=vE(Id),[rs,fL]=Ni(Id,[Z3,OE]),Fm=OE(),[q3,Mi]=rs(Id),[eA,tA]=rs(Id),nA=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,m=Fm(t),[g,_]=p.useState(null),[v,y]=p.useState(null),[x,S]=p.useState(!1),k=Wg(u),[T=!1,b]=Dl({prop:r,defaultProp:o,onChange:i}),[N,D]=Dl({prop:l,defaultProp:s,onChange:a}),M=p.useRef(null),j=g?!!g.closest("form"):!0,[B,re]=p.useState(new Set),V=Array.from(B).map(Y=>Y.props.value).join(";");return p.createElement(i3,m,p.createElement(q3,{required:h,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Ad(),value:N,onValueChange:D,open:T,onOpenChange:b,dir:k,triggerPointerDownPosRef:M,disabled:f},p.createElement(jd.Provider,{scope:t},p.createElement(eA,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(Y=>{re(C=>new Set(C).add(Y))},[]),onNativeOptionRemove:p.useCallback(Y=>{re(C=>{const $=new Set(C);return $.delete(Y),$})},[])},n)),j?p.createElement(XE,{key:V,"aria-hidden":!0,required:h,tabIndex:-1,name:c,autoComplete:d,value:N,onChange:Y=>D(Y.target.value),disabled:f},N===void 0?p.createElement("option",{value:""}):null,Array.from(B)):null))},rA="SelectTrigger",oA=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=Fm(n),l=Mi(rA,n),s=l.disabled||r,a=Ze(t,l.onTriggerChange),u=zm(n),[c,d,f]=QE(m=>{const g=u().filter(y=>!y.disabled),_=g.find(y=>y.value===l.value),v=JE(g,m,_);v!==void 0&&l.onValueChange(v.value)}),h=()=>{s||(l.onOpenChange(!0),f())};return p.createElement(l3,te({asChild:!0},i),p.createElement(Ie.button,te({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":YE(l.value)?"":void 0},o,{ref:a,onClick:Ge(o.onClick,m=>{m.currentTarget.focus()}),onPointerDown:Ge(o.onPointerDown,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&g.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&(h(),l.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)},m.preventDefault())}),onKeyDown:Ge(o.onKeyDown,m=>{const g=c.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&d(m.key),!(g&&m.key===" ")&&Q3.includes(m.key)&&(h(),m.preventDefault())})})))}),iA="SelectValue",lA=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:l="",...s}=e,a=Mi(iA,n),{onValueNodeHasChildrenChange:u}=a,c=i!==void 0,d=Ze(t,a.onValueNodeChange);return Nn(()=>{u(c)},[u,c]),p.createElement(Ie.span,te({},s,{ref:d,style:{pointerEvents:"none"}}),YE(a.value)?p.createElement(p.Fragment,null,l):i)}),sA=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.createElement(Ie.span,te({"aria-hidden":!0},o,{ref:t}),r||"▼")}),aA=e=>p.createElement(a3,te({asChild:!0},e)),Il="SelectContent",uA=p.forwardRef((e,t)=>{const n=Mi(Il,e.__scopeSelect),[r,o]=p.useState();if(Nn(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Nr.createPortal(p.createElement(KE,{scope:e.__scopeSelect},p.createElement(jd.Slot,{scope:e.__scopeSelect},p.createElement("div",null,e.children))),i):null}return p.createElement(cA,te({},e,{ref:t}))}),jr=10,[KE,zd]=rs(Il),cA=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:m,hideWhenDetached:g,avoidCollisions:_,...v}=e,y=Mi(Il,n),[x,S]=p.useState(null),[k,T]=p.useState(null),b=Ze(t,Q=>S(Q)),[N,D]=p.useState(null),[M,j]=p.useState(null),B=zm(n),[re,V]=p.useState(!1),Y=p.useRef(!1);p.useEffect(()=>{if(x)return p3(x)},[x]),o5();const C=p.useCallback(Q=>{const[Ne,...ye]=B().map(Te=>Te.ref.current),[Se]=ye.slice(-1),pe=document.activeElement;for(const Te of Q)if(Te===pe||(Te==null||Te.scrollIntoView({block:"nearest"}),Te===Ne&&k&&(k.scrollTop=0),Te===Se&&k&&(k.scrollTop=k.scrollHeight),Te==null||Te.focus(),document.activeElement!==pe))return},[B,k]),$=p.useCallback(()=>C([N,x]),[C,N,x]);p.useEffect(()=>{re&&$()},[re,$]);const{onOpenChange:E,triggerPointerDownPosRef:O}=y;p.useEffect(()=>{if(x){let Q={x:0,y:0};const Ne=Se=>{var pe,Te,We,At;Q={x:Math.abs(Math.round(Se.pageX)-((pe=(Te=O.current)===null||Te===void 0?void 0:Te.x)!==null&&pe!==void 0?pe:0)),y:Math.abs(Math.round(Se.pageY)-((We=(At=O.current)===null||At===void 0?void 0:At.y)!==null&&We!==void 0?We:0))}},ye=Se=>{Q.x<=10&&Q.y<=10?Se.preventDefault():x.contains(Se.target)||E(!1),document.removeEventListener("pointermove",Ne),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",Ne),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ne),document.removeEventListener("pointerup",ye,{capture:!0})}}},[x,E,O]),p.useEffect(()=>{const Q=()=>E(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[E]);const[R,F]=QE(Q=>{const Ne=B().filter(pe=>!pe.disabled),ye=Ne.find(pe=>pe.ref.current===document.activeElement),Se=JE(Ne,Q,ye);Se&&setTimeout(()=>Se.ref.current.focus())}),H=p.useCallback((Q,Ne,ye)=>{const Se=!Y.current&&!ye;(y.value!==void 0&&y.value===Ne||Se)&&(D(Q),Se&&(Y.current=!0))},[y.value]),ae=p.useCallback(()=>x==null?void 0:x.focus(),[x]),oe=p.useCallback((Q,Ne,ye)=>{const Se=!Y.current&&!ye;(y.value!==void 0&&y.value===Ne||Se)&&j(Q)},[y.value]),$e=r==="popper"?W0:dA,_e=$e===W0?{side:s,sideOffset:a,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:m,hideWhenDetached:g,avoidCollisions:_}:{};return p.createElement(KE,{scope:n,content:x,viewport:k,onViewportChange:T,itemRefCallback:H,selectedItem:N,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:$,selectedItemText:M,position:r,isPositioned:re,searchRef:R},p.createElement(X3,{as:Rl,allowPinchZoom:!0},p.createElement(i5,{asChild:!0,trapped:y.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:Ge(o,Q=>{var Ne;(Ne=y.trigger)===null||Ne===void 0||Ne.focus({preventScroll:!0}),Q.preventDefault()})},p.createElement(t5,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>y.onOpenChange(!1)},p.createElement($e,te({role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:Q=>Q.preventDefault()},v,_e,{onPlaced:()=>V(!0),ref:b,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Ge(v.onKeyDown,Q=>{const Ne=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!Ne&&Q.key.length===1&&F(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let Se=B().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(Se=Se.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const pe=Q.target,Te=Se.indexOf(pe);Se=Se.slice(Te+1)}setTimeout(()=>C(Se)),Q.preventDefault()}})}))))))}),dA=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Mi(Il,n),l=zd(Il,n),[s,a]=p.useState(null),[u,c]=p.useState(null),d=Ze(t,b=>c(b)),f=zm(n),h=p.useRef(!1),m=p.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:v,focusSelectedItem:y}=l,x=p.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&u&&g&&_&&v){const b=i.trigger.getBoundingClientRect(),N=u.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),M=v.getBoundingClientRect();if(i.dir!=="rtl"){const pe=M.left-N.left,Te=D.left-pe,We=b.left-Te,At=b.width+We,cn=Math.max(At,N.width),Gn=window.innerWidth-jr,Re=Hh(Te,[jr,Gn-cn]);s.style.minWidth=At+"px",s.style.left=Re+"px"}else{const pe=N.right-M.right,Te=window.innerWidth-D.right-pe,We=window.innerWidth-b.right-Te,At=b.width+We,cn=Math.max(At,N.width),Gn=window.innerWidth-jr,Re=Hh(Te,[jr,Gn-cn]);s.style.minWidth=At+"px",s.style.right=Re+"px"}const j=f(),B=window.innerHeight-jr*2,re=g.scrollHeight,V=window.getComputedStyle(u),Y=parseInt(V.borderTopWidth,10),C=parseInt(V.paddingTop,10),$=parseInt(V.borderBottomWidth,10),E=parseInt(V.paddingBottom,10),O=Y+C+re+E+$,R=Math.min(_.offsetHeight*5,O),F=window.getComputedStyle(g),H=parseInt(F.paddingTop,10),ae=parseInt(F.paddingBottom,10),oe=b.top+b.height/2-jr,$e=B-oe,_e=_.offsetHeight/2,Q=_.offsetTop+_e,Ne=Y+C+Q,ye=O-Ne;if(Ne<=oe){const pe=_===j[j.length-1].ref.current;s.style.bottom="0px";const Te=u.clientHeight-g.offsetTop-g.offsetHeight,We=Math.max($e,_e+(pe?ae:0)+Te+$),At=Ne+We;s.style.height=At+"px"}else{const pe=_===j[0].ref.current;s.style.top="0px";const We=Math.max(oe,Y+g.offsetTop+(pe?H:0)+_e)+ye;s.style.height=We+"px",g.scrollTop=Ne-oe+g.offsetTop}s.style.margin=`${jr}px 0`,s.style.minHeight=R+"px",s.style.maxHeight=B+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[f,i.trigger,i.valueNode,s,u,g,_,v,i.dir,r]);Nn(()=>x(),[x]);const[S,k]=p.useState();Nn(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const T=p.useCallback(b=>{b&&m.current===!0&&(x(),y==null||y(),m.current=!1)},[x,y]);return p.createElement(fA,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:T},p.createElement("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S}},p.createElement(Ie.div,te({},o,{ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}}))))}),W0=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=jr,...i}=e,l=Fm(n);return p.createElement(s3,te({},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)"}}))}),[fA,hA]=rs(Il,{}),U0="SelectViewport",pA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=zd(U0,n),i=hA(U0,n),l=Ze(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(jd.Slot,{scope:n},p.createElement(Ie.div,te({"data-radix-select-viewport":"",role:"presentation"},r,{ref:l,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:Ge(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-jr*2,m=parseFloat(c.style.minHeight),g=parseFloat(c.style.height),_=Math.max(m,g);if(_<h){const v=_+f,y=Math.min(h,v),x=v-y;c.style.height=y+"px",c.style.bottom==="0px"&&(u.scrollTop=x>0?x:0,c.style.justifyContent="flex-end")}}}s.current=u.scrollTop})}))))}),gA="SelectGroup",[hL,mA]=rs(gA),vA="SelectLabel",yA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=mA(vA,n);return p.createElement(Ie.div,te({id:o.id},r,{ref:t}))}),Dp="SelectItem",[xA,GE]=rs(Dp),wA=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...l}=e,s=Mi(Dp,n),a=zd(Dp,n),u=s.value===r,[c,d]=p.useState(i??""),[f,h]=p.useState(!1),m=Ze(t,v=>{var y;return(y=a.itemRefCallback)===null||y===void 0?void 0:y.call(a,v,r,o)}),g=Ad(),_=()=>{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(xA,{scope:n,value:r,disabled:o,textId:g,isSelected:u,onItemTextChange:p.useCallback(v=>{d(y=>{var x;return y||((x=v==null?void 0:v.textContent)!==null&&x!==void 0?x:"").trim()})},[])},p.createElement(jd.ItemSlot,{scope:n,value:r,disabled:o,textValue:c},p.createElement(Ie.div,te({role:"option","aria-labelledby":g,"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:m,onFocus:Ge(l.onFocus,()=>h(!0)),onBlur:Ge(l.onBlur,()=>h(!1)),onPointerUp:Ge(l.onPointerUp,_),onPointerMove:Ge(l.onPointerMove,v=>{if(o){var y;(y=a.onItemLeave)===null||y===void 0||y.call(a)}else v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ge(l.onPointerLeave,v=>{if(v.currentTarget===document.activeElement){var y;(y=a.onItemLeave)===null||y===void 0||y.call(a)}}),onKeyDown:Ge(l.onKeyDown,v=>{var y;((y=a.searchRef)===null||y===void 0?void 0:y.current)!==""&&v.key===" "||(J3.includes(v.key)&&_(),v.key===" "&&v.preventDefault())})}))))}),Lu="SelectItemText",_A=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,l=Mi(Lu,n),s=zd(Lu,n),a=GE(Lu,n),u=tA(Lu,n),[c,d]=p.useState(null),f=Ze(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,m=p.useMemo(()=>p.createElement("option",{key:a.value,value:a.value,disabled:a.disabled},h),[a.disabled,a.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return Nn(()=>(g(m),()=>_(m)),[g,_,m]),p.createElement(p.Fragment,null,p.createElement(Ie.span,te({id:a.textId},i,{ref:f})),a.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Nr.createPortal(i.children,l.valueNode):null)}),SA="SelectItemIndicator",EA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return GE(SA,n).isSelected?p.createElement(Ie.span,te({"aria-hidden":!0},r,{ref:t})):null}),CA=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.createElement(Ie.div,te({"aria-hidden":!0},r,{ref:t}))});function YE(e){return e===""||e===void 0}const XE=p.forwardRef((e,t)=>{const{value:n,...r}=e,o=p.useRef(null),i=Ze(t,o),l=DE(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(c3,{asChild:!0},p.createElement("select",te({},r,{ref:i,defaultValue:n})))});XE.displayName="BubbleSelect";function QE(e){const t=Ht(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 JE(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=$A(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 $A(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const kA=nA,ZE=oA,bA=lA,TA=sA,NA=aA,qE=uA,RA=pA,eC=yA,tC=wA,PA=_A,OA=EA,nC=CA,AA=kA,MA=bA,rC=p.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(ZE,{ref:r,className:ut("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,w.jsx(TA,{asChild:!0,children:w.jsx(mE,{className:"w-4 h-4 opacity-50"})})]}));rC.displayName=ZE.displayName;const oC=p.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>w.jsx(NA,{children:w.jsx(qE,{ref:o,className:ut("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:w.jsx(RA,{className:ut("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));oC.displayName=qE.displayName;const LA=p.forwardRef(({className:e,...t},n)=>w.jsx(eC,{ref:n,className:ut("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));LA.displayName=eC.displayName;const iC=p.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(tC,{ref:r,className:ut("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:[w.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(OA,{children:w.jsx(LO,{className:"w-4 h-4"})})}),w.jsx(PA,{children:t})]}));iC.displayName=tC.displayName;const DA=p.forwardRef(({className:e,...t},n)=>w.jsx(nC,{ref:n,className:ut("-mx-1 my-1 h-px bg-muted",e),...t}));DA.displayName=nC.displayName;function lC({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"?w.jsx(zA,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||n===null)&&(r==null?void 0:r.type)==="number"?w.jsx(G0,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="keyOf"?w.jsx(K0,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i,selector:r.selector}):(typeof n=="number"||n===null)&&(r==null?void 0:r.type)==="number"?w.jsx(G0,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="keyOf"?w.jsx(K0,{defaultValue:n,disabled:t,registerPatchCallback:o,onSubmit:i,selector:r.selector}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="richtext"?w.jsx(jA,{registerPatchCallback:o,onSubmit:i,defaultValue:n}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="image"?w.jsx(IA,{path:e,registerPatchCallback:o,onSubmit:i,defaultValue:n}):w.jsxs("div",{children:["Unsupported schema: ",r.type]})}function H0(e,t,n,r){if(!t||!r)return[];const o=r.sha256.slice(0,5),i=function(){const l=Yg(t)??"unknown",s=Xg(l);return n?`/public/${n.split(".").slice(0,-1).join(".")||n}_${o}.${s}`:`/public/${r.sha256}.${s}`}();return[{value:{[vn]:i,[Kt]:"file",metadata:r},op:"replace",path:e},{value:t,op:"file",path:e,filePath:i}]}function IA({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&&$n.convertFileSource(t).url)},[t]),p.useEffect(()=>{r&&r(async f=>H0(f,(o==null?void 0:o.src)??null,(o==null?void 0:o.filename)??null,a))},[o,t]),w.jsxs("div",{className:"max-w-4xl p-4",children:[w.jsxs("label",{htmlFor:`img_input:${e}`,className:"",children:[o||c?w.jsx("img",{src:(o==null?void 0:o.src)||c}):w.jsx("div",{children:"Empty"}),w.jsx("input",{id:`img_input:${e}`,type:"file",hidden:!0,onChange:f=>{dE(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&&w.jsx("div",{children:o&&w.jsx(es,{disabled:l,onClick:()=>{s(!0),n(f=>Promise.resolve(H0(f,o.src,o.filename??null,a))).finally(()=>{s(!1),i(null),u(void 0)})},children:l?"Saving...":"Save"})})]},e)}async function V0(e,t){const{templateStrings:n,exprs:r,files:o}=t?await c2(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 jA({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=>V0(u,r))},[r]),w.jsxs("div",{className:"p-4 border rounded border-card",children:[w.jsx(OO,{onEditor:u=>{o(u)},richtext:e||{children:[],[Kt]:"root"}}),t&&w.jsx("div",{children:i&&w.jsx(es,{disabled:s||!r,onClick:()=>{r&&(a(!0),t(u=>V0(u,r)).finally(()=>{a(!1),l(!1)}))},children:s?"Saving...":"Save"})})]})}function K0({disabled:e,defaultValue:t,registerPatchCallback:n,onSubmit:r,selector:o}){const i=lM(o),s=(h=>Array.isArray(h.moduleSource)?{type:"number",values:Object.keys(h.moduleSource).map(m=>parseInt(m))}:{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]),w.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[w.jsxs(AA,{defaultValue:a.toString(),disabled:c,onValueChange:h=>{u(f(h))},children:[w.jsx(rC,{children:w.jsx(MA,{placeholder:"Select a value"})}),w.jsx(oC,{children:s.values.map(h=>w.jsx(iC,{value:h.toString(),children:h.toString()},h))})]}),r&&w.jsx("div",{children:t!==a&&w.jsx(es,{disabled:c,onClick:()=>{d(!0),r(async h=>[{op:"replace",path:h,value:a}]).finally(()=>{d(!1)})},children:c?"Saving...":"Save"})})]})}function G0({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}]})},[]),w.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[w.jsx(Om,{ref:a,disabled:l,defaultValue:o??0,onChange:u=>i(Number(u.target.value)),type:"number"}),r&&w.jsx("div",{children:t!==o&&w.jsx(es,{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...":"Save"})})]})}function zA({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)||""}]})},[]),w.jsxs("div",{className:"flex flex-col justify-between h-full gap-y-4",children:[w.jsx(Om,{ref:a,disabled:l,defaultValue:o??"",onChange:u=>i(u.target.value)}),r&&w.jsx("div",{children:t!==o&&w.jsx(es,{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...":"Save"})})]})}const FA=({className:e})=>w.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[w.jsx("g",{filter:"url(#filter0_d_21_1677)",children:w.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"})}),w.jsx("g",{filter:"url(#filter1_i_21_1677)",children:w.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),w.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"}),w.jsxs("defs",{children:[w.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[w.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),w.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"}),w.jsx("feOffset",{}),w.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),w.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),w.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"}),w.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),w.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),w.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[w.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),w.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),w.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"}),w.jsx("feOffset",{}),w.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),w.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),w.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"}),w.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]}),sC=FA,aC="Switch",[BA,pL]=Ni(aC),[WA,UA]=BA(aC),HA=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=Ze(t,y=>f(y)),m=p.useRef(!1),g=d?!!d.closest("form"):!0,[_=!1,v]=Dl({prop:o,defaultProp:i,onChange:u});return p.createElement(WA,{scope:n,checked:_,disabled:s},p.createElement(Ie.button,te({type:"button",role:"switch","aria-checked":_,"aria-required":l,"data-state":uC(_),"data-disabled":s?"":void 0,disabled:s,value:a},c,{ref:h,onClick:Ge(e.onClick,y=>{v(x=>!x),g&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})),g&&p.createElement(GA,{control:d,bubbles:!m.current,name:r,value:a,checked:_,required:l,disabled:s,style:{transform:"translateX(-100%)"}}))}),VA="SwitchThumb",KA=p.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=UA(VA,n);return p.createElement(Ie.span,te({"data-state":uC(o.checked),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),GA=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=p.useRef(null),l=DE(n),s=NE(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",te({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 uC(e){return e?"checked":"unchecked"}const cC=HA,YA=KA,Ip=p.forwardRef(({className:e,...t},n)=>w.jsx(cC,{className:ut("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:w.jsx(YA,{className:ut("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")})}));Ip.displayName=cC.displayName;const Bm=p.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:ut("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Bm.displayName="Card";const XA=p.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:ut("flex flex-col space-y-1.5 p-6",e),...t}));XA.displayName="CardHeader";const QA=p.forwardRef(({className:e,...t},n)=>w.jsx("h3",{ref:n,className:ut("text-2xl font-semibold leading-none tracking-tight",e),...t}));QA.displayName="CardTitle";const JA=p.forwardRef(({className:e,...t},n)=>w.jsx("p",{ref:n,className:ut("text-sm text-muted-foreground",e),...t}));JA.displayName="CardDescription";const ZA=p.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:ut("p-6 pt-0",e),...t}));ZA.displayName="CardContent";const qA=p.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:ut("flex items-center p-6 pt-0",e),...t}));qA.displayName="CardFooter";/**
170
170
  * @remix-run/router v1.13.0
171
171
  *
172
172
  * Copyright (c) Remix Software Inc.
@@ -189,7 +189,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
189
189
  ${d.map((N,D)=>`${D+1}. ${N.message}`).join(`
190
190
  `)}
191
191
 
192
- Showing stack trace of: 0. ${d[0].message}`,b=new Error(T);throw b.stack=d[0].stack,b}f&&f.length>0&&console.warn("Val encountered validation errors:",f),p.useEffect(()=>{s(t?`/${t}`:l)},[t]);const[h,m]=p.useState(null);p.useEffect(()=>{try{new WebSocket(`${window.location.origin.replace("http://","ws://")}/_next/webpack-hmr`).addEventListener("message",b=>{let N;try{N=JSON.parse(b.data)}catch{console.error("Failed to parse HMR")}typeof(N==null?void 0:N.hash)=="string"&&(N==null?void 0:N.action)==="built"&&m(N.hash)})}catch(T){console.warn("Failed to initialize HMR",T)}},[]),p.useEffect(()=>{console.log("(Re)-fetching modules"),e.getTree({patch:!0,includeSchema:!0,includeSource:!0}).then(T=>{Fs.isOk(T)?r(T.value.modules):(i("Could not load modules: "+T.error.message),console.error(T.error))})},[h]);const g=Hm(),[_,v]=QO();p.useEffect(()=>{const T=b=>{console.log("popstate",b)};return window.addEventListener("popstate",T),()=>{window.removeEventListener("popstate",T)}},[]);const y=ee.useRef(null),x=p.useCallback(T=>async b=>{const[N,D]=$n.splitModuleIdAndModulePath(T),M=await b($n.createPatchJSONPath(D));return e.postPatches(N,M).then(j=>{if(Fs.isErr(j))throw j.error;if(!h)return e.getTree({treePath:N,patch:!0,includeSchema:!0,includeSource:!0}).then(B=>{Fs.isOk(B)?r(B.value.modules):(i("Could not load modules: "+B.error.message),console.error(B.error))})}).catch(j=>{console.error(j)})},[]);return w.jsx(cE.Provider,{value:{theme:_,setTheme:v,api:e,editMode:"full",session:{status:"not-asked"},highlight:!1,setHighlight:()=>{},setEditMode:()=>{},setWindowSize:()=>{}},children:w.jsxs("div",{id:"val-fullscreen-container",className:"relative font-serif antialiased","data-mode":_,children:[w.jsx("div",{className:"fixed -translate-x-1/2 z-overlay left-1/2 bottom-4",children:w.jsx(KO,{api:e})}),w.jsx("div",{id:"val-fullscreen-hover",ref:y}),w.jsx(RC.Provider,{value:{hoverElem:y==null?void 0:y.current},children:w.jsx("div",{className:"text-primary bg-background",children:w.jsxs(Ws,{children:[w.jsx("div",{className:"px-4 h-[50px] flex items-center justify-center",children:w.jsx(sC,{})}),w.jsx(Bs,{className:"px-4",children:n?w.jsx(mM,{paths:Object.keys(n),setSelectedModuleId:T=>{g(T)}}):!o&&w.jsx("div",{className:"py-4",children:"Loading..."})}),w.jsxs("div",{className:"flex items-center justify-start w-full h-[50px] gap-2 font-serif text-xs",children:[w.jsx("button",{onClick:()=>{history.back()},children:w.jsx(DO,{})}),w.jsx("p",{children:l||"/"})]}),w.jsxs("div",{className:"p-4",children:[o&&w.jsxs("div",{className:"text-lg text-destructive-foreground",children:["ERROR: ",o]}),n&&l&&a&&u!==void 0&&c!==void 0&&w.jsx(NC.Provider,{value:n,children:w.jsx(uM,{path:l,source:u,schema:c,setSelectedPath:s,initOnSubmit:x})})]})]})})})]})})},RC=ee.createContext({hoverElem:null}),aM=()=>ee.useContext(RC);function uM({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o}){const[,i]=$n.splitModuleIdAndModulePath(e),l=$n.resolvePath(i,t,n);if(!l)throw Error("Could not resolve module: "+e);return w.jsx(PC,{path:e,source:l.source,schema:l.schema,setSelectedPath:r,initOnSubmit:o,top:!0})}function PC({path:e,source:t,schema:n,setSelectedPath:r,field:o,initOnSubmit:i,top:l}){return t===null||n.opt?w.jsx(hM,{path:e,source:t,schema:n,field:o,initOnSubmit:i,setSelectedPath:r}):n.type==="object"?typeof t!="object"||ea(t)?w.jsxs("div",{children:["ERROR: expected object, but found ",typeof t]}):w.jsx(OC,{source:t,path:e,schema:n,initOnSubmit:i,setSelectedPath:r,top:l}):n.type==="array"?typeof t!="object"||!ea(t)?w.jsxs("div",{children:["ERROR: expected array, but found ",typeof t]}):w.jsx(AC,{source:t,path:e,schema:n,setSelectedPath:r}):n.type==="record"?typeof t!="object"?w.jsxs("div",{children:["ERROR: expected object for ",n.type,", but found ",typeof t]}):ea(t)?w.jsxs("div",{children:["ERROR: did not expect array for ",n.type]}):w.jsx(cM,{source:t,path:e,schema:n,setSelectedPath:r}):w.jsxs("div",{className:"py-2 gap-y-4",children:[w.jsx("div",{className:"text-left",children:o||e}),w.jsx(lC,{path:e,disabled:!1,source:t,schema:n,onSubmit:i(e)})]})}function OC({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o,top:i}){return w.jsx("div",{className:vd("flex flex-col gap-y-8",{"border-l-2 border-border pl-6":!i}),children:Object.entries(n.items).map(([l,s])=>{const a=Aa(e,l);return w.jsx(PC,{path:a,source:t[l],schema:s,setSelectedPath:r,field:l,initOnSubmit:o},a)})},e)}function cM({path:e,source:t,schema:n,setSelectedPath:r}){const o=Hm();return w.jsx("div",{className:"flex flex-col gap-4 p-2",children:Object.entries(t).map(([i,l])=>{const s=Aa(e,i);return w.jsx("button",{onClick:()=>{r(s),o(s)},children:w.jsx(dM,{recordKey:i,path:s,source:l,schema:n.item})},s)})},e)}const Wp=170;function dM({recordKey:e,path:t,source:n,schema:r}){const o=ee.useRef(null),[i,l]=p.useState(!1);return p.useEffect(()=>{o.current&&o.current.getBoundingClientRect().height>=Wp&&l(!0)},[]),w.jsxs(Bm,{ref:o,className:"relative px-4 pt-2 pb-4 overflow-hidden border gap-y-2",style:{maxHeight:Wp},children:[w.jsx("div",{className:"pb-4 font-serif text-left text-accent",children:e}),w.jsx("div",{className:"text-xs",children:w.jsx(Vm,{path:t,source:n,schema:r})}),i&&w.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[20px] bg-gradient-to-b from-transparent to-background"})]},t)}function AC({path:e,source:t,schema:n,setSelectedPath:r}){const o=Hm();return w.jsx("div",{className:"flex flex-col gap-4 p-2",children:t.map((i,l)=>{const s=Aa(e,l);return w.jsx("button",{onClick:()=>{r(s),o(s)},children:w.jsx(fM,{index:l,path:s,source:i,schema:n.item},s)},s)})},e)}const a1=Wp;function fM({index:e,path:t,source:n,schema:r}){const o=ee.useRef(null),[i,l]=p.useState(!1);return p.useEffect(()=>{o.current&&o.current.getBoundingClientRect().height>=a1&&l(!0)},[]),w.jsxs(Bm,{ref:o,className:"relative px-4 pt-2 pb-4 overflow-hidden border gap-y-2",style:{maxHeight:a1},children:[w.jsx("div",{className:"pb-4 font-serif text-left uppercase text-accent",children:e+1<10?`0${e+1}`:e+1}),w.jsx("div",{className:"text-xs",children:w.jsx(Vm,{path:t,source:n,schema:r})}),i&&w.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[20px] bg-gradient-to-b from-transparent to-background"})]})}function Aa(e,t){const n=$n.createValPathOfItem(e,t);if(!n)throw Error(`Could not create val path: ${e} of ${t==null?void 0:t.toString()}`);return n}function Vm({path:e,source:t,schema:n}){const[r,o]=p.useState(null),{hoverElem:i}=aM();if(n.type==="object")return w.jsx("div",{className:"grid grid-cols-[min-content_1fr] gap-2 text-left",children:Object.entries(n.items).map(([l])=>w.jsxs(p.Fragment,{children:[w.jsxs("span",{className:"text-muted",children:[l,":"]}),w.jsx("span",{children:w.jsx(Vm,{source:(t==null?void 0:t[l])??null,schema:n.items[l],path:Aa(e,l)})})]},Aa(e,l)))},e);if(n.type==="array")return t===null?w.jsx("span",{className:"text-accent",children:"Empty"},e):Array.isArray(t)?w.jsxs("span",{children:[w.jsx("span",{className:"text-accent",children:t.length}),w.jsx("span",{children:t.length===1?" item":" items"})]},e):w.jsx("span",{className:"px-2 bg-destructive text-destructive-foreground",children:"Unknown length"},e);if(n.type==="richtext")return t===null?w.jsx("span",{className:"text-accent",children:"Empty"},e):typeof t!="object"?w.jsxs("div",{className:"p-4 text-destructive-foreground bg-destructive",children:["ERROR: ",typeof t," not an object"]},e):!(Kt in t)||t[Kt]!=="richtext"?w.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: object is not richtext"},e):w.jsx(vM,{children:v_(t)},e);if(n.type==="string")return t===null?w.jsx("span",{className:"text-accent",children:"Empty"},e):w.jsx("span",{children:t});if(n.type==="image"){if(t===null)return w.jsx("span",{className:"text-accent",children:"Empty"},e);if(typeof t!="object")return w.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: not an object"},e);if(!(vn in t)||typeof t[vn]!="string")return w.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: object is not an image"},e);const l=$n.convertFileSource(t).url;return w.jsxs("span",{onMouseOver:s=>{o({x:s.clientX,y:s.clientY})},onMouseLeave:()=>{o(null)},className:"relative flex items-center justify-start gap-1",children:[w.jsx("a",{href:l,className:"overflow-hidden underline truncate ",children:t[vn]}),r&&i&&Nr.createPortal(w.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?w.jsx("span",{className:"text-accent",children:"Empty"},e):w.jsx("span",{className:"text-accent",children:t?"true":"false"},e);if(n.type==="number")return t===null?w.jsx("span",{className:"text-accent",children:"Empty"},e):w.jsx("span",{className:"text-accent",children:t.toString()});if(n.type==="keyOf")return t===null?w.jsx("span",{className:"text-accent",children:"Empty"},e):w.jsx("span",{className:"text-accent",children:t.toString()},e)}return w.jsxs("div",{children:["TODO: ",n.type]},e)}function hM({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o,field:i}){const[l,s]=p.useState(t!==null);return w.jsxs("div",{className:"flex flex-col gap-y-6",children:[i?w.jsxs("div",{className:"flex items-center justify-start gap-x-4",children:[w.jsx(Ip,{checked:l,onClick:()=>{s(a=>!a)}}),w.jsx("span",{children:i})]}):w.jsx(Ip,{checked:l,onClick:()=>{s(a=>!a)}}),l&&w.jsx(pM,{source:t,schema:n,path:e,setSelectedPath:r,initOnSubmit:o})]},e)}function pM({source:e,path:t,schema:n,setSelectedPath:r,initOnSubmit:o}){if(n.type==="array"){if(typeof e=="object"&&(e===null||ea(e)))return w.jsx(AC,{source:e===null?[]:e,path:t,schema:n,setSelectedPath:r})}else if(n.type==="object"){if(typeof e=="object"&&(e===null||!ea(e)))return w.jsx(OC,{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 w.jsx(lC,{path:t,disabled:!1,source:e,schema:n,onSubmit:o(t)},t);return w.jsxs("div",{className:"p-4 bg-destructive text-destructive-foreground",children:["ERROR: unexpected source type ",typeof e," for schema type"," ",n.type]})}function ea(e){return Array.isArray(e)}function gM(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 mM({paths:e,setSelectedModuleId:t}){const n=gM(e);return w.jsx(s_,{children:Object.entries(n).map(([r,o])=>w.jsx("div",{className:"px-4 py-2",children:w.jsx(MC,{name:r,tree:o,moduleId:`/${r}`,setSelectedModuleId:t})},`/${r}`))})}function MC({name:e,tree:t,moduleId:n,setSelectedModuleId:r}){return w.jsxs("div",{children:[w.jsx("button",{onClick:()=>{r(n)},children:e}),Object.entries(t).map(([o,i])=>w.jsx("div",{className:"px-4 py-1",children:w.jsx(MC,{name:o,tree:i,moduleId:`${n}/${o}`,setSelectedModuleId:r})},`${n}/${o}`))]})}const u1={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 vM({children:e}){const t=e;function n(i,l){const s=u1.tags[i];return s&&l?[l,s].join(" "):s||l}function r(i,l){const s=u1.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 w.jsx("p",{className:n("p"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="img")return w.jsx("img",{className:n("img"),src:i.src},l);if(i.tag==="ul")return w.jsx("ul",{className:n("ul"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="ol")return w.jsx("ol",{className:n("ol"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="li")return w.jsx("li",{className:n("li"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="span")return w.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 w.jsx("h1",{className:n("h1"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h2")return w.jsx("h2",{className:n("h2"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h3")return w.jsx("h3",{className:n("h3"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h4")return w.jsx("h4",{className:n("h4"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h5")return w.jsx("h5",{className:n("h5"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h6")return w.jsx("h6",{className:n("h6"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="br")return w.jsx("br",{},l);if(i.tag==="a")return w.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?ee.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 w.jsx("span",{"data-val-path":t.valPath,children:t.children.map((i,l)=>o(i,l))})}const yM=p.createContext(null),Vf={didCatch:!1,error:null};class xM extends p.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Vf}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(Vf)}}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&&wM(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(Vf)}}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(yM.Provider,{value:{didCatch:i,error:l,resetErrorBoundary:this.resetErrorBoundary}},s)}}function wM(){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 LC="Collapsible",[_M,DC]=Ni(LC),[SM,Km]=_M(LC),EM=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:l,...s}=e,[a=!1,u]=Dl({prop:r,defaultProp:o,onChange:l});return p.createElement(SM,{scope:n,disabled:i,contentId:Ad(),open:a,onOpenToggle:p.useCallback(()=>u(c=>!c),[u])},p.createElement(Ie.div,te({"data-state":Gm(a),"data-disabled":i?"":void 0},s,{ref:t})))}),CM="CollapsibleTrigger",$M=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Km(CM,n);return p.createElement(Ie.button,te({type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Gm(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled},r,{ref:t,onClick:Ge(e.onClick,o.onOpenToggle)}))}),IC="CollapsibleContent",kM=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Km(IC,e.__scopeCollapsible);return p.createElement(Wl,{present:n||o.open},({present:i})=>p.createElement(bM,te({},r,{ref:t,present:i})))}),bM=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,l=Km(IC,n),[s,a]=p.useState(r),u=p.useRef(null),c=Ze(t,u),d=p.useRef(0),f=d.current,h=p.useRef(0),m=h.current,g=l.open||s,_=p.useRef(g),v=p.useRef();return p.useEffect(()=>{const y=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(y)},[]),Nn(()=>{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 x=y.getBoundingClientRect();d.current=x.height,h.current=x.width,_.current||(y.style.transitionDuration=v.current.transitionDuration,y.style.animationName=v.current.animationName),a(r)}},[l.open,r]),p.createElement(Ie.div,te({"data-state":Gm(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!g},i,{ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style}}),g&&o)});function Gm(e){return e?"open":"closed"}const TM=EM,NM=$M,RM=kM,Yo="Accordion",PM=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Ym,OM,AM]=vE(Yo),[Hd,gL]=Ni(Yo,[AM,DC]),Xm=DC(),jC=ee.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return ee.createElement(Ym.Provider,{scope:e.__scopeAccordion},n==="multiple"?ee.createElement(IM,te({},i,{ref:t})):ee.createElement(DM,te({},o,{ref:t})))});jC.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[zC,MM]=Hd(Yo),[FC,LM]=Hd(Yo,{collapsible:!1}),DM=ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...l}=e,[s,a]=Dl({prop:n,defaultProp:r,onChange:o});return ee.createElement(zC,{scope:e.__scopeAccordion,value:s?[s]:[],onItemOpen:a,onItemClose:ee.useCallback(()=>i&&a(""),[i,a])},ee.createElement(FC,{scope:e.__scopeAccordion,collapsible:i},ee.createElement(BC,te({},l,{ref:t}))))}),IM=ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l=[],s]=Dl({prop:n,defaultProp:r,onChange:o}),a=ee.useCallback(c=>s((d=[])=>[...d,c]),[s]),u=ee.useCallback(c=>s((d=[])=>d.filter(f=>f!==c)),[s]);return ee.createElement(zC,{scope:e.__scopeAccordion,value:l,onItemOpen:a,onItemClose:u},ee.createElement(FC,{scope:e.__scopeAccordion,collapsible:!0},ee.createElement(BC,te({},i,{ref:t}))))}),[jM,Vd]=Hd(Yo),BC=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...l}=e,s=ee.useRef(null),a=Ze(s,t),u=OM(n),d=Wg(o)==="ltr",f=Ge(e.onKeyDown,h=>{var m;if(!PM.includes(h.key))return;const g=h.target,_=u().filter(D=>{var M;return!((M=D.ref.current)!==null&&M!==void 0&&M.disabled)}),v=_.findIndex(D=>D.ref.current===g),y=_.length;if(v===-1)return;h.preventDefault();let x=v;const S=0,k=y-1,T=()=>{x=v+1,x>k&&(x=S)},b=()=>{x=v-1,x<S&&(x=k)};switch(h.key){case"Home":x=S;break;case"End":x=k;break;case"ArrowRight":i==="horizontal"&&(d?T():b());break;case"ArrowDown":i==="vertical"&&T();break;case"ArrowLeft":i==="horizontal"&&(d?b():T());break;case"ArrowUp":i==="vertical"&&b();break}const N=x%y;(m=_[N].ref.current)===null||m===void 0||m.focus()});return ee.createElement(jM,{scope:n,disabled:r,direction:o,orientation:i},ee.createElement(Ym.Slot,{scope:n},ee.createElement(Ie.div,te({},l,{"data-orientation":i,ref:a,onKeyDown:r?void 0:f}))))}),Up="AccordionItem",[zM,Qm]=Hd(Up),FM=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=Vd(Up,n),l=MM(Up,n),s=Xm(n),a=Ad(),u=r&&l.value.includes(r)||!1,c=i.disabled||e.disabled;return ee.createElement(zM,{scope:n,open:u,disabled:c,triggerId:a},ee.createElement(TM,te({"data-orientation":i.orientation,"data-state":WC(u)},s,o,{ref:t,disabled:c,open:u,onOpenChange:d=>{d?l.onItemOpen(r):l.onItemClose(r)}})))}),BM="AccordionHeader",WM=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Vd(Yo,n),i=Qm(BM,n);return ee.createElement(Ie.h3,te({"data-orientation":o.orientation,"data-state":WC(i.open),"data-disabled":i.disabled?"":void 0},r,{ref:t}))}),c1="AccordionTrigger",UM=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Vd(Yo,n),i=Qm(c1,n),l=LM(c1,n),s=Xm(n);return ee.createElement(Ym.ItemSlot,{scope:n},ee.createElement(NM,te({"aria-disabled":i.open&&!l.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId},s,r,{ref:t})))}),HM="AccordionContent",VM=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Vd(Yo,n),i=Qm(HM,n),l=Xm(n);return ee.createElement(RM,te({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 WC(e){return e?"open":"closed"}const KM=jC,GM=FM,YM=WM,UC=UM,HC=VM,XM=KM,VC=p.forwardRef(({className:e,...t},n)=>w.jsx(GM,{ref:n,className:ut("border-b",e),...t}));VC.displayName="AccordionItem";const KC=p.forwardRef(({className:e,children:t,...n},r)=>w.jsx(YM,{className:"flex",children:w.jsxs(UC,{ref:r,className:ut("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,w.jsx(mE,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));KC.displayName=UC.displayName;const GC=p.forwardRef(({className:e,children:t,...n},r)=>w.jsx(HC,{ref:r,className:ut("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:w.jsx("div",{className:"pt-0 pb-4",children:t})}));GC.displayName=HC.displayName;/**
192
+ Showing stack trace of: 0. ${d[0].message}`,b=new Error(T);throw b.stack=d[0].stack,b}f&&f.length>0&&console.warn("Val encountered validation errors:",f),p.useEffect(()=>{s(t?`/${t}`:l)},[t]);const[h,m]=p.useState(null);p.useEffect(()=>{try{new WebSocket(`${window.location.origin.replace("http://","ws://")}/_next/webpack-hmr`).addEventListener("message",b=>{let N;try{N=JSON.parse(b.data)}catch{console.error("Failed to parse HMR")}typeof(N==null?void 0:N.hash)=="string"&&(N==null?void 0:N.action)==="built"&&m(N.hash)})}catch(T){console.warn("Failed to initialize HMR",T)}},[]),p.useEffect(()=>{console.log("(Re)-fetching modules"),e.getTree({patch:!0,includeSchema:!0,includeSource:!0}).then(T=>{Fs.isOk(T)?r(T.value.modules):(i("Could not load modules: "+T.error.message),console.error(T.error))})},[h]);const g=Hm(),[_,v]=YO();p.useEffect(()=>{const T=b=>{console.log("popstate",b)};return window.addEventListener("popstate",T),()=>{window.removeEventListener("popstate",T)}},[]);const y=ee.useRef(null),x=p.useCallback(T=>async b=>{const[N,D]=$n.splitModuleIdAndModulePath(T),M=await b($n.createPatchJSONPath(D));return e.postPatches(N,M).then(j=>{if(Fs.isErr(j))throw j.error;if(!h)return e.getTree({treePath:N,patch:!0,includeSchema:!0,includeSource:!0}).then(B=>{Fs.isOk(B)?r(B.value.modules):(i("Could not load modules: "+B.error.message),console.error(B.error))})}).catch(j=>{console.error(j)})},[]);return w.jsx(cE.Provider,{value:{theme:_,setTheme:v,api:e,editMode:"full",session:{status:"not-asked"},highlight:!1,setHighlight:()=>{},setEditMode:()=>{},setWindowSize:()=>{}},children:w.jsxs("div",{id:"val-fullscreen-container",className:"relative font-serif antialiased","data-mode":_,children:[w.jsx("div",{className:"fixed -translate-x-1/2 z-overlay left-1/2 bottom-4",children:w.jsx(KO,{api:e})}),w.jsx("div",{id:"val-fullscreen-hover",ref:y}),w.jsx(RC.Provider,{value:{hoverElem:y==null?void 0:y.current},children:w.jsx("div",{className:"text-primary bg-background",children:w.jsxs(Ws,{children:[w.jsx("div",{className:"px-4 h-[50px] flex items-center justify-center",children:w.jsx(sC,{})}),w.jsx(Bs,{className:"px-4",children:n?w.jsx(mM,{paths:Object.keys(n),setSelectedModuleId:T=>{g(T)}}):!o&&w.jsx("div",{className:"py-4",children:"Loading..."})}),w.jsxs("div",{className:"flex items-center justify-start w-full h-[50px] gap-2 font-serif text-xs",children:[w.jsx("button",{onClick:()=>{history.back()},children:w.jsx(DO,{})}),w.jsx("p",{children:l||"/"})]}),w.jsxs("div",{className:"p-4",children:[o&&w.jsxs("div",{className:"text-lg text-destructive-foreground",children:["ERROR: ",o]}),n&&l&&a&&u!==void 0&&c!==void 0&&w.jsx(NC.Provider,{value:n,children:w.jsx(uM,{path:l,source:u,schema:c,setSelectedPath:s,initOnSubmit:x})})]})]})})})]})})},RC=ee.createContext({hoverElem:null}),aM=()=>ee.useContext(RC);function uM({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o}){const[,i]=$n.splitModuleIdAndModulePath(e),l=$n.resolvePath(i,t,n);if(!l)throw Error("Could not resolve module: "+e);return w.jsx(PC,{path:e,source:l.source,schema:l.schema,setSelectedPath:r,initOnSubmit:o,top:!0})}function PC({path:e,source:t,schema:n,setSelectedPath:r,field:o,initOnSubmit:i,top:l}){return t===null||n.opt?w.jsx(hM,{path:e,source:t,schema:n,field:o,initOnSubmit:i,setSelectedPath:r}):n.type==="object"?typeof t!="object"||ea(t)?w.jsxs("div",{children:["ERROR: expected object, but found ",typeof t]}):w.jsx(OC,{source:t,path:e,schema:n,initOnSubmit:i,setSelectedPath:r,top:l}):n.type==="array"?typeof t!="object"||!ea(t)?w.jsxs("div",{children:["ERROR: expected array, but found ",typeof t]}):w.jsx(AC,{source:t,path:e,schema:n,setSelectedPath:r}):n.type==="record"?typeof t!="object"?w.jsxs("div",{children:["ERROR: expected object for ",n.type,", but found ",typeof t]}):ea(t)?w.jsxs("div",{children:["ERROR: did not expect array for ",n.type]}):w.jsx(cM,{source:t,path:e,schema:n,setSelectedPath:r}):w.jsxs("div",{className:"py-2 gap-y-4",children:[w.jsx("div",{className:"text-left",children:o||e}),w.jsx(lC,{path:e,disabled:!1,source:t,schema:n,onSubmit:i(e)})]})}function OC({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o,top:i}){return w.jsx("div",{className:vd("flex flex-col gap-y-8",{"border-l-2 border-border pl-6":!i}),children:Object.entries(n.items).map(([l,s])=>{const a=Aa(e,l);return w.jsx(PC,{path:a,source:t[l],schema:s,setSelectedPath:r,field:l,initOnSubmit:o},a)})},e)}function cM({path:e,source:t,schema:n,setSelectedPath:r}){const o=Hm();return w.jsx("div",{className:"flex flex-col gap-4 p-2",children:Object.entries(t).map(([i,l])=>{const s=Aa(e,i);return w.jsx("button",{onClick:()=>{r(s),o(s)},children:w.jsx(dM,{recordKey:i,path:s,source:l,schema:n.item})},s)})},e)}const Wp=170;function dM({recordKey:e,path:t,source:n,schema:r}){const o=ee.useRef(null),[i,l]=p.useState(!1);return p.useEffect(()=>{o.current&&o.current.getBoundingClientRect().height>=Wp&&l(!0)},[]),w.jsxs(Bm,{ref:o,className:"relative px-4 pt-2 pb-4 overflow-hidden border gap-y-2",style:{maxHeight:Wp},children:[w.jsx("div",{className:"pb-4 font-serif text-left text-accent",children:e}),w.jsx("div",{className:"text-xs",children:w.jsx(Vm,{path:t,source:n,schema:r})}),i&&w.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[20px] bg-gradient-to-b from-transparent to-background"})]},t)}function AC({path:e,source:t,schema:n,setSelectedPath:r}){const o=Hm();return w.jsx("div",{className:"flex flex-col gap-4 p-2",children:t.map((i,l)=>{const s=Aa(e,l);return w.jsx("button",{onClick:()=>{r(s),o(s)},children:w.jsx(fM,{index:l,path:s,source:i,schema:n.item},s)},s)})},e)}const a1=Wp;function fM({index:e,path:t,source:n,schema:r}){const o=ee.useRef(null),[i,l]=p.useState(!1);return p.useEffect(()=>{o.current&&o.current.getBoundingClientRect().height>=a1&&l(!0)},[]),w.jsxs(Bm,{ref:o,className:"relative px-4 pt-2 pb-4 overflow-hidden border gap-y-2",style:{maxHeight:a1},children:[w.jsx("div",{className:"pb-4 font-serif text-left uppercase text-accent",children:e+1<10?`0${e+1}`:e+1}),w.jsx("div",{className:"text-xs",children:w.jsx(Vm,{path:t,source:n,schema:r})}),i&&w.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[20px] bg-gradient-to-b from-transparent to-background"})]})}function Aa(e,t){const n=$n.createValPathOfItem(e,t);if(!n)throw Error(`Could not create val path: ${e} of ${t==null?void 0:t.toString()}`);return n}function Vm({path:e,source:t,schema:n}){const[r,o]=p.useState(null),{hoverElem:i}=aM();if(n.type==="object")return w.jsx("div",{className:"grid grid-cols-[min-content_1fr] gap-2 text-left",children:Object.entries(n.items).map(([l])=>w.jsxs(p.Fragment,{children:[w.jsxs("span",{className:"text-muted",children:[l,":"]}),w.jsx("span",{children:w.jsx(Vm,{source:(t==null?void 0:t[l])??null,schema:n.items[l],path:Aa(e,l)})})]},Aa(e,l)))},e);if(n.type==="array")return t===null?w.jsx("span",{className:"text-accent",children:"Empty"},e):Array.isArray(t)?w.jsxs("span",{children:[w.jsx("span",{className:"text-accent",children:t.length}),w.jsx("span",{children:t.length===1?" item":" items"})]},e):w.jsx("span",{className:"px-2 bg-destructive text-destructive-foreground",children:"Unknown length"},e);if(n.type==="richtext")return t===null?w.jsx("span",{className:"text-accent",children:"Empty"},e):typeof t!="object"?w.jsxs("div",{className:"p-4 text-destructive-foreground bg-destructive",children:["ERROR: ",typeof t," not an object"]},e):!(Kt in t)||t[Kt]!=="richtext"?w.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: object is not richtext"},e):w.jsx(vM,{children:v_(t)},e);if(n.type==="string")return t===null?w.jsx("span",{className:"text-accent",children:"Empty"},e):w.jsx("span",{children:t});if(n.type==="image"){if(t===null)return w.jsx("span",{className:"text-accent",children:"Empty"},e);if(typeof t!="object")return w.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: not an object"},e);if(!(vn in t)||typeof t[vn]!="string")return w.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: object is not an image"},e);const l=$n.convertFileSource(t).url;return w.jsxs("span",{onMouseOver:s=>{o({x:s.clientX,y:s.clientY})},onMouseLeave:()=>{o(null)},className:"relative flex items-center justify-start gap-1",children:[w.jsx("a",{href:l,className:"overflow-hidden underline truncate ",children:t[vn]}),r&&i&&Nr.createPortal(w.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?w.jsx("span",{className:"text-accent",children:"Empty"},e):w.jsx("span",{className:"text-accent",children:t?"true":"false"},e);if(n.type==="number")return t===null?w.jsx("span",{className:"text-accent",children:"Empty"},e):w.jsx("span",{className:"text-accent",children:t.toString()});if(n.type==="keyOf")return t===null?w.jsx("span",{className:"text-accent",children:"Empty"},e):w.jsx("span",{className:"text-accent",children:t.toString()},e)}return w.jsxs("div",{children:["TODO: ",n.type]},e)}function hM({path:e,source:t,schema:n,setSelectedPath:r,initOnSubmit:o,field:i}){const[l,s]=p.useState(t!==null);return w.jsxs("div",{className:"flex flex-col gap-y-6",children:[i?w.jsxs("div",{className:"flex items-center justify-start gap-x-4",children:[w.jsx(Ip,{checked:l,onClick:()=>{s(a=>!a)}}),w.jsx("span",{children:i})]}):w.jsx(Ip,{checked:l,onClick:()=>{s(a=>!a)}}),l&&w.jsx(pM,{source:t,schema:n,path:e,setSelectedPath:r,initOnSubmit:o})]},e)}function pM({source:e,path:t,schema:n,setSelectedPath:r,initOnSubmit:o}){if(n.type==="array"){if(typeof e=="object"&&(e===null||ea(e)))return w.jsx(AC,{source:e===null?[]:e,path:t,schema:n,setSelectedPath:r})}else if(n.type==="object"){if(typeof e=="object"&&(e===null||!ea(e)))return w.jsx(OC,{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 w.jsx(lC,{path:t,disabled:!1,source:e,schema:n,onSubmit:o(t)},t);return w.jsxs("div",{className:"p-4 bg-destructive text-destructive-foreground",children:["ERROR: unexpected source type ",typeof e," for schema type"," ",n.type]})}function ea(e){return Array.isArray(e)}function gM(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 mM({paths:e,setSelectedModuleId:t}){const n=gM(e);return w.jsx(s_,{children:Object.entries(n).map(([r,o])=>w.jsx("div",{className:"px-4 py-2",children:w.jsx(MC,{name:r,tree:o,moduleId:`/${r}`,setSelectedModuleId:t})},`/${r}`))})}function MC({name:e,tree:t,moduleId:n,setSelectedModuleId:r}){return w.jsxs("div",{children:[w.jsx("button",{onClick:()=>{r(n)},children:e}),Object.entries(t).map(([o,i])=>w.jsx("div",{className:"px-4 py-1",children:w.jsx(MC,{name:o,tree:i,moduleId:`${n}/${o}`,setSelectedModuleId:r})},`${n}/${o}`))]})}const u1={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 vM({children:e}){const t=e;function n(i,l){const s=u1.tags[i];return s&&l?[l,s].join(" "):s||l}function r(i,l){const s=u1.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 w.jsx("p",{className:n("p"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="img")return w.jsx("img",{className:n("img"),src:i.src},l);if(i.tag==="ul")return w.jsx("ul",{className:n("ul"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="ol")return w.jsx("ol",{className:n("ol"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="li")return w.jsx("li",{className:n("li"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="span")return w.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 w.jsx("h1",{className:n("h1"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h2")return w.jsx("h2",{className:n("h2"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h3")return w.jsx("h3",{className:n("h3"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h4")return w.jsx("h4",{className:n("h4"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h5")return w.jsx("h5",{className:n("h5"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="h6")return w.jsx("h6",{className:n("h6"),children:i.children.map((d,f)=>o(d,f))},l);if(i.tag==="br")return w.jsx("br",{},l);if(i.tag==="a")return w.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?ee.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 w.jsx("span",{"data-val-path":t.valPath,children:t.children.map((i,l)=>o(i,l))})}const yM=p.createContext(null),Vf={didCatch:!1,error:null};class xM extends p.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Vf}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(Vf)}}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&&wM(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(Vf)}}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(yM.Provider,{value:{didCatch:i,error:l,resetErrorBoundary:this.resetErrorBoundary}},s)}}function wM(){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 LC="Collapsible",[_M,DC]=Ni(LC),[SM,Km]=_M(LC),EM=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:l,...s}=e,[a=!1,u]=Dl({prop:r,defaultProp:o,onChange:l});return p.createElement(SM,{scope:n,disabled:i,contentId:Ad(),open:a,onOpenToggle:p.useCallback(()=>u(c=>!c),[u])},p.createElement(Ie.div,te({"data-state":Gm(a),"data-disabled":i?"":void 0},s,{ref:t})))}),CM="CollapsibleTrigger",$M=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Km(CM,n);return p.createElement(Ie.button,te({type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Gm(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled},r,{ref:t,onClick:Ge(e.onClick,o.onOpenToggle)}))}),IC="CollapsibleContent",kM=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Km(IC,e.__scopeCollapsible);return p.createElement(Wl,{present:n||o.open},({present:i})=>p.createElement(bM,te({},r,{ref:t,present:i})))}),bM=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,l=Km(IC,n),[s,a]=p.useState(r),u=p.useRef(null),c=Ze(t,u),d=p.useRef(0),f=d.current,h=p.useRef(0),m=h.current,g=l.open||s,_=p.useRef(g),v=p.useRef();return p.useEffect(()=>{const y=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(y)},[]),Nn(()=>{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 x=y.getBoundingClientRect();d.current=x.height,h.current=x.width,_.current||(y.style.transitionDuration=v.current.transitionDuration,y.style.animationName=v.current.animationName),a(r)}},[l.open,r]),p.createElement(Ie.div,te({"data-state":Gm(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!g},i,{ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style}}),g&&o)});function Gm(e){return e?"open":"closed"}const TM=EM,NM=$M,RM=kM,Yo="Accordion",PM=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Ym,OM,AM]=vE(Yo),[Hd,gL]=Ni(Yo,[AM,DC]),Xm=DC(),jC=ee.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return ee.createElement(Ym.Provider,{scope:e.__scopeAccordion},n==="multiple"?ee.createElement(IM,te({},i,{ref:t})):ee.createElement(DM,te({},o,{ref:t})))});jC.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[zC,MM]=Hd(Yo),[FC,LM]=Hd(Yo,{collapsible:!1}),DM=ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...l}=e,[s,a]=Dl({prop:n,defaultProp:r,onChange:o});return ee.createElement(zC,{scope:e.__scopeAccordion,value:s?[s]:[],onItemOpen:a,onItemClose:ee.useCallback(()=>i&&a(""),[i,a])},ee.createElement(FC,{scope:e.__scopeAccordion,collapsible:i},ee.createElement(BC,te({},l,{ref:t}))))}),IM=ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l=[],s]=Dl({prop:n,defaultProp:r,onChange:o}),a=ee.useCallback(c=>s((d=[])=>[...d,c]),[s]),u=ee.useCallback(c=>s((d=[])=>d.filter(f=>f!==c)),[s]);return ee.createElement(zC,{scope:e.__scopeAccordion,value:l,onItemOpen:a,onItemClose:u},ee.createElement(FC,{scope:e.__scopeAccordion,collapsible:!0},ee.createElement(BC,te({},i,{ref:t}))))}),[jM,Vd]=Hd(Yo),BC=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...l}=e,s=ee.useRef(null),a=Ze(s,t),u=OM(n),d=Wg(o)==="ltr",f=Ge(e.onKeyDown,h=>{var m;if(!PM.includes(h.key))return;const g=h.target,_=u().filter(D=>{var M;return!((M=D.ref.current)!==null&&M!==void 0&&M.disabled)}),v=_.findIndex(D=>D.ref.current===g),y=_.length;if(v===-1)return;h.preventDefault();let x=v;const S=0,k=y-1,T=()=>{x=v+1,x>k&&(x=S)},b=()=>{x=v-1,x<S&&(x=k)};switch(h.key){case"Home":x=S;break;case"End":x=k;break;case"ArrowRight":i==="horizontal"&&(d?T():b());break;case"ArrowDown":i==="vertical"&&T();break;case"ArrowLeft":i==="horizontal"&&(d?b():T());break;case"ArrowUp":i==="vertical"&&b();break}const N=x%y;(m=_[N].ref.current)===null||m===void 0||m.focus()});return ee.createElement(jM,{scope:n,disabled:r,direction:o,orientation:i},ee.createElement(Ym.Slot,{scope:n},ee.createElement(Ie.div,te({},l,{"data-orientation":i,ref:a,onKeyDown:r?void 0:f}))))}),Up="AccordionItem",[zM,Qm]=Hd(Up),FM=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=Vd(Up,n),l=MM(Up,n),s=Xm(n),a=Ad(),u=r&&l.value.includes(r)||!1,c=i.disabled||e.disabled;return ee.createElement(zM,{scope:n,open:u,disabled:c,triggerId:a},ee.createElement(TM,te({"data-orientation":i.orientation,"data-state":WC(u)},s,o,{ref:t,disabled:c,open:u,onOpenChange:d=>{d?l.onItemOpen(r):l.onItemClose(r)}})))}),BM="AccordionHeader",WM=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Vd(Yo,n),i=Qm(BM,n);return ee.createElement(Ie.h3,te({"data-orientation":o.orientation,"data-state":WC(i.open),"data-disabled":i.disabled?"":void 0},r,{ref:t}))}),c1="AccordionTrigger",UM=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Vd(Yo,n),i=Qm(c1,n),l=LM(c1,n),s=Xm(n);return ee.createElement(Ym.ItemSlot,{scope:n},ee.createElement(NM,te({"aria-disabled":i.open&&!l.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId},s,r,{ref:t})))}),HM="AccordionContent",VM=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Vd(Yo,n),i=Qm(HM,n),l=Xm(n);return ee.createElement(RM,te({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 WC(e){return e?"open":"closed"}const KM=jC,GM=FM,YM=WM,UC=UM,HC=VM,XM=KM,VC=p.forwardRef(({className:e,...t},n)=>w.jsx(GM,{ref:n,className:ut("border-b",e),...t}));VC.displayName="AccordionItem";const KC=p.forwardRef(({className:e,children:t,...n},r)=>w.jsx(YM,{className:"flex",children:w.jsxs(UC,{ref:r,className:ut("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,w.jsx(mE,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));KC.displayName=UC.displayName;const GC=p.forwardRef(({className:e,children:t,...n},r)=>w.jsx(HC,{ref:r,className:ut("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:w.jsx("div",{className:"pt-0 pb-4",children:t})}));GC.displayName=HC.displayName;/**
193
193
  * React Router DOM v6.20.0
194
194
  *
195
195
  * Copyright (c) Remix Software Inc.