headroom-cms 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -6
- package/admin/assets/{AdminsPage-BIWASote.js → AdminsPage-BnzH9TL3.js} +1 -1
- package/admin/assets/{AllContentPage-1gXe2OC7.js → AllContentPage-BtObN6oy.js} +1 -1
- package/admin/assets/{ApiKeysPage-BBW4ATBx.js → ApiKeysPage-DEAa8eyC.js} +1 -1
- package/admin/assets/{AuditPage-B5GGFWGG.js → AuditPage-BN9yNsxh.js} +1 -1
- package/admin/assets/{BlockEditor-ClskiZoX.js → BlockEditor-3wnisTOZ.js} +3 -3
- package/admin/assets/{BlockTypeEditPage-CY0gCPei.js → BlockTypeEditPage-C2evAESK.js} +1 -1
- package/admin/assets/{BlockTypesPage-D8Me6OeX.js → BlockTypesPage-Dhkho6T_.js} +1 -1
- package/admin/assets/{BulkActionBar--35xjnOP.js → BulkActionBar-BxdfUSrN.js} +1 -1
- package/admin/assets/CollectionEditPage-lOb4hEZy.js +1 -0
- package/admin/assets/{CollectionsPage-BQmGXpvW.js → CollectionsPage-CgtOloa1.js} +1 -1
- package/admin/assets/{ContentCreatePage-DlgxamOe.js → ContentCreatePage-LeQjahp_.js} +1 -1
- package/admin/assets/ContentEditPage-xczr4d_h.js +1 -0
- package/admin/assets/{ContentField-D04Uo1Ov.js → ContentField-pilCbdnA.js} +1 -1
- package/admin/assets/{ContentListPage-BDMx7pWb.js → ContentListPage-BAKDn1Xy.js} +1 -1
- package/admin/assets/{CustomBlockPreview-Cs9bFDh4.js → CustomBlockPreview-DNnTFM0z.js} +1 -1
- package/admin/assets/FieldRenderer-DiOKvkWV.js +2 -0
- package/admin/assets/{FilterBar-kFcOLffg.js → FilterBar-BZoa63zh.js} +1 -1
- package/admin/assets/{FloatingComposerController-D4uLQfUX-C0Lhbmda.js → FloatingComposerController-D4uLQfUX-BMIvFCoE.js} +1 -1
- package/admin/assets/{IconPicker-BrgSAsa_.js → IconPicker-CpIgiQTC.js} +2 -2
- package/admin/assets/{LoginPage-Bi7TBzK4.js → LoginPage-D9ZsGLIi.js} +1 -1
- package/admin/assets/{MediaField-B-Cz8TlK.js → MediaField-CxccCFGQ.js} +1 -1
- package/admin/assets/{MediaPage-C84p9d1U.js → MediaPage-QvMaH2YJ.js} +1 -1
- package/admin/assets/{Pagination-CuHwUPHi.js → Pagination-Df9nQ7Z0.js} +1 -1
- package/admin/assets/{RelationshipPicker-Dv7GaLcU.js → RelationshipPicker-B3Ftmqxp.js} +1 -1
- package/admin/assets/{SiteSettingsPage-nBT7NzkA.js → SiteSettingsPage-6NvH7CiQ.js} +1 -1
- package/admin/assets/{SiteUserEditPage-DroUTii9.js → SiteUserEditPage-D5VaQ1Xq.js} +1 -1
- package/admin/assets/{SiteUsersPage-iVXPCBPe.js → SiteUsersPage-BYVduiqs.js} +1 -1
- package/admin/assets/{SitesPage-BefZeWuJ.js → SitesPage-rfWWE0yK.js} +1 -1
- package/admin/assets/{SubmissionDetailPage-ktmzzOE1.js → SubmissionDetailPage-BSUR685F.js} +1 -1
- package/admin/assets/{SubmissionEditPage-C-ykTI2t.js → SubmissionEditPage-DjLXHjWU.js} +1 -1
- package/admin/assets/{SubmissionListPage-DA-8deUy.js → SubmissionListPage-DBxNEvde.js} +1 -1
- package/admin/assets/{TagInput-d-Hw1fkL.js → TagInput-57c4DG1w.js} +1 -1
- package/admin/assets/{TagsPage-BZzDvcKa.js → TagsPage-BEO5AwCv.js} +1 -1
- package/admin/assets/{UsersPage-CnQAOOGF.js → UsersPage-BpIRorJ1.js} +1 -1
- package/admin/assets/{WebhookEditPage-KeS8hmdW.js → WebhookEditPage-D5xgi56h.js} +1 -1
- package/admin/assets/{WebhooksPage-CASjmlPN.js → WebhooksPage-BY7AaiGr.js} +1 -1
- package/admin/assets/{card-CZTHR2Qa.js → card-C9hfyHXf.js} +1 -1
- package/admin/assets/{checkbox-DEgzM8H9.js → checkbox-DVJcwUt1.js} +1 -1
- package/admin/assets/{command-CdzYw11U.js → command-Bfmj0MEL.js} +1 -1
- package/admin/assets/index-BB9Syqw2.css +1 -0
- package/admin/assets/{index-BA3y7HJs.js → index-Ce5pmRMj.js} +2 -2
- package/admin/assets/media-url-DdCoIedP.js +1 -0
- package/admin/assets/{popover-BFw_h3j6.js → popover-CzaQYEEP.js} +1 -1
- package/admin/assets/{select-dX9e6VDt.js → select-CrRhFGIi.js} +1 -1
- package/admin/assets/serializeToText-2VrsuRUh.js +2 -0
- package/admin/assets/{table-Dk7eeOt2.js → table-_3bMY0_z.js} +1 -1
- package/admin/assets/{textarea-CpDSUg2s.js → textarea-6fq0R6VV.js} +1 -1
- package/admin/assets/{useAdminResolver-Bljb4XGQ.js → useAdminResolver-BJNPz3OG.js} +1 -1
- package/admin/assets/{useContent-CW0tm0FY.js → useContent-Bs7nel7C.js} +1 -1
- package/admin/assets/{useContentSearch-_bwacEth.js → useContentSearch-B3aTjuCu.js} +1 -1
- package/admin/assets/{useMedia-Cu5N4rY8.js → useMedia-ae3s_ajC.js} +1 -1
- package/admin/assets/{usePageTitle-DYvuJQp6.js → usePageTitle-C1r1-C00.js} +1 -1
- package/admin/assets/{useSiteUsers-CKtC_8Jc.js → useSiteUsers-DIaqgNSp.js} +1 -1
- package/admin/assets/{useTags-ybsMbCst.js → useTags-B-HgMVwo.js} +1 -1
- package/admin/assets/{useWebhooks-BAB-3sLa.js → useWebhooks-BvZjUJkJ.js} +1 -1
- package/admin/favicon-16x16.png +0 -0
- package/admin/favicon-32x32.png +0 -0
- package/admin/icons/icon-180x180.png +0 -0
- package/admin/icons/icon-192x192.png +0 -0
- package/admin/icons/icon-512x512.png +0 -0
- package/admin/icons/maskable-icon-512x512.png +0 -0
- package/admin/index.html +2 -2
- package/admin/sw.js +1 -1
- package/dist/admin-site.d.ts +4 -2
- package/dist/admin-site.d.ts.map +1 -1
- package/dist/admin-site.js +3 -3
- package/dist/admin-site.js.map +1 -1
- package/dist/cdn-api.d.ts +25 -0
- package/dist/cdn-api.d.ts.map +1 -0
- package/dist/{cdn.js → cdn-api.js} +7 -139
- package/dist/cdn-api.js.map +1 -0
- package/dist/cdn-media.d.ts +26 -0
- package/dist/cdn-media.d.ts.map +1 -0
- package/dist/cdn-media.js +202 -0
- package/dist/cdn-media.js.map +1 -0
- package/dist/index.d.ts +15 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -9
- package/dist/index.js.map +1 -1
- package/lambda/api/bootstrap +0 -0
- package/lambda/image-lambda/node_modules/.package-lock.json +3 -3
- package/lambda/image-lambda/node_modules/semver/README.md +19 -4
- package/lambda/image-lambda/node_modules/semver/bin/semver.js +14 -10
- package/lambda/image-lambda/node_modules/semver/functions/truncate.js +48 -0
- package/lambda/image-lambda/node_modules/semver/index.js +2 -0
- package/lambda/image-lambda/node_modules/semver/internal/re.js +1 -1
- package/lambda/image-lambda/node_modules/semver/package.json +3 -3
- package/lambda/image-lambda/node_modules/semver/range.bnf +5 -4
- package/lambda/webhook-worker/bootstrap +0 -0
- package/package.json +1 -1
- package/src/admin-site.ts +7 -5
- package/src/{cdn.ts → cdn-api.ts} +8 -161
- package/src/cdn-media.ts +250 -0
- package/src/index.ts +34 -11
- package/admin/assets/CollectionEditPage-y8t0ZO89.js +0 -1
- package/admin/assets/ContentEditPage-WkSbCnnG.js +0 -1
- package/admin/assets/FieldRenderer-wE-mtqZB.js +0 -2
- package/admin/assets/index-c7UygSvP.css +0 -1
- package/admin/assets/media-url-DIg_vSyf.js +0 -1
- package/admin/assets/serializeToText-Zin3gYPm.js +0 -2
- package/dist/cdn.d.ts +0 -27
- package/dist/cdn.d.ts.map +0 -1
- package/dist/cdn.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FloatingComposerController-D4uLQfUX-
|
|
2
|
-
import{j as E}from"./tanstack-Bs3zYPPV.js";import{r as C,b as aE,a as Ev,g as cp,R as Re,u as lE,f as xv}from"./react-vendor-C2CvUxFh.js";import{aK as Qi,be as Cv,bf as kv,bg as up,D as cE,k as uE,l as dE,m as fE,n as hE,a1 as pE,L as Wa,j as Tv,bh as wv,X as Sv,I as qa,B as Bs,o as mE,a3 as gE,aE as vv,ad as Av}from"./index-BA3y7HJs.js";import{W as Xr,ai as Nv,R as Iv,aj as Mv,ak as _v,al as Df,am as Ov,T as Rv,P as Lv,C as Dv,A as Pv,a as Bv,an as Fv,o as Hv,L as Uv,p as Vv,n as $v,a6 as jv,a4 as zv,a5 as Wv,aa as qv,ab as Gv,ac as Yv,a8 as Kv,a9 as Qv,a3 as Xv,_ as Zv,a0 as Jv,Z as eA,d as tA,ao as nA,ap as rA,aq as oA,g as iA,ar as sA,I as aA,f as lA,as as cA,at as uA,c as dA,ad as fA,ae as hA}from"./radix-C5ZmWuuL.js";import{B as ug,k as pA,l as mA,m as gA,n as bA,o as yA,p as Xo,q as Gl,s as cd,u as bE,D as yE,v as dg,x as EE,y as fg,z as xE,S as CE,U as kE,A as EA,C as xA,Y as er,E as CA,F as zr,G as TE,H as kA,I as TA,J as wA,K as SA,L as vA,M as wE,N as AA,P as NA,Q as SE,R as IA,T as ud,V as Pf,W as Bf,X as MA,Z as _A,_ as OA,$ as hg,a0 as Fs,a1 as RA,i as pg,j as mg,h as LA}from"./yjs-tXBm_srz.js";import{P as hu,S as vE}from"./command-CdzYw11U.js";import{M as DA}from"./MediaField-B-Cz8TlK.js";import{m as Ff}from"./media-url-DIg_vSyf.js";import{F as PA}from"./FieldRenderer-wE-mtqZB.js";import{C as BA}from"./CustomBlockPreview-Cs9bFDh4.js";import{a as FA}from"./ContentField-D04Uo1Ov.js";const HA=e=>class{constructor(n){this._=n}destroy(){e(this._)}},UA=HA(clearTimeout),dp=(e,t)=>new UA(setTimeout(t,e));function pu(){return typeof window<"u"}function Do(e){return fp(e)?(e.nodeName||"").toLowerCase():"#document"}function Mn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function wr(e){var t;return(t=(fp(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fp(e){return pu()?e instanceof Node||e instanceof Mn(e).Node:!1}function ct(e){return pu()?e instanceof Element||e instanceof Mn(e).Element:!1}function Yt(e){return pu()?e instanceof HTMLElement||e instanceof Mn(e).HTMLElement:!1}function aa(e){return!pu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mn(e).ShadowRoot}function Ia(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Wn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function VA(e){return/^(table|td|th)$/.test(Do(e))}function mu(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $A=/transform|translate|scale|rotate|perspective|filter/,jA=/paint|layout|strict|content/,Vo=e=>!!e&&e!=="none";let dd;function hp(e){const t=ct(e)?Wn(e):e;return Vo(t.transform)||Vo(t.translate)||Vo(t.scale)||Vo(t.rotate)||Vo(t.perspective)||!gu()&&(Vo(t.backdropFilter)||Vo(t.filter))||$A.test(t.willChange||"")||jA.test(t.contain||"")}function zA(e){let t=Zr(e);for(;Yt(t)&&!Wr(t);){if(hp(t))return t;if(mu(t))return null;t=Zr(t)}return null}function gu(){return dd==null&&(dd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),dd}function Wr(e){return/^(html|body|#document)$/.test(Do(e))}function Wn(e){return Mn(e).getComputedStyle(e)}function bu(e){return ct(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zr(e){if(Do(e)==="html")return e;const t=e.assignedSlot||e.parentNode||aa(e)&&e.host||wr(e);return aa(t)?t.host:t}function AE(e){const t=Zr(e);return Wr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Yt(t)&&Ia(t)?t:AE(t)}function wo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=AE(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Mn(o);if(i){const a=Hf(s);return t.concat(s,s.visualViewport||[],Ia(o)?o:[],a&&n?wo(a):[])}else return t.concat(o,wo(o,[],n))}function Hf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const WA=["top","right","bottom","left"],gg=["start","end"],bg=WA.reduce((e,t)=>e.concat(t,t+"-"+gg[0],t+"-"+gg[1]),[]),Xi=Math.min,vn=Math.max,Yl=Math.round,Ga=Math.floor,gr=e=>({x:e,y:e}),qA={left:"right",right:"left",bottom:"top",top:"bottom"};function yg(e,t,n){return vn(e,Xi(t,n))}function ds(e,t){return typeof e=="function"?e(t):e}function xr(e){return e.split("-")[0]}function br(e){return e.split("-")[1]}function NE(e){return e==="x"?"y":"x"}function IE(e){return e==="y"?"height":"width"}function Vr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ME(e){return NE(Vr(e))}function _E(e,t,n){n===void 0&&(n=!1);const r=br(e),o=ME(e),i=IE(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Ql(s)),[s,Ql(s)]}function GA(e){const t=Ql(e);return[Kl(e),t,Kl(t)]}function Kl(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Eg=["left","right"],xg=["right","left"],YA=["top","bottom"],KA=["bottom","top"];function QA(e,t,n){switch(e){case"top":case"bottom":return n?t?xg:Eg:t?Eg:xg;case"left":case"right":return t?YA:KA;default:return[]}}function XA(e,t,n,r){const o=br(e);let i=QA(xr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Kl)))),i}function Ql(e){const t=xr(e);return qA[t]+e.slice(t.length)}function ZA(e){return{top:0,right:0,bottom:0,left:0,...e}}function JA(e){return typeof e!="number"?ZA(e):{top:e,right:e,bottom:e,left:e}}function Xl(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}var eN=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Zl=eN.join(","),OE=typeof Element>"u",Zi=OE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jl=!OE&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},ec=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=o===""||o==="true",s=i||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):ec(t.parentNode));return s},tN=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},RE=function(t,n,r){if(ec(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Zl));return n&&Zi.call(t,Zl)&&o.unshift(t),o=o.filter(r),o},tc=function(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if(!ec(s,!1))if(s.tagName==="SLOT"){var a=s.assignedElements(),l=a.length?a:s.children,c=tc(l,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{var u=Zi.call(s,Zl);u&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),f=!ec(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&f){var h=tc(d===!0?s.children:d.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return o},LE=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},DE=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||tN(t))&&!LE(t)?0:t.tabIndex},nN=function(t,n){var r=DE(t);return r<0&&n&&!LE(t)?0:r},rN=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},PE=function(t){return t.tagName==="INPUT"},oN=function(t){return PE(t)&&t.type==="hidden"},iN=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},sN=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},aN=function(t){if(!t.name)return!0;var n=t.form||Jl(t),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=sN(o,t.form);return!i||i===t},lN=function(t){return PE(t)&&t.type==="radio"},cN=function(t){return lN(t)&&!aN(t)},uN=function(t){var n,r=t&&Jl(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,a,l;for(i=!!((s=o)!==null&&s!==void 0&&(a=s.ownerDocument)!==null&&a!==void 0&&a.contains(o)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&o;){var c,u,d;r=Jl(o),o=(c=r)===null||c===void 0?void 0:c.host,i=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},Cg=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},dN=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var i=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(t).visibility==="hidden")return!0;var s=Zi.call(t,"details>summary:first-of-type"),a=s?t.parentElement:t;if(Zi.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var l=t;t;){var c=t.parentElement,u=Jl(t);if(c&&!c.shadowRoot&&o(c)===!0)return Cg(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=l}if(uN(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Cg(t);return!1},fN=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Zi.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},Uf=function(t,n){return!(n.disabled||oN(n)||dN(n,t)||iN(n)||fN(n))},Vf=function(t,n){return!(cN(n)||DE(n)<0||!Uf(t,n))},hN=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},BE=function(t){var n=[],r=[];return t.forEach(function(o,i){var s=!!o.scopeParent,a=s?o.scopeParent:o,l=nN(a,s),c=s?BE(o.candidates):a;l===0?s?n.push.apply(n,c):n.push(a):r.push({documentOrder:i,tabIndex:l,item:o,isScope:s,content:c})}),r.sort(rN).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},yu=function(t,n){n=n||{};var r;return n.getShadowRoot?r=tc([t],n.includeContainer,{filter:Vf.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:hN}):r=RE(t,n.includeContainer,Vf.bind(null,n)),BE(r)},pN=function(t,n){n=n||{};var r;return n.getShadowRoot?r=tc([t],n.includeContainer,{filter:Uf.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=RE(t,n.includeContainer,Uf.bind(null,n)),r},FE=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Zi.call(t,Zl)===!1?!1:Vf(n,t)};function mN(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function HE(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function gN(){return/apple/i.test(navigator.vendor)}function $f(){const e=/android/i;return e.test(mN())||e.test(HE())}function bN(){return HE().includes("jsdom/")}const kg="data-floating-ui-focusable",yN="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function _i(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function pn(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&aa(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function ho(e){return"composedPath"in e?e.composedPath()[0]:e.target}function fd(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function EN(e){return e.matches("html,body")}function rn(e){return e?.ownerDocument||document}function xN(e){return Yt(e)&&e.matches(yN)}function Tg(e){return e?e.getAttribute("role")==="combobox"&&xN(e):!1}function wg(e){return e?e.hasAttribute(kg)?e:e.querySelector("["+kg+"]")||e:null}function Ui(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var i;return o.parentId===t&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...Ui(e,o.id,n)])}function Sg(e,t){var n;let r=[],o=(n=e.find(i=>i.id===t))==null?void 0:n.parentId;for(;o;){const i=e.find(s=>s.id===o);o=i?.parentId,i&&(r=r.concat(i))}return r}function hd(e){e.preventDefault(),e.stopPropagation()}function CN(e){return"nativeEvent"in e}function kN(e){return e.mozInputSource===0&&e.isTrusted?!0:$f()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function TN(e){return bN()?!1:!$f()&&e.width===0&&e.height===0||$f()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function jf(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}var wN=typeof document<"u",SN=function(){},Kt=wN?C.useLayoutEffect:SN;const vN={...aE};function tr(e){const t=C.useRef(e);return Kt(()=>{t.current=e}),t}const AN=vN.useInsertionEffect,NN=AN||(e=>e());function bn(e){const t=C.useRef(()=>{});return NN(()=>{t.current=e}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const Ma=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function UE(e,t){const n=yu(e,Ma()),r=n.length;if(r===0)return;const o=_i(rn(e)),i=n.indexOf(o),s=i===-1?t===1?0:r-1:i+t;return n[s]}function VE(e){return UE(rn(e).body,1)||e}function $E(e){return UE(rn(e).body,-1)||e}function Hs(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!pn(n,r)}function IN(e){yu(e,Ma()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function vg(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Ag(e,t,n){let{reference:r,floating:o}=e;const i=Vr(t),s=ME(t),a=IE(s),l=xr(t),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,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(br(t)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}async function MN(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=ds(t,e),p=JA(h),y=a[f?d==="floating"?"reference":"floating":d],b=Xl(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),O=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},M=Xl(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:k,strategy:l}):x);return{top:(b.top-M.top+p.top)/O.y,bottom:(M.bottom-b.bottom+p.bottom)/O.y,left:(b.left-M.left+p.left)/O.x,right:(M.right-b.right+p.right)/O.x}}const _N=50,ON=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:MN},l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Ag(c,r,l),f=r,h=0;const p={};for(let g=0;g<i.length;g++){const y=i[g];if(!y)continue;const{name:b,fn:x}=y,{x:k,y:O,data:M,reset:A}=await x({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=k??u,d=O??d,p[b]={...p[b],...M},A&&h<_N&&(h++,typeof A=="object"&&(A.placement&&(f=A.placement),A.rects&&(c=A.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):A.rects),{x:u,y:d}=Ag(c,f,l)),g=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}};function RN(e,t,n){return(e?[...n.filter(o=>br(o)===e),...n.filter(o=>br(o)!==e)]:n.filter(o=>xr(o)===o)).filter(o=>e?br(o)===e||(t?Kl(o)!==o:!1):!0)}const LN=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:s,placement:a,platform:l,elements:c}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:f=bg,autoAlignment:h=!0,...p}=ds(e,t),g=d!==void 0||f===bg?RN(d||null,h,f):f,y=await l.detectOverflow(t,p),b=((n=s.autoPlacement)==null?void 0:n.index)||0,x=g[b];if(x==null)return{};const k=_E(x,i,await(l.isRTL==null?void 0:l.isRTL(c.floating)));if(a!==x)return{reset:{placement:g[0]}};const O=[y[xr(x)],y[k[0]],y[k[1]]],M=[...((r=s.autoPlacement)==null?void 0:r.overflows)||[],{placement:x,overflows:O}],A=g[b+1];if(A)return{data:{index:b+1,overflows:M},reset:{placement:A}};const D=M.map(N=>{const K=br(N.placement);return[N.placement,K&&u?N.overflows.slice(0,2).reduce((F,q)=>F+q,0):N.overflows[0],N.overflows]}).sort((N,K)=>N[1]-K[1]),Y=((o=D.filter(N=>N[2].slice(0,br(N[0])?2:3).every(K=>K<=0))[0])==null?void 0:o[0])||D[0][0];return Y!==a?{data:{index:b+1,overflows:M},reset:{placement:Y}}:{}}}},DN=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=ds(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=xr(o),x=Vr(a),k=xr(a)===a,O=await(l.isRTL==null?void 0:l.isRTL(c.floating)),M=f||(k||!g?[Ql(a)]:GA(a)),A=p!=="none";!f&&A&&M.push(...XA(a,g,p,O));const D=[a,...M],z=await l.detectOverflow(t,y),Y=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&Y.push(z[b]),d){const L=_E(o,s,O);Y.push(z[L[0]],z[L[1]])}if(N=[...N,{placement:o,overflows:Y}],!Y.every(L=>L<=0)){var K,F;const L=(((K=i.flip)==null?void 0:K.index)||0)+1,H=D[L];if(H&&(!(d==="alignment"?x!==Vr(H):!1)||N.every(G=>Vr(G.placement)===x?G.overflows[0]>0:!0)))return{data:{index:L,overflows:N},reset:{placement:H}};let re=(F=N.filter(W=>W.overflows[0]<=0).sort((W,G)=>W.overflows[1]-G.overflows[1])[0])==null?void 0:F.placement;if(!re)switch(h){case"bestFit":{var q;const W=(q=N.filter(G=>{if(A){const te=Vr(G.placement);return te===x||te==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(te=>te>0).reduce((te,S)=>te+S,0)]).sort((G,te)=>G[1]-te[1])[0])==null?void 0:q[0];W&&(re=W);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}},PN=new Set(["left","top"]);async function BN(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=xr(n),a=br(n),l=Vr(n)==="y",c=PN.has(s)?-1:1,u=i&&l?-1:1,d=ds(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const FN=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await BN(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},HN=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x,y:k}=b;return{x,y:k}}},...c}=ds(e,t),u={x:n,y:r},d=await i.detectOverflow(t,c),f=Vr(xr(o)),h=NE(f);let p=u[h],g=u[f];if(s){const b=h==="y"?"top":"left",x=h==="y"?"bottom":"right",k=p+d[b],O=p-d[x];p=yg(k,p,O)}if(a){const b=f==="y"?"top":"left",x=f==="y"?"bottom":"right",k=g+d[b],O=g-d[x];g=yg(k,g,O)}const y=l.fn({...t,[h]:p,[f]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:s,[f]:a}}}}}},UN=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=ds(e,t),u=await s.detectOverflow(t,c),d=xr(o),f=br(o),h=Vr(o)==="y",{width:p,height:g}=i.floating;let y,b;d==="top"||d==="bottom"?(y=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,y=f==="end"?"top":"bottom");const x=g-u.top-u.bottom,k=p-u.left-u.right,O=Xi(g-u[y],x),M=Xi(p-u[b],k),A=!t.middlewareData.shift;let D=O,z=M;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(z=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=x),A&&!f){const N=vn(u.left,0),K=vn(u.right,0),F=vn(u.top,0),q=vn(u.bottom,0);h?z=p-2*(N!==0||K!==0?N+K:vn(u.left,u.right)):D=g-2*(F!==0||q!==0?F+q:vn(u.top,u.bottom))}await l({...t,availableWidth:z,availableHeight:D});const Y=await s.getDimensions(a.floating);return p!==Y.width||g!==Y.height?{reset:{rects:!0}}:{}}}};function jE(e){const t=Wn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Yt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Yl(n)!==i||Yl(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function pp(e){return ct(e)?e:e.contextElement}function Vi(e){const t=pp(e);if(!Yt(t))return gr(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=jE(t);let s=(i?Yl(n.width):n.width)/r,a=(i?Yl(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const VN=gr(0);function zE(e){const t=Mn(e);return!gu()||!t.visualViewport?VN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $N(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mn(e)?!1:t}function ii(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=pp(e);let s=gr(1);t&&(r?ct(r)&&(s=Vi(r)):s=Vi(e));const a=$N(i,n,r)?zE(i):gr(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const f=Mn(i),h=r&&ct(r)?Mn(r):r;let p=f,g=Hf(p);for(;g&&r&&h!==p;){const y=Vi(g),b=g.getBoundingClientRect(),x=Wn(g),k=b.left+(g.clientLeft+parseFloat(x.paddingLeft))*y.x,O=b.top+(g.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,d*=y.y,l+=k,c+=O,p=Mn(g),g=Hf(p)}}return Xl({width:u,height:d,x:l,y:c})}function Eu(e,t){const n=bu(e).scrollLeft;return t?t.left+n:ii(wr(e)).left+n}function WE(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Eu(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function jN(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=wr(r),a=t?mu(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=gr(1);const u=gr(0),d=Yt(r);if((d||!d&&!i)&&((Do(r)!=="body"||Ia(s))&&(l=bu(r)),d)){const h=ii(r);c=Vi(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!i?WE(s,l):gr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function zN(e){return Array.from(e.getClientRects())}function WN(e){const t=wr(e),n=bu(e),r=e.ownerDocument.body,o=vn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=vn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Eu(e);const a=-n.scrollTop;return Wn(r).direction==="rtl"&&(s+=vn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}const Ng=25;function qN(e,t){const n=Mn(e),r=wr(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const u=gu();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=Eu(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=Ng&&(i-=p)}else c<=Ng&&(i+=c);return{width:i,height:s,x:a,y:l}}function GN(e,t){const n=ii(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Yt(e)?Vi(e):gr(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function Ig(e,t,n){let r;if(t==="viewport")r=qN(e,n);else if(t==="document")r=WN(wr(e));else if(ct(t))r=GN(t,n);else{const o=zE(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Xl(r)}function qE(e,t){const n=Zr(e);return n===t||!ct(n)||Wr(n)?!1:Wn(n).position==="fixed"||qE(n,t)}function YN(e,t){const n=t.get(e);if(n)return n;let r=wo(e,[],!1).filter(a=>ct(a)&&Do(a)!=="body"),o=null;const i=Wn(e).position==="fixed";let s=i?Zr(e):e;for(;ct(s)&&!Wr(s);){const a=Wn(s),l=hp(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Ia(s)&&!l&&qE(e,s))?r=r.filter(u=>u!==s):o=a,s=Zr(s)}return t.set(e,r),r}function KN(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?mu(t)?[]:YN(t,this._c):[].concat(n),r],a=Ig(t,s[0],o);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<s.length;f++){const h=Ig(t,s[f],o);l=vn(h.top,l),c=Xi(h.right,c),u=Xi(h.bottom,u),d=vn(h.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function QN(e){const{width:t,height:n}=jE(e);return{width:t,height:n}}function XN(e,t,n){const r=Yt(t),o=wr(t),i=n==="fixed",s=ii(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=gr(0);function c(){l.x=Eu(o)}if(r||!r&&!i)if((Do(t)!=="body"||Ia(o))&&(a=bu(t)),r){const h=ii(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?WE(o,a):gr(0),d=s.left+a.scrollLeft-l.x-u.x,f=s.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function pd(e){return Wn(e).position==="static"}function Mg(e,t){if(!Yt(e)||Wn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return wr(e)===n&&(n=n.ownerDocument.body),n}function GE(e,t){const n=Mn(e);if(mu(e))return n;if(!Yt(e)){let o=Zr(e);for(;o&&!Wr(o);){if(ct(o)&&!pd(o))return o;o=Zr(o)}return n}let r=Mg(e,t);for(;r&&VA(r)&&pd(r);)r=Mg(r,t);return r&&Wr(r)&&pd(r)&&!hp(r)?n:r||zA(e)||n}const ZN=async function(e){const t=this.getOffsetParent||GE,n=this.getDimensions,r=await n(e.floating);return{reference:XN(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function JN(e){return Wn(e).direction==="rtl"}const eI={convertOffsetParentRelativeRectToViewportRelativeRect:jN,getDocumentElement:wr,getClippingRect:KN,getOffsetParent:GE,getElementRects:ZN,getClientRects:zN,getDimensions:QN,getScale:Vi,isElement:ct,isRTL:JN};function YE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tI(e,t){let n=null,r;const o=wr(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(a||t(),!f||!h)return;const p=Ga(d),g=Ga(o.clientWidth-(u+f)),y=Ga(o.clientHeight-(d+h)),b=Ga(u),k={rootMargin:-p+"px "+-g+"px "+-y+"px "+-b+"px",threshold:vn(0,Xi(1,l))||1};let O=!0;function M(A){const D=A[0].intersectionRatio;if(D!==l){if(!O)return s();D?s(!1,D):r=setTimeout(()=>{s(!1,1e-7)},1e3)}D===1&&!YE(c,e.getBoundingClientRect())&&s(),O=!1}try{n=new IntersectionObserver(M,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(M,k)}n.observe(e)}return s(!0),i}function mp(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=pp(e),u=o||i?[...c?wo(c):[],...t?wo(t):[]]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&a?tI(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(b=>{let[x]=b;x&&x.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let p,g=l?ii(e):null;l&&y();function y(){const b=ii(e);g&&!YE(g,b)&&n(),g=b,p=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(x=>{o&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),d?.(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const nI=FN,rI=LN,oI=HN,iI=DN,sI=UN,aI=(e,t,n)=>{const r=new Map,o={platform:eI,...n},i={...o.platform,_c:r};return ON(e,t,{...o,platform:i})};var lI=typeof document<"u",cI=function(){},Il=lI?C.useLayoutEffect:cI;function nc(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(!nc(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)&&!nc(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function KE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _g(e,t){const n=KE(e);return Math.round(t*n)/n}function md(e){const t=C.useRef(e);return Il(()=>{t.current=e}),t}function uI(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=C.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=C.useState(r);nc(f,r)||h(r);const[p,g]=C.useState(null),[y,b]=C.useState(null),x=C.useCallback(G=>{G!==A.current&&(A.current=G,g(G))},[]),k=C.useCallback(G=>{G!==D.current&&(D.current=G,b(G))},[]),O=i||p,M=s||y,A=C.useRef(null),D=C.useRef(null),z=C.useRef(u),Y=l!=null,N=md(l),K=md(o),F=md(c),q=C.useCallback(()=>{if(!A.current||!D.current)return;const G={placement:t,strategy:n,middleware:f};K.current&&(G.platform=K.current),aI(A.current,D.current,G).then(te=>{const S={...te,isPositioned:F.current!==!1};L.current&&!nc(z.current,S)&&(z.current=S,Xr.flushSync(()=>{d(S)}))})},[f,t,n,K,F]);Il(()=>{c===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,d(G=>({...G,isPositioned:!1})))},[c]);const L=C.useRef(!1);Il(()=>(L.current=!0,()=>{L.current=!1}),[]),Il(()=>{if(O&&(A.current=O),M&&(D.current=M),O&&M){if(N.current)return N.current(O,M,q);q()}},[O,M,q,N,Y]);const H=C.useMemo(()=>({reference:A,floating:D,setReference:x,setFloating:k}),[x,k]),re=C.useMemo(()=>({reference:O,floating:M}),[O,M]),W=C.useMemo(()=>{const G={position:n,left:0,top:0};if(!re.floating)return G;const te=_g(re.floating,u.x),S=_g(re.floating,u.y);return a?{...G,transform:"translate("+te+"px, "+S+"px)",...KE(re.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:S}},[n,a,re.floating,u.x,u.y]);return C.useMemo(()=>({...u,update:q,refs:H,elements:re,floatingStyles:W}),[u,q,H,re,W])}const qr=(e,t)=>{const n=nI(e);return{name:n.name,fn:n.fn,options:[e,t]}},xu=(e,t)=>{const n=oI(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cu=(e,t)=>{const n=iI(e);return{name:n.name,fn:n.fn,options:[e,t]}},rc=(e,t)=>{const n=sI(e);return{name:n.name,fn:n.fn,options:[e,t]}},QE=(e,t)=>{const n=rI(e);return{name:n.name,fn:n.fn,options:[e,t]}};function dI(e){const t=C.useRef(void 0),n=C.useCallback(r=>{const o=e.map(i=>{if(i!=null){if(typeof i=="function"){const s=i,a=s(r);return typeof a=="function"?a:()=>{s(null)}}return i.current=r,()=>{i.current=null}}});return()=>{o.forEach(i=>i?.())}},e);return C.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}const fI="data-floating-ui-focusable",Og="active",Rg="selected",hI={...aE};let Lg=!1,pI=0;const Dg=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+pI++;function mI(){const[e,t]=C.useState(()=>Lg?Dg():void 0);return Kt(()=>{e==null&&t(Dg())},[]),C.useEffect(()=>{Lg=!0},[]),e}const gI=hI.useId,XE=gI||mI;function bI(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const yI=C.createContext(null),EI=C.createContext(null),ZE=()=>{var e;return((e=C.useContext(yI))==null?void 0:e.id)||null},ku=()=>C.useContext(EI);function Ji(e){return"data-floating-ui-"+e}function hn(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Pg=Ji("safe-polygon");function gd(e,t,n){if(n&&!jf(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}function bd(e){return typeof e=="function"?e():e}function xI(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:s}=e,{enabled:a=!0,delay:l=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,h=ku(),p=ZE(),g=tr(c),y=tr(l),b=tr(n),x=tr(d),k=C.useRef(),O=C.useRef(-1),M=C.useRef(),A=C.useRef(-1),D=C.useRef(!0),z=C.useRef(!1),Y=C.useRef(()=>{}),N=C.useRef(!1),K=bn(()=>{var W;const G=(W=o.current.openEvent)==null?void 0:W.type;return G?.includes("mouse")&&G!=="mousedown"});C.useEffect(()=>{if(!a)return;function W(G){let{open:te}=G;te||(hn(O),hn(A),D.current=!0,N.current=!1)}return i.on("openchange",W),()=>{i.off("openchange",W)}},[a,i]),C.useEffect(()=>{if(!a||!g.current||!n)return;function W(te){K()&&r(!1,te,"hover")}const G=rn(s.floating).documentElement;return G.addEventListener("mouseleave",W),()=>{G.removeEventListener("mouseleave",W)}},[s.floating,n,r,a,g,K]);const F=C.useCallback(function(W,G,te){G===void 0&&(G=!0),te===void 0&&(te="hover");const S=gd(y.current,"close",k.current);S&&!M.current?(hn(O),O.current=window.setTimeout(()=>r(!1,W,te),S)):G&&(hn(O),r(!1,W,te))},[y,r]),q=bn(()=>{Y.current(),M.current=void 0}),L=bn(()=>{if(z.current){const W=rn(s.floating).body;W.style.pointerEvents="",W.removeAttribute(Pg),z.current=!1}}),H=bn(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);C.useEffect(()=>{if(!a)return;function W(pe){if(hn(O),D.current=!1,u&&!jf(k.current)||bd(x.current)>0&&!gd(y.current,"open"))return;const v=gd(y.current,"open",k.current);v?O.current=window.setTimeout(()=>{b.current||r(!0,pe,"hover")},v):n||r(!0,pe,"hover")}function G(pe){if(H()){L();return}Y.current();const v=rn(s.floating);if(hn(A),N.current=!1,g.current&&o.current.floatingContext){n||hn(O),M.current=g.current({...o.current.floatingContext,tree:h,x:pe.clientX,y:pe.clientY,onClose(){L(),q(),H()||F(pe,!0,"safe-polygon")}});const ve=M.current;v.addEventListener("mousemove",ve),Y.current=()=>{v.removeEventListener("mousemove",ve)};return}(k.current==="touch"?!pn(s.floating,pe.relatedTarget):!0)&&F(pe)}function te(pe){H()||o.current.floatingContext&&(g.current==null||g.current({...o.current.floatingContext,tree:h,x:pe.clientX,y:pe.clientY,onClose(){L(),q(),H()||F(pe)}})(pe))}function S(){hn(O)}function ye(pe){H()||F(pe,!1)}if(ct(s.domReference)){const pe=s.domReference,v=s.floating;return n&&pe.addEventListener("mouseleave",te),f&&pe.addEventListener("mousemove",W,{once:!0}),pe.addEventListener("mouseenter",W),pe.addEventListener("mouseleave",G),v&&(v.addEventListener("mouseleave",te),v.addEventListener("mouseenter",S),v.addEventListener("mouseleave",ye)),()=>{n&&pe.removeEventListener("mouseleave",te),f&&pe.removeEventListener("mousemove",W),pe.removeEventListener("mouseenter",W),pe.removeEventListener("mouseleave",G),v&&(v.removeEventListener("mouseleave",te),v.removeEventListener("mouseenter",S),v.removeEventListener("mouseleave",ye))}}},[s,a,e,u,f,F,q,L,r,n,b,h,y,g,o,H,x]),Kt(()=>{var W;if(a&&n&&(W=g.current)!=null&&(W=W.__options)!=null&&W.blockPointerEvents&&K()){z.current=!0;const te=s.floating;if(ct(s.domReference)&&te){var G;const S=rn(s.floating).body;S.setAttribute(Pg,"");const ye=s.domReference,pe=h==null||(G=h.nodesRef.current.find(v=>v.id===p))==null||(G=G.context)==null?void 0:G.elements.floating;return pe&&(pe.style.pointerEvents=""),S.style.pointerEvents="none",ye.style.pointerEvents="auto",te.style.pointerEvents="auto",()=>{S.style.pointerEvents="",ye.style.pointerEvents="",te.style.pointerEvents=""}}}},[a,n,p,s,h,g,K]),Kt(()=>{n||(k.current=void 0,N.current=!1,q(),L())},[n,q,L]),C.useEffect(()=>()=>{q(),hn(O),hn(A),L()},[a,s.domReference,q,L]);const re=C.useMemo(()=>{function W(G){k.current=G.pointerType}return{onPointerDown:W,onPointerEnter:W,onMouseMove(G){const{nativeEvent:te}=G;function S(){!D.current&&!b.current&&r(!0,te,"hover")}u&&!jf(k.current)||n||bd(x.current)===0||N.current&&G.movementX**2+G.movementY**2<2||(hn(A),k.current==="touch"?S():(N.current=!0,A.current=window.setTimeout(S,bd(x.current))))}}},[u,r,n,b,x]);return C.useMemo(()=>a?{reference:re}:{},[a,re])}let Bg=0;function wi(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Bg);const i=()=>e?.focus({preventScroll:n});o?i():Bg=requestAnimationFrame(i)}function yd(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&aa(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function CI(e){return"composedPath"in e?e.composedPath()[0]:e.target}function kI(e){return e?.ownerDocument||document}const $i={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Fg(e){return e==="inert"?$i.inert:e==="aria-hidden"?$i["aria-hidden"]:$i.none}let Ya=new WeakSet,Ka={},Ed=0;const TI=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype;function JE(e){return e?aa(e)?e.host:JE(e.parentNode):null}const wI=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=JE(n);return e.contains(r)?r:null}).filter(n=>n!=null);function SI(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,s=wI(t,e),a=new Set,l=new Set(s),c=[];Ka[o]||(Ka[o]=new WeakMap);const u=Ka[o];s.forEach(d),f(t),a.clear();function d(h){!h||a.has(h)||(a.add(h),h.parentNode&&d(h.parentNode))}function f(h){!h||l.has(h)||[].forEach.call(h.children,p=>{if(Do(p)!=="script")if(a.has(p))f(p);else{const g=i?p.getAttribute(i):null,y=g!==null&&g!=="false",b=Fg(i),x=(b.get(p)||0)+1,k=(u.get(p)||0)+1;b.set(p,x),u.set(p,k),c.push(p),x===1&&y&&Ya.add(p),k===1&&p.setAttribute(o,""),!y&&i&&p.setAttribute(i,i==="inert"?"":"true")}})}return Ed++,()=>{c.forEach(h=>{const p=Fg(i),y=(p.get(h)||0)-1,b=(u.get(h)||0)-1;p.set(h,y),u.set(h,b),y||(!Ya.has(h)&&i&&h.removeAttribute(i),Ya.delete(h)),b||h.removeAttribute(o)}),Ed--,Ed||($i.inert=new WeakMap,$i["aria-hidden"]=new WeakMap,$i.none=new WeakMap,Ya=new WeakSet,Ka={})}}function Hg(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=kI(e[0]).body;return SI(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,t,n)}const gp={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},oc=C.forwardRef(function(t,n){const[r,o]=C.useState();Kt(()=>{gN()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ji("focus-guard")]:"",style:gp};return E.jsx("span",{...t,...i})}),vI={clipPath:"inset(50%)",position:"fixed",top:0,left:0},ex=C.createContext(null),Ug=Ji("portal");function AI(e){e===void 0&&(e={});const{id:t,root:n}=e,r=XE(),o=tx(),[i,s]=C.useState(null),a=C.useRef(null);return Kt(()=>()=>{i?.remove(),queueMicrotask(()=>{a.current=null})},[i]),Kt(()=>{if(!r||a.current)return;const l=t?document.getElementById(t):null;if(!l)return;const c=document.createElement("div");c.id=r,c.setAttribute(Ug,""),l.appendChild(c),a.current=c,s(c)},[t,r]),Kt(()=>{if(n===null||!r||a.current)return;let l=n||o?.portalNode;l&&!fp(l)&&(l=l.current),l=l||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,l.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(Ug,""),l=c||l,l.appendChild(u),a.current=u,s(u)},[t,n,r,o]),i}function xd(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,i=AI({id:n,root:r}),[s,a]=C.useState(null),l=C.useRef(null),c=C.useRef(null),u=C.useRef(null),d=C.useRef(null),f=s?.modal,h=s?.open,p=!!s&&!s.modal&&s.open&&o&&!!(r||i);return C.useEffect(()=>{if(!i||!o||f)return;function g(y){i&&Hs(y)&&(y.type==="focusin"?vg:IN)(i)}return i.addEventListener("focusin",g,!0),i.addEventListener("focusout",g,!0),()=>{i.removeEventListener("focusin",g,!0),i.removeEventListener("focusout",g,!0)}},[i,o,f]),C.useEffect(()=>{i&&(h||vg(i))},[h,i]),E.jsxs(ex.Provider,{value:C.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:i,setFocusManagerState:a}),[o,i]),children:[p&&i&&E.jsx(oc,{"data-type":"outside",ref:l,onFocus:g=>{if(Hs(g,i)){var y;(y=u.current)==null||y.focus()}else{const b=s?s.domReference:null,x=$E(b);x?.focus()}}}),p&&i&&E.jsx("span",{"aria-owns":i.id,style:vI}),i&&Xr.createPortal(t,i),p&&i&&E.jsx(oc,{"data-type":"outside",ref:c,onFocus:g=>{if(Hs(g,i)){var y;(y=d.current)==null||y.focus()}else{const b=s?s.domReference:null,x=VE(b);x?.focus(),s?.closeOnFocusOut&&s?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const tx=()=>C.useContext(ex);function Vg(e){return C.useMemo(()=>t=>{e.forEach(n=>{n&&(n.current=t)})},e)}const $g=20;let yo=[];function bp(){yo=yo.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function NI(e){bp(),e&&Do(e)!=="body"&&(yo.push(new WeakRef(e)),yo.length>$g&&(yo=yo.slice(-$g)))}function jg(){bp();const e=yo[yo.length-1];return e?.deref()}function II(e){const t=Ma();return FE(e,t)?e:yu(e,t)[0]||e}function zg(e,t){var n;if(!t.current.includes("floating")&&!((n=e.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=Ma(),i=pN(e,r).filter(a=>{const l=a.getAttribute("data-tabindex")||"";return FE(a,r)||a.hasAttribute("data-tabindex")&&!l.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||i.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const MI=C.forwardRef(function(t,n){return E.jsx("button",{...t,type:"button",ref:n,tabIndex:-1,style:gp})});function _I(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],guards:i=!0,initialFocus:s=0,returnFocus:a=!0,restoreFocus:l=!1,modal:c=!0,visuallyHiddenDismiss:u=!1,closeOnFocusOut:d=!0,outsideElementsInert:f=!1,getInsideElements:h=()=>[]}=e,{open:p,onOpenChange:g,events:y,dataRef:b,elements:{domReference:x,floating:k}}=t,O=bn(()=>{var Ee;return(Ee=b.current.floatingContext)==null?void 0:Ee.nodeId}),M=bn(h),A=typeof s=="number"&&s<0,D=Tg(x)&&A,z=TI(),Y=z?i:!0,N=!Y||z&&f,K=tr(o),F=tr(s),q=tr(a),L=ku(),H=tx(),re=C.useRef(null),W=C.useRef(null),G=C.useRef(!1),te=C.useRef(!1),S=C.useRef(-1),ye=C.useRef(-1),pe=H!=null,v=wg(k),ze=bn(function(Ee){return Ee===void 0&&(Ee=v),Ee?yu(Ee,Ma()):[]}),ve=bn(Ee=>{const De=ze(Ee);return K.current.map(Ne=>x&&Ne==="reference"?x:v&&Ne==="floating"?v:De).filter(Boolean).flat()});C.useEffect(()=>{if(r||!c)return;function Ee(Ne){if(Ne.key==="Tab"){pn(v,_i(rn(v)))&&ze().length===0&&!D&&hd(Ne);const Ke=ve(),ft=ho(Ne);K.current[0]==="reference"&&ft===x&&(hd(Ne),Ne.shiftKey?wi(Ke[Ke.length-1]):wi(Ke[1])),K.current[1]==="floating"&&ft===v&&Ne.shiftKey&&(hd(Ne),wi(Ke[0]))}}const De=rn(v);return De.addEventListener("keydown",Ee),()=>{De.removeEventListener("keydown",Ee)}},[r,x,v,c,K,D,ze,ve]),C.useEffect(()=>{if(r||!k)return;function Ee(De){const Ne=ho(De),ft=ze().indexOf(Ne);ft!==-1&&(S.current=ft)}return k.addEventListener("focusin",Ee),()=>{k.removeEventListener("focusin",Ee)}},[r,k,ze]),C.useEffect(()=>{if(r||!d)return;function Ee(){te.current=!0,setTimeout(()=>{te.current=!1})}function De(ft){const Fe=ft.relatedTarget,Tn=ft.currentTarget,zt=ho(ft);queueMicrotask(()=>{const It=O(),_=!(pn(x,Fe)||pn(k,Fe)||pn(Fe,k)||pn(H?.portalNode,Fe)||Fe!=null&&Fe.hasAttribute(Ji("focus-guard"))||L&&(Ui(L.nodesRef.current,It).find(P=>{var U,oe;return pn((U=P.context)==null?void 0:U.elements.floating,Fe)||pn((oe=P.context)==null?void 0:oe.elements.domReference,Fe)})||Sg(L.nodesRef.current,It).find(P=>{var U,oe,ne;return[(U=P.context)==null?void 0:U.elements.floating,wg((oe=P.context)==null?void 0:oe.elements.floating)].includes(Fe)||((ne=P.context)==null?void 0:ne.elements.domReference)===Fe})));if(Tn===x&&v&&zg(v,K),l&&Tn!==x&&!(zt!=null&&zt.isConnected)&&_i(rn(v))===rn(v).body){Yt(v)&&v.focus();const P=S.current,U=ze(),oe=U[P]||U[U.length-1]||v;Yt(oe)&&oe.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(D||!c)&&Fe&&_&&!te.current&&Fe!==jg()&&(G.current=!0,g(!1,ft,"focus-out"))})}const Ne=!!(!L&&H);function Ke(){hn(ye),b.current.insideReactTree=!0,ye.current=window.setTimeout(()=>{b.current.insideReactTree=!1})}if(k&&Yt(x))return x.addEventListener("focusout",De),x.addEventListener("pointerdown",Ee),k.addEventListener("focusout",De),Ne&&k.addEventListener("focusout",Ke,!0),()=>{x.removeEventListener("focusout",De),x.removeEventListener("pointerdown",Ee),k.removeEventListener("focusout",De),Ne&&k.removeEventListener("focusout",Ke,!0)}},[r,x,k,v,c,L,H,g,d,l,ze,D,O,K,b]);const Le=C.useRef(null),Et=C.useRef(null),Pe=Vg([Le,H?.beforeInsideRef]),We=Vg([Et,H?.afterInsideRef]);C.useEffect(()=>{var Ee,De;if(r||!k)return;const Ne=Array.from((H==null||(Ee=H.portalNode)==null?void 0:Ee.querySelectorAll("["+Ji("portal")+"]"))||[]),ft=(De=(L?Sg(L.nodesRef.current,O()):[]).find(zt=>{var It;return Tg(((It=zt.context)==null?void 0:It.elements.domReference)||null)}))==null||(De=De.context)==null?void 0:De.elements.domReference,Fe=[k,ft,...Ne,...M(),re.current,W.current,Le.current,Et.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,K.current.includes("reference")||D?x:null].filter(zt=>zt!=null),Tn=c||D?Hg(Fe,!N,N):Hg(Fe);return()=>{Tn()}},[r,x,k,c,K,H,D,Y,N,L,O,M]),Kt(()=>{if(r||!Yt(v))return;const Ee=rn(v),De=_i(Ee);queueMicrotask(()=>{const Ne=ve(v),Ke=F.current,ft=(typeof Ke=="number"?Ne[Ke]:Ke.current)||v,Fe=pn(v,De);!A&&!Fe&&p&&wi(ft,{preventScroll:ft===v})})},[r,p,v,A,ve,F]),Kt(()=>{if(r||!v)return;const Ee=rn(v),De=_i(Ee);NI(De);function Ne(Fe){let{reason:Tn,event:zt,nested:It}=Fe;if(["hover","safe-polygon"].includes(Tn)&&zt.type==="mouseleave"&&(G.current=!0),Tn==="outside-press")if(It)G.current=!1;else if(kN(zt)||TN(zt))G.current=!1;else{let _=!1;document.createElement("div").focus({get preventScroll(){return _=!0,!1}}),_?G.current=!1:G.current=!0}}y.on("openchange",Ne);const Ke=Ee.createElement("span");Ke.setAttribute("tabindex","-1"),Ke.setAttribute("aria-hidden","true"),Object.assign(Ke.style,gp),pe&&x&&x.insertAdjacentElement("afterend",Ke);function ft(){if(typeof q.current=="boolean"){const Fe=x||jg();return Fe&&Fe.isConnected?Fe:Ke}return q.current.current||Ke}return()=>{y.off("openchange",Ne);const Fe=_i(Ee),Tn=pn(k,Fe)||L&&Ui(L.nodesRef.current,O(),!1).some(It=>{var _;return pn((_=It.context)==null?void 0:_.elements.floating,Fe)}),zt=ft();queueMicrotask(()=>{const It=II(zt);q.current&&!G.current&&Yt(It)&&(!(It!==Fe&&Fe!==Ee.body)||Tn)&&It.focus({preventScroll:!0}),Ke.remove()})}},[r,k,v,q,b,y,L,pe,x,O]),C.useEffect(()=>(queueMicrotask(()=>{G.current=!1}),()=>{queueMicrotask(bp)}),[r]),Kt(()=>{if(!r&&H)return H.setFocusManagerState({modal:c,closeOnFocusOut:d,open:p,onOpenChange:g,domReference:x}),()=>{H.setFocusManagerState(null)}},[r,H,c,p,g,d,x]),Kt(()=>{r||v&&zg(v,K)},[r,v,K]);function dt(Ee){return r||!u||!c?null:E.jsx(MI,{ref:Ee==="start"?re:W,onClick:De=>g(!1,De.nativeEvent),children:typeof u=="string"?u:"Dismiss"})}const xt=!r&&Y&&(c?!D:!0)&&(pe||c);return E.jsxs(E.Fragment,{children:[xt&&E.jsx(oc,{"data-type":"inside",ref:Pe,onFocus:Ee=>{if(c){const Ne=ve();wi(o[0]==="reference"?Ne[0]:Ne[Ne.length-1])}else if(H!=null&&H.preserveTabOrder&&H.portalNode)if(G.current=!1,Hs(Ee,H.portalNode)){const Ne=VE(x);Ne?.focus()}else{var De;(De=H.beforeOutsideRef.current)==null||De.focus()}}}),!D&&dt("start"),n,dt("end"),xt&&E.jsx(oc,{"data-type":"inside",ref:We,onFocus:Ee=>{if(c)wi(ve()[0]);else if(H!=null&&H.preserveTabOrder&&H.portalNode)if(d&&(G.current=!0),Hs(Ee,H.portalNode)){const Ne=$E(x);Ne?.focus()}else{var De;(De=H.afterOutsideRef.current)==null||De.focus()}}})]})}const OI={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},RI={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Wg=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e?.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e?.outsidePress)!=null?n:!0}};function LI(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=t,g=ku(),y=bn(typeof l=="function"?l:()=>!1),b=typeof l=="function"?y:l,x=C.useRef(!1),{escapeKey:k,outsidePress:O}=Wg(h),{escapeKey:M,outsidePress:A}=Wg(p),D=C.useRef(!1),z=bn(L=>{var H;if(!n||!s||!a||L.key!=="Escape"||D.current)return;const re=(H=i.current.floatingContext)==null?void 0:H.nodeId,W=g?Ui(g.nodesRef.current,re):[];if(!k&&(L.stopPropagation(),W.length>0)){let G=!0;if(W.forEach(te=>{var S;if((S=te.context)!=null&&S.open&&!te.context.dataRef.current.__escapeKeyBubbles){G=!1;return}}),!G)return}r(!1,CN(L)?L.nativeEvent:L,"escape-key")}),Y=bn(L=>{var H;const re=()=>{var W;z(L),(W=ho(L))==null||W.removeEventListener("keydown",re)};(H=ho(L))==null||H.addEventListener("keydown",re)}),N=bn(L=>{var H;const re=i.current.insideReactTree;i.current.insideReactTree=!1;const W=x.current;if(x.current=!1,c==="click"&&W||re||typeof b=="function"&&!b(L))return;const G=ho(L),te="["+Ji("inert")+"]",S=rn(o.floating).querySelectorAll(te);let ye=ct(G)?G:null;for(;ye&&!Wr(ye);){const ve=Zr(ye);if(Wr(ve)||!ct(ve))break;ye=ve}if(S.length&&ct(G)&&!EN(G)&&!pn(G,o.floating)&&Array.from(S).every(ve=>!pn(ye,ve)))return;if(Yt(G)&&q){const ve=Wr(G),Le=Wn(G),Et=/auto|scroll/,Pe=ve||Et.test(Le.overflowX),We=ve||Et.test(Le.overflowY),dt=Pe&&G.clientWidth>0&&G.scrollWidth>G.clientWidth,xt=We&&G.clientHeight>0&&G.scrollHeight>G.clientHeight,Ee=Le.direction==="rtl",De=xt&&(Ee?L.offsetX<=G.offsetWidth-G.clientWidth:L.offsetX>G.clientWidth),Ne=dt&&L.offsetY>G.clientHeight;if(De||Ne)return}const pe=(H=i.current.floatingContext)==null?void 0:H.nodeId,v=g&&Ui(g.nodesRef.current,pe).some(ve=>{var Le;return fd(L,(Le=ve.context)==null?void 0:Le.elements.floating)});if(fd(L,o.floating)||fd(L,o.domReference)||v)return;const ze=g?Ui(g.nodesRef.current,pe):[];if(ze.length>0){let ve=!0;if(ze.forEach(Le=>{var Et;if((Et=Le.context)!=null&&Et.open&&!Le.context.dataRef.current.__outsidePressBubbles){ve=!1;return}}),!ve)return}r(!1,L,"outside-press")}),K=bn(L=>{var H;const re=()=>{var W;N(L),(W=ho(L))==null||W.removeEventListener(c,re)};(H=ho(L))==null||H.addEventListener(c,re)});C.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=k,i.current.__outsidePressBubbles=O;let L=-1;function H(S){r(!1,S,"ancestor-scroll")}function re(){window.clearTimeout(L),D.current=!0}function W(){L=window.setTimeout(()=>{D.current=!1},gu()?5:0)}const G=rn(o.floating);a&&(G.addEventListener("keydown",M?Y:z,M),G.addEventListener("compositionstart",re),G.addEventListener("compositionend",W)),b&&G.addEventListener(c,A?K:N,A);let te=[];return f&&(ct(o.domReference)&&(te=wo(o.domReference)),ct(o.floating)&&(te=te.concat(wo(o.floating))),!ct(o.reference)&&o.reference&&o.reference.contextElement&&(te=te.concat(wo(o.reference.contextElement)))),te=te.filter(S=>{var ye;return S!==((ye=G.defaultView)==null?void 0:ye.visualViewport)}),te.forEach(S=>{S.addEventListener("scroll",H,{passive:!0})}),()=>{a&&(G.removeEventListener("keydown",M?Y:z,M),G.removeEventListener("compositionstart",re),G.removeEventListener("compositionend",W)),b&&G.removeEventListener(c,A?K:N,A),te.forEach(S=>{S.removeEventListener("scroll",H)}),window.clearTimeout(L)}},[i,o,a,b,c,n,r,f,s,k,O,z,M,Y,N,A,K]),C.useEffect(()=>{i.current.insideReactTree=!1},[i,b,c]);const F=C.useMemo(()=>({onKeyDown:z,...u&&{[OI[d]]:L=>{r(!1,L.nativeEvent,"reference-press")},...d!=="click"&&{onClick(L){r(!1,L.nativeEvent,"reference-press")}}}}),[z,r,u,d]),q=C.useMemo(()=>{function L(H){H.button===0&&(x.current=!0)}return{onKeyDown:z,onMouseDown:L,onMouseUp:L,[RI[c]]:()=>{i.current.insideReactTree=!0}}},[z,c,i]);return C.useMemo(()=>s?{reference:F,floating:q}:{},[s,F,q])}function DI(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=XE(),i=C.useRef({}),[s]=C.useState(()=>bI()),a=ZE()!=null,[l,c]=C.useState(r.reference),u=bn((h,p,g)=>{i.current.openEvent=h?p:void 0,s.emit("openchange",{open:h,event:p,reason:g,nested:a}),n?.(h,p,g)}),d=C.useMemo(()=>({setPositionReference:c}),[]),f=C.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return C.useMemo(()=>({dataRef:i,open:t,onOpenChange:u,elements:f,events:s,floatingId:o,refs:d}),[t,u,f,s,o,d])}function PI(e){e===void 0&&(e={});const{nodeId:t}=e,n=DI({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,s]=C.useState(null),[a,l]=C.useState(null),u=o?.domReference||i,d=C.useRef(null),f=ku();Kt(()=>{u&&(d.current=u)},[u]);const h=uI({...e,elements:{...o,...a&&{reference:a}}}),p=C.useCallback(k=>{const O=ct(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),getClientRects:()=>k.getClientRects(),contextElement:k}:k;l(O),h.refs.setReference(O)},[h.refs]),g=C.useCallback(k=>{(ct(k)||k===null)&&(d.current=k,s(k)),(ct(h.refs.reference.current)||h.refs.reference.current===null||k!==null&&!ct(k))&&h.refs.setReference(k)},[h.refs]),y=C.useMemo(()=>({...h.refs,setReference:g,setPositionReference:p,domReference:d}),[h.refs,g,p]),b=C.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),x=C.useMemo(()=>({...h,...r,refs:y,elements:b,nodeId:t}),[h,y,b,t,r]);return Kt(()=>{r.dataRef.current.floatingContext=x;const k=f?.nodesRef.current.find(O=>O.id===t);k&&(k.context=x)}),C.useMemo(()=>({...h,context:x,refs:y,elements:b}),[h,y,b,x])}function Cd(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[Og]:s,[Rg]:a,...l}=e;i=l}return{...n==="floating"&&{tabIndex:-1,[fI]:""},...i,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(o&&[Og,Rg].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var f,h=arguments.length,p=new Array(h),g=0;g<h;g++)p[g]=arguments[g];return(f=r.get(c))==null?void 0:f.map(y=>y(...p)).find(y=>y!==void 0)}}}else s[c]=u}),s),{})}}function BI(e){e===void 0&&(e=[]);const t=e.map(a=>a?.reference),n=e.map(a=>a?.floating),r=e.map(a=>a?.item),o=C.useCallback(a=>Cd(a,e,"reference"),t),i=C.useCallback(a=>Cd(a,e,"floating"),n),s=C.useCallback(a=>Cd(a,e,"item"),r);return C.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const qg=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase());function Si(e,t){return typeof e=="function"?e(t):e}function FI(e,t){const[n,r]=C.useState(e);return e&&!n&&r(!0),C.useEffect(()=>{if(!e&&n){const o=setTimeout(()=>r(!1),t);return()=>clearTimeout(o)}},[e,n,t]),n}function nx(e,t){t===void 0&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,s=(typeof o=="number"?o:o.close)||0,[a,l]=C.useState("unmounted"),c=FI(n,s);return!c&&a==="close"&&l("unmounted"),Kt(()=>{if(r){if(n){l("initial");const u=requestAnimationFrame(()=>{Xr.flushSync(()=>{l("open")})});return()=>{cancelAnimationFrame(u)}}l("close")}},[n,r]),{isMounted:c,status:a}}function HI(e,t){t===void 0&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:s=250}=t,a=e.placement,l=a.split("-")[0],c=C.useMemo(()=>({side:l,placement:a}),[l,a]),u=typeof s=="number",d=(u?s:s.open)||0,f=(u?s:s.close)||0,[h,p]=C.useState(()=>({...Si(i,c),...Si(n,c)})),{isMounted:g,status:y}=nx(e,{duration:s}),b=tr(n),x=tr(r),k=tr(o),O=tr(i);return Kt(()=>{const M=Si(b.current,c),A=Si(k.current,c),D=Si(O.current,c),z=Si(x.current,c)||Object.keys(M).reduce((Y,N)=>(Y[N]="",Y),{});if(y==="initial"&&p(Y=>({transitionProperty:Y.transitionProperty,...D,...M})),y==="open"&&p({transitionProperty:Object.keys(z).map(qg).join(","),transitionDuration:d+"ms",...D,...z}),y==="close"){const Y=A||M;p({transitionProperty:Object.keys(Y).map(qg).join(","),transitionDuration:f+"ms",...D,...Y})}},[f,k,b,x,O,d,y,c]),{isMounted:g,styles:h}}function rx(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var i;return o.parentId===t&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...rx(e,o.id,n)])}function Gg(e,t){const[n,r]=e;let o=!1;const i=t.length;for(let s=0,a=i-1;s<i;a=s++){const[l,c]=t[s]||[0,0],[u,d]=t[a]||[0,0];c>=r!=d>=r&&n<=(u-l)*(r-c)/(d-c)+l&&(o=!o)}return o}function UI(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function VI(e){e===void 0&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o={current:-1};let i=!1,s=null,a=null,l=typeof performance<"u"?performance.now():0;function c(d,f){const h=performance.now(),p=h-l;if(s===null||a===null||p===0)return s=d,a=f,l=h,null;const g=d-s,y=f-a,x=Math.sqrt(g*g+y*y)/p;return s=d,a=f,l=h,x}const u=d=>{let{x:f,y:h,placement:p,elements:g,onClose:y,nodeId:b,tree:x}=d;return function(O){function M(){hn(o),y()}if(hn(o),!g.domReference||!g.floating||p==null||f==null||h==null)return;const{clientX:A,clientY:D}=O,z=[A,D],Y=CI(O),N=O.type==="mouseleave",K=yd(g.floating,Y),F=yd(g.domReference,Y),q=g.domReference.getBoundingClientRect(),L=g.floating.getBoundingClientRect(),H=p.split("-")[0],re=f>L.right-L.width/2,W=h>L.bottom-L.height/2,G=UI(z,q),te=L.width>q.width,S=L.height>q.height,ye=(te?q:L).left,pe=(te?q:L).right,v=(S?q:L).top,ze=(S?q:L).bottom;if(K&&(i=!0,!N))return;if(F&&(i=!1),F&&!N){i=!0;return}if(N&&ct(O.relatedTarget)&&yd(g.floating,O.relatedTarget)||x&&rx(x.nodesRef.current,b).length)return;if(H==="top"&&h>=q.bottom-1||H==="bottom"&&h<=q.top+1||H==="left"&&f>=q.right-1||H==="right"&&f<=q.left+1)return M();let ve=[];switch(H){case"top":ve=[[ye,q.top+1],[ye,L.bottom-1],[pe,L.bottom-1],[pe,q.top+1]];break;case"bottom":ve=[[ye,L.top+1],[ye,q.bottom-1],[pe,q.bottom-1],[pe,L.top+1]];break;case"left":ve=[[L.right-1,ze],[L.right-1,v],[q.left+1,v],[q.left+1,ze]];break;case"right":ve=[[q.right-1,ze],[q.right-1,v],[L.left+1,v],[L.left+1,ze]];break}function Le(Et){let[Pe,We]=Et;switch(H){case"top":{const dt=[te?Pe+t/2:re?Pe+t*4:Pe-t*4,We+t+1],xt=[te?Pe-t/2:re?Pe+t*4:Pe-t*4,We+t+1],Ee=[[L.left,re||te?L.bottom-t:L.top],[L.right,re?te?L.bottom-t:L.top:L.bottom-t]];return[dt,xt,...Ee]}case"bottom":{const dt=[te?Pe+t/2:re?Pe+t*4:Pe-t*4,We-t],xt=[te?Pe-t/2:re?Pe+t*4:Pe-t*4,We-t],Ee=[[L.left,re||te?L.top+t:L.bottom],[L.right,re?te?L.top+t:L.bottom:L.top+t]];return[dt,xt,...Ee]}case"left":{const dt=[Pe+t+1,S?We+t/2:W?We+t*4:We-t*4],xt=[Pe+t+1,S?We-t/2:W?We+t*4:We-t*4];return[...[[W||S?L.right-t:L.left,L.top],[W?S?L.right-t:L.left:L.right-t,L.bottom]],dt,xt]}case"right":{const dt=[Pe-t,S?We+t/2:W?We+t*4:We-t*4],xt=[Pe-t,S?We-t/2:W?We+t*4:We-t*4],Ee=[[W||S?L.left+t:L.right,L.top],[W?S?L.left+t:L.right:L.left+t,L.bottom]];return[dt,xt,...Ee]}}}if(!Gg([A,D],ve)){if(i&&!G)return M();if(!N&&r){const Et=c(O.clientX,O.clientY);if(Et!==null&&Et<.1)return M()}Gg([A,D],Le([f,h]))?!i&&r&&(o.current=window.setTimeout(M,40)):M()}}};return u.__options={blockPointerEvents:n},u}var kd={exports:{}},Td={};var Yg;function $I(){if(Yg)return Td;Yg=1;var e=Ev(),t=Nv();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Td.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function b(A){if(!x){if(x=!0,k=A,A=f(A),h!==void 0&&g.hasValue){var D=g.value;if(h(D,A))return O=D}return O=A}if(D=O,r(k,A))return D;var z=f(A);return h!==void 0&&h(D,z)?(k=A,D):(k=A,O=z)}var x=!1,k,O,M=d===void 0?null:d;return[function(){return b(u())},M===null?void 0:function(){return b(M())}]},[u,d,f,h]);var y=o(c,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=y},[y]),l(y),y},Td}var Kg;function jI(){return Kg||(Kg=1,kd.exports=$I()),kd.exports}var ox=jI();const ji=new WeakMap,Ml=new WeakMap,ic={current:[]};let wd=!1;const Qa=new Set,Qg=new Map;function ix(e){const t=Array.from(e).sort((n,r)=>n instanceof zi&&n.options.deps.includes(r)?1:r instanceof zi&&r.options.deps.includes(n)?-1:0);for(const n of t){if(ic.current.includes(n))continue;ic.current.push(n),n.recompute();const r=Ml.get(n);if(r)for(const o of r){const i=ji.get(o);i&&ix(i)}}}function zI(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function WI(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qI(e){if(Qa.add(e),!wd)try{for(wd=!0;Qa.size>0;){const t=Array.from(Qa);Qa.clear();for(const n of t){const r=Qg.get(n)??n.prevState;n.prevState=r,zI(n)}for(const n of t){const r=ji.get(n);r&&(ic.current.push(n),ix(r))}for(const n of t){const r=ji.get(n);if(r)for(const o of r)WI(o)}}}finally{wd=!1,ic.current=[],Qg.clear()}}function GI(e){return typeof e=="function"}class zf{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const s=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),s?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):GI(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),qI(this)}}class zi{constructor(t){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),o=new Array(n);for(let i=0;i<n;i++){const s=this.options.deps[i];r[i]=s.prevState,o[i]=s.state}return this.lastSeenDepValues=o,{prevDepVals:r,currDepVals:o,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const o=this.getDepVals();this.state=this.options.fn(o),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const i of this.options.deps)i instanceof zi&&i.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:o}=this.getDepVals();for(let i=0;i<o.length;i++)if(o[i]!==r[i]){n=!0;break}n&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const n of this._subscriptions)n()}),this.subscribe=n=>{var r,o;this.listeners.add(n);const i=(o=(r=this.options).onSubscribe)==null?void 0:o.call(r,n,this);return()=>{this.listeners.delete(n),i?.()}},this.options=t,this.state=t.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(t=this.options.deps){for(const n of t)if(n instanceof zi)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof zf){let r=ji.get(n);r||(r=new Set,ji.set(n,r)),r.add(this);let o=Ml.get(this);o||(o=new Set,Ml.set(this,o)),o.add(n)}}unregisterFromGraph(t=this.options.deps){for(const n of t)if(n instanceof zi)this.unregisterFromGraph(n.options.deps);else if(n instanceof zf){const r=ji.get(n);r&&r.delete(this);const o=Ml.get(this);o&&o.delete(n)}}}function YI(e,t=n=>n){return ox.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,KI)}function KI(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Xg(e);if(n.length!==Xg(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Xg(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var Wf=Symbol("originalFactory");function Ve(e){if(typeof e=="object"&&"key"in e)return function t(){return e[Wf]=t,e};if(typeof e!="function")throw Error("factory must be a function");return function t(n){return r=>{let o=e({editor:r.editor,options:n});return o[Wf]=t,o}}}function Po(e,t){return new zf(e,t)}function Ft(e){this.content=e}Ft.prototype={constructor:Ft,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return o==-1?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new Ft(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Ft(n)},addToStart:function(e,t){return new Ft([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Ft(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(i==-1?o.length:i,0,t,n),new Ft(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Ft.from(e),e.size?new Ft(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Ft.from(e),e.size?new Ft(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Ft.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};Ft.from=function(e){if(e instanceof Ft)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Ft(t)};function sx(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=sx(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function ax(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=ax(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class j{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>t&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,o){let i="",s=!0;return this.nodesBetween(t,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(t,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new j(o,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],o=0;if(n>t)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>t&&((s<t||l>n)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new j(r,o)}cutByIndex(t,n){return t==n?j.empty:t==0&&n==this.content.length?this:new j(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new j(o,i)}addToStart(t){return new j([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new j(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];t(o,r,n),r+=o.nodeSize}}findDiffStart(t,n=0){return sx(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return ax(this,t,n,r)}findIndex(t){if(t==0)return Xa(0,t);if(t==this.size)return Xa(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=t)return i==t?Xa(n+1,i):Xa(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return j.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new j(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return j.empty;let n,r=0;for(let o=0;o<t.length;o++){let i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new j(n||t,r)}static from(t){if(!t)return j.empty;if(t instanceof j)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new j([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}j.empty=new j([],0);const Sd={index:0,offset:0};function Xa(e,t){return Sd.index=e,Sd.offset=t,Sd}function sc(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!sc(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!sc(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let Xe=class qf{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let o=0;o<t.length;o++){let i=t[o];if(this.eq(i))return t;if(this.type.excludes(i.type))n||(n=t.slice(0,o));else{if(i.type.excludes(this.type))return t;!r&&i.type.rank>this.type.rank&&(n||(n=t.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&sc(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return qf.none;if(t instanceof qf)return[t];let n=t.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Xe.none=[];class ac extends Error{}class Z{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=cx(this.content,t+this.openStart,n);return r&&new Z(r,this.openStart,this.openEnd)}removeBetween(t,n){return new Z(lx(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return Z.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Z(j.fromJSON(t,n.content),r,o)}static maxOpen(t,n=!0){let r=0,o=0;for(let i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=t.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new Z(t,r,o)}}Z.empty=new Z(j.empty,0,0);function lx(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(lx(i.content,t-o-1,n-o-1)))}function cx(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=cx(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function QI(e,t,n){if(n.openStart>e.depth)throw new ac("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ac("Inconsistent open depths");return ux(e,t,n,0)}function ux(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=ux(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let s=e.parent,a=s.content;return Jo(s,a.cut(0,e.parentOffset).append(n.content).append(a.cut(t.parentOffset)))}else{let{start:s,end:a}=XI(n,e);return Jo(i,fx(e,s,a,t,r))}else return Jo(i,lc(e,t,r))}function dx(e,t){if(!t.type.compatibleContent(e.type))throw new ac("Cannot join "+t.type.name+" onto "+e.type.name)}function Gf(e,t,n){let r=e.node(n);return dx(r,t.node(n)),r}function Zo(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Us(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(Zo(e.nodeAfter,r),i++));for(let a=i;a<s;a++)Zo(o.child(a),r);t&&t.depth==n&&t.textOffset&&Zo(t.nodeBefore,r)}function Jo(e,t){return e.type.checkContent(t),e.copy(t)}function fx(e,t,n,r,o){let i=e.depth>o&&Gf(e,t,o+1),s=r.depth>o&&Gf(n,r,o+1),a=[];return Us(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(dx(i,s),Zo(Jo(i,fx(e,t,n,r,o+1)),a)):(i&&Zo(Jo(i,lc(e,t,o+1)),a),Us(t,n,o,a),s&&Zo(Jo(s,lc(n,r,o+1)),a)),Us(r,null,o,a),new j(a)}function lc(e,t,n){let r=[];if(Us(null,e,n,r),e.depth>n){let o=Gf(e,t,n+1);Zo(Jo(o,lc(e,t,n+1)),r)}return Us(t,null,n,r),new j(r)}function XI(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)o=t.node(i).copy(j.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}class la{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=t.child(n);return r?t.child(n).cut(r):o}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<t;i++)o+=r.child(i).nodeSize;return o}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return Xe.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),o=t.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new ca(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=t;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new la(n,r,i)}static resolveCached(t,n){let r=Zg.get(t);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else Zg.set(t,r=new ZI);let o=r.elts[r.i]=la.resolve(t,n);return r.i=(r.i+1)%JI,o}}class ZI{constructor(){this.elts=[],this.i=0}}const JI=12,Zg=new WeakMap;class ca{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const eM=Object.create(null);let Gr=class Yf{constructor(t,n,r,o=Xe.none){this.type=t,this.attrs=n,this.marks=o,this.content=r||j.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,o=0){this.content.nodesBetween(t,n,r,o,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,o){return this.content.textBetween(t,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&sc(this.attrs,n||t.defaultAttrs||eM)&&Xe.sameSet(this.marks,r||Xe.none)}copy(t=null){return t==this.content?this:new Yf(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Yf(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return Z.empty;let o=this.resolve(t),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new Z(c,o.depth-s,i.depth-s)}replace(t,n,r){return QI(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(o==t||n.isText)return n;t-=o+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(t){return la.resolveCached(this,t)}resolveNoCache(t){return la.resolve(this,t)}rangeHasMark(t,n,r){let o=!1;return n>t&&this.nodesBetween(t,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),hx(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=j.empty,o=0,i=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(t).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=Xe.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!Xe.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let o=j.fromJSON(t,n.content),i=t.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};Gr.prototype.text=void 0;class cc extends Gr{constructor(t,n,r,o){if(super(t,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):hx(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new cc(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new cc(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function hx(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class si{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new tM(t,n);if(r.next==null)return si.empty;let o=px(r);r.next&&r.err("Unexpected trailing text");let i=lM(aM(o));return cM(i,r),i}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(t.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(t,r);if(l&&(!n||l.validEnd))return j.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(t)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let o=0;o<r.next.length;o++)t.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),t.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+t.indexOf(r.next[s].next);return i}).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FloatingComposerController-D4uLQfUX-BMIvFCoE.js","assets/react-vendor-C2CvUxFh.js","assets/tanstack-Bs3zYPPV.js","assets/index-Ce5pmRMj.js","assets/radix-C5ZmWuuL.js","assets/index-BB9Syqw2.css","assets/yjs-tXBm_srz.js","assets/command-Bfmj0MEL.js","assets/MediaField-CxccCFGQ.js","assets/useMedia-ae3s_ajC.js","assets/select-CrRhFGIi.js","assets/card-C9hfyHXf.js","assets/media-url-DdCoIedP.js","assets/FieldRenderer-DiOKvkWV.js","assets/textarea-6fq0R6VV.js","assets/checkbox-DVJcwUt1.js","assets/core.esm-DdQHdRkd.js","assets/sortable.esm-qVEMoaTg.js","assets/ContentField-pilCbdnA.js","assets/popover-CzaQYEEP.js","assets/useContentSearch-B3aTjuCu.js","assets/CustomBlockPreview-DNnTFM0z.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as E}from"./tanstack-Bs3zYPPV.js";import{r as C,b as aE,a as Ev,g as cp,R as Re,u as lE,f as xv}from"./react-vendor-C2CvUxFh.js";import{aK as Qi,be as Cv,bf as kv,bg as up,D as cE,k as uE,l as dE,m as fE,n as hE,a1 as pE,L as Wa,j as Tv,bh as wv,X as Sv,I as qa,B as Bs,o as mE,a3 as gE,aE as vv,ad as Av}from"./index-Ce5pmRMj.js";import{W as Xr,ai as Nv,R as Iv,aj as Mv,ak as _v,al as Df,am as Ov,T as Rv,P as Lv,C as Dv,A as Pv,a as Bv,an as Fv,o as Hv,L as Uv,p as Vv,n as $v,a6 as jv,a4 as zv,a5 as Wv,aa as qv,ab as Gv,ac as Yv,a8 as Kv,a9 as Qv,a3 as Xv,_ as Zv,a0 as Jv,Z as eA,d as tA,ao as nA,ap as rA,aq as oA,g as iA,ar as sA,I as aA,f as lA,as as cA,at as uA,c as dA,ad as fA,ae as hA}from"./radix-C5ZmWuuL.js";import{B as ug,k as pA,l as mA,m as gA,n as bA,o as yA,p as Xo,q as Gl,s as cd,u as bE,D as yE,v as dg,x as EE,y as fg,z as xE,S as CE,U as kE,A as EA,C as xA,Y as er,E as CA,F as zr,G as TE,H as kA,I as TA,J as wA,K as SA,L as vA,M as wE,N as AA,P as NA,Q as SE,R as IA,T as ud,V as Pf,W as Bf,X as MA,Z as _A,_ as OA,$ as hg,a0 as Fs,a1 as RA,i as pg,j as mg,h as LA}from"./yjs-tXBm_srz.js";import{P as hu,S as vE}from"./command-Bfmj0MEL.js";import{M as DA}from"./MediaField-CxccCFGQ.js";import{m as Ff}from"./media-url-DdCoIedP.js";import{F as PA}from"./FieldRenderer-DiOKvkWV.js";import{C as BA}from"./CustomBlockPreview-DNnTFM0z.js";import{a as FA}from"./ContentField-pilCbdnA.js";const HA=e=>class{constructor(n){this._=n}destroy(){e(this._)}},UA=HA(clearTimeout),dp=(e,t)=>new UA(setTimeout(t,e));function pu(){return typeof window<"u"}function Do(e){return fp(e)?(e.nodeName||"").toLowerCase():"#document"}function Mn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function wr(e){var t;return(t=(fp(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fp(e){return pu()?e instanceof Node||e instanceof Mn(e).Node:!1}function ct(e){return pu()?e instanceof Element||e instanceof Mn(e).Element:!1}function Yt(e){return pu()?e instanceof HTMLElement||e instanceof Mn(e).HTMLElement:!1}function aa(e){return!pu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mn(e).ShadowRoot}function Ia(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Wn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function VA(e){return/^(table|td|th)$/.test(Do(e))}function mu(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $A=/transform|translate|scale|rotate|perspective|filter/,jA=/paint|layout|strict|content/,Vo=e=>!!e&&e!=="none";let dd;function hp(e){const t=ct(e)?Wn(e):e;return Vo(t.transform)||Vo(t.translate)||Vo(t.scale)||Vo(t.rotate)||Vo(t.perspective)||!gu()&&(Vo(t.backdropFilter)||Vo(t.filter))||$A.test(t.willChange||"")||jA.test(t.contain||"")}function zA(e){let t=Zr(e);for(;Yt(t)&&!Wr(t);){if(hp(t))return t;if(mu(t))return null;t=Zr(t)}return null}function gu(){return dd==null&&(dd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),dd}function Wr(e){return/^(html|body|#document)$/.test(Do(e))}function Wn(e){return Mn(e).getComputedStyle(e)}function bu(e){return ct(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zr(e){if(Do(e)==="html")return e;const t=e.assignedSlot||e.parentNode||aa(e)&&e.host||wr(e);return aa(t)?t.host:t}function AE(e){const t=Zr(e);return Wr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Yt(t)&&Ia(t)?t:AE(t)}function wo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=AE(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Mn(o);if(i){const a=Hf(s);return t.concat(s,s.visualViewport||[],Ia(o)?o:[],a&&n?wo(a):[])}else return t.concat(o,wo(o,[],n))}function Hf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const WA=["top","right","bottom","left"],gg=["start","end"],bg=WA.reduce((e,t)=>e.concat(t,t+"-"+gg[0],t+"-"+gg[1]),[]),Xi=Math.min,vn=Math.max,Yl=Math.round,Ga=Math.floor,gr=e=>({x:e,y:e}),qA={left:"right",right:"left",bottom:"top",top:"bottom"};function yg(e,t,n){return vn(e,Xi(t,n))}function ds(e,t){return typeof e=="function"?e(t):e}function xr(e){return e.split("-")[0]}function br(e){return e.split("-")[1]}function NE(e){return e==="x"?"y":"x"}function IE(e){return e==="y"?"height":"width"}function Vr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ME(e){return NE(Vr(e))}function _E(e,t,n){n===void 0&&(n=!1);const r=br(e),o=ME(e),i=IE(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Ql(s)),[s,Ql(s)]}function GA(e){const t=Ql(e);return[Kl(e),t,Kl(t)]}function Kl(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Eg=["left","right"],xg=["right","left"],YA=["top","bottom"],KA=["bottom","top"];function QA(e,t,n){switch(e){case"top":case"bottom":return n?t?xg:Eg:t?Eg:xg;case"left":case"right":return t?YA:KA;default:return[]}}function XA(e,t,n,r){const o=br(e);let i=QA(xr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Kl)))),i}function Ql(e){const t=xr(e);return qA[t]+e.slice(t.length)}function ZA(e){return{top:0,right:0,bottom:0,left:0,...e}}function JA(e){return typeof e!="number"?ZA(e):{top:e,right:e,bottom:e,left:e}}function Xl(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}var eN=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Zl=eN.join(","),OE=typeof Element>"u",Zi=OE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jl=!OE&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},ec=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=o===""||o==="true",s=i||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):ec(t.parentNode));return s},tN=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},RE=function(t,n,r){if(ec(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Zl));return n&&Zi.call(t,Zl)&&o.unshift(t),o=o.filter(r),o},tc=function(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if(!ec(s,!1))if(s.tagName==="SLOT"){var a=s.assignedElements(),l=a.length?a:s.children,c=tc(l,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{var u=Zi.call(s,Zl);u&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),f=!ec(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&f){var h=tc(d===!0?s.children:d.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return o},LE=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},DE=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||tN(t))&&!LE(t)?0:t.tabIndex},nN=function(t,n){var r=DE(t);return r<0&&n&&!LE(t)?0:r},rN=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},PE=function(t){return t.tagName==="INPUT"},oN=function(t){return PE(t)&&t.type==="hidden"},iN=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},sN=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},aN=function(t){if(!t.name)return!0;var n=t.form||Jl(t),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=sN(o,t.form);return!i||i===t},lN=function(t){return PE(t)&&t.type==="radio"},cN=function(t){return lN(t)&&!aN(t)},uN=function(t){var n,r=t&&Jl(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,a,l;for(i=!!((s=o)!==null&&s!==void 0&&(a=s.ownerDocument)!==null&&a!==void 0&&a.contains(o)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&o;){var c,u,d;r=Jl(o),o=(c=r)===null||c===void 0?void 0:c.host,i=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},Cg=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},dN=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var i=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(t).visibility==="hidden")return!0;var s=Zi.call(t,"details>summary:first-of-type"),a=s?t.parentElement:t;if(Zi.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var l=t;t;){var c=t.parentElement,u=Jl(t);if(c&&!c.shadowRoot&&o(c)===!0)return Cg(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=l}if(uN(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Cg(t);return!1},fN=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Zi.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},Uf=function(t,n){return!(n.disabled||oN(n)||dN(n,t)||iN(n)||fN(n))},Vf=function(t,n){return!(cN(n)||DE(n)<0||!Uf(t,n))},hN=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},BE=function(t){var n=[],r=[];return t.forEach(function(o,i){var s=!!o.scopeParent,a=s?o.scopeParent:o,l=nN(a,s),c=s?BE(o.candidates):a;l===0?s?n.push.apply(n,c):n.push(a):r.push({documentOrder:i,tabIndex:l,item:o,isScope:s,content:c})}),r.sort(rN).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},yu=function(t,n){n=n||{};var r;return n.getShadowRoot?r=tc([t],n.includeContainer,{filter:Vf.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:hN}):r=RE(t,n.includeContainer,Vf.bind(null,n)),BE(r)},pN=function(t,n){n=n||{};var r;return n.getShadowRoot?r=tc([t],n.includeContainer,{filter:Uf.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=RE(t,n.includeContainer,Uf.bind(null,n)),r},FE=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Zi.call(t,Zl)===!1?!1:Vf(n,t)};function mN(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function HE(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function gN(){return/apple/i.test(navigator.vendor)}function $f(){const e=/android/i;return e.test(mN())||e.test(HE())}function bN(){return HE().includes("jsdom/")}const kg="data-floating-ui-focusable",yN="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function _i(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function pn(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&aa(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function ho(e){return"composedPath"in e?e.composedPath()[0]:e.target}function fd(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function EN(e){return e.matches("html,body")}function rn(e){return e?.ownerDocument||document}function xN(e){return Yt(e)&&e.matches(yN)}function Tg(e){return e?e.getAttribute("role")==="combobox"&&xN(e):!1}function wg(e){return e?e.hasAttribute(kg)?e:e.querySelector("["+kg+"]")||e:null}function Ui(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var i;return o.parentId===t&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...Ui(e,o.id,n)])}function Sg(e,t){var n;let r=[],o=(n=e.find(i=>i.id===t))==null?void 0:n.parentId;for(;o;){const i=e.find(s=>s.id===o);o=i?.parentId,i&&(r=r.concat(i))}return r}function hd(e){e.preventDefault(),e.stopPropagation()}function CN(e){return"nativeEvent"in e}function kN(e){return e.mozInputSource===0&&e.isTrusted?!0:$f()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function TN(e){return bN()?!1:!$f()&&e.width===0&&e.height===0||$f()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function jf(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}var wN=typeof document<"u",SN=function(){},Kt=wN?C.useLayoutEffect:SN;const vN={...aE};function tr(e){const t=C.useRef(e);return Kt(()=>{t.current=e}),t}const AN=vN.useInsertionEffect,NN=AN||(e=>e());function bn(e){const t=C.useRef(()=>{});return NN(()=>{t.current=e}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const Ma=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function UE(e,t){const n=yu(e,Ma()),r=n.length;if(r===0)return;const o=_i(rn(e)),i=n.indexOf(o),s=i===-1?t===1?0:r-1:i+t;return n[s]}function VE(e){return UE(rn(e).body,1)||e}function $E(e){return UE(rn(e).body,-1)||e}function Hs(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!pn(n,r)}function IN(e){yu(e,Ma()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function vg(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Ag(e,t,n){let{reference:r,floating:o}=e;const i=Vr(t),s=ME(t),a=IE(s),l=xr(t),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,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(br(t)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}async function MN(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=ds(t,e),p=JA(h),y=a[f?d==="floating"?"reference":"floating":d],b=Xl(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),O=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},M=Xl(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:k,strategy:l}):x);return{top:(b.top-M.top+p.top)/O.y,bottom:(M.bottom-b.bottom+p.bottom)/O.y,left:(b.left-M.left+p.left)/O.x,right:(M.right-b.right+p.right)/O.x}}const _N=50,ON=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:MN},l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Ag(c,r,l),f=r,h=0;const p={};for(let g=0;g<i.length;g++){const y=i[g];if(!y)continue;const{name:b,fn:x}=y,{x:k,y:O,data:M,reset:A}=await x({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=k??u,d=O??d,p[b]={...p[b],...M},A&&h<_N&&(h++,typeof A=="object"&&(A.placement&&(f=A.placement),A.rects&&(c=A.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):A.rects),{x:u,y:d}=Ag(c,f,l)),g=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}};function RN(e,t,n){return(e?[...n.filter(o=>br(o)===e),...n.filter(o=>br(o)!==e)]:n.filter(o=>xr(o)===o)).filter(o=>e?br(o)===e||(t?Kl(o)!==o:!1):!0)}const LN=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:s,placement:a,platform:l,elements:c}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:f=bg,autoAlignment:h=!0,...p}=ds(e,t),g=d!==void 0||f===bg?RN(d||null,h,f):f,y=await l.detectOverflow(t,p),b=((n=s.autoPlacement)==null?void 0:n.index)||0,x=g[b];if(x==null)return{};const k=_E(x,i,await(l.isRTL==null?void 0:l.isRTL(c.floating)));if(a!==x)return{reset:{placement:g[0]}};const O=[y[xr(x)],y[k[0]],y[k[1]]],M=[...((r=s.autoPlacement)==null?void 0:r.overflows)||[],{placement:x,overflows:O}],A=g[b+1];if(A)return{data:{index:b+1,overflows:M},reset:{placement:A}};const D=M.map(N=>{const K=br(N.placement);return[N.placement,K&&u?N.overflows.slice(0,2).reduce((F,q)=>F+q,0):N.overflows[0],N.overflows]}).sort((N,K)=>N[1]-K[1]),Y=((o=D.filter(N=>N[2].slice(0,br(N[0])?2:3).every(K=>K<=0))[0])==null?void 0:o[0])||D[0][0];return Y!==a?{data:{index:b+1,overflows:M},reset:{placement:Y}}:{}}}},DN=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=ds(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=xr(o),x=Vr(a),k=xr(a)===a,O=await(l.isRTL==null?void 0:l.isRTL(c.floating)),M=f||(k||!g?[Ql(a)]:GA(a)),A=p!=="none";!f&&A&&M.push(...XA(a,g,p,O));const D=[a,...M],z=await l.detectOverflow(t,y),Y=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&Y.push(z[b]),d){const L=_E(o,s,O);Y.push(z[L[0]],z[L[1]])}if(N=[...N,{placement:o,overflows:Y}],!Y.every(L=>L<=0)){var K,F;const L=(((K=i.flip)==null?void 0:K.index)||0)+1,H=D[L];if(H&&(!(d==="alignment"?x!==Vr(H):!1)||N.every(G=>Vr(G.placement)===x?G.overflows[0]>0:!0)))return{data:{index:L,overflows:N},reset:{placement:H}};let re=(F=N.filter(W=>W.overflows[0]<=0).sort((W,G)=>W.overflows[1]-G.overflows[1])[0])==null?void 0:F.placement;if(!re)switch(h){case"bestFit":{var q;const W=(q=N.filter(G=>{if(A){const te=Vr(G.placement);return te===x||te==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(te=>te>0).reduce((te,S)=>te+S,0)]).sort((G,te)=>G[1]-te[1])[0])==null?void 0:q[0];W&&(re=W);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}},PN=new Set(["left","top"]);async function BN(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=xr(n),a=br(n),l=Vr(n)==="y",c=PN.has(s)?-1:1,u=i&&l?-1:1,d=ds(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const FN=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await BN(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},HN=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x,y:k}=b;return{x,y:k}}},...c}=ds(e,t),u={x:n,y:r},d=await i.detectOverflow(t,c),f=Vr(xr(o)),h=NE(f);let p=u[h],g=u[f];if(s){const b=h==="y"?"top":"left",x=h==="y"?"bottom":"right",k=p+d[b],O=p-d[x];p=yg(k,p,O)}if(a){const b=f==="y"?"top":"left",x=f==="y"?"bottom":"right",k=g+d[b],O=g-d[x];g=yg(k,g,O)}const y=l.fn({...t,[h]:p,[f]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:s,[f]:a}}}}}},UN=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=ds(e,t),u=await s.detectOverflow(t,c),d=xr(o),f=br(o),h=Vr(o)==="y",{width:p,height:g}=i.floating;let y,b;d==="top"||d==="bottom"?(y=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,y=f==="end"?"top":"bottom");const x=g-u.top-u.bottom,k=p-u.left-u.right,O=Xi(g-u[y],x),M=Xi(p-u[b],k),A=!t.middlewareData.shift;let D=O,z=M;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(z=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=x),A&&!f){const N=vn(u.left,0),K=vn(u.right,0),F=vn(u.top,0),q=vn(u.bottom,0);h?z=p-2*(N!==0||K!==0?N+K:vn(u.left,u.right)):D=g-2*(F!==0||q!==0?F+q:vn(u.top,u.bottom))}await l({...t,availableWidth:z,availableHeight:D});const Y=await s.getDimensions(a.floating);return p!==Y.width||g!==Y.height?{reset:{rects:!0}}:{}}}};function jE(e){const t=Wn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Yt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Yl(n)!==i||Yl(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function pp(e){return ct(e)?e:e.contextElement}function Vi(e){const t=pp(e);if(!Yt(t))return gr(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=jE(t);let s=(i?Yl(n.width):n.width)/r,a=(i?Yl(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const VN=gr(0);function zE(e){const t=Mn(e);return!gu()||!t.visualViewport?VN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $N(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mn(e)?!1:t}function ii(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=pp(e);let s=gr(1);t&&(r?ct(r)&&(s=Vi(r)):s=Vi(e));const a=$N(i,n,r)?zE(i):gr(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const f=Mn(i),h=r&&ct(r)?Mn(r):r;let p=f,g=Hf(p);for(;g&&r&&h!==p;){const y=Vi(g),b=g.getBoundingClientRect(),x=Wn(g),k=b.left+(g.clientLeft+parseFloat(x.paddingLeft))*y.x,O=b.top+(g.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,d*=y.y,l+=k,c+=O,p=Mn(g),g=Hf(p)}}return Xl({width:u,height:d,x:l,y:c})}function Eu(e,t){const n=bu(e).scrollLeft;return t?t.left+n:ii(wr(e)).left+n}function WE(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Eu(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function jN(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=wr(r),a=t?mu(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=gr(1);const u=gr(0),d=Yt(r);if((d||!d&&!i)&&((Do(r)!=="body"||Ia(s))&&(l=bu(r)),d)){const h=ii(r);c=Vi(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!i?WE(s,l):gr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function zN(e){return Array.from(e.getClientRects())}function WN(e){const t=wr(e),n=bu(e),r=e.ownerDocument.body,o=vn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=vn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Eu(e);const a=-n.scrollTop;return Wn(r).direction==="rtl"&&(s+=vn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}const Ng=25;function qN(e,t){const n=Mn(e),r=wr(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const u=gu();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=Eu(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=Ng&&(i-=p)}else c<=Ng&&(i+=c);return{width:i,height:s,x:a,y:l}}function GN(e,t){const n=ii(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Yt(e)?Vi(e):gr(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function Ig(e,t,n){let r;if(t==="viewport")r=qN(e,n);else if(t==="document")r=WN(wr(e));else if(ct(t))r=GN(t,n);else{const o=zE(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Xl(r)}function qE(e,t){const n=Zr(e);return n===t||!ct(n)||Wr(n)?!1:Wn(n).position==="fixed"||qE(n,t)}function YN(e,t){const n=t.get(e);if(n)return n;let r=wo(e,[],!1).filter(a=>ct(a)&&Do(a)!=="body"),o=null;const i=Wn(e).position==="fixed";let s=i?Zr(e):e;for(;ct(s)&&!Wr(s);){const a=Wn(s),l=hp(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Ia(s)&&!l&&qE(e,s))?r=r.filter(u=>u!==s):o=a,s=Zr(s)}return t.set(e,r),r}function KN(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?mu(t)?[]:YN(t,this._c):[].concat(n),r],a=Ig(t,s[0],o);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<s.length;f++){const h=Ig(t,s[f],o);l=vn(h.top,l),c=Xi(h.right,c),u=Xi(h.bottom,u),d=vn(h.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function QN(e){const{width:t,height:n}=jE(e);return{width:t,height:n}}function XN(e,t,n){const r=Yt(t),o=wr(t),i=n==="fixed",s=ii(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=gr(0);function c(){l.x=Eu(o)}if(r||!r&&!i)if((Do(t)!=="body"||Ia(o))&&(a=bu(t)),r){const h=ii(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?WE(o,a):gr(0),d=s.left+a.scrollLeft-l.x-u.x,f=s.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function pd(e){return Wn(e).position==="static"}function Mg(e,t){if(!Yt(e)||Wn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return wr(e)===n&&(n=n.ownerDocument.body),n}function GE(e,t){const n=Mn(e);if(mu(e))return n;if(!Yt(e)){let o=Zr(e);for(;o&&!Wr(o);){if(ct(o)&&!pd(o))return o;o=Zr(o)}return n}let r=Mg(e,t);for(;r&&VA(r)&&pd(r);)r=Mg(r,t);return r&&Wr(r)&&pd(r)&&!hp(r)?n:r||zA(e)||n}const ZN=async function(e){const t=this.getOffsetParent||GE,n=this.getDimensions,r=await n(e.floating);return{reference:XN(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function JN(e){return Wn(e).direction==="rtl"}const eI={convertOffsetParentRelativeRectToViewportRelativeRect:jN,getDocumentElement:wr,getClippingRect:KN,getOffsetParent:GE,getElementRects:ZN,getClientRects:zN,getDimensions:QN,getScale:Vi,isElement:ct,isRTL:JN};function YE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tI(e,t){let n=null,r;const o=wr(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(a||t(),!f||!h)return;const p=Ga(d),g=Ga(o.clientWidth-(u+f)),y=Ga(o.clientHeight-(d+h)),b=Ga(u),k={rootMargin:-p+"px "+-g+"px "+-y+"px "+-b+"px",threshold:vn(0,Xi(1,l))||1};let O=!0;function M(A){const D=A[0].intersectionRatio;if(D!==l){if(!O)return s();D?s(!1,D):r=setTimeout(()=>{s(!1,1e-7)},1e3)}D===1&&!YE(c,e.getBoundingClientRect())&&s(),O=!1}try{n=new IntersectionObserver(M,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(M,k)}n.observe(e)}return s(!0),i}function mp(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=pp(e),u=o||i?[...c?wo(c):[],...t?wo(t):[]]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&a?tI(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(b=>{let[x]=b;x&&x.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let p,g=l?ii(e):null;l&&y();function y(){const b=ii(e);g&&!YE(g,b)&&n(),g=b,p=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(x=>{o&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),d?.(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const nI=FN,rI=LN,oI=HN,iI=DN,sI=UN,aI=(e,t,n)=>{const r=new Map,o={platform:eI,...n},i={...o.platform,_c:r};return ON(e,t,{...o,platform:i})};var lI=typeof document<"u",cI=function(){},Il=lI?C.useLayoutEffect:cI;function nc(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(!nc(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)&&!nc(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function KE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _g(e,t){const n=KE(e);return Math.round(t*n)/n}function md(e){const t=C.useRef(e);return Il(()=>{t.current=e}),t}function uI(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=C.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=C.useState(r);nc(f,r)||h(r);const[p,g]=C.useState(null),[y,b]=C.useState(null),x=C.useCallback(G=>{G!==A.current&&(A.current=G,g(G))},[]),k=C.useCallback(G=>{G!==D.current&&(D.current=G,b(G))},[]),O=i||p,M=s||y,A=C.useRef(null),D=C.useRef(null),z=C.useRef(u),Y=l!=null,N=md(l),K=md(o),F=md(c),q=C.useCallback(()=>{if(!A.current||!D.current)return;const G={placement:t,strategy:n,middleware:f};K.current&&(G.platform=K.current),aI(A.current,D.current,G).then(te=>{const S={...te,isPositioned:F.current!==!1};L.current&&!nc(z.current,S)&&(z.current=S,Xr.flushSync(()=>{d(S)}))})},[f,t,n,K,F]);Il(()=>{c===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,d(G=>({...G,isPositioned:!1})))},[c]);const L=C.useRef(!1);Il(()=>(L.current=!0,()=>{L.current=!1}),[]),Il(()=>{if(O&&(A.current=O),M&&(D.current=M),O&&M){if(N.current)return N.current(O,M,q);q()}},[O,M,q,N,Y]);const H=C.useMemo(()=>({reference:A,floating:D,setReference:x,setFloating:k}),[x,k]),re=C.useMemo(()=>({reference:O,floating:M}),[O,M]),W=C.useMemo(()=>{const G={position:n,left:0,top:0};if(!re.floating)return G;const te=_g(re.floating,u.x),S=_g(re.floating,u.y);return a?{...G,transform:"translate("+te+"px, "+S+"px)",...KE(re.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:S}},[n,a,re.floating,u.x,u.y]);return C.useMemo(()=>({...u,update:q,refs:H,elements:re,floatingStyles:W}),[u,q,H,re,W])}const qr=(e,t)=>{const n=nI(e);return{name:n.name,fn:n.fn,options:[e,t]}},xu=(e,t)=>{const n=oI(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cu=(e,t)=>{const n=iI(e);return{name:n.name,fn:n.fn,options:[e,t]}},rc=(e,t)=>{const n=sI(e);return{name:n.name,fn:n.fn,options:[e,t]}},QE=(e,t)=>{const n=rI(e);return{name:n.name,fn:n.fn,options:[e,t]}};function dI(e){const t=C.useRef(void 0),n=C.useCallback(r=>{const o=e.map(i=>{if(i!=null){if(typeof i=="function"){const s=i,a=s(r);return typeof a=="function"?a:()=>{s(null)}}return i.current=r,()=>{i.current=null}}});return()=>{o.forEach(i=>i?.())}},e);return C.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}const fI="data-floating-ui-focusable",Og="active",Rg="selected",hI={...aE};let Lg=!1,pI=0;const Dg=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+pI++;function mI(){const[e,t]=C.useState(()=>Lg?Dg():void 0);return Kt(()=>{e==null&&t(Dg())},[]),C.useEffect(()=>{Lg=!0},[]),e}const gI=hI.useId,XE=gI||mI;function bI(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const yI=C.createContext(null),EI=C.createContext(null),ZE=()=>{var e;return((e=C.useContext(yI))==null?void 0:e.id)||null},ku=()=>C.useContext(EI);function Ji(e){return"data-floating-ui-"+e}function hn(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Pg=Ji("safe-polygon");function gd(e,t,n){if(n&&!jf(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}function bd(e){return typeof e=="function"?e():e}function xI(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:s}=e,{enabled:a=!0,delay:l=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,h=ku(),p=ZE(),g=tr(c),y=tr(l),b=tr(n),x=tr(d),k=C.useRef(),O=C.useRef(-1),M=C.useRef(),A=C.useRef(-1),D=C.useRef(!0),z=C.useRef(!1),Y=C.useRef(()=>{}),N=C.useRef(!1),K=bn(()=>{var W;const G=(W=o.current.openEvent)==null?void 0:W.type;return G?.includes("mouse")&&G!=="mousedown"});C.useEffect(()=>{if(!a)return;function W(G){let{open:te}=G;te||(hn(O),hn(A),D.current=!0,N.current=!1)}return i.on("openchange",W),()=>{i.off("openchange",W)}},[a,i]),C.useEffect(()=>{if(!a||!g.current||!n)return;function W(te){K()&&r(!1,te,"hover")}const G=rn(s.floating).documentElement;return G.addEventListener("mouseleave",W),()=>{G.removeEventListener("mouseleave",W)}},[s.floating,n,r,a,g,K]);const F=C.useCallback(function(W,G,te){G===void 0&&(G=!0),te===void 0&&(te="hover");const S=gd(y.current,"close",k.current);S&&!M.current?(hn(O),O.current=window.setTimeout(()=>r(!1,W,te),S)):G&&(hn(O),r(!1,W,te))},[y,r]),q=bn(()=>{Y.current(),M.current=void 0}),L=bn(()=>{if(z.current){const W=rn(s.floating).body;W.style.pointerEvents="",W.removeAttribute(Pg),z.current=!1}}),H=bn(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);C.useEffect(()=>{if(!a)return;function W(pe){if(hn(O),D.current=!1,u&&!jf(k.current)||bd(x.current)>0&&!gd(y.current,"open"))return;const v=gd(y.current,"open",k.current);v?O.current=window.setTimeout(()=>{b.current||r(!0,pe,"hover")},v):n||r(!0,pe,"hover")}function G(pe){if(H()){L();return}Y.current();const v=rn(s.floating);if(hn(A),N.current=!1,g.current&&o.current.floatingContext){n||hn(O),M.current=g.current({...o.current.floatingContext,tree:h,x:pe.clientX,y:pe.clientY,onClose(){L(),q(),H()||F(pe,!0,"safe-polygon")}});const ve=M.current;v.addEventListener("mousemove",ve),Y.current=()=>{v.removeEventListener("mousemove",ve)};return}(k.current==="touch"?!pn(s.floating,pe.relatedTarget):!0)&&F(pe)}function te(pe){H()||o.current.floatingContext&&(g.current==null||g.current({...o.current.floatingContext,tree:h,x:pe.clientX,y:pe.clientY,onClose(){L(),q(),H()||F(pe)}})(pe))}function S(){hn(O)}function ye(pe){H()||F(pe,!1)}if(ct(s.domReference)){const pe=s.domReference,v=s.floating;return n&&pe.addEventListener("mouseleave",te),f&&pe.addEventListener("mousemove",W,{once:!0}),pe.addEventListener("mouseenter",W),pe.addEventListener("mouseleave",G),v&&(v.addEventListener("mouseleave",te),v.addEventListener("mouseenter",S),v.addEventListener("mouseleave",ye)),()=>{n&&pe.removeEventListener("mouseleave",te),f&&pe.removeEventListener("mousemove",W),pe.removeEventListener("mouseenter",W),pe.removeEventListener("mouseleave",G),v&&(v.removeEventListener("mouseleave",te),v.removeEventListener("mouseenter",S),v.removeEventListener("mouseleave",ye))}}},[s,a,e,u,f,F,q,L,r,n,b,h,y,g,o,H,x]),Kt(()=>{var W;if(a&&n&&(W=g.current)!=null&&(W=W.__options)!=null&&W.blockPointerEvents&&K()){z.current=!0;const te=s.floating;if(ct(s.domReference)&&te){var G;const S=rn(s.floating).body;S.setAttribute(Pg,"");const ye=s.domReference,pe=h==null||(G=h.nodesRef.current.find(v=>v.id===p))==null||(G=G.context)==null?void 0:G.elements.floating;return pe&&(pe.style.pointerEvents=""),S.style.pointerEvents="none",ye.style.pointerEvents="auto",te.style.pointerEvents="auto",()=>{S.style.pointerEvents="",ye.style.pointerEvents="",te.style.pointerEvents=""}}}},[a,n,p,s,h,g,K]),Kt(()=>{n||(k.current=void 0,N.current=!1,q(),L())},[n,q,L]),C.useEffect(()=>()=>{q(),hn(O),hn(A),L()},[a,s.domReference,q,L]);const re=C.useMemo(()=>{function W(G){k.current=G.pointerType}return{onPointerDown:W,onPointerEnter:W,onMouseMove(G){const{nativeEvent:te}=G;function S(){!D.current&&!b.current&&r(!0,te,"hover")}u&&!jf(k.current)||n||bd(x.current)===0||N.current&&G.movementX**2+G.movementY**2<2||(hn(A),k.current==="touch"?S():(N.current=!0,A.current=window.setTimeout(S,bd(x.current))))}}},[u,r,n,b,x]);return C.useMemo(()=>a?{reference:re}:{},[a,re])}let Bg=0;function wi(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Bg);const i=()=>e?.focus({preventScroll:n});o?i():Bg=requestAnimationFrame(i)}function yd(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&aa(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function CI(e){return"composedPath"in e?e.composedPath()[0]:e.target}function kI(e){return e?.ownerDocument||document}const $i={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Fg(e){return e==="inert"?$i.inert:e==="aria-hidden"?$i["aria-hidden"]:$i.none}let Ya=new WeakSet,Ka={},Ed=0;const TI=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype;function JE(e){return e?aa(e)?e.host:JE(e.parentNode):null}const wI=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=JE(n);return e.contains(r)?r:null}).filter(n=>n!=null);function SI(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,s=wI(t,e),a=new Set,l=new Set(s),c=[];Ka[o]||(Ka[o]=new WeakMap);const u=Ka[o];s.forEach(d),f(t),a.clear();function d(h){!h||a.has(h)||(a.add(h),h.parentNode&&d(h.parentNode))}function f(h){!h||l.has(h)||[].forEach.call(h.children,p=>{if(Do(p)!=="script")if(a.has(p))f(p);else{const g=i?p.getAttribute(i):null,y=g!==null&&g!=="false",b=Fg(i),x=(b.get(p)||0)+1,k=(u.get(p)||0)+1;b.set(p,x),u.set(p,k),c.push(p),x===1&&y&&Ya.add(p),k===1&&p.setAttribute(o,""),!y&&i&&p.setAttribute(i,i==="inert"?"":"true")}})}return Ed++,()=>{c.forEach(h=>{const p=Fg(i),y=(p.get(h)||0)-1,b=(u.get(h)||0)-1;p.set(h,y),u.set(h,b),y||(!Ya.has(h)&&i&&h.removeAttribute(i),Ya.delete(h)),b||h.removeAttribute(o)}),Ed--,Ed||($i.inert=new WeakMap,$i["aria-hidden"]=new WeakMap,$i.none=new WeakMap,Ya=new WeakSet,Ka={})}}function Hg(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=kI(e[0]).body;return SI(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,t,n)}const gp={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},oc=C.forwardRef(function(t,n){const[r,o]=C.useState();Kt(()=>{gN()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ji("focus-guard")]:"",style:gp};return E.jsx("span",{...t,...i})}),vI={clipPath:"inset(50%)",position:"fixed",top:0,left:0},ex=C.createContext(null),Ug=Ji("portal");function AI(e){e===void 0&&(e={});const{id:t,root:n}=e,r=XE(),o=tx(),[i,s]=C.useState(null),a=C.useRef(null);return Kt(()=>()=>{i?.remove(),queueMicrotask(()=>{a.current=null})},[i]),Kt(()=>{if(!r||a.current)return;const l=t?document.getElementById(t):null;if(!l)return;const c=document.createElement("div");c.id=r,c.setAttribute(Ug,""),l.appendChild(c),a.current=c,s(c)},[t,r]),Kt(()=>{if(n===null||!r||a.current)return;let l=n||o?.portalNode;l&&!fp(l)&&(l=l.current),l=l||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,l.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(Ug,""),l=c||l,l.appendChild(u),a.current=u,s(u)},[t,n,r,o]),i}function xd(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,i=AI({id:n,root:r}),[s,a]=C.useState(null),l=C.useRef(null),c=C.useRef(null),u=C.useRef(null),d=C.useRef(null),f=s?.modal,h=s?.open,p=!!s&&!s.modal&&s.open&&o&&!!(r||i);return C.useEffect(()=>{if(!i||!o||f)return;function g(y){i&&Hs(y)&&(y.type==="focusin"?vg:IN)(i)}return i.addEventListener("focusin",g,!0),i.addEventListener("focusout",g,!0),()=>{i.removeEventListener("focusin",g,!0),i.removeEventListener("focusout",g,!0)}},[i,o,f]),C.useEffect(()=>{i&&(h||vg(i))},[h,i]),E.jsxs(ex.Provider,{value:C.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:i,setFocusManagerState:a}),[o,i]),children:[p&&i&&E.jsx(oc,{"data-type":"outside",ref:l,onFocus:g=>{if(Hs(g,i)){var y;(y=u.current)==null||y.focus()}else{const b=s?s.domReference:null,x=$E(b);x?.focus()}}}),p&&i&&E.jsx("span",{"aria-owns":i.id,style:vI}),i&&Xr.createPortal(t,i),p&&i&&E.jsx(oc,{"data-type":"outside",ref:c,onFocus:g=>{if(Hs(g,i)){var y;(y=d.current)==null||y.focus()}else{const b=s?s.domReference:null,x=VE(b);x?.focus(),s?.closeOnFocusOut&&s?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const tx=()=>C.useContext(ex);function Vg(e){return C.useMemo(()=>t=>{e.forEach(n=>{n&&(n.current=t)})},e)}const $g=20;let yo=[];function bp(){yo=yo.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function NI(e){bp(),e&&Do(e)!=="body"&&(yo.push(new WeakRef(e)),yo.length>$g&&(yo=yo.slice(-$g)))}function jg(){bp();const e=yo[yo.length-1];return e?.deref()}function II(e){const t=Ma();return FE(e,t)?e:yu(e,t)[0]||e}function zg(e,t){var n;if(!t.current.includes("floating")&&!((n=e.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=Ma(),i=pN(e,r).filter(a=>{const l=a.getAttribute("data-tabindex")||"";return FE(a,r)||a.hasAttribute("data-tabindex")&&!l.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||i.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const MI=C.forwardRef(function(t,n){return E.jsx("button",{...t,type:"button",ref:n,tabIndex:-1,style:gp})});function _I(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],guards:i=!0,initialFocus:s=0,returnFocus:a=!0,restoreFocus:l=!1,modal:c=!0,visuallyHiddenDismiss:u=!1,closeOnFocusOut:d=!0,outsideElementsInert:f=!1,getInsideElements:h=()=>[]}=e,{open:p,onOpenChange:g,events:y,dataRef:b,elements:{domReference:x,floating:k}}=t,O=bn(()=>{var Ee;return(Ee=b.current.floatingContext)==null?void 0:Ee.nodeId}),M=bn(h),A=typeof s=="number"&&s<0,D=Tg(x)&&A,z=TI(),Y=z?i:!0,N=!Y||z&&f,K=tr(o),F=tr(s),q=tr(a),L=ku(),H=tx(),re=C.useRef(null),W=C.useRef(null),G=C.useRef(!1),te=C.useRef(!1),S=C.useRef(-1),ye=C.useRef(-1),pe=H!=null,v=wg(k),ze=bn(function(Ee){return Ee===void 0&&(Ee=v),Ee?yu(Ee,Ma()):[]}),ve=bn(Ee=>{const De=ze(Ee);return K.current.map(Ne=>x&&Ne==="reference"?x:v&&Ne==="floating"?v:De).filter(Boolean).flat()});C.useEffect(()=>{if(r||!c)return;function Ee(Ne){if(Ne.key==="Tab"){pn(v,_i(rn(v)))&&ze().length===0&&!D&&hd(Ne);const Ke=ve(),ft=ho(Ne);K.current[0]==="reference"&&ft===x&&(hd(Ne),Ne.shiftKey?wi(Ke[Ke.length-1]):wi(Ke[1])),K.current[1]==="floating"&&ft===v&&Ne.shiftKey&&(hd(Ne),wi(Ke[0]))}}const De=rn(v);return De.addEventListener("keydown",Ee),()=>{De.removeEventListener("keydown",Ee)}},[r,x,v,c,K,D,ze,ve]),C.useEffect(()=>{if(r||!k)return;function Ee(De){const Ne=ho(De),ft=ze().indexOf(Ne);ft!==-1&&(S.current=ft)}return k.addEventListener("focusin",Ee),()=>{k.removeEventListener("focusin",Ee)}},[r,k,ze]),C.useEffect(()=>{if(r||!d)return;function Ee(){te.current=!0,setTimeout(()=>{te.current=!1})}function De(ft){const Fe=ft.relatedTarget,Tn=ft.currentTarget,zt=ho(ft);queueMicrotask(()=>{const It=O(),_=!(pn(x,Fe)||pn(k,Fe)||pn(Fe,k)||pn(H?.portalNode,Fe)||Fe!=null&&Fe.hasAttribute(Ji("focus-guard"))||L&&(Ui(L.nodesRef.current,It).find(P=>{var U,oe;return pn((U=P.context)==null?void 0:U.elements.floating,Fe)||pn((oe=P.context)==null?void 0:oe.elements.domReference,Fe)})||Sg(L.nodesRef.current,It).find(P=>{var U,oe,ne;return[(U=P.context)==null?void 0:U.elements.floating,wg((oe=P.context)==null?void 0:oe.elements.floating)].includes(Fe)||((ne=P.context)==null?void 0:ne.elements.domReference)===Fe})));if(Tn===x&&v&&zg(v,K),l&&Tn!==x&&!(zt!=null&&zt.isConnected)&&_i(rn(v))===rn(v).body){Yt(v)&&v.focus();const P=S.current,U=ze(),oe=U[P]||U[U.length-1]||v;Yt(oe)&&oe.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(D||!c)&&Fe&&_&&!te.current&&Fe!==jg()&&(G.current=!0,g(!1,ft,"focus-out"))})}const Ne=!!(!L&&H);function Ke(){hn(ye),b.current.insideReactTree=!0,ye.current=window.setTimeout(()=>{b.current.insideReactTree=!1})}if(k&&Yt(x))return x.addEventListener("focusout",De),x.addEventListener("pointerdown",Ee),k.addEventListener("focusout",De),Ne&&k.addEventListener("focusout",Ke,!0),()=>{x.removeEventListener("focusout",De),x.removeEventListener("pointerdown",Ee),k.removeEventListener("focusout",De),Ne&&k.removeEventListener("focusout",Ke,!0)}},[r,x,k,v,c,L,H,g,d,l,ze,D,O,K,b]);const Le=C.useRef(null),Et=C.useRef(null),Pe=Vg([Le,H?.beforeInsideRef]),We=Vg([Et,H?.afterInsideRef]);C.useEffect(()=>{var Ee,De;if(r||!k)return;const Ne=Array.from((H==null||(Ee=H.portalNode)==null?void 0:Ee.querySelectorAll("["+Ji("portal")+"]"))||[]),ft=(De=(L?Sg(L.nodesRef.current,O()):[]).find(zt=>{var It;return Tg(((It=zt.context)==null?void 0:It.elements.domReference)||null)}))==null||(De=De.context)==null?void 0:De.elements.domReference,Fe=[k,ft,...Ne,...M(),re.current,W.current,Le.current,Et.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,K.current.includes("reference")||D?x:null].filter(zt=>zt!=null),Tn=c||D?Hg(Fe,!N,N):Hg(Fe);return()=>{Tn()}},[r,x,k,c,K,H,D,Y,N,L,O,M]),Kt(()=>{if(r||!Yt(v))return;const Ee=rn(v),De=_i(Ee);queueMicrotask(()=>{const Ne=ve(v),Ke=F.current,ft=(typeof Ke=="number"?Ne[Ke]:Ke.current)||v,Fe=pn(v,De);!A&&!Fe&&p&&wi(ft,{preventScroll:ft===v})})},[r,p,v,A,ve,F]),Kt(()=>{if(r||!v)return;const Ee=rn(v),De=_i(Ee);NI(De);function Ne(Fe){let{reason:Tn,event:zt,nested:It}=Fe;if(["hover","safe-polygon"].includes(Tn)&&zt.type==="mouseleave"&&(G.current=!0),Tn==="outside-press")if(It)G.current=!1;else if(kN(zt)||TN(zt))G.current=!1;else{let _=!1;document.createElement("div").focus({get preventScroll(){return _=!0,!1}}),_?G.current=!1:G.current=!0}}y.on("openchange",Ne);const Ke=Ee.createElement("span");Ke.setAttribute("tabindex","-1"),Ke.setAttribute("aria-hidden","true"),Object.assign(Ke.style,gp),pe&&x&&x.insertAdjacentElement("afterend",Ke);function ft(){if(typeof q.current=="boolean"){const Fe=x||jg();return Fe&&Fe.isConnected?Fe:Ke}return q.current.current||Ke}return()=>{y.off("openchange",Ne);const Fe=_i(Ee),Tn=pn(k,Fe)||L&&Ui(L.nodesRef.current,O(),!1).some(It=>{var _;return pn((_=It.context)==null?void 0:_.elements.floating,Fe)}),zt=ft();queueMicrotask(()=>{const It=II(zt);q.current&&!G.current&&Yt(It)&&(!(It!==Fe&&Fe!==Ee.body)||Tn)&&It.focus({preventScroll:!0}),Ke.remove()})}},[r,k,v,q,b,y,L,pe,x,O]),C.useEffect(()=>(queueMicrotask(()=>{G.current=!1}),()=>{queueMicrotask(bp)}),[r]),Kt(()=>{if(!r&&H)return H.setFocusManagerState({modal:c,closeOnFocusOut:d,open:p,onOpenChange:g,domReference:x}),()=>{H.setFocusManagerState(null)}},[r,H,c,p,g,d,x]),Kt(()=>{r||v&&zg(v,K)},[r,v,K]);function dt(Ee){return r||!u||!c?null:E.jsx(MI,{ref:Ee==="start"?re:W,onClick:De=>g(!1,De.nativeEvent),children:typeof u=="string"?u:"Dismiss"})}const xt=!r&&Y&&(c?!D:!0)&&(pe||c);return E.jsxs(E.Fragment,{children:[xt&&E.jsx(oc,{"data-type":"inside",ref:Pe,onFocus:Ee=>{if(c){const Ne=ve();wi(o[0]==="reference"?Ne[0]:Ne[Ne.length-1])}else if(H!=null&&H.preserveTabOrder&&H.portalNode)if(G.current=!1,Hs(Ee,H.portalNode)){const Ne=VE(x);Ne?.focus()}else{var De;(De=H.beforeOutsideRef.current)==null||De.focus()}}}),!D&&dt("start"),n,dt("end"),xt&&E.jsx(oc,{"data-type":"inside",ref:We,onFocus:Ee=>{if(c)wi(ve()[0]);else if(H!=null&&H.preserveTabOrder&&H.portalNode)if(d&&(G.current=!0),Hs(Ee,H.portalNode)){const Ne=$E(x);Ne?.focus()}else{var De;(De=H.afterOutsideRef.current)==null||De.focus()}}})]})}const OI={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},RI={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Wg=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e?.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e?.outsidePress)!=null?n:!0}};function LI(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=t,g=ku(),y=bn(typeof l=="function"?l:()=>!1),b=typeof l=="function"?y:l,x=C.useRef(!1),{escapeKey:k,outsidePress:O}=Wg(h),{escapeKey:M,outsidePress:A}=Wg(p),D=C.useRef(!1),z=bn(L=>{var H;if(!n||!s||!a||L.key!=="Escape"||D.current)return;const re=(H=i.current.floatingContext)==null?void 0:H.nodeId,W=g?Ui(g.nodesRef.current,re):[];if(!k&&(L.stopPropagation(),W.length>0)){let G=!0;if(W.forEach(te=>{var S;if((S=te.context)!=null&&S.open&&!te.context.dataRef.current.__escapeKeyBubbles){G=!1;return}}),!G)return}r(!1,CN(L)?L.nativeEvent:L,"escape-key")}),Y=bn(L=>{var H;const re=()=>{var W;z(L),(W=ho(L))==null||W.removeEventListener("keydown",re)};(H=ho(L))==null||H.addEventListener("keydown",re)}),N=bn(L=>{var H;const re=i.current.insideReactTree;i.current.insideReactTree=!1;const W=x.current;if(x.current=!1,c==="click"&&W||re||typeof b=="function"&&!b(L))return;const G=ho(L),te="["+Ji("inert")+"]",S=rn(o.floating).querySelectorAll(te);let ye=ct(G)?G:null;for(;ye&&!Wr(ye);){const ve=Zr(ye);if(Wr(ve)||!ct(ve))break;ye=ve}if(S.length&&ct(G)&&!EN(G)&&!pn(G,o.floating)&&Array.from(S).every(ve=>!pn(ye,ve)))return;if(Yt(G)&&q){const ve=Wr(G),Le=Wn(G),Et=/auto|scroll/,Pe=ve||Et.test(Le.overflowX),We=ve||Et.test(Le.overflowY),dt=Pe&&G.clientWidth>0&&G.scrollWidth>G.clientWidth,xt=We&&G.clientHeight>0&&G.scrollHeight>G.clientHeight,Ee=Le.direction==="rtl",De=xt&&(Ee?L.offsetX<=G.offsetWidth-G.clientWidth:L.offsetX>G.clientWidth),Ne=dt&&L.offsetY>G.clientHeight;if(De||Ne)return}const pe=(H=i.current.floatingContext)==null?void 0:H.nodeId,v=g&&Ui(g.nodesRef.current,pe).some(ve=>{var Le;return fd(L,(Le=ve.context)==null?void 0:Le.elements.floating)});if(fd(L,o.floating)||fd(L,o.domReference)||v)return;const ze=g?Ui(g.nodesRef.current,pe):[];if(ze.length>0){let ve=!0;if(ze.forEach(Le=>{var Et;if((Et=Le.context)!=null&&Et.open&&!Le.context.dataRef.current.__outsidePressBubbles){ve=!1;return}}),!ve)return}r(!1,L,"outside-press")}),K=bn(L=>{var H;const re=()=>{var W;N(L),(W=ho(L))==null||W.removeEventListener(c,re)};(H=ho(L))==null||H.addEventListener(c,re)});C.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=k,i.current.__outsidePressBubbles=O;let L=-1;function H(S){r(!1,S,"ancestor-scroll")}function re(){window.clearTimeout(L),D.current=!0}function W(){L=window.setTimeout(()=>{D.current=!1},gu()?5:0)}const G=rn(o.floating);a&&(G.addEventListener("keydown",M?Y:z,M),G.addEventListener("compositionstart",re),G.addEventListener("compositionend",W)),b&&G.addEventListener(c,A?K:N,A);let te=[];return f&&(ct(o.domReference)&&(te=wo(o.domReference)),ct(o.floating)&&(te=te.concat(wo(o.floating))),!ct(o.reference)&&o.reference&&o.reference.contextElement&&(te=te.concat(wo(o.reference.contextElement)))),te=te.filter(S=>{var ye;return S!==((ye=G.defaultView)==null?void 0:ye.visualViewport)}),te.forEach(S=>{S.addEventListener("scroll",H,{passive:!0})}),()=>{a&&(G.removeEventListener("keydown",M?Y:z,M),G.removeEventListener("compositionstart",re),G.removeEventListener("compositionend",W)),b&&G.removeEventListener(c,A?K:N,A),te.forEach(S=>{S.removeEventListener("scroll",H)}),window.clearTimeout(L)}},[i,o,a,b,c,n,r,f,s,k,O,z,M,Y,N,A,K]),C.useEffect(()=>{i.current.insideReactTree=!1},[i,b,c]);const F=C.useMemo(()=>({onKeyDown:z,...u&&{[OI[d]]:L=>{r(!1,L.nativeEvent,"reference-press")},...d!=="click"&&{onClick(L){r(!1,L.nativeEvent,"reference-press")}}}}),[z,r,u,d]),q=C.useMemo(()=>{function L(H){H.button===0&&(x.current=!0)}return{onKeyDown:z,onMouseDown:L,onMouseUp:L,[RI[c]]:()=>{i.current.insideReactTree=!0}}},[z,c,i]);return C.useMemo(()=>s?{reference:F,floating:q}:{},[s,F,q])}function DI(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=XE(),i=C.useRef({}),[s]=C.useState(()=>bI()),a=ZE()!=null,[l,c]=C.useState(r.reference),u=bn((h,p,g)=>{i.current.openEvent=h?p:void 0,s.emit("openchange",{open:h,event:p,reason:g,nested:a}),n?.(h,p,g)}),d=C.useMemo(()=>({setPositionReference:c}),[]),f=C.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return C.useMemo(()=>({dataRef:i,open:t,onOpenChange:u,elements:f,events:s,floatingId:o,refs:d}),[t,u,f,s,o,d])}function PI(e){e===void 0&&(e={});const{nodeId:t}=e,n=DI({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,s]=C.useState(null),[a,l]=C.useState(null),u=o?.domReference||i,d=C.useRef(null),f=ku();Kt(()=>{u&&(d.current=u)},[u]);const h=uI({...e,elements:{...o,...a&&{reference:a}}}),p=C.useCallback(k=>{const O=ct(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),getClientRects:()=>k.getClientRects(),contextElement:k}:k;l(O),h.refs.setReference(O)},[h.refs]),g=C.useCallback(k=>{(ct(k)||k===null)&&(d.current=k,s(k)),(ct(h.refs.reference.current)||h.refs.reference.current===null||k!==null&&!ct(k))&&h.refs.setReference(k)},[h.refs]),y=C.useMemo(()=>({...h.refs,setReference:g,setPositionReference:p,domReference:d}),[h.refs,g,p]),b=C.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),x=C.useMemo(()=>({...h,...r,refs:y,elements:b,nodeId:t}),[h,y,b,t,r]);return Kt(()=>{r.dataRef.current.floatingContext=x;const k=f?.nodesRef.current.find(O=>O.id===t);k&&(k.context=x)}),C.useMemo(()=>({...h,context:x,refs:y,elements:b}),[h,y,b,x])}function Cd(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[Og]:s,[Rg]:a,...l}=e;i=l}return{...n==="floating"&&{tabIndex:-1,[fI]:""},...i,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(o&&[Og,Rg].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var f,h=arguments.length,p=new Array(h),g=0;g<h;g++)p[g]=arguments[g];return(f=r.get(c))==null?void 0:f.map(y=>y(...p)).find(y=>y!==void 0)}}}else s[c]=u}),s),{})}}function BI(e){e===void 0&&(e=[]);const t=e.map(a=>a?.reference),n=e.map(a=>a?.floating),r=e.map(a=>a?.item),o=C.useCallback(a=>Cd(a,e,"reference"),t),i=C.useCallback(a=>Cd(a,e,"floating"),n),s=C.useCallback(a=>Cd(a,e,"item"),r);return C.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const qg=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase());function Si(e,t){return typeof e=="function"?e(t):e}function FI(e,t){const[n,r]=C.useState(e);return e&&!n&&r(!0),C.useEffect(()=>{if(!e&&n){const o=setTimeout(()=>r(!1),t);return()=>clearTimeout(o)}},[e,n,t]),n}function nx(e,t){t===void 0&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,s=(typeof o=="number"?o:o.close)||0,[a,l]=C.useState("unmounted"),c=FI(n,s);return!c&&a==="close"&&l("unmounted"),Kt(()=>{if(r){if(n){l("initial");const u=requestAnimationFrame(()=>{Xr.flushSync(()=>{l("open")})});return()=>{cancelAnimationFrame(u)}}l("close")}},[n,r]),{isMounted:c,status:a}}function HI(e,t){t===void 0&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:s=250}=t,a=e.placement,l=a.split("-")[0],c=C.useMemo(()=>({side:l,placement:a}),[l,a]),u=typeof s=="number",d=(u?s:s.open)||0,f=(u?s:s.close)||0,[h,p]=C.useState(()=>({...Si(i,c),...Si(n,c)})),{isMounted:g,status:y}=nx(e,{duration:s}),b=tr(n),x=tr(r),k=tr(o),O=tr(i);return Kt(()=>{const M=Si(b.current,c),A=Si(k.current,c),D=Si(O.current,c),z=Si(x.current,c)||Object.keys(M).reduce((Y,N)=>(Y[N]="",Y),{});if(y==="initial"&&p(Y=>({transitionProperty:Y.transitionProperty,...D,...M})),y==="open"&&p({transitionProperty:Object.keys(z).map(qg).join(","),transitionDuration:d+"ms",...D,...z}),y==="close"){const Y=A||M;p({transitionProperty:Object.keys(Y).map(qg).join(","),transitionDuration:f+"ms",...D,...Y})}},[f,k,b,x,O,d,y,c]),{isMounted:g,styles:h}}function rx(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var i;return o.parentId===t&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...rx(e,o.id,n)])}function Gg(e,t){const[n,r]=e;let o=!1;const i=t.length;for(let s=0,a=i-1;s<i;a=s++){const[l,c]=t[s]||[0,0],[u,d]=t[a]||[0,0];c>=r!=d>=r&&n<=(u-l)*(r-c)/(d-c)+l&&(o=!o)}return o}function UI(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function VI(e){e===void 0&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o={current:-1};let i=!1,s=null,a=null,l=typeof performance<"u"?performance.now():0;function c(d,f){const h=performance.now(),p=h-l;if(s===null||a===null||p===0)return s=d,a=f,l=h,null;const g=d-s,y=f-a,x=Math.sqrt(g*g+y*y)/p;return s=d,a=f,l=h,x}const u=d=>{let{x:f,y:h,placement:p,elements:g,onClose:y,nodeId:b,tree:x}=d;return function(O){function M(){hn(o),y()}if(hn(o),!g.domReference||!g.floating||p==null||f==null||h==null)return;const{clientX:A,clientY:D}=O,z=[A,D],Y=CI(O),N=O.type==="mouseleave",K=yd(g.floating,Y),F=yd(g.domReference,Y),q=g.domReference.getBoundingClientRect(),L=g.floating.getBoundingClientRect(),H=p.split("-")[0],re=f>L.right-L.width/2,W=h>L.bottom-L.height/2,G=UI(z,q),te=L.width>q.width,S=L.height>q.height,ye=(te?q:L).left,pe=(te?q:L).right,v=(S?q:L).top,ze=(S?q:L).bottom;if(K&&(i=!0,!N))return;if(F&&(i=!1),F&&!N){i=!0;return}if(N&&ct(O.relatedTarget)&&yd(g.floating,O.relatedTarget)||x&&rx(x.nodesRef.current,b).length)return;if(H==="top"&&h>=q.bottom-1||H==="bottom"&&h<=q.top+1||H==="left"&&f>=q.right-1||H==="right"&&f<=q.left+1)return M();let ve=[];switch(H){case"top":ve=[[ye,q.top+1],[ye,L.bottom-1],[pe,L.bottom-1],[pe,q.top+1]];break;case"bottom":ve=[[ye,L.top+1],[ye,q.bottom-1],[pe,q.bottom-1],[pe,L.top+1]];break;case"left":ve=[[L.right-1,ze],[L.right-1,v],[q.left+1,v],[q.left+1,ze]];break;case"right":ve=[[q.right-1,ze],[q.right-1,v],[L.left+1,v],[L.left+1,ze]];break}function Le(Et){let[Pe,We]=Et;switch(H){case"top":{const dt=[te?Pe+t/2:re?Pe+t*4:Pe-t*4,We+t+1],xt=[te?Pe-t/2:re?Pe+t*4:Pe-t*4,We+t+1],Ee=[[L.left,re||te?L.bottom-t:L.top],[L.right,re?te?L.bottom-t:L.top:L.bottom-t]];return[dt,xt,...Ee]}case"bottom":{const dt=[te?Pe+t/2:re?Pe+t*4:Pe-t*4,We-t],xt=[te?Pe-t/2:re?Pe+t*4:Pe-t*4,We-t],Ee=[[L.left,re||te?L.top+t:L.bottom],[L.right,re?te?L.top+t:L.bottom:L.top+t]];return[dt,xt,...Ee]}case"left":{const dt=[Pe+t+1,S?We+t/2:W?We+t*4:We-t*4],xt=[Pe+t+1,S?We-t/2:W?We+t*4:We-t*4];return[...[[W||S?L.right-t:L.left,L.top],[W?S?L.right-t:L.left:L.right-t,L.bottom]],dt,xt]}case"right":{const dt=[Pe-t,S?We+t/2:W?We+t*4:We-t*4],xt=[Pe-t,S?We-t/2:W?We+t*4:We-t*4],Ee=[[W||S?L.left+t:L.right,L.top],[W?S?L.left+t:L.right:L.left+t,L.bottom]];return[dt,xt,...Ee]}}}if(!Gg([A,D],ve)){if(i&&!G)return M();if(!N&&r){const Et=c(O.clientX,O.clientY);if(Et!==null&&Et<.1)return M()}Gg([A,D],Le([f,h]))?!i&&r&&(o.current=window.setTimeout(M,40)):M()}}};return u.__options={blockPointerEvents:n},u}var kd={exports:{}},Td={};var Yg;function $I(){if(Yg)return Td;Yg=1;var e=Ev(),t=Nv();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Td.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function b(A){if(!x){if(x=!0,k=A,A=f(A),h!==void 0&&g.hasValue){var D=g.value;if(h(D,A))return O=D}return O=A}if(D=O,r(k,A))return D;var z=f(A);return h!==void 0&&h(D,z)?(k=A,D):(k=A,O=z)}var x=!1,k,O,M=d===void 0?null:d;return[function(){return b(u())},M===null?void 0:function(){return b(M())}]},[u,d,f,h]);var y=o(c,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=y},[y]),l(y),y},Td}var Kg;function jI(){return Kg||(Kg=1,kd.exports=$I()),kd.exports}var ox=jI();const ji=new WeakMap,Ml=new WeakMap,ic={current:[]};let wd=!1;const Qa=new Set,Qg=new Map;function ix(e){const t=Array.from(e).sort((n,r)=>n instanceof zi&&n.options.deps.includes(r)?1:r instanceof zi&&r.options.deps.includes(n)?-1:0);for(const n of t){if(ic.current.includes(n))continue;ic.current.push(n),n.recompute();const r=Ml.get(n);if(r)for(const o of r){const i=ji.get(o);i&&ix(i)}}}function zI(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function WI(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qI(e){if(Qa.add(e),!wd)try{for(wd=!0;Qa.size>0;){const t=Array.from(Qa);Qa.clear();for(const n of t){const r=Qg.get(n)??n.prevState;n.prevState=r,zI(n)}for(const n of t){const r=ji.get(n);r&&(ic.current.push(n),ix(r))}for(const n of t){const r=ji.get(n);if(r)for(const o of r)WI(o)}}}finally{wd=!1,ic.current=[],Qg.clear()}}function GI(e){return typeof e=="function"}class zf{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const s=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),s?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):GI(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),qI(this)}}class zi{constructor(t){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),o=new Array(n);for(let i=0;i<n;i++){const s=this.options.deps[i];r[i]=s.prevState,o[i]=s.state}return this.lastSeenDepValues=o,{prevDepVals:r,currDepVals:o,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const o=this.getDepVals();this.state=this.options.fn(o),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const i of this.options.deps)i instanceof zi&&i.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:o}=this.getDepVals();for(let i=0;i<o.length;i++)if(o[i]!==r[i]){n=!0;break}n&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const n of this._subscriptions)n()}),this.subscribe=n=>{var r,o;this.listeners.add(n);const i=(o=(r=this.options).onSubscribe)==null?void 0:o.call(r,n,this);return()=>{this.listeners.delete(n),i?.()}},this.options=t,this.state=t.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(t=this.options.deps){for(const n of t)if(n instanceof zi)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof zf){let r=ji.get(n);r||(r=new Set,ji.set(n,r)),r.add(this);let o=Ml.get(this);o||(o=new Set,Ml.set(this,o)),o.add(n)}}unregisterFromGraph(t=this.options.deps){for(const n of t)if(n instanceof zi)this.unregisterFromGraph(n.options.deps);else if(n instanceof zf){const r=ji.get(n);r&&r.delete(this);const o=Ml.get(this);o&&o.delete(n)}}}function YI(e,t=n=>n){return ox.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,KI)}function KI(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Xg(e);if(n.length!==Xg(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Xg(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var Wf=Symbol("originalFactory");function Ve(e){if(typeof e=="object"&&"key"in e)return function t(){return e[Wf]=t,e};if(typeof e!="function")throw Error("factory must be a function");return function t(n){return r=>{let o=e({editor:r.editor,options:n});return o[Wf]=t,o}}}function Po(e,t){return new zf(e,t)}function Ft(e){this.content=e}Ft.prototype={constructor:Ft,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return o==-1?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new Ft(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Ft(n)},addToStart:function(e,t){return new Ft([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Ft(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(i==-1?o.length:i,0,t,n),new Ft(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Ft.from(e),e.size?new Ft(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Ft.from(e),e.size?new Ft(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Ft.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};Ft.from=function(e){if(e instanceof Ft)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Ft(t)};function sx(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=sx(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function ax(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=ax(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class j{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>t&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,o){let i="",s=!0;return this.nodesBetween(t,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(t,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new j(o,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],o=0;if(n>t)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>t&&((s<t||l>n)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new j(r,o)}cutByIndex(t,n){return t==n?j.empty:t==0&&n==this.content.length?this:new j(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new j(o,i)}addToStart(t){return new j([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new j(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];t(o,r,n),r+=o.nodeSize}}findDiffStart(t,n=0){return sx(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return ax(this,t,n,r)}findIndex(t){if(t==0)return Xa(0,t);if(t==this.size)return Xa(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=t)return i==t?Xa(n+1,i):Xa(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return j.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new j(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return j.empty;let n,r=0;for(let o=0;o<t.length;o++){let i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new j(n||t,r)}static from(t){if(!t)return j.empty;if(t instanceof j)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new j([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}j.empty=new j([],0);const Sd={index:0,offset:0};function Xa(e,t){return Sd.index=e,Sd.offset=t,Sd}function sc(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!sc(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!sc(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let Xe=class qf{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let o=0;o<t.length;o++){let i=t[o];if(this.eq(i))return t;if(this.type.excludes(i.type))n||(n=t.slice(0,o));else{if(i.type.excludes(this.type))return t;!r&&i.type.rank>this.type.rank&&(n||(n=t.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&sc(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return qf.none;if(t instanceof qf)return[t];let n=t.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Xe.none=[];class ac extends Error{}class Z{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=cx(this.content,t+this.openStart,n);return r&&new Z(r,this.openStart,this.openEnd)}removeBetween(t,n){return new Z(lx(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return Z.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Z(j.fromJSON(t,n.content),r,o)}static maxOpen(t,n=!0){let r=0,o=0;for(let i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=t.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new Z(t,r,o)}}Z.empty=new Z(j.empty,0,0);function lx(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(lx(i.content,t-o-1,n-o-1)))}function cx(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=cx(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function QI(e,t,n){if(n.openStart>e.depth)throw new ac("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ac("Inconsistent open depths");return ux(e,t,n,0)}function ux(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=ux(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let s=e.parent,a=s.content;return Jo(s,a.cut(0,e.parentOffset).append(n.content).append(a.cut(t.parentOffset)))}else{let{start:s,end:a}=XI(n,e);return Jo(i,fx(e,s,a,t,r))}else return Jo(i,lc(e,t,r))}function dx(e,t){if(!t.type.compatibleContent(e.type))throw new ac("Cannot join "+t.type.name+" onto "+e.type.name)}function Gf(e,t,n){let r=e.node(n);return dx(r,t.node(n)),r}function Zo(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Us(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(Zo(e.nodeAfter,r),i++));for(let a=i;a<s;a++)Zo(o.child(a),r);t&&t.depth==n&&t.textOffset&&Zo(t.nodeBefore,r)}function Jo(e,t){return e.type.checkContent(t),e.copy(t)}function fx(e,t,n,r,o){let i=e.depth>o&&Gf(e,t,o+1),s=r.depth>o&&Gf(n,r,o+1),a=[];return Us(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(dx(i,s),Zo(Jo(i,fx(e,t,n,r,o+1)),a)):(i&&Zo(Jo(i,lc(e,t,o+1)),a),Us(t,n,o,a),s&&Zo(Jo(s,lc(n,r,o+1)),a)),Us(r,null,o,a),new j(a)}function lc(e,t,n){let r=[];if(Us(null,e,n,r),e.depth>n){let o=Gf(e,t,n+1);Zo(Jo(o,lc(e,t,n+1)),r)}return Us(t,null,n,r),new j(r)}function XI(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)o=t.node(i).copy(j.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}class la{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=t.child(n);return r?t.child(n).cut(r):o}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<t;i++)o+=r.child(i).nodeSize;return o}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return Xe.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),o=t.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new ca(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=t;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new la(n,r,i)}static resolveCached(t,n){let r=Zg.get(t);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else Zg.set(t,r=new ZI);let o=r.elts[r.i]=la.resolve(t,n);return r.i=(r.i+1)%JI,o}}class ZI{constructor(){this.elts=[],this.i=0}}const JI=12,Zg=new WeakMap;class ca{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const eM=Object.create(null);let Gr=class Yf{constructor(t,n,r,o=Xe.none){this.type=t,this.attrs=n,this.marks=o,this.content=r||j.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,o=0){this.content.nodesBetween(t,n,r,o,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,o){return this.content.textBetween(t,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&sc(this.attrs,n||t.defaultAttrs||eM)&&Xe.sameSet(this.marks,r||Xe.none)}copy(t=null){return t==this.content?this:new Yf(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Yf(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return Z.empty;let o=this.resolve(t),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new Z(c,o.depth-s,i.depth-s)}replace(t,n,r){return QI(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(o==t||n.isText)return n;t-=o+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(t){return la.resolveCached(this,t)}resolveNoCache(t){return la.resolve(this,t)}rangeHasMark(t,n,r){let o=!1;return n>t&&this.nodesBetween(t,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),hx(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=j.empty,o=0,i=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(t).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=Xe.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!Xe.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let o=j.fromJSON(t,n.content),i=t.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};Gr.prototype.text=void 0;class cc extends Gr{constructor(t,n,r,o){if(super(t,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):hx(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new cc(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new cc(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function hx(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class si{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new tM(t,n);if(r.next==null)return si.empty;let o=px(r);r.next&&r.err("Unexpected trailing text");let i=lM(aM(o));return cM(i,r),i}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(t.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(t,r);if(l&&(!n||l.validEnd))return j.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(t)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let o=0;o<r.next.length;o++)t.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),t.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+t.indexOf(r.next[s].next);return i}).join(`
|
|
3
3
|
`)}}si.empty=new si(!0);class tM{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function px(e){let t=[];do t.push(nM(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function nM(e){let t=[];do t.push(rM(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function rM(e){let t=sM(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=oM(e,t);else break;return t}function Jg(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function oM(e,t){let n=Jg(e),r=n;return e.eat(",")&&(e.next!="}"?r=Jg(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function iM(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(t)&&o.push(s)}return o.length==0&&e.err("No node type or group '"+t+"' found"),o}function sM(e){if(e.eat("(")){let t=px(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=iM(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function aM(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(s,a,l){let c={term:l,to:a};return t[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,l),u),l=u}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),o(i(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function mx(e,t){return t-e}function e0(e,t){let n=[];return r(t),n.sort(mx);function r(o){let i=e[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function lM(e){let t=Object.create(null);return n(e0(e,0));function n(r){let o=[];r.forEach(s=>{e[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);e0(e,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=t[r.join(",")]=new si(r.indexOf(e.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(mx);i.next.push({type:o[s][0],next:t[a.join(",")]||n(a)})}return i}}function cM(e,t){for(let n=0,r=[e];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function gx(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function bx(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(o===void 0){let i=e[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function yx(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in e){let i=e[o];i.validate&&i.validate(t[o])}}function Ex(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new dM(e,r,t[r]);return n}let t0=class xx{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ex(t,r.attrs),this.defaultAttrs=gx(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==si.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:bx(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Gr(this,this.computeAttrs(t),j.from(n),Xe.setFrom(r))}createChecked(t=null,n,r){return n=j.from(n),this.checkContent(n),new Gr(this,this.computeAttrs(t),n,Xe.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=j.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(j.empty,!0);return i?new Gr(this,t,n.append(i),Xe.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){yx(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:Xe.none:t}static compile(t,n){let r=Object.create(null);t.forEach((i,s)=>r[i]=new xx(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function uM(e,t,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}class dM{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?uM(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Tu{constructor(t,n,r,o){this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=Ex(t,o.attrs),this.excluded=null;let i=gx(this.attrs);this.instance=i?new Xe(this,i):null}create(t=null){return!t&&this.instance?this.instance:new Xe(this,bx(this.attrs,t))}static compile(t,n){let r=Object.create(null),o=0;return t.forEach((i,s)=>r[i]=new Tu(i,o++,n,s)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){yx(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}let Cx=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in t)n[o]=t[o];n.nodes=Ft.from(t.nodes),n.marks=Ft.from(t.marks||{}),this.nodes=t0.compile(this.spec.nodes,this),this.marks=Tu.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=si.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?n0(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:n0(this,s.split(" "))}this.nodeFromJSON=o=>Gr.fromJSON(this,o),this.markFromJSON=o=>Xe.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,o){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof t0){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,o)}text(t,n){let r=this.nodes.text;return new cc(r,r.defaultAttrs,t,Xe.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}};function n0(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let a in e.marks){let l=e.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function fM(e){return e.tag!=null}function hM(e){return e.style!=null}class sn{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(fM(o))this.tags.push(o);else if(hM(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=t.nodes[o.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new o0(this,n,!1);return r.addAll(t,Xe.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new o0(this,n,!0);return r.addAll(t,Xe.none,n.from,n.to),Z.maxOpen(r.finish())}matchTag(t,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(gM(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(t);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(t,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(t)!=0||s.context&&!r.matchesContext(s.context)||a.length>t.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(t){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in t.marks){let i=t.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=i0(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in t.nodes){let i=t.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=i0(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new sn(t,sn.schemaRules(t)))}}const kx={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},pM={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Tx={ol:!0,ul:!0},ua=1,Kf=2,Vs=4;function r0(e,t,n){return t!=null?(t?ua:0)|(t==="full"?Kf:0):e&&e.whitespace=="pre"?ua|Kf:n&~Vs}class Za{constructor(t,n,r,o,i,s){this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Xe.none,this.match=i||(s&Vs?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(j.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(t.type))?(this.match=r,o):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&ua)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=j.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(j.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!kx.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class o0{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=r0(null,n.preserveWhitespace,0)|(r?Vs:0);o?i=new Za(o.type,o.attrs,Xe.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Za(null,null,Xe.none,!0,null,s):i=new Za(t.schema.topNodeType,null,Xe.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,o=this.top,i=o.options&Kf?"full":this.localPreserveWS||(o.options&ua)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
4
4
|
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(s.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=o.content[o.content.length-1],l=t.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let o=this.localPreserveWS,i=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s=t.nodeName.toLowerCase(),a;Tx.hasOwnProperty(s)&&this.parser.normalizeLists&&mM(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(a=this.parser.matchTag(t,this,r));e:if(l?l.ignore:pM.hasOwnProperty(s))this.findInside(t),this.ignoreFallback(t,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let c,u=this.needsBlock;if(kx.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break e}let d=l&&l.skip?n:this.readStyles(t,n);d&&this.addAll(t,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(t,n);c&&this.addElementByRule(t,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
|
5
5
|
`),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(t,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(t);else if(o)this.addElement(t,r,o);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=t;typeof n.contentElement=="string"?l=t.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(t):n.contentElement&&(l=n.contentElement),this.findAround(t,l,!0),this.addAll(l,r),this.findAround(t,l,!1)}i&&this.sync(a)&&this.open--}addAll(t,n,r,o){let i=r||0;for(let s=r?t.childNodes[r]:t.firstChild,a=o==null?null:t.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,n);this.findAtPoint(t,i)}findPlace(t,n,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(t);if(c&&(!o||o.length>c.length+a)&&(o=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(t,n,r){if(t.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(t,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(t.type));let s=Xe.none;for(let a of o.concat(t.marks))(i.type?i.type.allowsMarkType(a.type):s0(a.type,t.type))&&(s=a.addToSet(s));return i.content.push(t.mark(s)),!0}return!1}enter(t,n,r,o){let i=this.findPlace(t.create(n),r,!1);return i&&(i=this.enterInner(t,n,r,!0,o)),i}enterInner(t,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let a=r0(t,i,s.options);s.options&Vs&&s.content.length==0&&(a|=Vs);let l=Xe.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):s0(c.type,t))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Za(t,n,l,o,null,a)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ua)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)t+=r[o].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&t.nodeType==1&&t.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function mM(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&Tx.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function gM(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function i0(e){let t={};for(let n in e)t[n]=e[n];return t}function s0(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==t||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class On{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=vd(n).createDocumentFragment());let o=r,i=[];return t.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:o}=_l(vd(n),this.nodes[t.type.name](t),null,t.attrs);if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,o)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let o=t.marks.length-1;o>=0;o--){let i=this.serializeMark(t.marks[o],t.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(t,n,r={}){let o=this.marks[t.type.name];return o&&_l(vd(r),o(t,n),null,t.attrs)}static renderSpec(t,n,r=null,o){return _l(t,n,r,o)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new On(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=a0(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return a0(t.marks)}}function a0(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function vd(e){return e.document||window.document}const l0=new WeakMap;function bM(e){let t=l0.get(e);return t===void 0&&l0.set(e,t=yM(e)),t}function yM(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(e),t}function _l(e,t,n,r){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=bM(r))&&i.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?e.createElementNS(n,o):e.createElement(o),c=t[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<t.length;d++){let f=t[d];if(f===0){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=_l(e,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const wx=65535,Sx=Math.pow(2,16);function EM(e,t){return e+t*Sx}function c0(e){return e&wx}function xM(e){return(e-(e&wx))/Sx}const vx=1,Ax=2,Ol=4,Nx=8;class Qf{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Nx)>0}get deletedBefore(){return(this.delInfo&(vx|Ol))>0}get deletedAfter(){return(this.delInfo&(Ax|Ol))>0}get deletedAcross(){return(this.delInfo&Ol)>0}}class An{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&An.empty)return An.empty}recover(t){let n=0,r=c0(t);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+xM(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>t)break;let c=this.ranges[a+i],u=this.ranges[a+s],d=l+c;if(t<=d){let f=c?t==l?-1:t==d?1:n:n,h=l+o+(f<0?0:u);if(r)return h;let p=t==(n<0?l:d)?null:EM(a/3,t-l),g=t==l?Ax:t==d?vx:Ol;return(n<0?t!=l:t!=d)&&(g|=Nx),new Qf(h,g,p)}o+=u-c}return r?t+o:new Qf(t+o,0,null)}touches(t,n){let r=0,o=c0(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let c=this.ranges[a+i],u=l+c;if(t<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];t(a,a+c,l,l+u),i+=u-c}}invert(){return new An(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?An.empty:new An(t<0?[0,-t,0]:[0,0,t])}}An.empty=new An([]);class es{constructor(t,n,r=0,o=t?t.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new es(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(t){for(let n=0,r=this._maps.length;n<t._maps.length;n++){let o=t.getMirror(n);this.appendMap(t._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this._maps.length+t._maps.length;n>=0;n--){let o=t.getMirror(n);this.appendMap(t._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let t=new es;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(t,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,t=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,t=a.pos}return r?t:new Qf(t,o,null)}}const Ad=Object.create(null);class Jt{getMap(){return An.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ad[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in Ad)throw new RangeError("Duplicate use of step JSON ID "+t);return Ad[t]=n,n.prototype.jsonID=t,n}}class At{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new At(t,null)}static fail(t){return new At(null,t)}static fromReplace(t,n,r,o){try{return At.ok(t.replace(n,r,o))}catch(i){if(i instanceof ac)return At.fail(i.message);throw i}}}function yp(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(yp(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return j.fromArray(r)}class Eo extends Jt{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new Z(yp(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,i)}invert(){return new nr(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Eo(n.pos,r.pos,this.mark)}merge(t){return t instanceof Eo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Eo(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Eo(n.from,n.to,t.markFromJSON(n.mark))}}Jt.jsonID("addMark",Eo);class nr extends Jt{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new Z(yp(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),t),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,r)}invert(){return new Eo(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new nr(n.pos,r.pos,this.mark)}merge(t){return t instanceof nr&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new nr(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new nr(n.from,n.to,t.markFromJSON(n.mark))}}Jt.jsonID("removeMark",nr);class xo extends Jt{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return At.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return At.fromReplace(t,this.pos,this.pos+1,new Z(j.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new xo(this.pos,n.marks[o]);return new xo(this.pos,this.mark)}}return new ai(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new xo(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xo(n.pos,t.markFromJSON(n.mark))}}Jt.jsonID("addNodeMark",xo);class ai extends Jt{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return At.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return At.fromReplace(t,this.pos,this.pos+1,new Z(j.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new xo(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ai(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ai(n.pos,t.markFromJSON(n.mark))}}Jt.jsonID("removeNodeMark",ai);class vt extends Jt{constructor(t,n,r,o=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=o}apply(t){return this.structure&&Xf(t,this.from,this.to)?At.fail("Structure replace would overwrite content"):At.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new An([this.from,this.to-this.from,this.slice.size])}invert(t){return new vt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new vt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof vt)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?Z.empty:new Z(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new vt(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?Z.empty:new Z(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new vt(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new vt(n.from,n.to,Z.fromJSON(t,n.slice),!!n.structure)}}Jt.jsonID("replace",vt);class yt extends Jt{constructor(t,n,r,o,i,s,a=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(t){if(this.structure&&(Xf(t,this.from,this.gapFrom)||Xf(t,this.gapTo,this.to)))return At.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return At.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?At.fromReplace(t,this.from,this.to,r):At.fail("Content does not fit in gap")}getMap(){return new An([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new yt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new yt(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new yt(n.from,n.to,n.gapFrom,n.gapTo,Z.fromJSON(t,n.slice),n.insert,!!n.structure)}}Jt.jsonID("replaceAround",yt);function Xf(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function CM(e,t,n,r){let o=[],i=[],s,a;e.doc.nodesBetween(t,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,t),h=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=h:o.push(s=new nr(f,h,d[g])));a&&a.to==f?a.to=h:i.push(a=new Eo(f,h,r))}}),o.forEach(l=>e.step(l)),i.forEach(l=>e.step(l))}function kM(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof Tu){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(a,t),to:c,step:i})}}}),o.forEach(s=>e.step(new nr(s.from,s.to,s.style)))}function Ep(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new vt(a,u,Z.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||e.step(new nr(a,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new Z(j.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new vt(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(j.empty,!0);e.replace(a,a,new Z(l,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function TM(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function yi(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,o=0,i=0;;--r){let s=e.$from.node(r),a=e.$from.index(r)+o,l=e.$to.indexAfter(r)-i;if(r<e.depth&&s.canReplace(a,l,n))return r;if(r==0||s.type.spec.isolating||!TM(s,a,l))break;a&&(o=1),l<s.childCount&&(i=1)}return null}function wM(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=j.empty,d=0;for(let p=i,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=j.from(r.node(p).copy(u)),d++):l--;let f=j.empty,h=0;for(let p=i,g=!1;p>n;p--)g||o.after(p+1)<o.end(p)?(g=!0,f=j.from(o.node(p).copy(f)),h++):c++;e.step(new yt(l,c,s,a,new Z(u.append(f),d,h),u.size-d,!0))}function Ix(e,t,n=null,r=e){let o=SM(e,t),i=o&&vM(r,t);return i?o.map(u0).concat({type:t,attrs:n}).concat(i.map(u0)):null}function u0(e){return{type:e,attrs:null}}function SM(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}function vM(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function AM(e,t,n){let r=j.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=j.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new yt(o,i,o,i,new Z(r,0,0),n.length,!0))}function NM(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&IM(e.doc,e.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&_x(e,s,a,i),Ep(e,e.mapping.slice(i).map(a,1),r,void 0,c===null);let u=e.mapping.slice(i),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return e.step(new yt(d,f,d+1,f-1,new Z(j.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Mx(e,s,a,i),!1}})}function Mx(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function _x(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=e.mapping.slice(r).map(n+1+i);e.replaceWith(s,s+1,t.type.schema.text(`
|
|
@@ -173,4 +173,4 @@ ${y}
|
|
|
173
173
|
`);throw Error("Blocks with the following IDs could not be found in the editor: "+u)}return a.forEach(u=>ql(e,u)),{insertedBlocks:o.map(u=>pt(u,r)),removedBlocks:s}}function tW(e,t,n,r,o){let i;if(!t)throw Error("blockContent is required");if(typeof t=="string")i=ir([t],e.pmSchema,r);else if(Array.isArray(t))i=ir(t,e.pmSchema,r);else if(t.type==="tableContent")i=Uu(t,e.pmSchema);else throw new Tr(t.type);let s=(o?.document??document).createDocumentFragment();for(let a of i)if(a.type.name!=="text"&&e.schema.inlineContentSchema[a.type.name]){let l=e.schema.inlineContentSpecs[a.type.name].implementation;if(l){let c=rm(a,e.schema.inlineContentSchema,e.schema.styleSchema),u=l.render.call({renderType:"dom",props:void 0},c,()=>{},e);if(u){if(s.appendChild(u.dom),u.contentDOM){let d=n.serializeFragment(a.content,o);u.contentDOM.dataset.editable="",u.contentDOM.appendChild(d)}continue}}}else if(a.type.name==="text"){let l=document.createTextNode(a.textContent);for(let c of a.marks.toReversed())if(c.type.name in e.schema.styleSpecs){let u=e.schema.styleSpecs[c.type.name].implementation.render(c.attrs.stringValue,e);u.contentDOM.appendChild(l),l=u.dom}else{let u=c.type.spec.toDOM(c,!0),d=On.renderSpec(document,u);d.contentDOM.appendChild(l),l=d.dom}s.appendChild(l)}else{let l=n.serializeFragment(j.from([a]),o);s.appendChild(l)}return s}function nW(e,t,n,r){let o=e.pmSchema.nodes.blockContainer,i=t.props||{};for(let[c,u]of Object.entries(e.schema.blockSchema[t.type].propSchema))!(c in i)&&u.default!==void 0&&(i[c]=u.default);let s=t.children||[],a=e.blockImplementations[t.type].implementation.render.call({renderType:"dom",props:void 0},{...t,props:i,children:s},e);if(a.contentDOM&&t.content){let c=tW(e,t.content,n,t.type,r);a.contentDOM.appendChild(c)}if(e.pmSchema.nodes[t.type].isInGroup("bnBlock")){if(t.children&&t.children.length>0){let c=Hw(e,t.children,n,r);a.contentDOM?.append(c)}return a.dom}let l=o.spec?.toDOM?.(o.create({id:t.id,...i}));return l.contentDOM?.appendChild(a.dom),t.children&&t.children.length>0&&l.contentDOM?.appendChild(Uw(e,t.children,n,r)),l.dom}function Hw(e,t,n,r){let o=(r?.document??document).createDocumentFragment();for(let i of t){let s=nW(e,i,n,r);o.appendChild(s)}return o}var Uw=(e,t,n,r)=>{let o=e.pmSchema.nodes.blockGroup,i=o.spec.toDOM(o.create({})),s=Hw(e,t,n,r);return i.contentDOM?.appendChild(s),i.dom},rW=e=>(e.querySelectorAll('[data-content-type="numberedListItem"]').forEach(t=>{let n=t.closest(".bn-block-outer")?.previousElementSibling?.querySelector('[data-content-type="numberedListItem"]');if(!n)t.setAttribute("data-index",t.getAttribute("data-start")||"1");else{let r=n.getAttribute("data-index");t.setAttribute("data-index",(parseInt(r||"0")+1).toString())}}),e),oW=e=>(e.querySelectorAll('[data-content-type="checkListItem"] input').forEach(t=>{t.disabled=!0}),e),iW=e=>(e.querySelectorAll('.bn-toggle-wrapper[data-show-children="false"]').forEach(t=>{t.setAttribute("data-show-children","true")}),e),sW=e=>(e.querySelectorAll('[data-content-type="table"] table').forEach(t=>{t.setAttribute("style","--default-cell-min-width: 120px;"),t.setAttribute("data-show-children","true")}),e),aW=e=>(e.querySelectorAll('[data-content-type="table"] table').forEach(t=>{let n=document.createElement("div");n.className="tableWrapper";let r=document.createElement("div");r.className="tableWrapper-inner",n.appendChild(r),t.parentElement?.appendChild(n),n.appendChild(t)}),e),lW=e=>(e.querySelectorAll(".bn-inline-content:empty").forEach(t=>{let n=document.createElement("span");n.className="ProseMirror-trailingBreak",n.setAttribute("style","display: inline-block;"),t.appendChild(n)}),e),cW=(e,t)=>{let n=On.fromSchema(e),r=[rW,oW,iW,sW,aW,lW];return{serializeBlocks:(o,i)=>{let s=Uw(t,o,n,i);for(let a of r)s=a(s);return s.outerHTML}}};function uW(e){return e.transact(t=>{let n=_o(t.doc,t.selection.anchor);if(t.selection instanceof Ge)return{type:"cell",anchorBlockId:n.node.attrs.id,anchorCellOffset:t.selection.$anchorCell.pos-n.posBeforeNode,headCellOffset:t.selection.$headCell.pos-n.posBeforeNode};if(t.selection instanceof le)return{type:"node",anchorBlockId:n.node.attrs.id};{let r=_o(t.doc,t.selection.head);return{type:"text",anchorBlockId:n.node.attrs.id,headBlockId:r.node.attrs.id,anchorOffset:t.selection.anchor-n.posBeforeNode,headOffset:t.selection.head-r.posBeforeNode}}})}function dW(e,t){let n=cn(t.anchorBlockId,e.doc)?.posBeforeNode;if(n===void 0)throw Error(`Could not find block with ID ${t.anchorBlockId} to update selection`);let r;if(t.type==="cell")r=Ge.create(e.doc,n+t.anchorCellOffset,n+t.headCellOffset);else if(t.type==="node")r=le.create(e.doc,n+1);else{let o=cn(t.headBlockId,e.doc)?.posBeforeNode;if(o===void 0)throw Error(`Could not find block with ID ${t.headBlockId} to update selection`);r=se.create(e.doc,n+t.anchorOffset,o+t.headOffset)}e.setSelection(r)}function tp(e){return e.map(t=>t.type==="columnList"?t.children.map(n=>tp(n.children)).flat():{...t,children:tp(t.children)}).flat()}function Vw(e,t,n){e.transact(r=>{let o=e.getSelection()?.blocks||[e.getTextCursorPosition().block],i=uW(e);e.removeBlocks(o),e.insertBlocks(tp(o),t,n),dW(r,i)})}function $w(e){return!e||e.type!=="columnList"}function jw(e,t,n){let r,o;if(t?t.children.length>0?(r=t.children[t.children.length-1],o="after"):(r=t,o="before"):n&&(r=n,o="before"),!r||!o)return;let i=e.getParentBlock(r);return $w(i)?{referenceBlock:r,placement:o}:jw(e,o==="after"?r:e.getPrevBlock(r),i)}function zw(e,t,n){let r,o;if(t?t.children.length>0?(r=t.children[0],o="before"):(r=t,o="after"):n&&(r=n,o="after"),!r||!o)return;let i=e.getParentBlock(r);return $w(i)?{referenceBlock:r,placement:o}:zw(e,o==="before"?r:e.getNextBlock(r),i)}function fW(e){e.transact(()=>{let t=e.getSelection()?.blocks[0]||e.getTextCursorPosition().block,n=jw(e,e.getPrevBlock(t),e.getParentBlock(t));n&&Vw(e,n.referenceBlock,n.placement)})}function hW(e){e.transact(()=>{let t=e.getSelection(),n=t?.blocks[t?.blocks.length-1]||e.getTextCursorPosition().block,r=zw(e,e.getNextBlock(n),e.getParentBlock(n));r&&Vw(e,r.referenceBlock,r.placement)})}function pW(e,t,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,h=>h.childCount>0&&(h.type.name==="blockGroup"||h.type.name==="column"));if(!i)return!1;let s=i.startIndex;if(s===0)return!1;let a=i.parent.child(s-1);if(a.type!==t)return!1;let l=a.lastChild&&a.lastChild.type===n,c=j.from(l?t.create():null),u=new Z(j.from(t.create(null,j.from(n.create(null,c)))),l?3:1,0),d=i.start,f=i.end;return e.step(new yt(d-(l?3:1),f,d,f,u,1,!0)).scrollIntoView(),!0}function Ww(e){return e.transact(t=>pW(t,e.pmSchema.nodes.blockContainer,e.pmSchema.nodes.blockGroup))}function mW(e,t,n,r){let o=r.end,i=r.$to.end(r.depth);if(o<i){let l=r.parent.child(r.endIndex-1),c=l.lastChild&&l.lastChild.type===n;e.step(new yt(o-(c?2:1),i,o,i,new Z(j.from(t.create(null,n.create())),c?2:1,0),c?0:1,!0)),r=new ca(e.doc.resolve(r.$from.pos),e.doc.resolve(i),r.depth)}let s=yi(r);if(s==null)return!1;e.lift(r,s);let a=e.doc.resolve(e.mapping.map(o,-1)-1);return Bo(e.doc,a.pos)&&a.nodeBefore.type===a.nodeAfter.type&&e.join(a.pos),e.scrollIntoView(),!0}function np(e,t,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&(s.type.name==="blockGroup"||s.type.name==="column"));return i&&r.node(i.depth-1).type===t?mW(e,t,n,i):!1}function qw(e){return e.transact(t=>np(t,e.pmSchema.nodes.blockContainer,e.pmSchema.nodes.blockGroup))}function gW(e){return e.transact(t=>{let{bnBlock:n}=La(t);return t.doc.resolve(n.beforePos).nodeBefore!==null})}function bW(e){return e.transact(t=>{let{bnBlock:n}=La(t);return t.doc.resolve(n.beforePos).depth>1})}function yW(e,t){let n=typeof t=="string"?t:t.id,r=kt(e),o=cn(n,e);if(o)return pt(o.node,r)}function EW(e,t){let n=cn(typeof t=="string"?t:t.id,e),r=kt(e);if(!n)return;let o=e.resolve(n.posBeforeNode).nodeBefore;if(o)return pt(o,r)}function xW(e,t){let n=cn(typeof t=="string"?t:t.id,e),r=kt(e);if(!n)return;let o=e.resolve(n.posBeforeNode+n.node.nodeSize).nodeAfter;if(o)return pt(o,r)}function CW(e,t){let n=typeof t=="string"?t:t.id,r=kt(e),o=cn(n,e);if(!o)return;let i=e.resolve(o.posBeforeNode),s=i.node(),a=i.node(-1),l=a.type.name==="doc"?void 0:s.type.name==="blockGroup"?a:s;if(l)return pt(l,r)}var kW=class{constructor(e){this.editor=e}get document(){return this.editor.transact(e=>xD(e.doc,this.editor.pmSchema))}getBlock(e){return this.editor.transact(t=>yW(t.doc,e))}getPrevBlock(e){return this.editor.transact(t=>EW(t.doc,e))}getNextBlock(e){return this.editor.transact(t=>xW(t.doc,e))}getParentBlock(e){return this.editor.transact(t=>CW(t.doc,e))}forEachBlock(e,t=!1){let n=this.document.slice();t&&n.reverse();function r(o){for(let i of o)if(e(i)===!1||!r(t?i.children.slice().reverse():i.children))return!1;return!0}r(n)}insertBlocks(e,t,n="before"){return this.editor.transact(r=>Jz(r,e,t,n))}updateBlock(e,t){return this.editor.transact(n=>FD(n,e,t))}removeBlocks(e){return this.editor.transact(t=>Cy(t,e,[]).removedBlocks)}replaceBlocks(e,t){return this.editor.transact(n=>Cy(n,e,t))}canNestBlock(){return gW(this.editor)}nestBlock(){Ww(this.editor)}canUnnestBlock(){return bW(this.editor)}unnestBlock(){qw(this.editor)}moveBlocksUp(){return fW(this.editor)}moveBlocksDown(){return hW(this.editor)}},TW=class extends Dm{constructor(e){super(),this.editor=e,e.on("create",()=>{e._tiptapEditor.on("update",({transaction:t,appendedTransactions:n})=>{this.emit("onChange",{editor:e,transaction:t,appendedTransactions:n})}),e._tiptapEditor.on("selectionUpdate",({transaction:t})=>{this.emit("onSelectionChange",{editor:e,transaction:t})}),e._tiptapEditor.on("mount",()=>{this.emit("onMount",{editor:e})}),e._tiptapEditor.on("unmount",()=>{this.emit("onUnmount",{editor:e})})})}onChange(e,t=!0){let n=({transaction:r,appendedTransactions:o})=>{!t&&ky(r)||e(this.editor,{getChanges(){return uw(r,o)}})};return this.on("onChange",n),()=>{this.off("onChange",n)}}onSelectionChange(e,t=!1){let n=r=>{!t&&ky(r.transaction)||e(this.editor)};return this.on("onSelectionChange",n),()=>{this.off("onSelectionChange",n)}}onMount(e){return this.on("onMount",e),()=>{this.off("onMount",e)}}onUnmount(e){return this.on("onUnmount",e),()=>{this.off("onUnmount",e)}}};function ky(e){return!!e.getMeta("y-sync$")}function wW(e){return Array.prototype.indexOf.call(e.parentElement.childNodes,e)}function SW(e){return e.nodeType===3&&!/\S/.test(e.nodeValue||"")}function vW(e){e.querySelectorAll("li > ul, li > ol").forEach(t=>{let n=wW(t),r=t.parentElement,o=Array.from(r.childNodes).slice(n+1);t.remove(),o.forEach(i=>{i.remove()}),r.insertAdjacentElement("afterend",t),o.reverse().forEach(i=>{if(SW(i))return;let s=document.createElement("li");s.append(i),t.insertAdjacentElement("afterend",s)}),r.childNodes.length===0&&r.remove()})}function AW(e){e.querySelectorAll("li + ul, li + ol").forEach(t=>{let n=t.previousElementSibling,r=document.createElement("div");n.insertAdjacentElement("afterend",r),r.append(n);let o=document.createElement("div");for(o.setAttribute("data-node-type","blockGroup"),r.append(o);r.nextElementSibling?.nodeName==="UL"||r.nextElementSibling?.nodeName==="OL";)o.append(r.nextElementSibling)})}var NW=null;function IW(){return NW||=document.implementation.createHTMLDocument("title")}function MW(e){if(typeof e=="string"){let t=IW().createElement("div");t.innerHTML=e,e=t}return vW(e),AW(e),e}function _W(e){let t=e.ownerDocument.createTreeWalker(e,128),n;for(;n=t.nextNode();)if(/^\s*notionvc:/.test(n.nodeValue||""))return!0;return!1}function OW(e){let t=new Set(["PRE","CODE"]),n=e.ownerDocument.createTreeWalker(e,4,{acceptNode(i){let s=i.parentElement;for(;s&&s!==e;){if(t.has(s.tagName))return 2;s=s.parentElement}return 1}}),r=[],o;for(;o=n.nextNode();)r.push(o);for(let i of r)i.nodeValue&&/[\r\n]/.test(i.nodeValue)&&(i.nodeValue=i.nodeValue.replace(/[ \t\r\n\f]+/g," "))}function RW(e){_W(e)||OW(e)}function Gw(e,t){let n=MW(e);RW(n);let r=sn.fromSchema(t).parse(n,{topNode:t.nodes.blockGroup.create()}),o=[];for(let i=0;i<r.childCount;i++)o.push(pt(r.child(i),t));return o}function LW(e,t){let n=t.value?t.value:"",r={};t.lang&&(r["data-language"]=t.lang);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function DW(e,t){let n=String(t?.url||""),r=t?.title?String(t.title):void 0,o={type:"element",tagName:"video",properties:{src:n,"data-name":r,"data-url":n,controls:!0},children:[]};return e.patch?.(t,o),o=e.applyData?e.applyData(t,o):o,o}function Yw(e){return ow().use(M$).use(rw).use(dj,{handlers:{...jh,image:(t,n)=>pD(String(n?.url||""))?DW(t,n):jh.image(t,n),code:LW,blockquote:(t,n)=>{let r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(n),!1)};return t.patch(n,r),t.applyData(n,r)}}}).use(mz).processSync(e).value}function PW(e,t){return Gw(Yw(e),t)}var BW=class{constructor(t){this.editor=t}blocksToHTMLLossy(t=this.editor.document){return rd(this.editor.pmSchema,this.editor).exportBlocks(t,{})}blocksToFullHTML(t=this.editor.document){return cW(this.editor.pmSchema,this.editor).serializeBlocks(t,{})}tryParseHTMLToBlocks(t){return Gw(t,this.editor.pmSchema)}blocksToMarkdownLossy(t=this.editor.document){return UV(t,this.editor.pmSchema,this.editor,{})}tryParseMarkdownToBlocks(t){return PW(t,this.editor.pmSchema)}pasteHTML(t,n=!1){let r=t;if(!n){let o=this.tryParseHTMLToBlocks(t);r=this.blocksToFullHTML(o)}r&&this.editor.prosemirrorView?.pasteHTML(r)}pasteText(t){return this.editor.prosemirrorView?.pasteText(t)}pasteMarkdown(t){let n=Yw(t);return this.pasteHTML(n)}},Gm=["vscode-editor-data","blocknote/html","text/markdown","text/html","text/plain","Files"];function FW(e,t){if(!e.startsWith(".")||!t.startsWith("."))throw Error("The strings provided are not valid file extensions.");return e===t}function HW(e,t){let n=e.split("/"),r=t.split("/");if(n.length!==2)throw Error(`The string ${e} is not a valid MIME type.`);if(r.length!==2)throw Error(`The string ${t} is not a valid MIME type.`);return n[1]==="*"||r[1]==="*"?n[0]===r[0]:(n[0]==="*"||r[0]==="*"||n[0]===r[0])&&n[1]===r[1]}function Ty(e,t,n,r="after"){let o;return o=Array.isArray(t.content)&&t.content.length===0?e.updateBlock(t,n).id:e.insertBlocks([n],t,r)[0].id,o}async function Kw(e,t){if(!t.uploadFile){console.warn("Attempted ot insert file, but uploadFile is not set in the BlockNote editor options");return}let n="dataTransfer"in e?e.dataTransfer:e.clipboardData;if(n===null)return;let r=null;for(let i of Gm)if(n.types.includes(i)){r=i;break}if(r!=="Files")return;let o=n.items;if(o){e.preventDefault();for(let i=0;i<o.length;i++){let s="file";for(let l of Object.values(t.schema.blockSpecs))for(let c of l.implementation.meta?.fileBlockAccept||[]){let u=c.startsWith("."),d=o[i].getAsFile();if(d&&(!u&&d.type&&HW(o[i].type,c)||u&&FW("."+d.name.split(".").pop(),c))){s=l.config.type;break}}let a=o[i].getAsFile();if(a){let l={type:s,props:{name:a.name}},c;if(e.type==="paste"){let f=t.getTextCursorPosition().block;c=Ty(t,f,l)}else if(e.type==="drop"){let f={left:e.clientX,top:e.clientY},h=t.prosemirrorView.posAtCoords(f);if(!h)return;c=t.transact(p=>{let g=_o(p.doc,h.pos),y=t.domElement?.querySelector(`[data-id="${g.node.attrs.id}"]`)?.getBoundingClientRect();return Ty(t,t.getBlock(g.node.attrs.id),l,y&&(y.top+y.bottom)/2>f.top?"before":"after")})}else return;let u=await t.uploadFile(a,c),d=typeof u=="string"?{props:{url:u}}:{...u};t.updateBlock(c,d)}}}}var UW=e=>mt.create({name:"dropFile",addProseMirrorPlugins(){return[new Ae({props:{handleDOMEvents:{drop(t,n){if(!e.isEditable)return;let r=null;for(let o of Gm)if(n.dataTransfer.types.includes(o)){r=o;break}return r===null?!0:r==="Files"?(Kw(n,e),!0):!1}}}})]}}),VW=/(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/,$W=/(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/,jW=/\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/,zW=/(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/,WW=/(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/,qW=/(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/,GW=/\n{2} {0,3}-{2,48}\n{2}/,YW=/(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/,KW=/(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/,QW=/(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/,XW=/^\s*\|(.+\|)+\s*$/m,ZW=/^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m,JW=/^\s*\|(.+\|)+\s*$/m,eq=e=>VW.test(e)||$W.test(e)||jW.test(e)||zW.test(e)||WW.test(e)||qW.test(e)||GW.test(e)||YW.test(e)||KW.test(e)||QW.test(e)||XW.test(e)||ZW.test(e)||JW.test(e);async function tq(e,t){let{schema:n}=t.state;if(!e.clipboardData)return!1;let r=e.clipboardData.getData("text/plain");if(!r)return!1;if(!n.nodes.codeBlock)return t.pasteText(r),!0;let o=e.clipboardData.getData("vscode-editor-data"),i=(o?JSON.parse(o):void 0)?.mode;return i?(t.pasteHTML(`<pre><code class="language-${i}">${r.replace(/\r\n?/g,`
|
|
174
174
|
`)}</code></pre>`),!0):!1}function nq({event:e,editor:t,prioritizeMarkdownOverHTML:n,plainTextAsMarkdown:r}){if(t.transact(s=>s.selection.$from.parent.type.spec.code&&s.selection.$to.parent.type.spec.code)){let s=e.clipboardData?.getData("text/plain");if(s)return t.pasteText(s),!0}let o;for(let s of Gm)if(e.clipboardData.types.includes(s)){o=s;break}if(!o)return!0;if(o==="vscode-editor-data")return tq(e,t.prosemirrorView),!0;if(o==="Files")return Kw(e,t),!0;let i=e.clipboardData.getData(o);if(o==="blocknote/html")return t.pasteHTML(i,!0),!0;if(o==="text/markdown")return t.pasteMarkdown(i),!0;if(n){let s=e.clipboardData.getData("text/plain");if(eq(s))return t.pasteMarkdown(s),!0}return o==="text/html"?(t.pasteHTML(i),!0):r?(t.pasteMarkdown(i),!0):(t.pasteText(i),!0)}var rq=(e,t)=>mt.create({name:"pasteFromClipboard",addProseMirrorPlugins(){return[new Ae({props:{handleDOMEvents:{paste(n,r){if(r.preventDefault(),e.isEditable)return t({event:r,editor:e,defaultPasteHandler:({prioritizeMarkdownOverHTML:o=!0,plainTextAsMarkdown:i=!0}={})=>nq({event:r,editor:e,prioritizeMarkdownOverHTML:o,plainTextAsMarkdown:i})})}}}})]}});function oq(e,t,n){let r=!1,o=e.state.selection instanceof Ge;if(!o){let a=e.state.doc.slice(e.state.selection.from,e.state.selection.to,!1).content,l=[];for(let c=0;c<a.childCount;c++)l.push(a.child(c));r=l.find(c=>c.type.isInGroup("bnBlock")||c.type.name==="blockGroup"||c.type.spec.group==="blockContent")===void 0,r&&(t=a)}let i,s=rd(e.state.schema,n);if(o){t.firstChild?.type.name==="table"&&(t=t.firstChild.content);let a=Rk(t,n.schema.inlineContentSchema,n.schema.styleSchema);i=`<table>${s.exportInlineContent(a,{})}</table>`}else if(r){let a=Hu(t,n.schema.inlineContentSchema,n.schema.styleSchema);i=s.exportInlineContent(a,{})}else{let a=gw(t);i=s.exportBlocks(a,{})}return i}function Qw(e,t){"node"in e.state.selection&&e.state.selection.node.type.spec.group==="blockContent"&&t.transact(i=>i.setSelection(new le(i.doc.resolve(e.state.selection.from-1))));let n=e.serializeForClipboard(e.state.selection.content()).dom.innerHTML,r=e.state.selection.content().content,o=oq(e,r,t);return{clipboardHTML:n,externalHTML:o,markdown:Lm(o)}}var wy=()=>{let e=window.getSelection();if(!e||e.isCollapsed)return!0;let t=e.focusNode;for(;t;){if(t instanceof HTMLElement&&t.getAttribute("contenteditable")==="false")return!0;t=t.parentElement}return!1},Sy=(e,t,n)=>{n.preventDefault(),n.clipboardData.clearData();let{clipboardHTML:r,externalHTML:o,markdown:i}=Qw(t,e);n.clipboardData.setData("blocknote/html",r),n.clipboardData.setData("text/html",o),n.clipboardData.setData("text/plain",i)},iq=e=>mt.create({name:"copyToClipboard",addProseMirrorPlugins(){return[new Ae({props:{handleDOMEvents:{copy(t,n){return wy()||Sy(e,t,n),!0},cut(t,n){return wy()||(Sy(e,t,n),t.editable&&t.dispatch(t.state.tr.deleteSelection())),!0},dragstart(t,n){if(!("node"in t.state.selection)||t.state.selection.node.type.spec.group!=="blockContent")return;e.transact(s=>s.setSelection(new le(s.doc.resolve(t.state.selection.from-1)))),n.preventDefault(),n.dataTransfer.clearData();let{clipboardHTML:r,externalHTML:o,markdown:i}=Qw(t,e);return n.dataTransfer.setData("blocknote/html",r),n.dataTransfer.setData("text/html",o),n.dataTransfer.setData("text/plain",i),!0}}}})]}}),sq=mt.create({name:"blockBackgroundColor",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{backgroundColor:VD()}}]}}),aq=sr.create({name:"hardBreak",inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,priority:10,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Rn(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
175
175
|
`}}),Xw=(e,t)=>{let n=e.resolve(t),r=n.depth-1;if(r<1)return;let o=n.before(r),i=e.resolve(o).nodeAfter;if(i)return i.type.spec.group?.includes("bnBlock")?Oo(e.resolve(o)):Xw(e,o)},Ps=(e,t)=>{let n=e.resolve(t),r=n.index();if(r===0)return;let o=n.posAtIndex(r-1);return Oo(e.resolve(o))},Ss=(e,t)=>{let n=e.resolve(t),r=n.index();if(r===n.node().childCount-1)return;let o=n.posAtIndex(r+1);return Oo(e.resolve(o))},rp=(e,t)=>{for(;t.childContainer;){let n=t.childContainer.node,r=e.resolve(t.childContainer.beforePos+1).posAtIndex(n.childCount-1);t=Oo(e.resolve(r))}return t},lq=(e,t)=>e.isBlockContainer&&e.blockContent.node.type.spec.content==="inline*"&&e.blockContent.node.childCount>0&&t.isBlockContainer&&t.blockContent.node.type.spec.content==="inline*",cq=(e,t,n,r)=>{if(!r.isBlockContainer)throw Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but next block is not a block container`);if(r.childContainer){let o=e.doc.resolve(r.childContainer.beforePos+1),i=e.doc.resolve(r.childContainer.afterPos-1),s=o.blockRange(i);if(t){let a=e.doc.resolve(r.bnBlock.beforePos);e.tr.lift(s,a.depth)}}if(t){if(!n.isBlockContainer)throw Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but previous block is not a block container`);t(e.tr.delete(n.blockContent.afterPos-1,r.blockContent.beforePos+1))}return!0},vy=e=>({state:t,dispatch:n})=>{let r=Oo(t.doc.resolve(e)),o=Ps(t.doc,r.bnBlock.beforePos);if(!o)return!1;let i=rp(t.doc,o);return lq(i,r)?cq(t,n,i,r):!1},uq=mt.create({priority:50,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({chain:r,commands:o})=>[()=>o.deleteSelection(),()=>o.undoInputRule(),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let a=i.selection.from===s.blockContent.beforePos+1,l=s.blockContent.node.type.name==="paragraph";return a&&!l?o.command(PD(s.bnBlock.beforePos,{type:"paragraph",props:{}})):!1}),()=>o.command(({state:i,tr:s})=>{let a=Ct(i);if(!a.isBlockContainer)return!1;let{blockContent:l}=a;return i.selection.from===l.beforePos+1?np(s,s.doc.type.schema.nodes.blockContainer,s.doc.type.schema.nodes.blockGroup):!1}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let{bnBlock:a,blockContent:l}=s,c=Ps(i.doc,s.bnBlock.beforePos);if(!c||!c.isBlockContainer||c.blockContent.node.type.spec.content!=="inline*")return!1;let u=i.selection.from===l.beforePos+1,d=i.selection.empty,f=a.beforePos;return u&&d?r().command(vy(f)).scrollIntoView().run():!1}),()=>o.command(({state:i,tr:s,dispatch:a})=>{let l=Ct(i);if(!l.isBlockContainer||i.selection.from!==l.blockContent.beforePos+1)return!1;let c=Ps(i.doc,l.bnBlock.beforePos);if(!c||c.isBlockContainer)return!1;if(a){let u=c.bnBlock.afterPos-1,d=s.doc.resolve(u-1);return s.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),s.insert(d.pos,l.bnBlock.node),s.setSelection(se.near(s.doc.resolve(d.pos+1))),!0}return!1}),()=>o.command(({state:i,tr:s,dispatch:a})=>{let l=Ct(i);if(!l.isBlockContainer||s.selection.from!==l.blockContent.beforePos+1)return!1;let c=s.doc.resolve(l.bnBlock.beforePos);if(c.nodeBefore||c.node().type.name!=="column")return!1;let u=s.doc.resolve(l.bnBlock.beforePos),d=s.doc.resolve(u.before()),f=d.before();return a&&(s.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),ql(s,f),d.pos===f+1?(s.insert(f,l.bnBlock.node),s.setSelection(se.near(s.doc.resolve(f)))):(s.insert(d.pos-1,l.bnBlock.node),s.setSelection(se.near(s.doc.resolve(d.pos))))),!0}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;if(s.blockContent.node.childCount===0&&s.blockContent.node.type.spec.content==="inline*"){let a=Ps(i.doc,s.bnBlock.beforePos);if(!a)return!1;let l=rp(i.doc,a);if(!l.isBlockContainer||!l||!l.isBlockContainer)return!1;let c=r();if(s.childContainer&&c.insertContentAt(s.bnBlock.afterPos,s.childContainer?.node.content),l.blockContent.node.type.spec.content==="tableRow+"){let u=s.bnBlock.beforePos-1-1-1-1-1;c=c.setTextSelection(u)}else if(l.blockContent.node.type.spec.content==="")c=c.setNodeSelection(l.blockContent.beforePos);else{let u=l.blockContent.afterPos-1;c=c.setTextSelection(u)}return c.deleteRange({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let a=i.selection.from===s.blockContent.beforePos+1,l=i.selection.empty,c=Ps(i.doc,s.bnBlock.beforePos);if(c&&a&&l){let u=rp(i.doc,c);if(!u.isBlockContainer)return!1;if(u.blockContent.node.type.spec.content===""||u.blockContent.node.type.spec.content==="inline*"&&u.blockContent.node.childCount===0)return r().cut({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos},u.bnBlock.afterPos).deleteRange({from:u.bnBlock.beforePos,to:u.bnBlock.afterPos}).run()}return!1})]),t=()=>this.editor.commands.first(({chain:r,commands:o})=>[()=>o.deleteSelection(),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer||!s.childContainer)return!1;let{blockContent:a,childContainer:l}=s,c=i.selection.from===a.afterPos-1,u=i.selection.empty,d=Oo(i.doc.resolve(l.beforePos+1));if(!d.isBlockContainer)return!1;if(c&&u){let f=d.blockContent.node,h=f.type.spec.content==="inline*",p=a.node.type.spec.content==="inline*";return r().insertContentAt(d.bnBlock.afterPos,d.childContainer?.node.content||j.empty).deleteRange(l.node.childCount===1?{from:l.beforePos,to:l.afterPos}:{from:d.bnBlock.beforePos,to:d.bnBlock.afterPos}).insertContentAt(i.selection.from,h&&p?f.content:null).setTextSelection(i.selection.from).scrollIntoView().run()}return!1}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let{bnBlock:a,blockContent:l}=s,c=Ss(i.doc,s.bnBlock.beforePos);if(!c||!c.isBlockContainer)return!1;let u=i.selection.from===l.afterPos-1,d=i.selection.empty,f=a.afterPos;return u&&d?r().command(vy(f)).scrollIntoView().run():!1}),()=>o.command(({state:i,tr:s,dispatch:a})=>{let l=Ct(i);if(!l.isBlockContainer||i.selection.from!==l.blockContent.afterPos-1)return!1;let c=Ss(i.doc,l.bnBlock.beforePos);if(!c||c.isBlockContainer)return!1;if(a){let u=c.bnBlock.beforePos+1,d=s.doc.resolve(u+1);return s.delete(d.pos,d.pos+d.nodeAfter.nodeSize),ql(s,c.bnBlock.beforePos),s.insert(l.bnBlock.afterPos,d.nodeAfter),s.setSelection(se.near(s.doc.resolve(d.pos))),!0}return!1}),()=>o.command(({state:i,tr:s,dispatch:a})=>{let l=Ct(i);if(!l.isBlockContainer||s.selection.from!==l.blockContent.afterPos-1)return!1;let c=s.doc.resolve(l.bnBlock.afterPos);if(c.nodeAfter||c.node().type.name!=="column")return!1;let u=s.doc.resolve(l.bnBlock.afterPos),d=s.doc.resolve(u.after()),f=d.after();if(a){let h=d.pos===f-1?f:d.pos+1,p=Oo(s.doc.resolve(h));s.delete(p.bnBlock.beforePos,p.bnBlock.afterPos),ql(s,f-d.node().nodeSize),s.insert(u.pos,p.bnBlock.node),s.setSelection(se.near(s.doc.resolve(h)))}return!0}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let{blockContent:a}=s,l=i.selection.from===a.afterPos-1,c=i.selection.empty;if(l&&c){let u=(g,y)=>{let b=Ss(g,y);if(b)return b;let x=Xw(g,y);if(x)return u(g,x.bnBlock.beforePos)},d=u(i.doc,s.bnBlock.beforePos);if(!d||!d.isBlockContainer)return!1;let f=d.blockContent.node,h=f.type.spec.content==="inline*",p=a.node.type.spec.content==="inline*";return r().insertContentAt(d.bnBlock.afterPos,d.childContainer?.node.content||j.empty).deleteRange({from:d.bnBlock.beforePos,to:d.bnBlock.afterPos}).insertContentAt(i.selection.from,h&&p?f.content:null).setTextSelection(i.selection.from).scrollIntoView().run()}return!1}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;if(s.blockContent.node.childCount===0&&s.blockContent.node.type.spec.content==="inline*"){let a=Ss(i.doc,s.bnBlock.beforePos);if(!a||!a.isBlockContainer)return!1;let l=r();if(a.blockContent.node.type.spec.content==="tableRow+"){let c=s.bnBlock.afterPos+1+1+1+1+1;l=l.setTextSelection(c)}else l=a.blockContent.node.type.spec.content===""?l.setNodeSelection(a.blockContent.beforePos):l.setTextSelection(a.blockContent.beforePos+1);return l.deleteRange({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let a=i.selection.from===s.blockContent.afterPos-1,l=i.selection.empty,c=Ss(i.doc,s.bnBlock.beforePos);if(!c||!c.isBlockContainer)return!1;if(c&&a&&l&&(c.blockContent.node.type.spec.content===""||c.blockContent.node.type.spec.content==="inline*"&&c.blockContent.node.childCount===0)){let u=c.bnBlock.node.lastChild.content;return r().deleteRange({from:c.bnBlock.beforePos,to:c.bnBlock.afterPos}).insertContentAt(s.bnBlock.afterPos,c.bnBlock.node.childCount===2?u:null).run()}return!1})]),n=(r=!1)=>this.editor.commands.first(({commands:o,tr:i})=>[()=>o.command(({state:s,tr:a})=>{let l=Ct(s);if(!l.isBlockContainer)return!1;let{bnBlock:c,blockContent:u}=l,{depth:d}=s.doc.resolve(c.beforePos),f=s.selection.$anchor.parentOffset===0,h=s.selection.anchor===s.selection.head,p=u.node.childCount===0;return f&&h&&p&&d>1?np(a,a.doc.type.schema.nodes.blockContainer,a.doc.type.schema.nodes.blockGroup):!1}),()=>o.command(({state:s})=>{let a=Ct(s),l=this.options.editor.schema.blockSchema[a.blockNoteType].meta?.hardBreakShortcut??"shift+enter";if(l==="none")return!1;if(l==="shift+enter"&&r||l==="enter"){let c=i.storedMarks||i.selection.$head.marks().filter(u=>this.editor.extensionManager.splittableMarks.includes(u.type.name));return i.insert(i.selection.head,i.doc.type.schema.nodes.hardBreak.create()).ensureMarks(c),!0}return!1}),()=>o.command(({state:s,dispatch:a,tr:l})=>{let c=Ct(s);if(!c.isBlockContainer)return!1;let{bnBlock:u,blockContent:d}=c,f=s.selection.$anchor.parentOffset===0,h=s.selection.anchor===s.selection.head,p=d.node.childCount===0;if(f&&h&&p){let g=u.afterPos,y=g+2;if(a){let b=s.schema.nodes.blockContainer.createAndFill(void 0,[s.schema.nodes.paragraph.createAndFill()||void 0,c.childContainer?.node].filter(x=>x!==void 0));l.insert(g,b).setSelection(new se(l.doc.resolve(y))).scrollIntoView(),c.childContainer&&l.delete(c.childContainer.beforePos,c.childContainer.afterPos)}return!0}return!1}),()=>o.command(({state:s,chain:a})=>{let l=Ct(s);if(!l.isBlockContainer)return!1;let{blockContent:c}=l,u=s.selection.$anchor.parentOffset===0;return c.node.childCount===0?!1:(a().deleteSelection().command(p6(s.selection.from,u,u)).run(),!0)})]);return{Backspace:e,Delete:t,Enter:()=>n(),"Shift-Enter":()=>n(!0),Tab:()=>this.options.tabBehavior!=="prefer-indent"&&(this.options.editor.getExtension(Lo)?.store.state||this.options.editor.getExtension(rr)?.store.state!==void 0)?!1:Ww(this.options.editor),"Shift-Tab":()=>this.options.tabBehavior!=="prefer-indent"&&(this.options.editor.getExtension(Lo)?.store.state||this.options.editor.getExtension(rr)?.store.state!==void 0)?!1:qw(this.options.editor),"Shift-Mod-ArrowUp":()=>(this.options.editor.moveBlocksUp(),!0),"Shift-Mod-ArrowDown":()=>(this.options.editor.moveBlocksDown(),!0),"Mod-z":()=>this.options.editor.undo(),"Mod-y":()=>this.options.editor.redo(),"Shift-Mod-z":()=>this.options.editor.redo()}}}),dq=Gn.create({name:"insertion",inclusive:!1,excludes:"deletion modification insertion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(e){return e.name==="insertion"?{blocknoteIgnore:!0,inclusive:!1,toDOM(t,n){return["ins",{"data-id":String(t.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"ins",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10)}:!1}}]}:{}}}),fq=Gn.create({name:"deletion",inclusive:!1,excludes:"insertion modification deletion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(e){return e.name==="deletion"?{blocknoteIgnore:!0,inclusive:!1,toDOM(t,n){return["del",{"data-id":String(t.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"del",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10)}:!1}}]}:{}}}),hq=Gn.create({name:"modification",inclusive:!1,excludes:"deletion insertion",addAttributes(){return{id:{default:null,validate:"number"},type:{validate:"string"},attrName:{default:null,validate:"string|null"},previousValue:{default:null},newValue:{default:null}}},extendMarkSchema(e){return e.name==="modification"?{blocknoteIgnore:!0,inclusive:!1,toDOM(t,n){return[n?"span":"div",{"data-type":"modification","data-id":String(t.attrs.id),"data-mod-type":t.attrs.type,"data-mod-prev-val":JSON.stringify(t.attrs.previousValue),"data-mod-new-val":JSON.stringify(t.attrs.newValue)},0]},parseDOM:[{tag:"span[data-type='modification']",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10),type:t.dataset.modType,previousValue:t.dataset.modPrevVal,newValue:t.dataset.modNewVal}:!1}},{tag:"div[data-type='modification']",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10),type:t.dataset.modType,previousValue:t.dataset.modPrevVal}:!1}}]}:{}}}),pq=mt.create({name:"textAlignment",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{textAlignment:{default:"left",parseHTML:e=>e.getAttribute("data-text-alignment"),renderHTML:e=>e.textAlignment==="left"?{}:{"data-text-alignment":e.textAlignment}}}}]}}),mq=mt.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["table","tableCell","tableHeader"],attributes:{textColor:$D()}}]}}),gq={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},bq=sr.create({name:"blockContainer",group:"blockGroupChild bnBlock",content:"blockContent blockGroup?",priority:50,defining:!0,marks:"insertion modification deletion",parseHTML(){return[{tag:"div[data-node-type="+this.name+"]",getAttrs:e=>{if(typeof e=="string")return!1;let t={};for(let[n,r]of Object.entries(gq))e.getAttribute(r)&&(t[n]=e.getAttribute(r));return t}},{tag:'div[data-node-type="blockOuter"]',skip:!0}]},renderHTML({HTMLAttributes:e}){let t=document.createElement("div");t.className="bn-block-outer",t.setAttribute("data-node-type","blockOuter");for(let[o,i]of Object.entries(e))o!=="class"&&t.setAttribute(o,i);let n={...this.options.domAttributes?.block||{},...e},r=document.createElement("div");r.className=ut("bn-block",n.class),r.setAttribute("data-node-type",this.name);for(let[o,i]of Object.entries(n))o!=="class"&&r.setAttribute(o,i);return t.appendChild(r),{dom:t,contentDOM:r}}}),yq=sr.create({name:"blockGroup",group:"childContainer",content:"blockGroupChild+",marks:"deletion insertion modification",parseHTML(){return[{tag:"div",getAttrs:e=>typeof e=="string"?!1:e.getAttribute("data-node-type")==="blockGroup"?null:!1}]},renderHTML({HTMLAttributes:e}){let t={...this.options.domAttributes?.blockGroup||{},...e},n=document.createElement("div");n.className=ut("bn-block-group",t.class),n.setAttribute("data-node-type","blockGroup");for(let[r,o]of Object.entries(t))r!=="class"&&n.setAttribute(r,o);return{dom:n,contentDOM:n}}}),Eq=sr.create({name:"doc",topNode:!0,content:"blockGroup",marks:"insertion modification deletion"}),xq=Ve(({options:e})=>({key:"collaboration",blockNoteExtensions:[kV(e),Uh(e),$l(e),jl(),wV(e)]})),Ay=!1;function Cq(e,t){let n=[Li.ClipboardTextSerializer,Li.Commands,Li.Editable,Li.FocusEvents,Li.Tabindex,vz,Fu.configure({types:["blockContainer","columnList","column"],setIdAttribute:t.setIdAttribute,isWithinEditor:e.isWithinEditor}),aq,Zz,dq,fq,hq,Xz.extend({inclusive:!1}).extend({addAttributes(){let r=this.parent?.()||{};return delete r.title,r}}).configure({defaultProtocol:pw,protocols:Ay?[]:hw}),...Object.values(e.schema.styleSpecs).map(r=>r.implementation.mark.configure({editor:e})),mq,sq,pq,mt.create({name:"OverrideEscape",addKeyboardShortcuts:()=>({Escape:()=>e.getExtension(zn)?.shown()?!1:(e.blur(),!0)})}),Eq,bq.configure({editor:e,domAttributes:t.domAttributes}),uq.configure({editor:e,tabBehavior:t.tabBehavior}),yq.configure({domAttributes:t.domAttributes}),...Object.values(e.schema.inlineContentSpecs).filter(r=>r.config!=="link"&&r.config!=="text").map(r=>r.implementation.node.configure({editor:e})),...Object.values(e.schema.blockSpecs).flatMap(r=>[..."node"in r.implementation?[r.implementation.node.configure({editor:e,domAttributes:t.domAttributes})]:[]]),iq(e),rq(e,t.pasteHandler||(r=>r.defaultPasteHandler())),UW(e)];return Ay=!0,n}function kq(e,t){let n=[dw(),IV(t),rr(t),Lo(t),ja(t),OV(),LV(t),va(t),qn(t),zn(t),...t.trailingBlock===!1?[]:[ZV()]];return t.collaboration?n.push(xq(t.collaboration)):n.push(MV()),"table"in e.schema.blockSpecs&&n.push(Je(t)),t.animations!==!1&&n.push(PV()),n}var Tq=class{disabledExtensions=new Set;extensions=[];abortMap=new Map;extensionFactories=new Map;extensionPlugins=new Map;constructor(t,n){this.editor=t,this.options=n,t.onMount(()=>{for(let r of this.extensions)if(r.mount){let o=new window.AbortController,i=r.mount({dom:t.prosemirrorView.dom,root:t.prosemirrorView.root,signal:o.signal});i&&o.signal.addEventListener("abort",()=>{i()}),this.abortMap.set(r,o)}}),t.onUnmount(()=>{for(let[r,o]of this.abortMap.entries())this.abortMap.delete(r),o.abort()}),this.disabledExtensions=new Set(n.disableExtensions||[]);for(let r of kq(this.editor,this.options))this.addExtension(r);for(let r of this.options.extensions??[])this.addExtension(r);for(let r of Object.values(this.editor.schema.blockSpecs))for(let o of r.extensions??[])this.addExtension(o)}registerExtension(t){let n=[].concat(t).filter(Boolean);if(!n.length){console.warn("No extensions found to register",t);return}let r=n.map(i=>this.addExtension(i)).filter(Boolean),o=new Set;for(let i of r)i?.tiptapExtensions&&console.warn(`Extension ${i.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,i),i?.inputRules?.length&&console.warn(`Extension ${i.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,i),this.getProsemirrorPluginsFromExtension(i).plugins.forEach(s=>{o.add(s)});this.updatePlugins(i=>[...i,...o])}addExtension(t){let n;if(n=typeof t=="function"?t({editor:this.editor}):t,!(!n||this.disabledExtensions.has(n.key))){if(typeof t=="function"){let r=n[Wf];typeof r=="function"&&this.extensionFactories.set(r,n)}if(this.extensions.push(n),n.blockNoteExtensions)for(let r of n.blockNoteExtensions)this.addExtension(r);return n}}resolveExtensions(t){let n=[];if(typeof t=="function"){let r=this.extensionFactories.get(t);r&&n.push(r)}else if(Array.isArray(t))for(let r of t)n.push(...this.resolveExtensions(r));else if(typeof t=="object"&&"key"in t)n.push(t);else if(typeof t=="string"){let r=this.extensions.find(o=>o.key===t);r&&n.push(r)}return n}unregisterExtension(t){let n=this.resolveExtensions(t);if(!n.length){console.warn("No extensions found to unregister",t);return}let r=!1,o=new Set;for(let i of n)this.extensions=this.extensions.filter(s=>s!==i),this.extensionFactories.forEach((s,a)=>{s===i&&this.extensionFactories.delete(a)}),this.abortMap.get(i)?.abort(),this.abortMap.delete(i),this.extensionPlugins.get(i)?.forEach(s=>{o.add(s)}),this.extensionPlugins.delete(i),i.tiptapExtensions&&!r&&(r=!0,console.warn(`Extension ${i.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,t));this.updatePlugins(i=>i.filter(s=>!o.has(s)))}updatePlugins(t){let n=this.editor.prosemirrorState,r=n.reconfigure({plugins:t(n.plugins.slice())});this.editor.prosemirrorView.updateState(r)}getTiptapExtensions(){let t=Cq(this.editor,this.options).filter(o=>!this.disabledExtensions.has(o.name)),n=Fk(this.extensions),r=new Map;for(let o of this.extensions){o.tiptapExtensions&&t.push(...o.tiptapExtensions);let i=n(o.key),{plugins:s,inputRules:a}=this.getProsemirrorPluginsFromExtension(o);s.length&&t.push(mt.create({name:o.key,priority:i,addProseMirrorPlugins:()=>s})),a.length&&(r.has(i)||r.set(i,[]),r.get(i).push(...a))}t.push(mt.create({name:"blocknote-input-rules",addProseMirrorPlugins(){let o=[];return Array.from(r.keys()).sort().reverse().forEach(i=>{o.push(...r.get(i))}),[yz({rules:o})]}}));for(let o of this.options._tiptapOptions?.extensions??[])t.push(o);return t}getProsemirrorPluginsFromExtension(t){let n=[...t.prosemirrorPlugins??[]],r=[];return!t.prosemirrorPlugins?.length&&!Object.keys(t.keyboardShortcuts||{}).length&&!t.inputRules?.length?{plugins:n,inputRules:r}:(this.extensionPlugins.set(t,n),t.inputRules?.length&&r.push(...t.inputRules.map(o=>new Ti(o.find,(i,s,a,l)=>{let c=o.replace({match:s,range:{from:a,to:l},editor:this.editor});if(c){let u=this.editor.getTextCursorPosition();if(this.editor.schema.blockSchema[u.block.type].content!=="inline")return null;let d=La(i.tr),f=i.tr.deleteRange(a,l);return Vu(f,d.bnBlock.beforePos,c),f}return null}))),Object.keys(t.keyboardShortcuts||{}).length&&n.push(LC(Object.fromEntries(Object.entries(t.keyboardShortcuts).map(([o,i])=>[o,()=>i({editor:this.editor})])))),{plugins:n,inputRules:r})}getExtensions(){return new Map(this.extensions.map(t=>[t.key,t]))}getExtension(t){if(typeof t=="string")return this.extensions.find(n=>n.key===t)||void 0;if(typeof t=="function")return this.extensionFactories.get(t)||void 0;throw Error(`Invalid extension type: ${typeof t}`)}hasExtension(t){return typeof t=="string"?this.extensions.some(n=>n.key===t):typeof t=="object"&&"key"in t?this.extensions.some(n=>n.key===t.key):typeof t=="function"?this.extensionFactories.has(t):!1}};function wq(e,t){let{$from:n,$to:r}=t;if(n.pos>n.start()&&n.pos<e.content.size){let o=e.textBetween(n.pos,n.pos+1);if(/^[\w\p{P}]$/u.test(o)){let i=e.textBetween(n.start(),n.pos).match(/[\w\p{P}]+$/u);i&&(n=e.resolve(n.pos-i[0].length))}}if(r.pos<r.end()&&r.pos>0){let o=e.textBetween(r.pos-1,r.pos);if(/^[\w\p{P}]$/u.test(o)){let i=e.textBetween(r.pos,r.end()).match(/^[\w\p{P}]+/u);i&&(r=e.resolve(r.pos+i[0].length))}}return{$from:n,$to:r,from:n.pos,to:r.pos}}function Sq(e){let t=kt(e);if(e.selection.empty||"node"in e.selection)return;let n=e.doc.resolve(_o(e.doc,e.selection.from).posBeforeNode),r=e.doc.resolve(_o(e.doc,e.selection.to).posBeforeNode),o=(c,u)=>{let d=n.posAtIndex(c,u),f=e.doc.resolve(d).nodeAfter;if(!f)throw Error(`Error getting selection - node not found at position ${d}`);return pt(f,t)},i=[],s=n.sharedDepth(r.pos),a=n.index(s),l=r.index(s);if(n.depth>s){i.push(pt(n.nodeAfter,t));for(let c=n.depth;c>s;c--)if(n.node(c).type.isInGroup("childContainer")){let u=n.index(c)+1,d=n.node(c).childCount;for(let f=u;f<d;f++)i.push(o(f,c))}}else i.push(o(a,s));for(let c=a+1;c<=l;c++)i.push(o(c,s));if(i.length===0)throw Error(`Error getting selection - selection doesn't span any blocks (${e.selection})`);return{blocks:i}}function vq(e,t,n){let r=typeof t=="string"?t:t.id,o=typeof n=="string"?n:n.id,i=Da(kt(e));if(r===o)throw Error(`Attempting to set selection with the same anchor and head blocks (id ${r})`);let s=cn(r,e.doc);if(!s)throw Error(`Block with ID ${r} not found`);let a=cn(o,e.doc);if(!a)throw Error(`Block with ID ${o} not found`);let l=Qr(s),c=Qr(a),u=i.blockSchema[l.blockNoteType],d=i.blockSchema[c.blockNoteType];if(!l.isBlockContainer||u.content==="none")throw Error(`Attempting to set selection anchor in block without content (id ${r})`);if(!c.isBlockContainer||d.content==="none")throw Error(`Attempting to set selection anchor in block without content (id ${o})`);let f,h;if(u.content==="table"){let p=nt.get(l.blockContent.node);f=l.blockContent.beforePos+p.positionAt(0,0,l.blockContent.node)+1+2}else f=l.blockContent.beforePos+1;if(d.content==="table"){let p=nt.get(c.blockContent.node),g=c.blockContent.beforePos+p.positionAt(p.height-1,p.width-1,c.blockContent.node)+1;h=g+e.doc.resolve(g).nodeAfter.nodeSize-2}else h=c.blockContent.afterPos-1;e.setSelection(se.create(e.doc,f,h))}function Aq(e,t=!1){let n=kt(e),r=t?wq(e.doc,e.selection):e.selection,o=r.$from,i=r.$to;for(;i.parentOffset>=i.parent.nodeSize-2&&i.depth>0;)i=e.doc.resolve(i.pos+1);for(;i.parentOffset===0&&i.depth>0;)i=e.doc.resolve(i.pos-1);for(;o.parentOffset===0&&o.depth>0;)o=e.doc.resolve(o.pos-1);for(;o.parentOffset>=o.parent.nodeSize-2&&o.depth>0;)o=e.doc.resolve(o.pos+1);let s=CD(e.doc.slice(o.pos,i.pos,!0),n);return{_meta:{startPos:o.pos,endPos:i.pos},...s}}function Nq(e){let{bnBlock:t}=La(e),n=kt(e.doc),r=e.doc.resolve(t.beforePos),o=r.nodeBefore,i=e.doc.resolve(t.afterPos).nodeAfter,s;return r.depth>1&&(s=r.node(),s.type.isInGroup("bnBlock")||(s=r.node(r.depth-1))),{block:pt(t.node,n),prevBlock:o===null?void 0:pt(o,n),nextBlock:i===null?void 0:pt(i,n),parentBlock:s===void 0?void 0:pt(s,n)}}function Zw(e,t,n="start"){let r=typeof t=="string"?t:t.id,o=Da(kt(e.doc)),i=cn(r,e.doc);if(!i)throw Error(`Block with ID ${r} not found`);let s=Qr(i),a=o.blockSchema[s.blockNoteType].content;if(s.isBlockContainer){let l=s.blockContent;if(a==="none"){e.setSelection(le.create(e.doc,l.beforePos));return}if(a==="inline")n==="start"?e.setSelection(se.create(e.doc,l.beforePos+1)):e.setSelection(se.create(e.doc,l.afterPos-1));else if(a==="table")n==="start"?e.setSelection(se.create(e.doc,l.beforePos+4)):e.setSelection(se.create(e.doc,l.afterPos-4));else throw new Tr(a)}else Zw(e,(n==="start"?s.childContainer.node.firstChild:s.childContainer.node.lastChild).attrs.id,n)}var Iq=class{constructor(t){this.editor=t}getSelection(){return this.editor.transact(t=>Sq(t))}getSelectionCutBlocks(t=!1){return this.editor.transact(n=>Aq(n,t))}setSelection(t,n){return this.editor.transact(r=>vq(r,t,n))}getTextCursorPosition(){return this.editor.transact(t=>Nq(t))}setTextCursorPosition(t,n="start"){return this.editor.transact(r=>Zw(r,t,n))}getSelectionBoundingBox(){if(!this.editor.prosemirrorView)return;let{selection:t}=this.editor.prosemirrorState,{ranges:n}=t,r=Math.min(...n.map(i=>i.$from.pos)),o=Math.max(...n.map(i=>i.$to.pos));if(eR(t)){let i=this.editor.prosemirrorView.nodeDOM(r);if(i)return i.getBoundingClientRect()}return Wp(this.editor.prosemirrorView,r,o).toJSON()}},Mq=class{constructor(t){this.editor=t}activeTransaction=null;can(t){try{return this.isInCan=!0,t()}finally{this.isInCan=!1}}isInCan=!1;exec(t){if(this.activeTransaction)throw Error("`exec` should not be called within a `transact` call, move the `exec` call outside of the `transact` call");if(this.isInCan)return this.canExec(t);let n=this.prosemirrorState,r=this.prosemirrorView;return t(n,o=>this.prosemirrorView.dispatch(o),r)}canExec(t){if(this.activeTransaction)throw Error("`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call");let n=this.prosemirrorState,r=this.prosemirrorView;return t(n,void 0,r)}transact(t){if(this.activeTransaction)return t(this.activeTransaction);try{this.activeTransaction=this.editor._tiptapEditor.state.tr;let n=t(this.activeTransaction),r=this.activeTransaction;return this.activeTransaction=null,r&&(r.docChanged||r.selectionSet||r.scrolledIntoView||r.storedMarksSet||!r.isGeneric)&&this.prosemirrorView.dispatch(r),n}finally{this.activeTransaction=null}}get prosemirrorState(){if(this.activeTransaction)throw Error("`prosemirrorState` should not be called within a `transact` call, move the `prosemirrorState` call outside of the `transact` call or use `editor.transact` to read the current editor state");return this.editor._tiptapEditor.state}get prosemirrorView(){return this.editor._tiptapEditor.view}isFocused(){return this.prosemirrorView?.hasFocus()||!1}focus(){this.prosemirrorView?.focus()}get isEditable(){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw Error("no editor, but also not headless?");return!1}return this.editor._tiptapEditor.isEditable===void 0?!0:this.editor._tiptapEditor.isEditable}set isEditable(t){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw Error("no editor, but also not headless?");return}this.editor._tiptapEditor.options.editable!==t&&this.editor._tiptapEditor.setEditable(t)}undo(){let t=this.editor.getExtension("yUndo");if(t)return this.exec(t.undoCommand);let n=this.editor.getExtension("history");if(n)return this.exec(n.undoCommand);throw Error("No undo plugin found")}redo(){let t=this.editor.getExtension("yUndo");if(t)return this.exec(t.redoCommand);let n=this.editor.getExtension("history");if(n)return this.exec(n.redoCommand);throw Error("No redo plugin found")}};function _q(e,t,n,r={updateSelection:!0}){let{from:o,to:i}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},s=!0,a=!0,l="";if(n.forEach(c=>{c.check(),s&&c.isText&&c.marks.length===0?l+=c.text:s=!1,a=a?c.isBlock:!1}),o===i&&a){let{parent:c}=e.doc.resolve(o);c.isTextblock&&!c.type.spec.code&&!c.childCount&&(--o,i+=1)}return s?e.insertText(l,o,i):e.replaceWith(o,i,n),r.updateSelection&&UC(e,e.steps.length-1,-1),!0}var Oq=class{constructor(t){this.editor=t}insertInlineContent(t,{updateSelection:n=!1}={}){let r=ir(t,this.editor.pmSchema);this.editor.transact(o=>{_q(o,{from:o.selection.from,to:o.selection.to},r,{updateSelection:n})})}getActiveStyles(){return this.editor.transact(t=>{let n={},r=t.selection.$to.marks();for(let o of r){let i=this.editor.schema.styleSchema[o.type.name];if(!i){o.type.name!=="link"&&!o.type.spec.blocknoteIgnore&&console.warn("mark not found in styleschema",o.type.name);continue}i.propSchema==="boolean"?n[i.type]=!0:n[i.type]=o.attrs.stringValue}return n})}addStyles(t){for(let[n,r]of Object.entries(t)){let o=this.editor.schema.styleSchema[n];if(!o)throw Error(`style ${n} not found in styleSchema`);if(o.propSchema==="boolean")this.editor._tiptapEditor.commands.setMark(n);else if(o.propSchema==="string")this.editor._tiptapEditor.commands.setMark(n,{stringValue:r});else throw new Tr(o.propSchema)}}removeStyles(t){for(let n of Object.keys(t))this.editor._tiptapEditor.commands.unsetMark(n)}toggleStyles(t){for(let[n,r]of Object.entries(t)){let o=this.editor.schema.styleSchema[n];if(!o)throw Error(`style ${n} not found in styleSchema`);if(o.propSchema==="boolean")this.editor._tiptapEditor.commands.toggleMark(n);else if(o.propSchema==="string")this.editor._tiptapEditor.commands.toggleMark(n,{stringValue:r});else throw new Tr(o.propSchema)}}getSelectedText(){return this.editor.transact(t=>t.doc.textBetween(t.selection.from,t.selection.to))}getSelectedLinkUrl(){return this.editor._tiptapEditor.getAttributes("link").href}createLink(t,n){if(t==="")return;let r=this.editor.pmSchema.mark("link",{href:t});this.editor.transact(o=>{let{from:i,to:s}=o.selection;n?o.insertText(n,i,s).addMark(i,i+n.length,r):o.setSelection(se.create(o.doc,s)).addMark(i,s,r)})}};function Rq(e){return jC(e.state.selection.$from,t=>t.type.name==="tableCell"||t.type.name==="tableHeader")!==void 0}function Jw(e,t){let n=t.nodes.hardBreak,r=j.empty;return e.forEach(o=>{o.isTextblock&&o.childCount>0?(r=r.append(o.content),r=r.addToEnd(n.create())):o.isText?r=r.addToEnd(o):o.isBlock&&o.childCount>0&&(r=r.append(Jw(o.content,t)),r=r.addToEnd(n.create()))}),r.lastChild?.type===n&&(r=r.cut(0,r.size-1)),r}function Lq(e,t){let n=[];return e.forEach((r,o,i)=>{i!==t&&n.push(r)}),j.from(n)}function Dq(e,t){let n=[];for(let r=0;r<e.childCount;r++)if(e.child(r).type.name==="tableRow")if(n.length>0&&n[n.length-1].type.name==="table"){let o=n[n.length-1],i=o.copy(o.content.addToEnd(e.child(r)));n[n.length-1]=i}else{let o=t.nodes.table.createChecked(void 0,e.child(r));n.push(o)}else n.push(e.child(r));return e=j.from(n),e}function Pq(e,t){let n=j.from(e.content);if(n=Dq(n,t.state.schema),Rq(t)){let r=!1;if(n.descendants(o=>{o.type.isInGroup("tableContent")&&(r=!0)}),!r&&!t.state.schema.nodes.tableParagraph.validContent(n))return new Z(Jw(n,t.state.schema),0,0)}if(!Bq(n,t))return new Z(n,e.openStart,e.openEnd);for(let r=0;r<n.childCount;r++)if(n.child(r).type.spec.group==="blockContent"){let o=[n.child(r)];if(r+1<n.childCount&&n.child(r+1).type.name==="blockGroup"){let s=n.child(r+1).child(0).child(0);(s.type.name==="bulletListItem"||s.type.name==="numberedListItem"||s.type.name==="checkListItem")&&(o.push(n.child(r+1)),n=Lq(n,r+1))}let i=t.state.schema.nodes.blockContainer.createChecked(void 0,o);n=n.replaceChild(r,i)}return new Z(n,e.openStart,e.openEnd)}function Bq(e,t){let n=e.childCount===1,r=e.firstChild?.type.spec.content==="inline*",o=e.firstChild?.type.spec.content==="tableRow+";if(n){if(r)return!1;if(o){let i=Ct(t.state);if(i.isBlockContainer)return i.blockContent.node.type.spec.content!=="tableRow+"}}return!0}var Fq={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1},Hq=class eS extends Dm{pmSchema;_tiptapEditor;elementRenderer=null;blockCache=new WeakMap;dictionary;schema;blockImplementations;inlineContentImplementations;styleImplementations;uploadFile;onUploadStartCallbacks=[];onUploadEndCallbacks=[];resolveFileUrl;settings;static create(t){return new eS(t??{})}constructor(t){super(),this.options=t,this.dictionary=t.dictionary||JV,this.settings={tables:{splitCells:t?.tables?.splitCells??!1,cellBackgroundColor:t?.tables?.cellBackgroundColor??!1,cellTextColor:t?.tables?.cellTextColor??!1,headers:t?.tables?.headers??!1}};let n={defaultStyles:!0,schema:t.schema||um.create(),...t,placeholders:{...this.dictionary.placeholders,...t.placeholders}};if(this.schema=n.schema,this.blockImplementations=n.schema.blockSpecs,this.inlineContentImplementations=n.schema.inlineContentSpecs,this.styleImplementations=n.schema.styleSpecs,n.uploadFile){let l=n.uploadFile;this.uploadFile=async(c,u)=>{this.onUploadStartCallbacks.forEach(d=>d.apply(this,[u]));try{return await l(c,u)}finally{this.onUploadEndCallbacks.forEach(d=>d.apply(this,[u]))}}}this.resolveFileUrl=n.resolveFileUrl,this._eventManager=new TW(this),this._extensionManager=new Tq(this,n);let r=this._extensionManager.getTiptapExtensions(),o=this._extensionManager.hasExtension("ySync")||this._extensionManager.hasExtension("liveblocksExtension");o&&n.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");let i={...Fq,...n._tiptapOptions,element:null,autofocus:n.autofocus??!1,extensions:r,editorProps:{...n._tiptapOptions?.editorProps,attributes:{tabIndex:"0",...n._tiptapOptions?.editorProps?.attributes,...n.domAttributes?.editor,class:ut("bn-editor",n.defaultStyles?"bn-default-styles":"",n.domAttributes?.editor?.class||"")},transformPasted:Pq}};try{let l=n.initialContent||(o?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:Fu.options.generateID()}]);if(!Array.isArray(l)||l.length===0)throw Error("initialContent must be a non-empty array of blocks, received: "+l);let c=G3(i.extensions),u=bc({type:"doc",content:[{type:"blockGroup",content:l.map(d=>Ei(d,c,this.schema.styleSchema).toJSON())}]},c,i.parseOptions);this._tiptapEditor=new FR({...i,content:u.toJSON()}),this.pmSchema=this._tiptapEditor.schema}catch(l){throw Error("Error creating document from blocks passed as `initialContent`",{cause:l})}let s,a=this.pmSchema.nodes.doc.createAndFill;this.pmSchema.nodes.doc.createAndFill=(...l)=>{if(s)return s;let c=a.apply(this.pmSchema.nodes.doc,l),u=JSON.parse(JSON.stringify(c.toJSON()));return u.content[0].content[0].attrs.id="initialBlockId",s=Gr.fromJSON(this.pmSchema,u),s},this.pmSchema.cached.blockNoteEditor=this,this._blockManager=new kW(this),this._exportManager=new BW(this),this._selectionManager=new Iq(this),this._stateManager=new Mq(this),this._styleManager=new Oq(this),this.emit("create")}_blockManager;_eventManager;_exportManager;_extensionManager;_selectionManager;_stateManager;_styleManager;get extensions(){return this._extensionManager.getExtensions()}exec(t){return this._stateManager.exec(t)}canExec(t){return this._stateManager.canExec(t)}transact(t){return this._stateManager.transact(t)}unregisterExtension=(...t)=>this._extensionManager.unregisterExtension(...t);registerExtension=(...t)=>this._extensionManager.registerExtension(...t);getExtension=((...t)=>this._extensionManager.getExtension(...t));mount=t=>{let n=t.getRootNode();typeof ShadowRoot<"u"&&n instanceof ShadowRoot?n.appendChild(this.portalElement):document.body.appendChild(this.portalElement),this._tiptapEditor.mount({mount:t})};unmount=()=>{this.portalElement?.remove(),this._tiptapEditor.unmount()};get prosemirrorState(){return this._stateManager.prosemirrorState}get prosemirrorView(){return this._stateManager.prosemirrorView}get domElement(){if(!this.headless)return this.prosemirrorView?.dom}_portalElement;get portalElement(){if(typeof document>"u")throw Error("Portal element accessed, but not available in headless mode");return this._portalElement||=document.createElement("div"),this._portalElement}isWithinEditor=t=>!!(this.domElement?.parentElement?.contains(t)||this.portalElement?.contains(t));isFocused(){return this.headless?!1:this.prosemirrorView?.hasFocus()||!1}get headless(){return!this._tiptapEditor.isInitialized}focus(){this.headless||this.prosemirrorView.focus()}blur(){this.headless||this.domElement?.blur()}onUploadStart(t){return this.onUploadStartCallbacks.push(t),()=>{let n=this.onUploadStartCallbacks.indexOf(t);n>-1&&this.onUploadStartCallbacks.splice(n,1)}}onUploadEnd(t){return this.onUploadEndCallbacks.push(t),()=>{let n=this.onUploadEndCallbacks.indexOf(t);n>-1&&this.onUploadEndCallbacks.splice(n,1)}}get topLevelBlocks(){return this.document}get document(){return this._blockManager.document}getBlock(t){return this._blockManager.getBlock(t)}getPrevBlock(t){return this._blockManager.getPrevBlock(t)}getNextBlock(t){return this._blockManager.getNextBlock(t)}getParentBlock(t){return this._blockManager.getParentBlock(t)}forEachBlock(t,n=!1){this._blockManager.forEachBlock(t,n)}onEditorContentChange(t){this._tiptapEditor.on("update",t)}onEditorSelectionChange(t){this._tiptapEditor.on("selectionUpdate",t)}onBeforeChange(t){return this._extensionManager.getExtension(dw).subscribe(t)}getTextCursorPosition(){return this._selectionManager.getTextCursorPosition()}setTextCursorPosition(t,n="start"){return this._selectionManager.setTextCursorPosition(t,n)}getSelection(){return this._selectionManager.getSelection()}getSelectionCutBlocks(t=!1){return this._selectionManager.getSelectionCutBlocks(t)}setSelection(t,n){return this._selectionManager.setSelection(t,n)}get isEditable(){return this._stateManager.isEditable}set isEditable(t){this._stateManager.isEditable=t}insertBlocks(t,n,r="before"){return this._blockManager.insertBlocks(t,n,r)}updateBlock(t,n){return this._blockManager.updateBlock(t,n)}removeBlocks(t){return this._blockManager.removeBlocks(t)}replaceBlocks(t,n){return this._blockManager.replaceBlocks(t,n)}undo(){return this._stateManager.undo()}redo(){return this._stateManager.redo()}insertInlineContent(t,{updateSelection:n=!1}={}){this._styleManager.insertInlineContent(t,{updateSelection:n})}getActiveStyles(){return this._styleManager.getActiveStyles()}addStyles(t){this._styleManager.addStyles(t)}removeStyles(t){this._styleManager.removeStyles(t)}toggleStyles(t){this._styleManager.toggleStyles(t)}getSelectedText(){return this._styleManager.getSelectedText()}getSelectedLinkUrl(){return this._styleManager.getSelectedLinkUrl()}createLink(t,n){this._styleManager.createLink(t,n)}canNestBlock(){return this._blockManager.canNestBlock()}nestBlock(){this._blockManager.nestBlock()}canUnnestBlock(){return this._blockManager.canUnnestBlock()}unnestBlock(){this._blockManager.unnestBlock()}moveBlocksUp(){return this._blockManager.moveBlocksUp()}moveBlocksDown(){return this._blockManager.moveBlocksDown()}blocksToHTMLLossy(t=this.document){return this._exportManager.blocksToHTMLLossy(t)}blocksToFullHTML(t=this.document){return this._exportManager.blocksToFullHTML(t)}tryParseHTMLToBlocks(t){return this._exportManager.tryParseHTMLToBlocks(t)}blocksToMarkdownLossy(t=this.document){return this._exportManager.blocksToMarkdownLossy(t)}tryParseMarkdownToBlocks(t){return this._exportManager.tryParseMarkdownToBlocks(t)}onChange(t,n){return this._eventManager.onChange(t,n)}onSelectionChange(t,n){return this._eventManager.onSelectionChange(t,n)}onMount(t){this._eventManager.onMount(t)}onUnmount(t){this._eventManager.onUnmount(t)}getSelectionBoundingBox(){return this._selectionManager.getSelectionBoundingBox()}get isEmpty(){let t=this.document;return t.length===0||t.length===1&&t[0].type==="paragraph"&&t[0].content.length===0}pasteHTML(t,n=!1){this._exportManager.pasteHTML(t,n)}pasteText(t){return this._exportManager.pasteText(t)}pasteMarkdown(t){return this._exportManager.pasteMarkdown(t)}},vf,Ny;function Uq(){return Ny||(Ny=1,vf=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],n.get(o[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(t[o]!==n[o])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!(s==="_owner"&&t.$$typeof)&&!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n}),vf}var Vq=Uq();const $q=cp(Vq);var tS=C.createContext(void 0);function Nr(e){return C.useContext(tS)}function be(e){let t=Nr();if(!t?.editor)throw Error("useBlockNoteEditor was called outside of a BlockNoteContext provider or BlockNoteView component");return t.editor}function je(e,t){let n=(t?.editor??be()).getExtension(e);if(!n)throw Error("Extension not found",{cause:{plugin:e}});return n}function rt(e,t){let{store:n}=je(e,t);if(!n)throw Error("Store not found on plugin",{cause:{plugin:e}});return YI(n,t?.selector)}function jq(e){let t=new DOMRect,n="getBoundingClientRect"in e?()=>e.getBoundingClientRect():()=>e.element.getBoundingClientRect();return()=>e.element&&(e.cacheMountedBoundingClientRect??!0)?(e.element.isConnected&&(t=n()),t):n()}function zq(e,t){return e?t?(n,r,o)=>{let i=e(n,r,o),s=t(n,r,o);return()=>{i?.(),s?.()}}:e:t}var mr=e=>{let t=be()?.portalElement;if(!t)throw Error("Portal element not found");let{whileElementsMounted:n,...r}=e.useFloatingOptions??{},{refs:o,floatingStyles:i,context:s}=PI({whileElementsMounted:zq(mp,e.useFloatingOptions?.whileElementsMounted),...r}),{isMounted:a,styles:l}=HI(s,e.useTransitionStylesProps),{status:c}=nx(s,e.useTransitionStatusProps),{getFloatingProps:u}=BI([LI(s,e.useDismissProps),xI(s,{enabled:!1,...e.useHoverProps})]),d=C.useRef(""),f=C.useRef(null),h=dI([f,o.setFloating]);if(C.useEffect(()=>{if(e.reference){let g="element"in e.reference?e.reference.element:void 0;g!==void 0&&o.setReference(g),o.setPositionReference({getBoundingClientRect:jq(e.reference),contextElement:g})}},[e.reference,o]),C.useEffect(()=>{(c==="initial"||c==="open")&&f.current?.innerHTML&&(d.current=f.current.innerHTML)},[c,e.reference,e.children]),!a)return!1;let p={...e.elementProps,style:{display:"flex",...e.elementProps?.style,zIndex:`calc(var(--bn-ui-base-z-index, 0) + ${e.elementProps?.style?.zIndex||0})`,...i,...l},...u()};return c==="close"?E.jsx(xd,{root:t,children:E.jsx("div",{ref:h,...p,dangerouslySetInnerHTML:{__html:d.current}})}):e.focusManagerProps?.disabled?E.jsx(xd,{root:t,children:E.jsx("div",{ref:h,...p,children:e.children})}):E.jsx(xd,{root:t,children:E.jsx(_I,{...e.focusManagerProps,context:s,children:E.jsx("div",{ref:h,...p,children:e.children})})})},nS=C.createContext(void 0);function fe(){return C.useContext(nS)}function Se(){return Nr().editor.dictionary}var Wq=typeof window<"u"?C.useLayoutEffect:C.useEffect,qq=class{transactionNumber=0;lastTransactionNumber=0;lastSnapshot;editor;subscribers=new Set;constructor(t){this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t,n){if(this.editor=t,this.editor){let r=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},o=this.editor._tiptapEditor,i={all:"transaction",selection:"selectionUpdate",change:"update"};return o.on(i[n],r),()=>{o.off(i[n],r)}}}};function jt(e){let t=Nr(),n=e.editor||t?.editor||null,r=e.on||"all",[o]=C.useState(()=>new qq(n)),i=ox.useSyncExternalStoreWithSelector(o.subscribe,o.getSnapshot,o.getServerSnapshot,e.selector,e.equalityFn??$q);return Wq(()=>o.watch(n,r),[n,o,r]),C.useDebugValue(i),i}var rS=e=>{let{position:t,children:n,...r}=e,{from:o,to:i}=t||{},s=be();return E.jsx(mr,{reference:C.useMemo(()=>{if(!(o===void 0||i===void 0))return{element:s.domElement?.firstElementChild||void 0,getBoundingClientRect:()=>Wp(s.prosemirrorView,o,i??o)}},[s,o,i]),...r,children:t!==void 0&&n})},Ym=(e={},t=[])=>C.useMemo(()=>{let n=Hq.create(e);return window&&(window.ProseMirror=n._tiptapEditor),n},t),oS=e=>{let[t,n]=C.useState(!1),r=jt({editor:e.editor,selector:({editor:a})=>a.isEmpty}),o=fe(),i=C.useCallback(()=>{n(!0)},[]),s=C.useCallback(()=>{n(!1)},[]);return C.useEffect(()=>{e.editable&&e.autoFocus&&e.editor.focus()},[e.autoFocus,e.editable,e.editor]),E.jsxs(E.Fragment,{children:[E.jsx(o.Comments.Editor,{autoFocus:e.autoFocus,className:"bn-comment-editor",editor:e.editor,onFocus:i,onBlur:s,editable:e.editable}),e.actions&&E.jsx("div",{className:"bn-comment-actions-wrapper",children:E.jsx(e.actions,{isFocused:t,isEmpty:r})})]})},{textColor:cJ,backgroundColor:uJ,...Gq}=cm,iS=um.create({blockSpecs:{paragraph:Kk()},styleSpecs:Gq}),Iy=Object.defineProperty,Yq=(e,t)=>{let n={};for(var r in e)Iy(n,r,{get:e[r],enumerable:!0});return Iy(n,Symbol.toStringTag,{value:"Module"}),n},My=Gn.create({name:"comment",excludes:"",inclusive:!1,keepOnSplit:!0,addAttributes(){return{orphan:{parseHTML:e=>!!e.getAttribute("data-orphan"),renderHTML:e=>e.orphan?{"data-orphan":"true"}:{},default:!1},threadId:{parseHTML:e=>e.getAttribute("data-bn-thread-id"),renderHTML:e=>({"data-bn-thread-id":e.threadId}),default:""}}},renderHTML({HTMLAttributes:e}){return["span",Rn(e,{class:"bn-thread-mark"})]},parseHTML(){return[{tag:"span.bn-thread-mark"}]},extendMarkSchema(e){return e.name==="comment"?{blocknoteIgnore:!0}:{}}}),Kq=class extends Dm{userCache=new Map;loadingUsers=new Set;constructor(e){super(),this.resolveUsers=e}async loadUsers(e){let t=e.filter(n=>!this.userCache.has(n)&&!this.loadingUsers.has(n));if(t.length!==0){for(let n of t)this.loadingUsers.add(n);try{let n=await this.resolveUsers(t);for(let r of n)this.userCache.set(r.id,r);this.emit("update",this.userCache)}finally{for(let n of t)this.loadingUsers.delete(n)}}}getUser(e){return this.userCache.get(e)}subscribe(e){return this.on("update",e)}},vl=new $e("blocknote-comments");function Qq(e,t){let n=new Map;return e.descendants((r,o)=>{r.marks.forEach(i=>{if(i.type.name===t){let s=i.attrs.threadId;if(!s)return;let a=o,l=a+r.nodeSize,c=n.get(s)??{from:1/0,to:0};n.set(s,{from:Math.min(a,c.from),to:Math.max(l,c.to)})}})}),n}var Jr=Ve(({editor:e,options:{schema:t,threadStore:n,resolveUsers:r}})=>{if(!r)throw Error("resolveUsers is required to be defined when using comments");if(!n)throw Error("threadStore is required to be defined when using comments");let o=My.name,i=new Kq(r),s=Po({pendingComment:!1,selectedThreadId:void 0,threadPositions:new Map},{onUpdate(){s.state.selectedThreadId!==s.prevState.selectedThreadId&&e.transact(l=>l.setMeta(vl,!0))}}),a=l=>{e.transact(c=>{c.doc.descendants((u,d)=>{u.marks.forEach(f=>{if(f.type.name===o){let h=f.type,p=f.attrs.threadId,g=l.get(p),y=!!(!g||g.resolved||g.deletedAt);if(y!==f.attrs.orphan){let b=Math.max(d,0),x=Math.min(d+u.nodeSize,c.doc.content.size-1,c.doc.content.size-1);c.removeMark(b,x,f),c.addMark(b,x,h.create({...f.attrs,orphan:y})),y&&s.state.selectedThreadId===p&&s.setState(k=>({...k,selectedThreadId:void 0}))}}})})})};return{key:"comments",store:s,prosemirrorPlugins:[new Ae({key:vl,state:{init(){return{decorations:_e.empty}},apply(l,c){let u=l.getMeta(vl);if(!l.docChanged&&!u)return c;let d=l.docChanged?Qq(l.doc,o):s.state.threadPositions;(d.size>0||s.state.threadPositions.size>0)&&s.setState(h=>({...h,threadPositions:d}));let f=[];if(s.state.selectedThreadId){let h=d.get(s.state.selectedThreadId);h&&f.push(qe.inline(h.from,h.to,{class:"bn-thread-mark-selected"}))}return{decorations:_e.create(l.doc,f)}}},props:{decorations(l){return vl.getState(l)?.decorations??_e.empty},handleClick:(l,c,u)=>{if(u.button!==0)return;let d=l.state.doc.nodeAt(c);if(!d){s.setState(h=>({...h,selectedThreadId:void 0}));return}let f=d.marks.find(h=>h.type.name===o&&h.attrs.orphan!==!0)?.attrs.threadId;f!==s.state.selectedThreadId&&s.setState(h=>({...h,selectedThreadId:f}))}}})],threadStore:n,mount(){let l=n.subscribe(a);a(n.getThreads());let c=e.onSelectionChange(()=>{s.state.pendingComment&&s.setState(u=>({...u,pendingComment:!1}))});return()=>{l(),c()}},selectThread(l,c=!0){if(s.state.selectedThreadId!==l&&(s.setState(u=>({...u,pendingComment:!1,selectedThreadId:l})),l&&c)){let u=s.state.threadPositions.get(l);if(!u)return;e.prosemirrorView?.domAtPos(u.from).node?.scrollIntoView({behavior:"smooth",block:"center"})}},startPendingComment(){s.setState(l=>({...l,selectedThreadId:void 0,pendingComment:!0})),e.getExtension(va)?.showSelection(!0,"comments")},stopPendingComment(){s.setState(l=>({...l,selectedThreadId:void 0,pendingComment:!1})),e.getExtension(va)?.showSelection(!1,"comments")},async createThread(l){let c=await n.createThread(l);if(n.addThreadToDocument){let u=e.prosemirrorView,d=u.state.selection,f=tt.getState(u.state),h={prosemirror:{head:d.head,anchor:d.anchor},yjs:f?Cc(f.binding,u.state):void 0};await n.addThreadToDocument({threadId:c.id,selection:h})}else e._tiptapEditor.commands.setMark(o,{orphan:!1,threadId:c.id})},userStore:i,commentEditorSchema:t,tiptapExtensions:[My]}}),sS={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},_y=Re.createContext&&Re.createContext(sS),Xq=["attr","size","title"];function Zq(e,t){if(e==null)return{};var n=Jq(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 Jq(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function su(){return su=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},su.apply(this,arguments)}function Oy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function au(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Oy(Object(n),!0).forEach(function(r){eG(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function eG(e,t,n){return t=tG(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tG(e){var t=nG(e,"string");return typeof t=="symbol"?t:t+""}function nG(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function aS(e){return e&&e.map((t,n)=>Re.createElement(t.tag,au({key:n},t.attr),aS(t.child)))}function he(e){return t=>Re.createElement(rG,su({attr:au({},e.attr)},t),aS(e.child))}function rG(e){var t=n=>{var{attr:r,size:o,title:i}=e,s=Zq(e,Xq),a=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),Re.createElement("svg",su({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:l,style:au(au({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),i&&Re.createElement("title",null,i),e.children)};return _y!==void 0?Re.createElement(_y.Consumer,null,n=>t(n)):t(sS)}function oG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 7V11L2 6L8 1V5H13C17.4183 5 21 8.58172 21 13C21 17.4183 17.4183 21 13 21H4V19H13C16.3137 19 19 16.3137 19 13C19 9.68629 16.3137 7 13 7H8Z"},child:[]}]})(e)}function lS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.29117 20.8242L2 22L3.17581 16.7088C2.42544 15.3056 2 13.7025 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C10.2975 22 8.6944 21.5746 7.29117 20.8242ZM7.58075 18.711L8.23428 19.0605C9.38248 19.6745 10.6655 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 13.3345 4.32549 14.6175 4.93949 15.7657L5.28896 16.4192L4.63416 19.3658L7.58075 18.711Z"},child:[]}]})(e)}function iG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.24264 17.9967H3V13.754L14.435 2.319C14.8256 1.92848 15.4587 1.92848 15.8492 2.319L18.6777 5.14743C19.0682 5.53795 19.0682 6.17112 18.6777 6.56164L7.24264 17.9967ZM3 19.9967H21V21.9967H3V19.9967Z"},child:[]}]})(e)}function sG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M23 12L15.9289 19.0711L14.5147 17.6569L20.1716 12L14.5147 6.34317L15.9289 4.92896L23 12ZM3.82843 12L9.48528 17.6569L8.07107 19.0711L1 12L8.07107 4.92896L9.48528 6.34317L3.82843 12Z"},child:[]}]})(e)}function aG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"},child:[]}]})(e)}function lG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM5 19H19V21H5V19ZM3 14H21V16H3V14ZM5 9H19V11H5V9Z"},child:[]}]})(e)}function cG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z"},child:[]}]})(e)}function uG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H17V21H3V19ZM3 14H21V16H3V14ZM3 9H17V11H3V9Z"},child:[]}]})(e)}function dG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM7 19H21V21H7V19ZM3 14H21V16H3V14ZM7 9H21V11H7V9Z"},child:[]}]})(e)}function fG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 11H12.5C13.8807 11 15 9.88071 15 8.5C15 7.11929 13.8807 6 12.5 6H8V11ZM18 15.5C18 17.9853 15.9853 20 13.5 20H6V4H12.5C14.9853 4 17 6.01472 17 8.5C17 9.70431 16.5269 10.7981 15.7564 11.6058C17.0979 12.3847 18 13.837 18 15.5ZM8 13V18H13.5C14.8807 18 16 16.8807 16 15.5C16 14.1193 14.8807 13 13.5 13H8Z"},child:[]}]})(e)}function hG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3.41436 5.99995L5.70726 3.70706L4.29304 2.29285L0.585938 5.99995L4.29304 9.70706L5.70726 8.29285L3.41436 5.99995ZM9.58594 5.99995L7.29304 3.70706L8.70726 2.29285L12.4144 5.99995L8.70726 9.70706L7.29304 8.29285L9.58594 5.99995ZM14.0002 2.99995H21.0002C21.5524 2.99995 22.0002 3.44767 22.0002 3.99995V20C22.0002 20.5522 21.5524 21 21.0002 21H3.00015C2.44787 21 2.00015 20.5522 2.00015 20V12H4.00015V19H20.0002V4.99995H14.0002V2.99995Z"},child:[]}]})(e)}function Ry(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.55397 22H3.3999L10.9999 3H12.9999L20.5999 22H18.4458L16.0458 16H7.95397L5.55397 22ZM8.75397 14H15.2458L11.9999 5.88517L8.75397 14Z"},child:[]}]})(e)}function lu(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"},child:[]}]})(e)}function cu(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 8C20.5711 8 22.25 9.67893 22.25 11.75C22.25 12.6074 21.9623 13.3976 21.4781 14.0292L21.3302 14.2102L18.0343 18H22V20H15L14.9993 18.444L19.8207 12.8981C20.0881 12.5908 20.25 12.1893 20.25 11.75C20.25 10.7835 19.4665 10 18.5 10C17.5818 10 16.8288 10.7071 16.7558 11.6065L16.75 11.75H14.75C14.75 9.67893 16.4289 8 18.5 8Z"},child:[]}]})(e)}function uu(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8L21.9984 10L19.4934 12.883C21.0823 13.3184 22.25 14.7728 22.25 16.5C22.25 18.5711 20.5711 20.25 18.5 20.25C16.674 20.25 15.1528 18.9449 14.8184 17.2166L16.7821 16.8352C16.9384 17.6413 17.6481 18.25 18.5 18.25C19.4665 18.25 20.25 17.4665 20.25 16.5C20.25 15.5335 19.4665 14.75 18.5 14.75C18.214 14.75 17.944 14.8186 17.7056 14.9403L16.3992 13.3932L19.3484 10H15V8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(e)}function cS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"},child:[]}]})(e)}function uS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8V10H17.6769L17.2126 12.6358C17.5435 12.5472 17.8912 12.5 18.25 12.5C20.4591 12.5 22.25 14.2909 22.25 16.5C22.25 18.7091 20.4591 20.5 18.25 20.5C16.4233 20.5 14.8827 19.2756 14.4039 17.6027L16.3271 17.0519C16.5667 17.8881 17.3369 18.5 18.25 18.5C19.3546 18.5 20.25 17.6046 20.25 16.5C20.25 15.3954 19.3546 14.5 18.25 14.5C17.6194 14.5 17.057 14.7918 16.6904 15.2478L14.8803 14.3439L16 8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(e)}function dS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21.097 8L18.499 12.5C20.7091 12.5 22.5 14.2909 22.5 16.5C22.5 18.7091 20.7091 20.5 18.5 20.5C16.2909 20.5 14.5 18.7091 14.5 16.5C14.5 15.7636 14.699 15.0737 15.0461 14.4811L18.788 8H21.097ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 14.5C17.3954 14.5 16.5 15.3954 16.5 16.5C16.5 17.6046 17.3954 18.5 18.5 18.5C19.6046 18.5 20.5 17.6046 20.5 16.5C20.5 15.3954 19.6046 14.5 18.5 14.5Z"},child:[]}]})(e)}function pG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM3 12.5L7 9V16L3 12.5Z"},child:[]}]})(e)}function mG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM7 12.5L3 16V9L7 12.5Z"},child:[]}]})(e)}function Ly(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 5H11V19H8V21H16V19H13V5H16V3H8V5ZM2 7C1.44772 7 1 7.44772 1 8V16C1 16.5523 1.44772 17 2 17H8V15H3V9H8V7H2ZM16 9H21V15H16V17H22C22.5523 17 23 16.5523 23 16V8C23 7.44772 22.5523 7 22 7H16V9Z"},child:[]}]})(e)}function gG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 20H7V18H9.92661L12.0425 6H9V4H17V6H14.0734L11.9575 18H15V20Z"},child:[]}]})(e)}function bG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 17H22V19H19V22H17V17ZM7 7H2V5H5V2H7V7ZM18.364 15.5355L16.9497 14.1213L18.364 12.7071C20.3166 10.7545 20.3166 7.58866 18.364 5.63604C16.4113 3.68342 13.2455 3.68342 11.2929 5.63604L9.87868 7.05025L8.46447 5.63604L9.87868 4.22183C12.6123 1.48816 17.0445 1.48816 19.7782 4.22183C22.5118 6.9555 22.5118 11.3877 19.7782 14.1213L18.364 15.5355ZM15.5355 18.364L14.1213 19.7782C11.3877 22.5118 6.9555 22.5118 4.22183 19.7782C1.48816 17.0445 1.48816 12.6123 4.22183 9.87868L5.63604 8.46447L7.05025 9.87868L5.63604 11.2929C3.68342 13.2455 3.68342 16.4113 5.63604 18.364C7.58866 20.3166 10.7545 20.3166 12.7071 18.364L14.1213 16.9497L15.5355 18.364ZM14.8284 7.75736L16.2426 9.17157L9.17157 16.2426L7.75736 14.8284L14.8284 7.75736Z"},child:[]}]})(e)}function fS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18.3638 15.5355L16.9496 14.1213L18.3638 12.7071C20.3164 10.7545 20.3164 7.58866 18.3638 5.63604C16.4112 3.68341 13.2453 3.68341 11.2927 5.63604L9.87849 7.05025L8.46428 5.63604L9.87849 4.22182C12.6122 1.48815 17.0443 1.48815 19.778 4.22182C22.5117 6.95549 22.5117 11.3876 19.778 14.1213L18.3638 15.5355ZM15.5353 18.364L14.1211 19.7782C11.3875 22.5118 6.95531 22.5118 4.22164 19.7782C1.48797 17.0445 1.48797 12.6123 4.22164 9.87868L5.63585 8.46446L7.05007 9.87868L5.63585 11.2929C3.68323 13.2455 3.68323 16.4113 5.63585 18.364C7.58847 20.3166 10.7543 20.3166 12.7069 18.364L14.1211 16.9497L15.5353 18.364ZM14.8282 7.75736L16.2425 9.17157L9.17139 16.2426L7.75717 14.8284L14.8282 7.75736Z"},child:[]}]})(e)}function hS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8.00008 6V9H5.00008V6H8.00008ZM3.00008 4V11H10.0001V4H3.00008ZM13.0001 4H21.0001V6H13.0001V4ZM13.0001 11H21.0001V13H13.0001V11ZM13.0001 18H21.0001V20H13.0001V18ZM10.7072 16.2071L9.29297 14.7929L6.00008 18.0858L4.20718 16.2929L2.79297 17.7071L6.00008 20.9142L10.7072 16.2071Z"},child:[]}]})(e)}function pS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM5 3V6H6V7H3V6H4V4H3V3H5ZM3 14V11.5H5V11H3V10H6V12.5H4V13H6V14H3ZM5 19.5H3V18.5H5V18H3V17H6V21H3V20H5V19.5ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(e)}function mS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM4.5 6.5C3.67157 6.5 3 5.82843 3 5C3 4.17157 3.67157 3.5 4.5 3.5C5.32843 3.5 6 4.17157 6 5C6 5.82843 5.32843 6.5 4.5 6.5ZM4.5 13.5C3.67157 13.5 3 12.8284 3 12C3 11.1716 3.67157 10.5 4.5 10.5C5.32843 10.5 6 11.1716 6 12C6 12.8284 5.32843 13.5 4.5 13.5ZM4.5 20.4C3.67157 20.4 3 19.7284 3 18.9C3 18.0716 3.67157 17.4 4.5 17.4C5.32843 17.4 6 18.0716 6 18.9C6 19.7284 5.32843 20.4 4.5 20.4ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(e)}function yG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM11 5H5V10.999H7V9L10 12L7 15V13H5V19H11V17H13V19H19V13H17V15L14 12L17 9V10.999H19V5H13V7H11V5ZM13 13V15H11V13H13ZM13 9V11H11V9H13Z"},child:[]}]})(e)}function EG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20C20.5523 3 21 3.44772 21 4V20ZM19 11V5H13.001V7H15L12 10L9 7H11V5H5V11H7V13H5V19H11V17H9L12 14L15 17H13.001V19H19V13H17V11H19ZM11 13H9V11H11V13ZM15 13H13V11H15V13Z"},child:[]}]})(e)}function gS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 4H3V6H21V4ZM21 11H8V13H21V11ZM21 18H8V20H21V18ZM5 11H3V20H5V11Z"},child:[]}]})(e)}function xG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17.1538 14C17.3846 14.5161 17.5 15.0893 17.5 15.7196C17.5 17.0625 16.9762 18.1116 15.9286 18.867C14.8809 19.6223 13.4335 20 11.5862 20C9.94674 20 8.32335 19.6185 6.71592 18.8555V16.6009C8.23538 17.4783 9.7908 17.917 11.3822 17.917C13.9333 17.917 15.2128 17.1846 15.2208 15.7196C15.2208 15.0939 15.0049 14.5598 14.5731 14.1173C14.5339 14.0772 14.4939 14.0381 14.4531 14H3V12H21V14H17.1538ZM13.076 11H7.62908C7.4566 10.8433 7.29616 10.6692 7.14776 10.4778C6.71592 9.92084 6.5 9.24559 6.5 8.45207C6.5 7.21602 6.96583 6.165 7.89749 5.299C8.82916 4.43299 10.2706 4 12.2219 4C13.6934 4 15.1009 4.32808 16.4444 4.98426V7.13591C15.2448 6.44921 13.9293 6.10587 12.4978 6.10587C10.0187 6.10587 8.77917 6.88793 8.77917 8.45207C8.77917 8.87172 8.99709 9.23796 9.43293 9.55079C9.86878 9.86362 10.4066 10.1135 11.0463 10.3004C11.6665 10.4816 12.3431 10.7148 13.076 11H13.076Z"},child:[]}]})(e)}function CG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 10V14H19V10H13ZM11 10H5V14H11V10ZM13 19H19V16H13V19ZM11 19V16H5V19H11ZM13 5V8H19V5H13ZM11 5H5V8H11V5ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3Z"},child:[]}]})(e)}function Km(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 6V21H11V6H5V4H19V6H13Z"},child:[]}]})(e)}function kG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 3V12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12V3H18V12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12V3H8ZM4 20H20V22H4V20Z"},child:[]}]})(e)}function TG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"},child:[]}]})(e)}function wG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"},child:[]}]})(e)}function SG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 15V18H24V20H21V23H19V20H16V18H19V15H21ZM21.0082 3C21.556 3 22 3.44495 22 3.9934L22.0007 13.3417C21.3749 13.1204 20.7015 13 20 13V5H4L4.001 19L13.2929 9.70715C13.6528 9.34604 14.22 9.31823 14.6123 9.62322L14.7065 9.70772L18.2521 13.2586C15.791 14.0069 14 16.2943 14 19C14 19.7015 14.1204 20.3749 14.3417 21.0007L2.9918 21C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082ZM8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7Z"},child:[]}]})(e)}function vG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V5.757L19 7.757V5H5V13.1L9 9.1005L13.328 13.429L12.0012 14.7562L11.995 18.995L16.2414 19.0012L17.571 17.671L18.8995 19H19V16.242L21 14.242V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM21.7782 7.80761L23.1924 9.22183L15.4142 17L13.9979 16.9979L14 15.5858L21.7782 7.80761ZM15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7Z"},child:[]}]})(e)}function bS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 18V20H2V18H22ZM2 3.5L10 8.5L2 13.5V3.5ZM22 11V13H12V11H22ZM22 4V6H12V4H22Z"},child:[]}]})(e)}function AG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"},child:[]}]})(e)}function NG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z"},child:[]}]})(e)}function IG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"},child:[]}]})(e)}function MG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 4V6H15V4H9Z"},child:[]}]})(e)}function _G(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM9 11V17H11V11H9ZM13 11V17H15V11H13ZM9 4V6H15V4H9Z"},child:[]}]})(e)}function OG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 19H20V12H22V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V12H4V19ZM14 9H19L12 16L5 9H10V3H14V9Z"},child:[]}]})(e)}function RG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V12L17.206 8.207L11.2071 14.2071L9.79289 12.7929L15.792 6.793L12 3H21Z"},child:[]}]})(e)}function LG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10ZM19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z"},child:[]}]})(e)}function DG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11V13H19V11H5Z"},child:[]}]})(e)}function PG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM8 13C8 15.2091 9.79086 17 12 17C14.2091 17 16 15.2091 16 13H8ZM8 11C8.82843 11 9.5 10.3284 9.5 9.5C9.5 8.67157 8.82843 8 8 8C7.17157 8 6.5 8.67157 6.5 9.5C6.5 10.3284 7.17157 11 8 11ZM16 11C16.8284 11 17.5 10.3284 17.5 9.5C17.5 8.67157 16.8284 8 16 8C15.1716 8 14.5 8.67157 14.5 9.5C14.5 10.3284 15.1716 11 16 11Z"},child:[]}]})(e)}function Dy(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8 13H16C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13ZM8 11C7.17157 11 6.5 10.3284 6.5 9.5C6.5 8.67157 7.17157 8 8 8C8.82843 8 9.5 8.67157 9.5 9.5C9.5 10.3284 8.82843 11 8 11ZM16 11C15.1716 11 14.5 10.3284 14.5 9.5C14.5 8.67157 15.1716 8 16 8C16.8284 8 17.5 8.67157 17.5 9.5C17.5 10.3284 16.8284 11 16 11Z"},child:[]}]})(e)}var Af;async function BG(){return Af||(Af=(async()=>{let[e,t]=await Promise.all([Qi(()=>import("./module-RjUF93sV.js"),[]),Qi(()=>import("./native-48B9X9Wg.js"),[])]),n="default"in e?e.default:e,r="default"in t?t.default:t;return await n.init({data:r}),{emojiMart:n,emojiData:r}})(),Af)}function FG(e){let t=C.useRef(null),n=C.useRef(null);return n.current&&n.current.update(e),C.useEffect(()=>((async()=>{let{emojiMart:r}=await BG();n.current=new r.Picker({...e,ref:t})})(),()=>{n.current=null}),[]),Re.createElement("div",{ref:t})}var Py=e=>{let[t,n]=C.useState(!1),r=fe(),o=Nr(),i=o.editor?.portalElement;if(!i)throw Error("Portal root not found");return E.jsxs(r.Generic.Popover.Root,{open:t,portalRoot:i,children:[E.jsx(r.Generic.Popover.Trigger,{children:E.jsx("div",{onClick:s=>{s.preventDefault(),s.stopPropagation(),n(!t),e.onOpenChange?.(!t)},style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.children})}),E.jsx(r.Generic.Popover.Content,{className:"bn-emoji-picker-popover",variant:"panel-popover",children:E.jsx(FG,{perLine:7,onClickOutside:()=>{n(!1),e.onOpenChange?.(!1)},onEmojiSelect:s=>{e.onEmojiSelect(s),n(!1),e.onOpenChange?.(!1)},theme:o?.colorSchemePreference})})]})};function yS(e){return id([e]).get(e)}function id(e){let t=je(Jr).userStore,n=C.useCallback(()=>{let o=new Map;for(let i of e){let s=t.getUser(i);s&&o.set(i,s)}return o},[t,e]),r=C.useMemo(()=>({current:n()}),[n]);return C.useSyncExternalStore(C.useCallback(o=>{let i=t.subscribe(s=>{r.current=n(),o()});return t.loadUsers(e),i},[t,n,e,r]),()=>r.current)}var HG=e=>{let t=fe(),n=Se(),r=je(Jr),o=e.comment.reactions.find(l=>l.emoji===e.emoji);if(!o)throw Error("Trying to render reaction badge for non-existing reaction");let[i,s]=C.useState([]),a=id(i);return E.jsx(t.Generic.Badge.Root,{className:ut("bn-badge","bn-comment-reaction"),text:o.userIds.length.toString(),icon:o.emoji,isSelected:r.threadStore.auth.canDeleteReaction(e.comment,o.emoji),onClick:()=>e.onReactionSelect(o.emoji),onMouseEnter:()=>s(o.userIds),mainTooltip:n.comments.reactions.reacted_by,secondaryTooltip:`${Array.from(a.values()).map(l=>l.username).join(`
|
|
176
|
-
`)}`},o.emoji)},ES=({comment:e,thread:t,showResolveButton:n})=>{let r=je(Jr),o=Se(),i=Ym({initialContent:e.body,trailingBlock:!1,dictionary:{...o,placeholders:{emptyDocument:o.placeholders.edit_comment}},schema:r.commentEditorSchema||iS}),s=fe(),[a,l]=C.useState(!1),[c,u]=C.useState(!1),d=r.threadStore,f=C.useCallback(()=>{l(!0)},[]),h=C.useCallback(()=>{i.replaceBlocks(i.document,e.body),l(!1)},[i,e.body]),p=C.useCallback(async N=>{await d.updateComment({commentId:e.id,comment:{body:i.document},threadId:t.id}),l(!1)},[e,t.id,i,d]),g=C.useCallback(async()=>{await d.deleteComment({commentId:e.id,threadId:t.id})},[e,t.id,d]),y=C.useCallback(async N=>{d.auth.canAddReaction(e,N)?await d.addReaction({threadId:t.id,commentId:e.id,emoji:N}):d.auth.canDeleteReaction(e,N)&&await d.deleteReaction({threadId:t.id,commentId:e.id,emoji:N})},[d,e,t.id]),b=C.useCallback(async()=>{await d.resolveThread({threadId:t.id})},[t.id,d]),x=C.useCallback(async()=>{await d.unresolveThread({threadId:t.id})},[t.id,d]),k=yS(e.userId);if(!e.body)return null;let O,M=d.auth.canAddReaction(e),A=d.auth.canDeleteComment(e),D=d.auth.canUpdateComment(e),z=n&&(t.resolved?d.auth.canUnresolveThread(t):d.auth.canResolveThread(t));a||(O=E.jsxs(s.Generic.Toolbar.Root,{className:ut("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[M&&E.jsx(Py,{onEmojiSelect:N=>y(N.native),onOpenChange:u,children:E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.add_reaction,variant:"compact",children:E.jsx(Dy,{size:16})},"add-reaction")}),z&&(t.resolved?E.jsx(s.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:x,children:E.jsx(oG,{size:16})},"reopen"):E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.resolve,variant:"compact",onClick:b,children:E.jsx(IG,{size:16})},"resolve")),(A||D)&&E.jsxs(s.Generic.Menu.Root,{position:"bottom-start",children:[E.jsx(s.Generic.Menu.Trigger,{children:E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.more_actions,variant:"compact",children:E.jsx(LG,{size:16})},"more-actions")}),E.jsxs(s.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[D&&E.jsx(s.Generic.Menu.Item,{icon:E.jsx(iG,{}),onClick:f,children:o.comments.actions.edit_comment},"edit-comment"),A&&E.jsx(s.Generic.Menu.Item,{icon:E.jsx(_G,{}),onClick:g,children:o.comments.actions.delete_comment},"delete-comment")]})]})]}));let Y=e.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!e.body)throw Error("soft deletes are not yet supported");return E.jsx(s.Comments.Comment,{authorInfo:k??"loading",timeString:Y,edited:e.updatedAt.getTime()!==e.createdAt.getTime(),showActions:"hover",actions:O,className:"bn-thread-comment",emojiPickerOpen:c,children:E.jsx(oS,{autoFocus:a,editor:i,editable:a,actions:e.reactions.length>0||a?({isEmpty:N})=>E.jsxs(E.Fragment,{children:[e.reactions.length>0&&!a&&E.jsxs(s.Generic.Badge.Group,{className:ut("bn-badge-group","bn-comment-reactions"),children:[e.reactions.map(K=>E.jsx(HG,{comment:e,emoji:K.emoji,onReactionSelect:y},K.emoji)),M&&E.jsx(Py,{onEmojiSelect:K=>y(K.native),onOpenChange:u,children:E.jsx(s.Generic.Badge.Root,{className:ut("bn-badge","bn-comment-add-reaction"),text:"+",icon:E.jsx(Dy,{size:16}),mainTooltip:o.comments.actions.add_reaction})})]}),a&&E.jsxs(s.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:[E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.save_button_text,variant:"compact",onClick:p,isDisabled:N,children:o.comments.save_button_text}),E.jsx(s.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:o.comments.cancel_button_text,variant:"compact",onClick:h,children:o.comments.cancel_button_text})]})]}):void 0})})},xS=({thread:e,maxCommentsBeforeCollapse:t})=>{let n=fe(),r=Se(),o=id(e.resolvedBy?[e.resolvedBy]:[]),i=e.comments.map((s,a)=>E.jsx(ES,{thread:e,comment:s,showResolveButton:a===0},s.id+JSON.stringify(s.body||"{}")));if(e.resolved&&e.resolvedUpdatedAt&&e.resolvedBy){if(!o.get(e.resolvedBy))throw Error(`User ${e.resolvedBy} resolved thread ${e.id}, but their data could not be found.`);let s=e.comments.findLastIndex(a=>e.resolvedUpdatedAt.getTime()>a.createdAt.getTime())+1;i.splice(s,0,E.jsx(n.Comments.Comment,{className:"bn-thread-comment",authorInfo:e.resolvedBy&&o.get(e.resolvedBy)||"loading",timeString:e.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:E.jsx("div",{className:"bn-resolved-text",children:r.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return t&&i.length>t&&i.splice(1,i.length-2,E.jsx(n.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:r.comments.sidebar.more_replies(e.comments.length-2)},"expand-prompt")),i},Qm=({thread:e,selected:t,referenceText:n,maxCommentsBeforeCollapse:r,onFocus:o,onBlur:i,tabIndex:s})=>{let a=fe(),l=Se(),c=je(Jr),u=Ym({trailingBlock:!1,dictionary:{...l,placeholders:{emptyDocument:l.placeholders.comment_reply}},schema:c.commentEditorSchema||iS}),d=C.useCallback(async()=>{await c.threadStore.addComment({comment:{body:u.document},threadId:e.id}),u.removeBlocks(u.document)},[c,u,e.id]);return E.jsxs(a.Comments.Card,{className:"bn-thread",headerText:n,onFocus:o,onBlur:i,selected:t,tabIndex:s,children:[E.jsx(a.Comments.CardSection,{className:"bn-thread-comments",children:E.jsx(xS,{thread:e,maxCommentsBeforeCollapse:t?void 0:r||5})}),t&&E.jsx(a.Comments.CardSection,{className:"bn-thread-composer",children:E.jsx(oS,{autoFocus:!1,editable:!0,editor:u,actions:({isEmpty:f})=>f?null:E.jsx(a.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:E.jsx(a.Generic.Toolbar.Button,{mainTooltip:l.comments.save_button_text,variant:"compact",isDisabled:f,onClick:d,children:l.comments.save_button_text})})})})]})};function CS(){let e=je(Jr).threadStore,t=C.useRef(void 0);return t.current||=e.getThreads(),C.useSyncExternalStore(C.useCallback(n=>e.subscribe(r=>{t.current=r,n()}),[e]),()=>t.current)}var UG=Yq({default:()=>kS});function kS(e){let t=be(),n=je(Jr),r=rt(Jr,{editor:t,selector:l=>l.selectedThreadId?{id:l.selectedThreadId,position:l.threadPositions.get(l.selectedThreadId)}:void 0}),o=CS(),i=C.useMemo(()=>r?o.get(r.id):void 0,[r,o]),s=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:(l,c,u)=>{u==="escape-key"&&t.focus(),l||n.selectThread(void 0)},placement:"bottom",middleware:[qr(10),xu(),Cu()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:30},...e.floatingUIOptions?.elementProps}}),[n,t,e.floatingUIOptions,r]),a=e.floatingThread||Qm;return E.jsx(rS,{position:r?.position,...s,children:i&&E.jsx(a,{thread:i,selected:!0})})}const VG=Object.freeze(Object.defineProperty({__proto__:null,a:xS,c:id,i:Qm,n:UG,o:ES,r:CS,s:yS,t:kS},Symbol.toStringTag,{value:"Module"}));function $G(e){return he({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z"},child:[]},{tag:"path",attr:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z"},child:[]}]})(e)}function TS(e){return he({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(e)}function jG(e){return he({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(e)}var zG=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},WG=({contentComponent:e})=>{const t=Mv.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(t)})};function qG(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Iv.createPortal(r.reactElement,r.element,n)},e.forEach(o=>o())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(o=>o())}}}var GG=class extends Re.Component{constructor(e){var t;super(e),this.editorContentRef=Re.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=e.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),t.contentComponent=qG(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return E.jsxs(E.Fragment,{children:[E.jsx("div",{ref:zG(t,this.editorContentRef),...n}),e?.contentComponent&&E.jsx(WG,{contentComponent:e.contentComponent})]})}},YG=C.forwardRef((e,t)=>{const n=Re.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return Re.createElement(GG,{key:n,innerRef:t,...e})}),KG=Re.memo(YG),wS=C.createContext({editor:null});wS.Consumer;var SS=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),vS=()=>C.useContext(SS),QG=Re.forwardRef((e,t)=>{const{onDragStart:n}=vS(),r=e.as||"div";return E.jsx(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function By(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function Fy(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.forward_ref)"||e.$$typeof.description==="react.forward_ref"))}function XG(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.memo)"||e.$$typeof.description==="react.memo"))}function ZG(e){if(By(e)||Fy(e))return!0;if(XG(e)){const t=e.type;if(t)return By(t)||Fy(t)}return!1}function JG(){try{if(C.version)return parseInt(C.version.split(".")[0],10)>=19}catch{}return!1}var eY=class{constructor(e,{editor:t,props:n={},as:r="div",className:o=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?Xr.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;const t=this.component,n=this.props,r=this.editor,o=JG(),i=ZG(t),s={...n};s.ref&&!(o||i)&&delete s.ref,!s.ref&&(o||i)&&(s.ref=a=>{this.ref=a}),this.reactElement=E.jsx(t,{...s}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){this.destroyed||(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;const t=this.editor;(e=t?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};Re.createContext({markViewContentRef:()=>{}});var tY=class extends YR{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,o){var i;return r==="storage"?(i=e.storage[t.name])!=null?i:{}:Reflect.get(n,r,o)}})}return this.cachedExtensionWithSyncedStorage}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:C.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},o=this.component,i=C.memo(l=>E.jsx(SS.Provider,{value:r,children:C.createElement(o,l)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new eY(i,{editor:this.editor,props:e,as:s,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!((e=this.renderer.element.firstElementChild)!=null&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:e,to:t}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:i,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,n=ya(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function nY(e,t){return n=>n.editor.contentComponent?new tY(e,n,t):{}}var Xm=C.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Xm.displayName="TiptapContext";var rY=()=>C.useContext(Xm);function AS({editor:e,instance:t,children:n}){const r=e??t;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=C.useMemo(()=>({editor:r}),[r]),i=C.useMemo(()=>({editor:r}),[r]);return E.jsx(wS.Provider,{value:i,children:E.jsx(Xm.Provider,{value:o,children:n})})}AS.displayName="Tiptap";function NS({...e}){const{editor:t}=rY();return E.jsx(KG,{editor:t,...e})}NS.displayName="Tiptap.Content";Object.assign(AS,{Content:NS});var IS=e=>{let{blockId:t,children:n,...r}=e,o=be();return E.jsx(mr,{reference:C.useMemo(()=>o.transact(i=>{if(!t)return;let s=cn(t,i.doc);if(!s)return;let{node:a}=o.prosemirrorView.domAtPos(s.posBeforeNode+1);if(a instanceof Element)return{element:a}}),[o,t]),...r,children:t!==void 0&&n})},oY=e=>{let t=fe(),n=Se(),r=be(),o=r.getBlock(e.blockId),[i,s]=C.useState(""),a=C.useCallback(u=>{s(u.currentTarget.value)},[]),l=C.useCallback(u=>{u.key==="Enter"&&!u.nativeEvent.isComposing&&(u.preventDefault(),r.updateBlock(o.id,{props:{name:k1(i),url:i}}))},[r,o.id,i]),c=C.useCallback(()=>{r.updateBlock(o.id,{props:{name:k1(i),url:i}})},[r,o.id,i]);return E.jsxs(t.FilePanel.TabPanel,{className:"bn-tab-panel",children:[E.jsx(t.FilePanel.TextInput,{className:"bn-text-input",placeholder:n.file_panel.embed.url_placeholder,value:i,onChange:a,onKeyDown:l,"data-test":"embed-input"}),E.jsx(t.FilePanel.Button,{className:"bn-button",onClick:c,"data-test":"embed-input-button",children:n.file_panel.embed.embed_button[o.type]||n.file_panel.embed.embed_button.file})]})},iY=e=>{let t=fe(),n=Se(),{setLoading:r}=e,o=be(),i=o.getBlock(e.blockId),[s,a]=C.useState(!1);C.useEffect(()=>{s&&setTimeout(()=>{a(!1)},3e3)},[s]);let l=C.useCallback(d=>{if(d===null)return;async function f(h){if(r(!0),o.uploadFile!==void 0)try{let p=await o.uploadFile(h,e.blockId);typeof p=="string"&&(p={props:{name:h.name,url:p}}),o.updateBlock(e.blockId,p)}catch{a(!0)}finally{r(!1)}}f(d)},[e.blockId,o,r]),c=o.schema.blockSpecs[i.type],u=c.implementation.meta?.fileBlockAccept?.length?c.implementation.meta.fileBlockAccept.join(","):"*/*";return E.jsxs(t.FilePanel.TabPanel,{className:"bn-tab-panel",children:[E.jsx(t.FilePanel.FileInput,{className:"bn-file-input","data-test":"upload-input",accept:u,placeholder:n.file_panel.upload.file_placeholder[i.type]||n.file_panel.upload.file_placeholder.file,value:null,onChange:l}),s&&E.jsx("div",{className:"bn-error-text",children:n.file_panel.upload.upload_error})]})},MS=e=>{let t=fe(),n=Se(),r=be(),[o,i]=C.useState(!1),s=e.tabs??[...r.uploadFile===void 0?[]:[{name:n.file_panel.upload.title,tabPanel:E.jsx(iY,{blockId:e.blockId,setLoading:i})}],{name:n.file_panel.embed.title,tabPanel:E.jsx(oY,{blockId:e.blockId})}],[a,l]=C.useState(e.defaultOpenTab||s[0].name);return E.jsx(t.FilePanel.Root,{className:"bn-panel",defaultOpenTab:a,openTab:a,setOpenTab:l,tabs:s,loading:o})},sY=e=>{let t=be(),n=je(rr),r=rt(rr),o=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:(s,a,l)=>{s||n.closeMenu(),l==="escape-key"&&t.focus()},middleware:[qr(10),Cu()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:90},...e.floatingUIOptions?.elementProps}}),[r,t,n,e.floatingUIOptions]),i=e.filePanel||MS;return E.jsx(IS,{blockId:r,...o,children:r&&E.jsx(i,{blockId:r})})},aY={bold:fG,italic:gG,underline:kG,strike:xG,code:sG};function lY(e,t){return e in t.schema.styleSchema&&t.schema.styleSchema[e].type===e&&t.schema.styleSchema[e].propSchema==="boolean"}var Al=e=>{let t=Se(),n=fe(),r=be(),o=jt({editor:r,selector:({editor:a})=>{if(!(!a.isEditable||!lY(e.basicTextStyle,a)||!(a.getSelection()?.blocks||[a.getTextCursorPosition().block]).find(l=>l.content!==void 0)))return e.basicTextStyle in a.getActiveStyles()?{active:!0}:{active:!1}}}),i=C.useCallback(a=>{r.focus(),r.toggleStyles({[a]:!0})},[r,e]);if(o===void 0)return null;let s=aY[e.basicTextStyle];return E.jsx(n.FormattingToolbar.Button,{className:"bn-button","data-test":e.basicTextStyle,onClick:()=>i(e.basicTextStyle),isSelected:o.active,label:t.formatting_toolbar[e.basicTextStyle].tooltip,mainTooltip:t.formatting_toolbar[e.basicTextStyle].tooltip,secondaryTooltip:Bn(t.formatting_toolbar[e.basicTextStyle].secondary_tooltip,t.generic.ctrl_shortcut),icon:E.jsx(s,{})})},op=e=>{let t=e.textColor||"default",n=e.backgroundColor||"default",r=e.size||16,o=C.useMemo(()=>({pointerEvents:"none",fontSize:(r*.75).toString()+"px",height:r.toString()+"px",lineHeight:r.toString()+"px",textAlign:"center",width:r.toString()+"px"}),[r]);return E.jsx("div",{className:"bn-color-icon","data-background-color":n,"data-text-color":t,style:o,children:"A"})},Hy=["default","gray","brown","red","orange","yellow","green","blue","purple","pink"],sd=e=>{let t=fe(),n=Se();return E.jsxs(E.Fragment,{children:[E.jsx(()=>e.text?E.jsxs(E.Fragment,{children:[E.jsx(t.Generic.Menu.Label,{children:n.color_picker.text_title}),Hy.map(r=>E.jsx(t.Generic.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.text.setColor(r)},"data-test":"text-color-"+r,icon:E.jsx(op,{textColor:r,size:e.iconSize}),checked:e.text.color===r,children:n.color_picker.colors[r]},"text-color-"+r))]}):null,{}),E.jsx(()=>e.background?E.jsxs(E.Fragment,{children:[E.jsx(t.Generic.Menu.Label,{children:n.color_picker.background_title}),Hy.map(r=>E.jsx(t.Generic.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.background.setColor(r)},"data-test":"background-color-"+r,icon:E.jsx(op,{backgroundColor:r,size:e.iconSize}),checked:e.background.color===r,children:n.color_picker.colors[r]},"background-color-"+r))]}):null,{})]})};function Nl(e,t){return`${e}Color`in t.schema.styleSchema&&t.schema.styleSchema[`${e}Color`].type===`${e}Color`&&t.schema.styleSchema[`${e}Color`].propSchema==="string"}var cY=()=>{let e=fe(),t=Se(),n=be(),r=Nl("text",n),o=Nl("background",n),i=jt({editor:n,selector:({editor:l})=>{if(!l.isEditable||!(l.getSelection()?.blocks||[l.getTextCursorPosition().block]).find(d=>d.content!==void 0))return;let c=Nl("text",l),u=Nl("background",l);if(!(!c&&!u))return{textColor:c?l.getActiveStyles().textColor||"default":void 0,backgroundColor:u?l.getActiveStyles().backgroundColor||"default":void 0}}}),s=C.useCallback(l=>{if(!r)throw Error("Tried to set text color, but style does not exist in editor schema.");l==="default"?n.removeStyles({textColor:l}):n.addStyles({textColor:l}),setTimeout(()=>{n.focus()})},[n,r]),a=C.useCallback(l=>{if(!o)throw Error("Tried to set background color, but style does not exist in editor schema.");l==="default"?n.removeStyles({backgroundColor:l}):n.addStyles({backgroundColor:l}),setTimeout(()=>{n.focus()})},[o,n]);return i===void 0?null:E.jsxs(e.Generic.Menu.Root,{children:[E.jsx(e.Generic.Menu.Trigger,{children:E.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"colors",label:t.formatting_toolbar.colors.tooltip,mainTooltip:t.formatting_toolbar.colors.tooltip,icon:E.jsx(op,{textColor:i.textColor,backgroundColor:i.backgroundColor,size:20})})}),E.jsx(e.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{text:i.textColor?{color:i.textColor,setColor:s}:void 0,background:i.backgroundColor?{color:i.backgroundColor,setColor:a}:void 0})})]})},Uy=e=>{for(let t of hw)if(e.startsWith(t))return e;return`${pw}://${e}`},_S=e=>{let t=fe(),n=Se(),{editLink:r}=je(ja),{url:o,text:i,showTextField:s}=e,[a,l]=C.useState(o),[c,u]=C.useState(i);C.useEffect(()=>{l(o),u(i)},[i,o]);let d=C.useCallback(g=>{g.key==="Enter"&&!g.nativeEvent.isComposing&&(g.preventDefault(),r(Uy(a),c,e.range.from),e.setToolbarOpen?.(!1),e.setToolbarPositionFrozen?.(!1))},[r,a,c,e]),f=C.useCallback(g=>l(g.currentTarget.value),[]),h=C.useCallback(g=>u(g.currentTarget.value),[]),p=C.useCallback(()=>{r(Uy(a),c,e.range.from),e.setToolbarOpen?.(!1),e.setToolbarPositionFrozen?.(!1)},[r,a,c,e]);return E.jsxs(t.Generic.Form.Root,{children:[E.jsx(t.Generic.Form.TextInput,{className:"bn-text-input",name:"url",icon:E.jsx(fS,{}),autoFocus:!0,placeholder:n.link_toolbar.form.url_placeholder,value:a,onKeyDown:d,onChange:f,onSubmit:p}),s!==!1&&E.jsx(t.Generic.Form.TextInput,{className:"bn-text-input",name:"title",icon:E.jsx(Km,{}),placeholder:n.link_toolbar.form.title_placeholder,value:c,onKeyDown:d,onChange:h,onSubmit:p})]})};function uY(e){return"link"in e.schema.inlineContentSchema&&e.schema.inlineContentSchema.link==="link"}var dY=()=>{let e=be(),t=fe(),n=Se(),r=je(Lo),{showSelection:o}=je(va),[i,s]=C.useState(!1);C.useEffect(()=>(o(i,"createLinkButton"),()=>o(!1,"createLinkButton")),[i,o]);let a=jt({editor:e,selector:({editor:l})=>{if(!(!l.isEditable||!uY(l)||Th(l.prosemirrorState.selection)||!(l.getSelection()?.blocks||[l.getTextCursorPosition().block]).find(c=>c.content!==void 0)))return{url:l.getSelectedLinkUrl(),text:l.getSelectedText(),range:{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}}}});return C.useEffect(()=>{s(!1)},[a]),C.useEffect(()=>{let l=u=>{(u.ctrlKey||u.metaKey)&&u.key==="k"&&(s(!0),u.preventDefault())},c=e.domElement;return c?.addEventListener("keydown",l),()=>{c?.removeEventListener("keydown",l)}},[e.domElement]),a===void 0?null:E.jsxs(t.Generic.Popover.Root,{open:i,onOpenChange:s,children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"createLink",label:n.formatting_toolbar.link.tooltip,mainTooltip:n.formatting_toolbar.link.tooltip,secondaryTooltip:Bn(n.formatting_toolbar.link.secondary_tooltip,n.generic.ctrl_shortcut),icon:E.jsx(fS,{}),onClick:()=>s(l=>!l)})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(_S,{url:a.url||"",text:a.text,range:a.range,showTextField:!1,setToolbarOpen:l=>r.store.setState(l)})})]})},fY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:l})=>{if(!l.isEditable)return;let c=l.getSelection()?.blocks||[l.getTextCursorPosition().block];if(c.length!==1)return;let u=c[0];if(En(u,l,u.type,{url:"string",caption:"string"}))return u}}),[o,i]=C.useState();C.useEffect(()=>{r!==void 0&&i(r.props.caption)},[r]);let s=C.useCallback(l=>i(l.currentTarget.value),[]),a=C.useCallback(l=>{r!==void 0&&it(n,r.type,{caption:"string"})&&l.key==="Enter"&&!l.nativeEvent.isComposing&&(l.preventDefault(),n.updateBlock(r.id,{props:{caption:o}}))},[r,o,n]);return r===void 0?null:E.jsxs(t.Generic.Popover.Root,{children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_caption.tooltip,mainTooltip:e.formatting_toolbar.file_caption.tooltip,icon:E.jsx(Ly,{})})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(t.Generic.Form.Root,{children:E.jsx(t.Generic.Form.TextInput,{name:"file-caption",icon:E.jsx(Ly,{}),value:o||"",autoFocus:!0,placeholder:e.formatting_toolbar.file_caption.input_placeholder,onKeyDown:a,onChange:s})})})]})},hY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!i.isEditable)return;let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(En(a,i,a.type,{url:"string"}))return a}}),o=C.useCallback(()=>{r!==void 0&&(n.focus(),n.removeBlocks([r.id]))},[r,n]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_delete.tooltip[r.type]||e.formatting_toolbar.file_delete.tooltip.file,mainTooltip:e.formatting_toolbar.file_delete.tooltip[r.type]||e.formatting_toolbar.file_delete.tooltip.file,icon:E.jsx(MG,{}),onClick:o})},pY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:l})=>{if(!l.isEditable)return;let c=l.getSelection()?.blocks||[l.getTextCursorPosition().block];if(c.length!==1)return;let u=c[0];if(En(u,l,u.type,{url:"string",name:"string"}))return u}}),[o,i]=C.useState();C.useEffect(()=>{r!==void 0&&i(r.props.name)},[r]);let s=C.useCallback(l=>i(l.currentTarget.value),[]),a=C.useCallback(l=>{r!==void 0&&it(n,r.type,{name:"string"})&&l.key==="Enter"&&!l.nativeEvent.isComposing&&(l.preventDefault(),n.updateBlock(r.id,{props:{name:o}}))},[r,o,n]);return r===void 0?null:E.jsxs(t.Generic.Popover.Root,{children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_rename.tooltip[r.type]||e.formatting_toolbar.file_rename.tooltip.file,mainTooltip:e.formatting_toolbar.file_rename.tooltip[r.type]||e.formatting_toolbar.file_rename.tooltip.file,icon:E.jsx(Ry,{})})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(t.Generic.Form.Root,{children:E.jsx(t.Generic.Form.TextInput,{name:"file-name",icon:E.jsx(Ry,{}),value:o||"",autoFocus:!0,placeholder:e.formatting_toolbar.file_rename.input_placeholder[r.type]||e.formatting_toolbar.file_rename.input_placeholder.file,onKeyDown:a,onChange:s})})})]})},mY=()=>{let e=Se(),t=fe(),n=jt({editor:be(),selector:({editor:r})=>{if(!r.isEditable)return;let o=r.getSelection()?.blocks||[r.getTextCursorPosition().block];if(o.length!==1)return;let i=o[0];if(En(i,r,i.type,{url:"string"}))return i}});return n===void 0?null:E.jsxs(t.Generic.Popover.Root,{position:"bottom",children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",mainTooltip:e.formatting_toolbar.file_replace.tooltip[n.type]||e.formatting_toolbar.file_replace.tooltip.file,label:e.formatting_toolbar.file_replace.tooltip[n.type]||e.formatting_toolbar.file_replace.tooltip.file,icon:E.jsx(vG,{})})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-panel-popover",variant:"panel-popover",children:E.jsx(MS,{blockId:n.id})})]})},gY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!(!i.isEditable||!(i.getSelection()?.blocks||[i.getTextCursorPosition().block]).find(s=>s.content!==void 0)))return{canNestBlock:i.canNestBlock()}}}),o=C.useCallback(()=>{r!==void 0&&r.canNestBlock&&(n.focus(),n.nestBlock())},[n,r]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"nestBlock",onClick:o,isDisabled:!r.canNestBlock,label:e.formatting_toolbar.nest.tooltip,mainTooltip:e.formatting_toolbar.nest.tooltip,secondaryTooltip:Bn(e.formatting_toolbar.nest.secondary_tooltip,e.generic.ctrl_shortcut),icon:E.jsx(mG,{})})},bY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!(!i.isEditable||!(i.getSelection()?.blocks||[i.getTextCursorPosition().block]).find(s=>s.content!==void 0)))return{canUnnestBlock:i.canUnnestBlock()}}}),o=C.useCallback(()=>{r!==void 0&&r.canUnnestBlock&&(n.focus(),n.unnestBlock())},[n,r]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"unnestBlock",onClick:o,isDisabled:!r.canUnnestBlock,label:e.formatting_toolbar.unnest.tooltip,mainTooltip:e.formatting_toolbar.unnest.tooltip,secondaryTooltip:Bn(e.formatting_toolbar.unnest.secondary_tooltip,e.generic.ctrl_shortcut),icon:E.jsx(pG,{})})},yY=e=>[{name:e.slash_menu.paragraph.title,type:"paragraph",icon:Km},{name:e.slash_menu.heading.title,type:"heading",props:{level:1,isToggleable:!1},icon:lu},{name:e.slash_menu.heading_2.title,type:"heading",props:{level:2,isToggleable:!1},icon:cu},{name:e.slash_menu.heading_3.title,type:"heading",props:{level:3,isToggleable:!1},icon:uu},{name:e.slash_menu.heading_4.title,type:"heading",props:{level:4,isToggleable:!1},icon:cS},{name:e.slash_menu.heading_5.title,type:"heading",props:{level:5,isToggleable:!1},icon:uS},{name:e.slash_menu.heading_6.title,type:"heading",props:{level:6,isToggleable:!1},icon:dS},{name:e.slash_menu.toggle_heading.title,type:"heading",props:{level:1,isToggleable:!0},icon:lu},{name:e.slash_menu.toggle_heading_2.title,type:"heading",props:{level:2,isToggleable:!0},icon:cu},{name:e.slash_menu.toggle_heading_3.title,type:"heading",props:{level:3,isToggleable:!0},icon:uu},{name:e.slash_menu.quote.title,type:"quote",icon:gS},{name:e.slash_menu.toggle_list.title,type:"toggleListItem",icon:bS},{name:e.slash_menu.bullet_list.title,type:"bulletListItem",icon:mS},{name:e.slash_menu.numbered_list.title,type:"numberedListItem",icon:pS},{name:e.slash_menu.check_list.title,type:"checkListItem",icon:hS}],EY=e=>{let t=fe(),n=be(),r=jt({editor:n,selector:({editor:a})=>a.getSelection()?.blocks||[a.getTextCursorPosition().block]}),o=r[0],i=C.useMemo(()=>(e.items||yY(n.dictionary)).filter(a=>it(n,a.type,Object.fromEntries(Object.entries(a.props||{}).map(([l,c])=>[l,typeof c])))),[n,e.items]),s=C.useMemo(()=>i.map(a=>{let l=a.icon,c=a.type===o.type,u=Object.entries(a.props||{}).filter(([d,f])=>f!==o.props[d]).length===0;return{text:a.name,icon:E.jsx(l,{size:16}),onClick:()=>{n.focus(),n.transact(()=>{for(let d of r)n.updateBlock(d,{type:a.type,props:a.props})})},isSelected:c&&u}}),[n,i,o.props,o.type,r]);return!C.useMemo(()=>s.find(a=>a.isSelected)!==void 0,[s])||!n.isEditable?null:E.jsx(t.FormattingToolbar.Select,{className:"bn-select",items:s})},xY=()=>{let e=Se(),t=fe(),n=je("comments"),{store:r}=je(Lo),o=C.useCallback(()=>{n.startPendingComment(),r.setState(!1)},[n,r]);return E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.comment.tooltip,mainTooltip:e.formatting_toolbar.comment.tooltip,icon:E.jsx(lS,{}),onClick:o})},CY=()=>be().getExtension("comments")?E.jsx(xY,{}):null,kY=()=>{let e=Se(),t=fe(),n=be(),r=C.useCallback(()=>{n._tiptapEditor.chain().focus().addPendingComment().run()},[n]);return!n._tiptapEditor.commands.addPendingComment||!n.isEditable?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.comment.tooltip,mainTooltip:e.formatting_toolbar.comment.tooltip,icon:E.jsx(lS,{}),onClick:r})};function ip(e,t){try{let n=new URL(e,t);if(n.protocol!=="javascript:")return n.href}catch{}return"#"}var TY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(En(a,i,a.type,{url:"string"}))return a}}),o=C.useCallback(()=>{r!==void 0&&(n.focus(),n.resolveFileUrl?n.resolveFileUrl(r.props.url).then(i=>window.open(ip(i,window.location.href))):window.open(ip(r.props.url,window.location.href)))},[r,n]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_download.tooltip[r.type]||e.formatting_toolbar.file_download.tooltip.file,mainTooltip:e.formatting_toolbar.file_download.tooltip[r.type]||e.formatting_toolbar.file_download.tooltip.file,icon:E.jsx(OG,{}),onClick:o})},wY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!i.isEditable)return;let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(En(a,i,a.type,{url:"string",showPreview:"boolean"}))return a}}),o=C.useCallback(()=>{r!==void 0&&it(n,r.type,{showPreview:"boolean"})&&n.updateBlock(r.id,{props:{showPreview:!r.props.showPreview}})},[r,n]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:"Toggle preview",mainTooltip:e.formatting_toolbar.file_preview_toggle.tooltip,icon:E.jsx(SG,{}),isSelected:r.props.showPreview,onClick:o})},SY=()=>{let e=Se(),t=fe(),n=be(),r=je(Je),o=jt({editor:n,selector:({editor:s})=>{if(!s.isEditable||!s.settings.tables.splitCells)return;let a=s.getSelection()?.blocks||[s.getTextCursorPosition().block];if(a.length!==1)return;let l=a[0];if(l.type==="table")return{mergeDirection:r.getMergeDirection(l)}}}),i=C.useCallback(()=>{r?.mergeCells()},[r]);return o===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.table_cell_merge.tooltip,mainTooltip:e.formatting_toolbar.table_cell_merge.tooltip,icon:o.mergeDirection==="horizontal"?E.jsx(yG,{}):E.jsx(EG,{}),onClick:i})},vY=()=>be().getExtension(Je)?E.jsx(SY,{}):null,AY={left:uG,center:lG,right:dG,justify:cG},Nf=e=>{let t=fe(),n=Se(),r=be(),o=jt({editor:r,selector:({editor:a})=>{if(!a.isEditable)return;let l=a.getSelection()?.blocks||[a.getTextCursorPosition().block],c=l[0];if(En(c,a,c.type,{textAlignment:Ue.textAlignment}))return{textAlignment:c.props.textAlignment,blocks:l};if(l.length===1&&En(c,a,"table"))return a.getExtension(Je)?.getCellSelection()?{textAlignment:Io(c.content.rows[0].cells[0]).props.textAlignment,blocks:[c]}:void 0}}),i=C.useCallback(a=>{if(o!==void 0){r.focus();for(let l of o.blocks)if(En(l,r,l.type,{textAlignment:Ue.textAlignment})&&it(r,l.type,{textAlignment:Ue.textAlignment}))r.updateBlock(l,{props:{textAlignment:a}});else if(l.type==="table"){let c=r.getExtension(Je)?.getCellSelection();if(!c)continue;let u=l.content.rows.map(d=>({...d,cells:d.cells.map(f=>Io(f))}));c.cells.forEach(({row:d,col:f})=>{u[d].cells[f].props.textAlignment=a}),r.updateBlock(l,{type:"table",content:{...l.content,type:"tableContent",rows:u}}),r.setTextCursorPosition(l)}}},[r,o]);if(o===void 0)return null;let s=AY[e.textAlignment];return E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":`alignText${e.textAlignment.slice(0,1).toUpperCase()+e.textAlignment.slice(1)}`,onClick:()=>i(e.textAlignment),isSelected:o.textAlignment===e.textAlignment,label:n.formatting_toolbar[`align_${e.textAlignment}`].tooltip,mainTooltip:n.formatting_toolbar[`align_${e.textAlignment}`].tooltip,icon:E.jsx(s,{})})},Zm=e=>[E.jsx(EY,{items:e},"blockTypeSelect"),E.jsx(vY,{},"tableCellMergeButton"),E.jsx(fY,{},"fileCaptionButton"),E.jsx(mY,{},"replaceFileButton"),E.jsx(pY,{},"fileRenameButton"),E.jsx(hY,{},"fileDeleteButton"),E.jsx(TY,{},"fileDownloadButton"),E.jsx(wY,{},"filePreviewButton"),E.jsx(Al,{basicTextStyle:"bold"},"boldStyleButton"),E.jsx(Al,{basicTextStyle:"italic"},"italicStyleButton"),E.jsx(Al,{basicTextStyle:"underline"},"underlineStyleButton"),E.jsx(Al,{basicTextStyle:"strike"},"strikeStyleButton"),E.jsx(Nf,{textAlignment:"left"},"textAlignLeftButton"),E.jsx(Nf,{textAlignment:"center"},"textAlignCenterButton"),E.jsx(Nf,{textAlignment:"right"},"textAlignRightButton"),E.jsx(cY,{},"colorStyleButton"),E.jsx(gY,{},"nestBlockButton"),E.jsx(bY,{},"unnestBlockButton"),E.jsx(dY,{},"createLinkButton"),E.jsx(CY,{},"addCommentButton"),E.jsx(kY,{},"addTiptapCommentButton")],Jm=e=>E.jsx(fe().FormattingToolbar.Root,{className:"bn-toolbar bn-formatting-toolbar",children:e.children||Zm(e.blockTypeSelectItems)}),NY=e=>{switch(e){case"left":return"top-start";case"center":return"top";case"right":return"top-end";default:return"top-start"}},eg=e=>{let t=be(),n=je(Lo,{editor:t}),r=rt(Lo,{editor:t}),o=jt({editor:t,selector:({editor:l})=>n.store.state?{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}:void 0}),i=jt({editor:t,selector:({editor:l})=>{let c=l.getTextCursorPosition().block;return En(c,l,c.type,{textAlignment:Ue.textAlignment})?NY(c.props.textAlignment):"top-start"}}),s=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:r,onOpenChange:(l,c,u)=>{n.store.setState(l),u==="escape-key"&&t.focus()},placement:i,middleware:[qr(10),xu(),Cu()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:40},...e.floatingUIOptions?.elementProps}}),[r,i,e.floatingUIOptions,n.store,t]),a=e.formattingToolbar||Jm;return E.jsx(rS,{position:o,...s,children:r&&E.jsx(a,{})})},OS=e=>{let t=fe(),n=Se(),{deleteLink:r}=je(ja);return E.jsx(t.LinkToolbar.Button,{className:"bn-button",label:n.link_toolbar.delete.tooltip,mainTooltip:n.link_toolbar.delete.tooltip,isSelected:!1,onClick:()=>{r(e.range.from),e.setToolbarOpen?.(!1)},icon:E.jsx(bG,{})})},RS=e=>{let t=fe(),n=Se();return E.jsxs(t.Generic.Popover.Root,{onOpenChange:e.setToolbarPositionFrozen,children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.edit.tooltip,isSelected:!1,children:n.link_toolbar.edit.text})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(_S,{url:e.url,text:e.text,range:e.range,setToolbarOpen:e.setToolbarOpen,setToolbarPositionFrozen:e.setToolbarPositionFrozen})})]})},IY=e=>{let t=fe(),n=Se();return E.jsx(t.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.open.tooltip,label:n.link_toolbar.open.tooltip,isSelected:!1,onClick:()=>{window.open(ip(e.url,window.location.href),"_blank")},icon:E.jsx(RG,{})})},LS=e=>E.jsx(fe().LinkToolbar.Root,{className:"bn-toolbar bn-link-toolbar",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(RS,{url:e.url,text:e.text,range:e.range,setToolbarOpen:e.setToolbarOpen,setToolbarPositionFrozen:e.setToolbarPositionFrozen}),E.jsx(IY,{url:e.url}),E.jsx(OS,{range:e.range,setToolbarOpen:e.setToolbarOpen})]})}),DS=e=>{let t=be(),[n,r]=C.useState(!1),[o,i]=C.useState(!1),s=je(ja),[a,l]=C.useState(void 0);C.useEffect(()=>{let f=()=>{let b=s.getLinkAtSelection();if(!b){l(void 0),o||r(!1);return}l({cursorType:"text",url:b.mark.attrs.href,text:b.text,range:b.range,element:s.getLinkElementAtPos(b.range.from)}),o||r(!0)},h=b=>{if(a!==void 0&&a.cursorType==="text"||!(b.target instanceof HTMLElement))return;let x=s.getLinkAtElement(b.target);x&&l({cursorType:"mouse",url:x.mark.attrs.href,text:x.text,range:x.range,element:s.getLinkElementAtPos(x.range.from)})},p=t.onChange(f),g=t.onSelectionChange(f),y=t.domElement;return y?.addEventListener("mouseover",h),()=>{p(),g(),y?.removeEventListener("mouseover",h)}},[t,t.domElement,s,a,o]);let c=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:n,onOpenChange:(f,h,p)=>{o||a!==void 0&&a.cursorType==="text"&&p==="hover"||(p==="escape-key"&&t.focus(),r(f))},placement:"top-start",middleware:[qr(10),Cu()],...e.floatingUIOptions?.useFloatingOptions},useHoverProps:{enabled:a!==void 0&&a.cursorType==="mouse",delay:{open:250,close:250},handleClose:VI(),...e.floatingUIOptions?.useHoverProps},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:50},...e.floatingUIOptions?.elementProps}}),[t,a,e.floatingUIOptions,n,o]),u=C.useMemo(()=>a?.element?{element:a.element}:void 0,[a?.element]);if(!t.isEditable)return null;let d=e.linkToolbar||LS;return E.jsx(mr,{reference:u,...c,children:a&&E.jsx(d,{url:a.url,text:a.text,range:a.range,setToolbarOpen:r,setToolbarPositionFrozen:i})})},MY=()=>{let e=fe(),t=Se(),n=be(),r=je(zn),o=rt(qn,{editor:n,selector:s=>s?.block}),i=C.useCallback(()=>{if(o===void 0)return;let s=o.content;if(s!==void 0&&Array.isArray(s)&&s.length===0)n.setTextCursorPosition(o),r.openSuggestionMenu("/");else{let a=n.insertBlocks([{type:"paragraph"}],o,"after")[0];n.setTextCursorPosition(a),r.openSuggestionMenu("/")}},[o,n,r]);return o===void 0?null:E.jsx(e.SideMenu.Button,{className:"bn-button",label:t.side_menu.add_block_label,icon:E.jsx($G,{size:24,onClick:i,"data-test":"dragHandleAdd"})})},_Y=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:o=>o?.block});return r===void 0||!En(r,n,r.type,{textColor:"string"})&&!En(r,n,r.type,{backgroundColor:"string"})?null:E.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[E.jsx(t.Generic.Menu.Trigger,{sub:!0,children:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children})}),E.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{iconSize:18,text:En(r,n,r.type,{textColor:"string"})&&it(n,r.type,{textColor:"string"})?{color:r.props.textColor,setColor:o=>n.updateBlock(r,{type:r.type,props:{textColor:o}})}:void 0,background:En(r,n,r.type,{backgroundColor:"string"})&&it(n,r.type,{backgroundColor:"string"})?{color:r.props.backgroundColor,setColor:o=>n.updateBlock(r,{props:{backgroundColor:o}})}:void 0})})]})},OY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:o=>o?.block});return r===void 0?null:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",onClick:()=>n.removeBlocks([r]),children:e.children})},RY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:i=>i?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;let o=!!r.content.headerRows;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:o,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerRows:o?void 0:1}})},children:e.children})},LY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:i=>i?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;let o=!!r.content.headerCols;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:o,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerCols:o?void 0:1}})},children:e.children})},DY=e=>{let t=fe(),n=Se();return E.jsx(t.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-drag-handle-menu",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(OY,{children:n.drag_handle.delete_menuitem}),E.jsx(_Y,{children:n.drag_handle.colors_menuitem}),E.jsx(RY,{children:n.drag_handle.header_row_menuitem}),E.jsx(LY,{children:n.drag_handle.header_column_menuitem})]})})},PY=e=>{let t=fe(),n=Se(),r=je(qn),o=rt(qn,{selector:s=>s?.block});if(o===void 0)return null;let i=e.dragHandleMenu||DY;return E.jsxs(t.Generic.Menu.Root,{onOpenChange:s=>{s?r.freezeMenu():r.unfreezeMenu()},position:"left",children:[E.jsx(t.Generic.Menu.Trigger,{children:E.jsx(t.SideMenu.Button,{label:n.side_menu.drag_handle_label,draggable:!0,onDragStart:s=>r.blockDragStart(s,o),onDragEnd:r.blockDragEnd,className:"bn-button",icon:E.jsx(TS,{size:24,"data-test":"dragHandle"})})}),E.jsx(i,{children:e.children})]})},BY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:i=>i?.block}),o=C.useMemo(()=>{if(r===void 0)return{};let i={"data-block-type":r.type};return r.type==="heading"&&(i["data-level"]=r.props.level.toString()),n.schema.blockSpecs[r.type].implementation.meta?.fileBlockAccept&&(r.props.url?i["data-url"]="true":i["data-url"]="false"),i},[r,n.schema.blockSpecs]);return E.jsx(t.SideMenu.Root,{className:"bn-side-menu",...o,children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(MY,{}),E.jsx(PY,{dragHandleMenu:e.dragHandleMenu})]})})},FY=e=>{let t=be(),{show:n,block:r}=rt(qn,{selector:a=>a===void 0?void 0:{show:a.show,block:a.block}})||{},o=C.useCallback((a,l,c)=>{let u=!1;return mp(a,l,()=>{if(!u){u=!0;return}t.getExtension(qn)?.hideMenuIfNotFrozen()},{ancestorScroll:!0,ancestorResize:!1,elementResize:!1,layoutShift:!1})},[t]),i=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:n,placement:"left-start",whileElementsMounted:o,...e.floatingUIOptions?.useFloatingOptions},useDismissProps:{enabled:!1,...e.floatingUIOptions?.useDismissProps},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:20},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,n,o]),s=e.sideMenu||BY;return E.jsx(IS,{blockId:n?r?.id:void 0,...i,children:r?.id&&E.jsx(s,{})})};async function HY(e,t){return(await GV(e,t)).map(({id:n,onItemClick:r})=>({id:n,onItemClick:r,icon:n}))}function UY(e){let t=fe(),n=Se(),{items:r,loadingState:o,selectedIndex:i,onItemClick:s,columns:a}=e,l=o==="loading-initial"||o==="loading"?E.jsx(t.GridSuggestionMenu.Loader,{className:"bn-grid-suggestion-menu-loader",columns:a}):null,c=C.useMemo(()=>{let u=[];for(let d=0;d<r.length;d++){let f=r[d];u.push(E.jsx(t.GridSuggestionMenu.Item,{className:"bn-grid-suggestion-menu-item",item:f,id:`bn-grid-suggestion-menu-item-${d}`,isSelected:d===i,onClick:()=>s?.(f)},f.id))}return u},[t,r,s,i]);return E.jsxs(t.GridSuggestionMenu.Root,{id:"bn-grid-suggestion-menu",columns:a,className:"bn-grid-suggestion-menu",children:[l,c,c.length===0&&e.loadingState==="loaded"&&E.jsx(t.GridSuggestionMenu.EmptyItem,{className:"bn-grid-suggestion-menu-empty-item",columns:a,children:n.suggestion_menu.no_items_title})]})}function PS(e,t,n,r=3){let o=C.useRef(0);C.useEffect(()=>{t!==void 0&&(e.length>0?o.current=t.length:t.length-o.current>r&&n())},[n,r,e.length,t])}function BS(e,t){let[n,r]=C.useState([]),[o,i]=C.useState(!1),s=C.useRef(void 0),a=C.useRef(void 0);return C.useEffect(()=>{let l=e;s.current=e,i(!0),t(e).then(c=>{s.current===l&&(r(c),i(!1),a.current=l)})},[e,t]),{items:n||[],usedQuery:a.current,loadingState:a.current===void 0?"loading-initial":o?"loading":"loaded"}}function VY(e,t,n,r,o){let[i,s]=C.useState(0),a=r!==void 0&&r>1;return C.useEffect(()=>{let l=u=>(u.key==="ArrowLeft"&&(u.preventDefault(),n.length&&s((i-1+n.length)%n.length)),u.key==="ArrowRight"&&(u.preventDefault(),n.length&&s((i+1+n.length)%n.length)),u.key==="ArrowUp"?(u.preventDefault(),n.length&&s((i-r+n.length)%n.length),!0):u.key==="ArrowDown"?(u.preventDefault(),n.length&&s((i+r)%n.length),!0):u.key==="Enter"&&!u.isComposing?(u.stopPropagation(),u.preventDefault(),n.length&&o?.(n[i]),!0):!1),c=e.domElement;return c?.addEventListener("keydown",l,!0),()=>{c?.removeEventListener("keydown",l,!0)}},[e.domElement,n,i,o,r,a]),C.useEffect(()=>{s(0)},[t]),{selectedIndex:n.length===0?void 0:i}}function $Y(e){let t=Nr().setContentEditableProps,n=be(),{getItems:r,gridSuggestionMenuComponent:o,query:i,clearQuery:s,closeMenu:a,onItemClick:l,columns:c}=e,u=C.useCallback(g=>{a(),s(),l?.(g)},[l,a,s]),{items:d,usedQuery:f,loadingState:h}=BS(i,r);PS(d,f,a);let{selectedIndex:p}=VY(n,i,d,c,u);return C.useEffect(()=>(t(g=>({...g,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{t(g=>({...g,"aria-expanded":!1,"aria-controls":void 0}))}),[t]),C.useEffect(()=>(t(g=>({...g,"aria-activedescendant":p?"bn-suggestion-menu-item-"+p:void 0})),()=>{t(g=>({...g,"aria-activedescendant":void 0}))}),[t,p]),E.jsx(o,{items:d,onItemClick:u,loadingState:h,selectedIndex:p,columns:c})}function jY(e){let t=be(),{triggerCharacter:n,gridSuggestionMenuComponent:r,columns:o,shouldOpen:i,minQueryLength:s,onItemClick:a,getItems:l}=e,c=C.useMemo(()=>a||(g=>{g.onItemClick(t)}),[t,a]),u=C.useMemo(()=>l||(async g=>await HY(t,g)),[t,l]),d=je(zn);C.useEffect(()=>{d.addSuggestionMenu({triggerCharacter:n,shouldOpen:i})},[d,n,i]);let f=rt(zn),h=rt(zn,{selector:g=>({element:t.domElement?.firstChild||void 0,getBoundingClientRect:()=>g?.referencePos||new DOMRect})}),p=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:f?.show&&f?.triggerCharacter===n,onOpenChange:g=>{g||d.closeMenu()},placement:"bottom-start",middleware:[qr(10),QE({allowedPlacements:["bottom-start","top-start"],padding:10}),xu(),rc({apply({elements:g,availableHeight:y}){g.floating.style.maxHeight=`${Math.max(0,y)}px`},padding:10})],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{onMouseDownCapture:g=>g.preventDefault(),style:{zIndex:70},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,f?.show,f?.triggerCharacter,d,n]);return!f||!f.ignoreQueryLength&&s&&(f.query.startsWith(" ")||f.query.length<s)?null:E.jsx(mr,{reference:h,...p,children:n&&E.jsx($Y,{query:f.query,closeMenu:d.closeMenu,clearQuery:d.clearQuery,getItems:u,columns:o,gridSuggestionMenuComponent:r||UY,onItemClick:c})})}function zY(e){let t=fe(),n=Se(),{items:r,loadingState:o,selectedIndex:i,onItemClick:s}=e,a=o==="loading-initial"||o==="loading"?E.jsx(t.SuggestionMenu.Loader,{className:"bn-suggestion-menu-loader"}):null,l=C.useMemo(()=>{let c,u=[];for(let d=0;d<r.length;d++){let f=r[d];f.group!==c&&(c=f.group,u.push(E.jsx(t.SuggestionMenu.Label,{className:"bn-suggestion-menu-label",children:c},c))),u.push(E.jsx(t.SuggestionMenu.Item,{className:ut("bn-suggestion-menu-item",f.size==="small"?"bn-suggestion-menu-item-small":""),item:f,id:`bn-suggestion-menu-item-${d}`,isSelected:d===i,onClick:()=>s?.(f)},f.title))}return u},[t,r,s,i]);return E.jsxs(t.SuggestionMenu.Root,{id:"bn-suggestion-menu",className:"bn-suggestion-menu",children:[l,l.length===0&&(e.loadingState==="loading"||e.loadingState==="loaded")&&E.jsx(t.SuggestionMenu.EmptyItem,{className:"bn-suggestion-menu-item",children:n.suggestion_menu.no_items_title}),a]})}function WY(e,t){let[n,r]=C.useState(0);return{selectedIndex:n,setSelectedIndex:r,handler:o=>{if(o.key==="ArrowUp")return o.preventDefault(),e.length&&r((n-1+e.length)%e.length),!0;if(o.key==="ArrowDown")return o.preventDefault(),e.length&&r((n+1)%e.length),!0;if(o.key==="PageUp")return o.preventDefault(),e.length&&r(0),!0;if(o.key==="PageDown")return o.preventDefault(),e.length&&r(e.length-1),!0;let i=qY(o)?o.nativeEvent.isComposing:o.isComposing;return o.key==="Enter"&&!i?(o.preventDefault(),o.stopPropagation(),e.length&&t?.(e[n]),!0):!1}}}function qY(e){return e.nativeEvent!==void 0}function GY(e,t,n,r,o){let{selectedIndex:i,setSelectedIndex:s,handler:a}=WY(n,r);return C.useEffect(()=>{let l=e.domElement;return l?.addEventListener("keydown",a,!0),()=>{l?.removeEventListener("keydown",a,!0)}},[e.domElement,n,i,r,o,a]),C.useEffect(()=>{s(0)},[t,s]),{selectedIndex:n.length===0?void 0:i}}function YY(e){let t=Nr().setContentEditableProps,n=be(),{getItems:r,suggestionMenuComponent:o,query:i,clearQuery:s,closeMenu:a,onItemClick:l}=e,c=C.useCallback(p=>{a(),s(),l?.(p)},[l,a,s]),{items:u,usedQuery:d,loadingState:f}=BS(i,r);PS(u,d,a);let{selectedIndex:h}=GY(n,i,u,c);return C.useEffect(()=>(t(p=>({...p,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{t(p=>({...p,"aria-expanded":!1,"aria-controls":void 0}))}),[t]),C.useEffect(()=>(t(p=>({...p,"aria-activedescendant":h?"bn-suggestion-menu-item-"+h:void 0})),()=>{t(p=>({...p,"aria-activedescendant":void 0}))}),[t,h]),E.jsx(o,{items:u,onItemClick:c,loadingState:f,selectedIndex:h})}var KY={heading:lu,heading_2:cu,heading_3:uu,heading_4:cS,heading_5:uS,heading_6:dS,toggle_heading:lu,toggle_heading_2:cu,toggle_heading_3:uu,quote:gS,toggle_list:bS,numbered_list:pS,bullet_list:mS,check_list:hS,paragraph:Km,table:CG,image:wG,video:TG,audio:AG,file:aG,emoji:PG,code_block:hG,divider:DG};function FS(e){return q6(e).map(t=>{let n=KY[t.key];return{...t,icon:E.jsx(n,{size:18})}})}function HS(e){let t=be(),{triggerCharacter:n,suggestionMenuComponent:r,shouldOpen:o,minQueryLength:i,onItemClick:s,getItems:a}=e,l=C.useMemo(()=>s||(p=>{p.onItemClick(t)}),[t,s]),c=C.useMemo(()=>a||(async p=>G6(FS(t),p)),[t,a]),u=je(zn);C.useEffect(()=>{u.addSuggestionMenu({triggerCharacter:n,shouldOpen:o})},[u,n,o]);let d=rt(zn),f=rt(zn,{selector:p=>({element:t.domElement?.firstChild||void 0,getBoundingClientRect:()=>p?.referencePos||new DOMRect})}),h=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:d?.show&&d?.triggerCharacter===n,onOpenChange:p=>{p||u.closeMenu()},placement:"bottom-start",middleware:[qr(10),QE({allowedPlacements:["bottom-start","top-start"],padding:10}),xu(),rc({apply({elements:p,availableHeight:g}){p.floating.style.maxHeight=`${Math.max(0,g)}px`},padding:10})],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{onMouseDownCapture:p=>p.preventDefault(),style:{zIndex:80},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,d?.show,d?.triggerCharacter,u,n]);return!d||!d.ignoreQueryLength&&i&&(d.query.startsWith(" ")||d.query.length<i)?null:E.jsx(mr,{reference:f,...h,children:n&&E.jsx(YY,{query:d.query,closeMenu:u.closeMenu,clearQuery:u.clearQuery,getItems:c,suggestionMenuComponent:r||zY,onItemClick:l})})}var QY=(e,t=.3)=>{let n=Math.floor(e)+t,r=Math.ceil(e)-t;return e>=n&&e<=r?Math.round(e):e<n?Math.floor(e):Math.ceil(e)},XY=e=>{let t=fe(),n=be(),r=je(Je),o=rt(Je,{selector:u=>u?.block}),i=C.useRef(!1),[s,a]=C.useState(),l=C.useCallback(u=>{r.freezeHandles(),e.hideOtherElements(!0),o&&(a({originalContent:o.content,originalCroppedContent:{rows:r.cropEmptyRowsOrColumns(o,e.orientation==="addOrRemoveColumns"?"columns":"rows")},startPos:e.orientation==="addOrRemoveColumns"?u.clientX:u.clientY}),i.current=!1,u.preventDefault())},[o,e,r]),c=C.useCallback(()=>{!o||i.current||n.updateBlock(o,{type:"table",content:{...o.content,rows:e.orientation==="addOrRemoveColumns"?r.addRowsOrColumns(o,"columns",1):r.addRowsOrColumns(o,"rows",1)}})},[o,n,e.orientation,r]);return C.useEffect(()=>{let u=d=>{if(!o)return;if(!s)throw Error("editingState is undefined");i.current=!0;let f=(e.orientation==="addOrRemoveColumns"?d.clientX:d.clientY)-s.startPos,h=e.orientation==="addOrRemoveColumns"?s.originalCroppedContent.rows[0]?.cells.length??0:s.originalCroppedContent.rows.length,p=e.orientation==="addOrRemoveColumns"?s.originalContent.rows[0]?.cells.length??0:s.originalContent.rows.length,g=e.orientation==="addOrRemoveColumns"?o.content.rows[0].cells.length:o.content.rows.length,y=p+QY(f/(e.orientation==="addOrRemoveColumns"?N6:I6),.3);y>=h&&y>0&&y!==g&&(n.updateBlock(o,{type:"table",content:{...o.content,rows:e.orientation==="addOrRemoveColumns"?r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"columns",y-h):r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"rows",y-h)}}),o.content&&n.setTextCursorPosition(o))};return s&&window.addEventListener("mousemove",u),()=>{window.removeEventListener("mousemove",u)}},[o,s,n,e.orientation,r]),C.useEffect(()=>{let u=()=>{e.hideOtherElements(!1),r.unfreezeHandles(),a(void 0)};return s&&window.addEventListener("mouseup",u),()=>{window.removeEventListener("mouseup",u)}},[s,e,r]),n.isEditable?E.jsx(t.TableHandle.ExtendButton,{className:ut("bn-extend-button",e.orientation==="addOrRemoveColumns"?"bn-extend-button-add-remove-columns":"bn-extend-button-add-remove-rows",s===null?"":"bn-extend-button-editing"),onClick:c,onMouseDown:l,children:e.children||E.jsx(NG,{size:18,"data-test":"extendButton"})}):null},ZY=e=>{let t=fe(),n=Se(),r=be(),{block:o,colIndex:i,rowIndex:s}=rt(Je,{selector:c=>({block:c?.block,colIndex:c?.colIndex,rowIndex:c?.rowIndex})}),a=(c,u)=>{if(o===void 0||i===void 0||s===void 0)return;let d=o.content.rows.map(f=>({...f,cells:f.cells.map(h=>Io(h))}));u==="text"?d[s].cells[i].props.textColor=c:d[s].cells[i].props.backgroundColor=c,r.updateBlock(o,{type:"table",content:{...o.content,rows:d}}),r.setTextCursorPosition(o)};if(o===void 0||i===void 0||s===void 0)return null;let l=o.content.rows[s]?.cells?.[i];return!l||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1?null:E.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[E.jsx(t.Generic.Menu.Trigger,{sub:!0,children:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children||n.drag_handle.colors_menuitem})}),E.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{iconSize:18,text:r.settings.tables.cellTextColor?{color:Mo(l)?l.props.textColor:"default",setColor:c=>a(c,"text")}:void 0,background:r.settings.tables.cellBackgroundColor?{color:Mo(l)?l.props.backgroundColor:"default",setColor:c=>a(c,"background")}:void 0})})]})},JY=()=>{let e=fe(),t=Se(),n=be(),r=je(Je),{block:o,colIndex:i,rowIndex:s}=rt(Je,{selector:l=>({block:l?.block,colIndex:l?.colIndex,rowIndex:l?.rowIndex})});if(o===void 0||i===void 0||s===void 0)return null;let a=o.content.rows[s]?.cells?.[i];return!a||!Mo(a)||ka(a)===1&&pi(a)===1||!n.settings.tables.splitCells?null:E.jsx(e.Generic.Menu.Item,{onClick:()=>{r.splitCell({row:s,col:i})},children:t.table_handle.split_cell_menuitem})},eK=e=>E.jsx(fe().Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-table-handle-menu",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(JY,{}),E.jsx(ZY,{})]})}),tK=e=>{let t=fe(),n=be(),r=je(Je),o=e.tableCellMenu||eK;return!n.settings.tables.splitCells&&!n.settings.tables.cellBackgroundColor&&!n.settings.tables.cellTextColor?null:E.jsxs(t.Generic.Menu.Root,{onOpenChange:i=>{i?(r.freezeHandles(),e.hideOtherElements(!0)):(r.unfreezeHandles(),e.hideOtherElements(!1),n.focus())},position:"right",children:[E.jsx(t.Generic.Menu.Trigger,{children:E.jsx(t.Generic.Menu.Button,{className:"bn-table-cell-handle",children:e.children||E.jsx(jG,{size:12,"data-test":"tableCellHandle"})})}),E.jsx(o,{})]})},Vy=e=>{let t=fe(),n=Se(),r=je(Je),o=rt(Je,{selector:i=>e.orientation==="column"?i?.colIndex:i?.rowIndex});return r===void 0||o===void 0?null:E.jsx(t.Generic.Menu.Item,{onClick:()=>{r.addRowOrColumn(o,e.orientation==="row"?{orientation:"row",side:e.side}:{orientation:"column",side:e.side})},children:n.table_handle[`add_${e.side}_menuitem`]})},nK=e=>{let t=fe(),n=Se(),r=je(Je),o=rt(Je,{selector:i=>e.orientation==="column"?i?.colIndex:i?.rowIndex});return r===void 0||o===void 0?null:E.jsx(t.Generic.Menu.Item,{onClick:()=>r.removeRowOrColumn(o,e.orientation),children:e.orientation==="row"?n.table_handle.delete_row_menuitem:n.table_handle.delete_column_menuitem})},rK=e=>{let t=fe(),n=Se(),r=be(),o=je(Je),{block:i,index:s}=rt(Je,{selector:u=>({block:u?.block,index:e.orientation==="column"?u?.colIndex:u?.rowIndex})}),a=C.useMemo(()=>o===void 0||i===void 0||s===void 0?[]:e.orientation==="row"?o.getCellsAtRowHandle(i,s):o.getCellsAtColumnHandle(i,s),[i,s,e.orientation,o]),l=(u,d)=>{if(i===void 0)return;let f=i.content.rows.map(h=>({...h,cells:h.cells.map(p=>Io(p))}));a.forEach(({row:h,col:p})=>{d==="text"?f[h].cells[p].props.textColor=u:f[h].cells[p].props.backgroundColor=u}),r.updateBlock(i,{type:"table",content:{...i.content,rows:f}}),r.setTextCursorPosition(i)};if(!a||!a[0]||!o||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1)return null;let c=Io(a[0].cell);return E.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[E.jsx(t.Generic.Menu.Trigger,{sub:!0,children:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children||n.drag_handle.colors_menuitem})}),E.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{iconSize:18,text:r.settings.tables.cellTextColor?{color:a.every(({cell:u})=>Mo(u)&&u.props.textColor===c.props.textColor)?c.props.textColor:"default",setColor:u=>{l(u,"text")}}:void 0,background:r.settings.tables.cellBackgroundColor?{color:a.every(({cell:u})=>Mo(u)&&u.props.backgroundColor===c.props.backgroundColor)?c.props.backgroundColor:"default",setColor:u=>l(u,"background")}:void 0})})]})},oK=e=>{let t=fe(),n=Se(),r=be(),o=je(Je),{block:i,index:s}=rt(Je,{selector:l=>({block:l?.block,index:e.orientation==="column"?l?.colIndex:l?.rowIndex})});if(o===void 0||i===void 0||s!==0||e.orientation!=="row"||!r.settings.tables.headers)return null;let a=!!i.content.headerRows;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(i,{...i,content:{...i.content,headerRows:a?void 0:1}})},children:n.drag_handle.header_row_menuitem})},iK=e=>{let t=fe(),n=Se(),r=be(),o=je(Je),i=rt(Je,{selector:l=>l?.block}),s=rt(Je,{selector:l=>e.orientation==="column"?l?.colIndex:l?.rowIndex});if(!o||s!==0||!i||e.orientation!=="column"||!r.settings.tables.headers)return null;let a=!!i.content.headerCols;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(i,{...i,content:{...i.content,headerCols:a?void 0:1}})},children:n.drag_handle.header_column_menuitem})},sK=e=>E.jsx(fe().Generic.Menu.Dropdown,{className:"bn-table-handle-menu",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(nK,{orientation:e.orientation}),E.jsx(Vy,{orientation:e.orientation,side:e.orientation==="row"?"above":"left"}),E.jsx(Vy,{orientation:e.orientation,side:e.orientation==="row"?"below":"right"}),E.jsx(oK,{orientation:e.orientation}),E.jsx(iK,{orientation:e.orientation}),E.jsx(rK,{orientation:e.orientation})]})}),aK=e=>{let t=be(),n=fe(),[r,o]=C.useState(!1),i=e.tableHandleMenu||sK,s=je(Je),a=rt(Je),l=C.useMemo(()=>!s||!a||!a.block||a.block.type!=="table"?!1:e.orientation==="column"?s.getCellsAtColumnHandle(a.block,a.colIndex).every(({cell:c})=>pi(c)===1):s.getCellsAtRowHandle(a.block,a.rowIndex).every(({cell:c})=>ka(c)===1),[e.orientation,a,s]);return a?E.jsxs(n.Generic.Menu.Root,{onOpenChange:c=>{c?(s.freezeHandles(),e.hideOtherElements(!0)):(s.unfreezeHandles(),e.hideOtherElements(!1),t.focus())},position:"right",children:[E.jsx(n.Generic.Menu.Trigger,{children:E.jsx(n.TableHandle.Root,{className:ut("bn-table-handle",r?"bn-table-handle-dragging":"",l?"":"bn-table-handle-not-draggable"),draggable:l,onDragStart:c=>{o(!0),e.hideOtherElements(!0),e.orientation==="column"?s.colDragStart(c):s.rowDragStart(c)},onDragEnd:()=>{s.dragEnd(),e.hideOtherElements(!1),o(!1)},style:e.orientation==="column"?{transform:"rotate(0.25turn)"}:void 0,children:e.children||E.jsx(TS,{size:24,"data-test":"tableHandle"})})}),E.jsx(i,{orientation:e.orientation})]}):null},lK=e=>{let t=be(),[n,r]=C.useState(),o=rt(Je),i=C.useMemo(()=>{let d={};if(o===void 0)return{};let f=cn(o.block.id,t.prosemirrorState.doc);if(!f)return{};let h=f.posBeforeNode+1,p=t.prosemirrorView.domAtPos(h+1).node;if(!(p instanceof Element))return{};if(d.tableReference={element:p},o.rowIndex===void 0||o.colIndex===void 0)return d;let g=t.prosemirrorState.doc.resolve(h+1).posAtIndex(o.rowIndex),y=t.prosemirrorState.doc.resolve(g+1).posAtIndex(o.colIndex),b=t.prosemirrorView.domAtPos(y+1).node;return b instanceof Element?(d.cellReference={element:b},d.rowReference={element:p,getBoundingClientRect:()=>{let x=p.getBoundingClientRect(),k=b.getBoundingClientRect();return new DOMRect(x.x,o.draggingState&&o.draggingState.draggedCellOrientation==="row"?o.draggingState.mousePos-k.height/2:k.y,x.width,k.height)}},d.columnReference={element:p,getBoundingClientRect:()=>{let x=p.getBoundingClientRect(),k=b.getBoundingClientRect();return new DOMRect(o.draggingState&&o.draggingState.draggedCellOrientation==="col"?o.draggingState.mousePos-k.width/2:k.x,x.y,k.width,x.height)}},d):{}},[t,o]),s=C.useCallback((d,f,h)=>{let p=!1;return mp(d,f,()=>{if(!p){p=!0;return}t.getExtension(Je)?.hideHandlesIfNotFrozen()},{ancestorScroll:!0,ancestorResize:!1,elementResize:!1,layoutShift:!1})},[t]),a=C.useMemo(()=>o===void 0?void 0:{rowTableHandle:{useFloatingOptions:{open:o.show&&o.rowIndex!==void 0&&(!n||n==="rowTableHandle"),placement:"left",middleware:[qr(-10)],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},columnTableHandle:{useFloatingOptions:{open:o.show&&o.colIndex!==void 0&&(!n||n==="columnTableHandle"),placement:"top",middleware:[qr(-12)],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},tableCellHandle:{useFloatingOptions:{open:o.show&&o.rowIndex!==void 0&&o.colIndex!==void 0&&(!n||n==="tableCellHandle"),placement:"top-end",middleware:[qr({mainAxis:-15,crossAxis:-1})],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},extendRowsButton:{useFloatingOptions:{open:o.show&&o.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton"),placement:"bottom",whileElementsMounted:s,middleware:[rc({apply({rects:d,elements:f}){Object.assign(f.floating.style,{width:`${d.reference.width}px`})}})]},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},extendColumnsButton:{useFloatingOptions:{open:o.show&&o.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton"),placement:"right",whileElementsMounted:s,middleware:[rc({apply({rects:d,elements:f}){Object.assign(f.floating.style,{height:`${d.reference.height}px`})}})]},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}}},[n,o,s]);if(!o)return null;let l=e.tableHandle||aK,c=e.extendButton||XY,u=e.tableCellHandle||tK;return E.jsxs(E.Fragment,{children:[E.jsx(mr,{reference:i?.rowReference,...a?.rowTableHandle,children:o.show&&o.rowIndex!==void 0&&(!n||n==="rowTableHandle")&&E.jsx(l,{orientation:"row",hideOtherElements:d=>r(d?"rowTableHandle":void 0)})}),E.jsx(mr,{reference:i?.columnReference,...a?.columnTableHandle,children:o.show&&o.colIndex!==void 0&&(!n||n==="columnTableHandle")&&E.jsx(l,{orientation:"column",hideOtherElements:d=>r(d?"columnTableHandle":void 0)})}),E.jsx(mr,{reference:i?.cellReference,...a?.tableCellHandle,children:o.show&&o.rowIndex!==void 0&&o.colIndex!==void 0&&(!n||n==="tableCellHandle")&&E.jsx(u,{hideOtherElements:d=>r(d?"tableCellHandle":void 0)})}),E.jsx(mr,{reference:i?.tableReference,...a?.extendRowsButton,children:o.show&&o.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton")&&E.jsx(c,{orientation:"addOrRemoveRows",hideOtherElements:d=>r(d?"extendRowsButton":void 0)})}),E.jsx(mr,{reference:i?.tableReference,...a?.extendColumnsButton,children:o.show&&o.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton")&&E.jsx(c,{orientation:"addOrRemoveColumns",hideOtherElements:d=>r(d?"extendColumnsButton":void 0)})})]})},cK=C.lazy(()=>Qi(()=>import("./FloatingComposerController-D4uLQfUX-C0Lhbmda.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(e=>e.n)),uK=C.lazy(()=>Qi(()=>Promise.resolve().then(()=>VG),void 0).then(e=>e.n));function dK(e){let t=be();if(!t)throw Error("BlockNoteDefaultUI must be used within a BlockNoteContext.Provider");return E.jsxs(E.Fragment,{children:[t.getExtension(Lo)&&e.formattingToolbar!==!1&&E.jsx(eg,{}),t.getExtension(ja)&&e.linkToolbar!==!1&&E.jsx(DS,{}),t.getExtension(zn)&&e.slashMenu!==!1&&E.jsx(HS,{triggerCharacter:"/",shouldOpen:n=>!n.selection.$from.parent.type.isInGroup("tableContent")}),t.getExtension(zn)&&e.emojiPicker!==!1&&E.jsx(jY,{triggerCharacter:":",columns:10,minQueryLength:2}),t.getExtension(qn)&&e.sideMenu!==!1&&E.jsx(FY,{}),t.getExtension(rr)&&e.filePanel!==!1&&E.jsx(sY,{}),t.getExtension(Je)&&e.tableHandles!==!1&&E.jsx(lK,{}),t.getExtension(Jr)&&e.comments!==!1&&E.jsxs(C.Suspense,{children:[E.jsx(cK,{}),E.jsx(uK,{})]})]})}function fK(e,t){let n=Nr();t||=n?.editor,C.useEffect(()=>{if(!t)throw Error("'editor' is required, either from BlockNoteContext or as a function argument");return t.onChange(e)},[e,t])}function hK(e,t,n){let r=Nr();t||=r?.editor,C.useEffect(()=>{if(!t)throw Error("'editor' is required, either from BlockNoteContext or as a function argument");return t.onSelectionChange(e,n)},[e,t,n])}var pK=()=>{let e=C.useMemo(()=>window.matchMedia?.("(prefers-color-scheme: dark)"),[]),t=C.useMemo(()=>window.matchMedia?.("(prefers-color-scheme: light)"),[]),n=e?.matches,r=t?.matches,[o,i]=C.useState(n?"dark":r?"light":"no-preference");return C.useEffect(()=>{i(n?"dark":r?"light":"no-preference")},[n,r]),C.useEffect(()=>{if(typeof e?.addEventListener=="function"){let s=({matches:l})=>l&&i("dark"),a=({matches:l})=>l&&i("light");return e?.addEventListener("change",s),t?.addEventListener("change",a),()=>{e?.removeEventListener("change",s),t?.removeEventListener("change",a)}}else{let s=()=>i(e.matches?"dark":t.matches?"light":"no-preference");return e?.addEventListener("change",s),t?.addEventListener("change",s),()=>{e?.removeEventListener("change",s),t?.removeEventListener("change",s)}}},[e,t]),o},US=C.createContext(void 0);function mK(){return C.useContext(US)}function gK(){let e=new Set,t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Xr.createPortal(r.reactElement,r.element,n)},e.forEach(o=>o())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(o=>o())}}}var bK=({contentComponent:e})=>{let t=C.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(t)})},yK=C.forwardRef((e,t)=>{let[n,r]=C.useState();return C.useImperativeHandle(t,()=>(o,i)=>{Xr.flushSync(()=>{r({node:o,container:i})}),r(void 0)},[]),E.jsx(E.Fragment,{children:n&&Xr.createPortal(n.node,n.container)})}),$y=()=>{};function EK(e,t){let{editor:n,className:r,theme:o,children:i,editable:s,onSelectionChange:a,onChange:l,formattingToolbar:c,linkToolbar:u,slashMenu:d,emojiPicker:f,sideMenu:h,filePanel:p,tableHandles:g,comments:y,autoFocus:b,renderEditor:x=!0,...k}=e,[O,M]=C.useState(),A=Nr(),D=pK(),z=A?.colorSchemePreference||D,Y=o||(z==="dark"?"dark":"light"),N=fe(),K=C.useMemo(()=>({formattingToolbar:N?c:!1,linkToolbar:N?u:!1,sideMenu:N?h:!1,slashMenu:N?d:!1,filePanel:N?p:!1,tableHandles:N?g:!1,emojiPicker:N?f:!1,comments:N?y:!1}),[y,N,f,p,c,u,h,d,g]);fK(l||$y,n),hK(a||$y,n);let F=C.useCallback(H=>{n.elementRenderer=H},[n]);C.useEffect(()=>{if(!n.portalElement)throw Error("Portal element not found");n.portalElement.className=ut("bn-root",Y,r||""),n.portalElement.setAttribute("data-color-scheme",Y)},[n,Y,r]);let q=C.useMemo(()=>({...A,editor:n,setContentEditableProps:M,colorSchemePreference:Y}),[A,n,Y]),L=C.useMemo(()=>({editorProps:{autoFocus:b,contentEditableProps:O,editable:s},defaultUIProps:K}),[b,O,s,K]);return E.jsx(tS.Provider,{value:q,children:E.jsxs(US.Provider,{value:L,children:[E.jsx(yK,{ref:F}),E.jsx(xK,{className:r,renderEditor:x,editorColorScheme:Y,ref:t,...k,children:i})]})})}var xK=Re.forwardRef(({className:e,renderEditor:t,editorColorScheme:n,children:r,...o},i)=>E.jsx("div",{className:ut("bn-root","bn-container",n,e),"data-color-scheme":n,...o,ref:i,children:t?E.jsx(kK,{children:r}):r})),CK=Re.forwardRef(EK),kK=e=>{let t=mK(),n=be(),r=C.useMemo(()=>gK(),[]),o=C.useCallback(i=>{n.isEditable=t.editorProps.editable!==!1,n._tiptapEditor.contentComponent=r,i?n.mount(i):n.unmount()},[t.editorProps.editable,n,r]);return E.jsxs(E.Fragment,{children:[E.jsx(bK,{contentComponent:r}),E.jsx(TK,{...t.editorProps,...e,mount:o}),E.jsx(dK,{...t.defaultUIProps}),e.children]})},TK=e=>{let{autoFocus:t,mount:n,contentEditableProps:r}=e;return E.jsx("div",{"aria-autocomplete":"list","aria-haspopup":"listbox","data-bn-autofocus":t,ref:n,...r})};function jy(e,t){let n,r=document.createElement("div"),o;if(t?.elementRenderer)t.elementRenderer(e(l=>n=l||void 0),r);else{if(!t?.headless)throw Error("elementRenderer not available, expected headless editor");o=Cv.createRoot(r),Xr.flushSync(()=>{o.render(e(l=>n=l||void 0))})}if(!r.childElementCount)return console.warn("ReactInlineContentSpec: renderHTML() failed"),{dom:document.createElement("span")};n?.setAttribute("data-tmp-find","true");let i=r.cloneNode(!0),s=i.firstElementChild,a=i.querySelector("[data-tmp-find]");return a?.removeAttribute("data-tmp-find"),o?.unmount(),{dom:s,contentDOM:a||void 0}}function If(e){return E.jsx(QG,{onDragOver:t=>t.preventDefault(),...Object.fromEntries(Object.entries(e.domAttributes||{}).filter(([t])=>t!=="class")),className:ut("bn-block-content",e.domAttributes?.class||""),"data-content-type":e.blockType,...Object.fromEntries(Object.entries(e.blockProps).filter(([t,n])=>n!==e.propSchema[t].default).map(([t,n])=>[Tc(t),n])),"data-file-block":e.isFileBlock===!0||void 0,children:e.children})}function VS(e,t,n){return(r={})=>{let o=typeof e=="function"?e(r):e,i=typeof t=="function"?t(r):t;return{config:o,implementation:{...i,toExternalHTML(a,l,c){let u=i.toExternalHTML||i.render;return jy(d=>E.jsx(If,{blockType:a.type,blockProps:a.props,propSchema:o.propSchema,domAttributes:this.blockContentDOMAttributes,isFileBlock:i.meta?.fileBlockAccept!==void 0,children:E.jsx(u,{block:a,editor:l,contentRef:f=>{d(f),f&&(f.className=ut("bn-inline-content",f.className))},context:c})}),l)},render(a,l){if(this.renderType==="nodeView")return nY(c=>{let u=_k(c.getPos,l,c.editor,o.type),d=vS().nodeViewContentRef;if(!d)throw Error("nodeViewContentRef is not set");let f=i.render;return E.jsx(If,{blockType:u.type,blockProps:u.props,propSchema:o.propSchema,isFileBlock:!!i.meta?.fileBlockAccept,domAttributes:this.blockContentDOMAttributes,children:E.jsx(f,{block:u,editor:l,contentRef:h=>{d(h),h&&(h.className=ut("bn-inline-content",h.className),h.dataset.nodeViewContent="")}})})},{className:"bn-react-node-view-renderer"})(this.props);{let c=i.render;return jy(u=>E.jsx(If,{blockType:a.type,blockProps:a.props,propSchema:o.propSchema,domAttributes:this.blockContentDOMAttributes,children:E.jsx(c,{block:a,editor:l,contentRef:d=>{u(d),d&&(d.className=ut("bn-inline-content",d.className))}})}),l)}}},extensions:void 0}}}Re.memo(({thread:e,selectedThreadId:t,maxCommentsBeforeCollapse:n,referenceText:r})=>{let o=je(Jr),i=C.useCallback(a=>{a.target.closest(".bn-action-toolbar")||o.selectThread(e.id)},[o,e.id]),s=C.useCallback(a=>{if(!a.relatedTarget||a.relatedTarget.closest(".bn-action-toolbar"))return;let l=a.target instanceof Node?a.target:null,c=a.relatedTarget instanceof Node?a.relatedTarget.closest(".bn-thread"):null;(!l||!c||!c.contains(l))&&o.selectThread(void 0)},[o]);return E.jsx(Qm,{thread:e,selected:e.id===t,referenceText:r,maxCommentsBeforeCollapse:n,onFocus:i,onBlur:s,tabIndex:0})});function wK(e){return e.currentTarget instanceof HTMLElement&&e.relatedTarget instanceof HTMLElement?e.currentTarget.contains(e.relatedTarget):!1}function SK({onBlur:e,onFocus:t}={}){let n=C.useRef(null),[r,o]=C.useState(!1),i=C.useRef(!1),s=c=>{o(c),i.current=c},a=c=>{i.current||(s(!0),t?.(c))},l=c=>{i.current&&!wK(c)&&(s(!1),e?.(c))};return C.useEffect(()=>{let c=n.current;if(c)return c.addEventListener("focusin",a),c.addEventListener("focusout",l),()=>{c?.removeEventListener("focusin",a),c?.removeEventListener("focusout",l)}},[a,l]),{ref:n,focused:r}}function $S(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=n.top<r.top,i=n.bottom>r.bottom;return o&&i?"both":o?"top":i?"bottom":"none"}function jS(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var za=e=>e.type==="checkbox",Qo=e=>e instanceof Date,mn=e=>e==null;const zS=e=>typeof e=="object";var Nt=e=>!mn(e)&&!Array.isArray(e)&&zS(e)&&!Qo(e),vK=e=>Nt(e)&&e.target?za(e.target)?e.target.checked:e.target.value:e,AK=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,NK=(e,t)=>e.has(AK(t)),IK=e=>{const t=e.constructor&&e.constructor.prototype;return Nt(t)&&t.hasOwnProperty("isPrototypeOf")},tg=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function _t(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(tg&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(Nt(e)&&IK(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=_t(e[o]));return r}var ad=e=>/^\w*$/.test(e),ht=e=>e===void 0,ng=e=>Array.isArray(e)?e.filter(Boolean):[],rg=e=>ng(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ce=(e,t,n)=>{if(!t||!Nt(e))return n;const r=(ad(t)?[t]:rg(t)).reduce((o,i)=>mn(o)?o:o[i],e);return ht(r)||r===e?ht(e[t])?n:e[t]:r},hr=e=>typeof e=="boolean",Zn=e=>typeof e=="function",lt=(e,t,n)=>{let r=-1;const o=ad(t)?[t]:rg(t),i=o.length,s=i-1;for(;++r<i;){const a=o[r];let l=n;if(r!==s){const c=e[a];l=Nt(c)||Array.isArray(c)?c:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=l,e=e[a]}};const zy={BLUR:"blur",FOCUS_OUT:"focusout"},Jn={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Dr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},WS=Re.createContext(null);WS.displayName="HookFormControlContext";var MK=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==Jn.all&&(t._proxyFormState[s]=!r||Jn.all),e[s]}});return o};const _K=typeof window<"u"?Re.useLayoutEffect:Re.useEffect;var In=e=>typeof e=="string",OK=(e,t,n,r,o)=>In(e)?(r&&t.watch.add(e),ce(n,e,o)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),ce(n,i))):(r&&(t.watchAll=!0),n),sp=e=>mn(e)||!zS(e);function bo(e,t,n=new WeakSet){if(sp(e)||sp(t))return Object.is(e,t);if(Qo(e)&&Qo(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const i of r){const s=e[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=t[i];if(Qo(s)&&Qo(a)||Nt(s)&&Nt(a)||Array.isArray(s)&&Array.isArray(a)?!bo(s,a,n):!Object.is(s,a))return!1}}return!0}const qS=Re.createContext(null);qS.displayName="HookFormContext";const RK=e=>{const{children:t,watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:y,subscribe:b}=e;return Re.createElement(qS.Provider,{value:Re.useMemo(()=>({watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:y,subscribe:b}),[s,p,c,o,r,f,g,d,u,i,y,a,b,l,h,n])},Re.createElement(WS.Provider,{value:p},t))};var LK=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},ia=e=>Array.isArray(e)?e:[e],Wy=()=>{let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}};function GS(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const o=e[r],i=t[r];if(o&&Nt(o)&&i){const s=GS(o,i);Nt(s)&&(n[r]=s)}else e[r]&&(n[r]=i)}return n}var nn=e=>Nt(e)&&!Object.keys(e).length,og=e=>e.type==="file",du=e=>{if(!tg)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},YS=e=>e.type==="select-multiple",ig=e=>e.type==="radio",DK=e=>ig(e)||za(e),Mf=e=>du(e)&&e.isConnected;function PK(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=ht(e)?r++:e[t[r++]];return e}function BK(e){for(const t in e)if(e.hasOwnProperty(t)&&!ht(e[t]))return!1;return!0}function wt(e,t){const n=Array.isArray(t)?t:ad(t)?[t]:rg(t),r=n.length===1?e:PK(e,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(Nt(r)&&nn(r)||Array.isArray(r)&&BK(r))&&wt(e,n.slice(0,-1)),e}var FK=e=>{for(const t in e)if(Zn(e[t]))return!0;return!1};function KS(e){return Array.isArray(e)||Nt(e)&&!FK(e)}function ap(e,t={}){for(const n in e){const r=e[n];KS(r)?(t[n]=Array.isArray(r)?[]:{},ap(r,t[n])):ht(r)||(t[n]=!0)}return t}function Bi(e,t,n){n||(n=ap(t));for(const r in e){const o=e[r];if(KS(o))ht(t)||sp(n[r])?n[r]=ap(o,Array.isArray(o)?[]:{}):Bi(o,mn(t)?{}:t[r],n[r]);else{const i=t[r];n[r]=!bo(o,i)}}return n}const qy={value:!1,isValid:!1},Gy={value:!0,isValid:!0};var QS=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ht(e[0].attributes.value)?ht(e[0].value)||e[0].value===""?Gy:{value:e[0].value,isValid:!0}:Gy:qy}return qy},XS=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>ht(e)?e:t?e===""?NaN:e&&+e:n&&In(e)?new Date(e):r?r(e):e;const Yy={isValid:!1,value:null};var ZS=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Yy):Yy;function Ky(e){const t=e.ref;return og(t)?t.files:ig(t)?ZS(e.refs).value:YS(t)?[...t.selectedOptions].map(({value:n})=>n):za(t)?QS(e.refs).value:XS(ht(t.value)?e.ref.value:t.value,e)}var HK=(e,t,n,r)=>{const o={};for(const i of e){const s=ce(t,i);s&<(o,i,s._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},fu=e=>e instanceof RegExp,vs=e=>ht(e)?e:fu(e)?e.source:Nt(e)?fu(e.value)?e.value.source:e.value:e,Qy=e=>({isOnSubmit:!e||e===Jn.onSubmit,isOnBlur:e===Jn.onBlur,isOnChange:e===Jn.onChange,isOnAll:e===Jn.all,isOnTouch:e===Jn.onTouched});const Xy="AsyncFunction";var UK=e=>!!e&&!!e.validate&&!!(Zn(e.validate)&&e.validate.constructor.name===Xy||Nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Xy)),VK=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Zy=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const sa=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const i=ce(e,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!r)return!0;if(s.ref&&t(s.ref,s.name)&&!r)return!0;if(sa(a,t))break}else if(Nt(a)&&sa(a,t))break}}};function Jy(e,t,n){const r=ce(e,n);if(r||ad(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=ce(t,i),a=ce(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:n}}var $K=(e,t,n,r)=>{n(e);const{name:o,...i}=e;return nn(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!r||Jn.all))},jK=(e,t,n)=>!e||!t||e===t||ia(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),zK=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,WK=(e,t)=>!ng(ce(e,t)).length&&wt(e,t),qK=(e,t,n)=>{const r=ia(ce(e,n));return lt(r,"root",t[n]),lt(e,n,r),e};function eE(e,t,n="validate"){if(In(e)||Array.isArray(e)&&e.every(In)||hr(e)&&!e)return{type:n,message:In(e)?e:"",ref:t}}var Mi=e=>Nt(e)&&!fu(e)?e:{value:e,message:""},tE=async(e,t,n,r,o,i)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:y,mount:b}=e._f,x=ce(n,g);if(!b||t.has(g))return{};const k=a?a[0]:s,O=F=>{o&&k.reportValidity&&(k.setCustomValidity(hr(F)?"":F||""),k.reportValidity())},M={},A=ig(s),D=za(s),z=A||D,Y=(y||og(s))&&ht(s.value)&&ht(x)||du(s)&&s.value===""||x===""||Array.isArray(x)&&!x.length,N=LK.bind(null,g,r,M),K=(F,q,L,H=Dr.maxLength,re=Dr.minLength)=>{const W=F?q:L;M[g]={type:F?H:re,message:W,ref:s,...N(F?H:re,W)}};if(i?!Array.isArray(x)||!x.length:l&&(!z&&(Y||mn(x))||hr(x)&&!x||D&&!QS(a).isValid||A&&!ZS(a).isValid)){const{value:F,message:q}=In(l)?{value:!!l,message:l}:Mi(l);if(F&&(M[g]={type:Dr.required,message:q,ref:k,...N(Dr.required,q)},!r))return O(q),M}if(!Y&&(!mn(d)||!mn(f))){let F,q;const L=Mi(f),H=Mi(d);if(!mn(x)&&!isNaN(x)){const re=s.valueAsNumber||x&&+x;mn(L.value)||(F=re>L.value),mn(H.value)||(q=re<H.value)}else{const re=s.valueAsDate||new Date(x),W=S=>new Date(new Date().toDateString()+" "+S),G=s.type=="time",te=s.type=="week";In(L.value)&&x&&(F=G?W(x)>W(L.value):te?x>L.value:re>new Date(L.value)),In(H.value)&&x&&(q=G?W(x)<W(H.value):te?x<H.value:re<new Date(H.value))}if((F||q)&&(K(!!F,L.message,H.message,Dr.max,Dr.min),!r))return O(M[g].message),M}if((c||u)&&!Y&&(In(x)||i&&Array.isArray(x))){const F=Mi(c),q=Mi(u),L=!mn(F.value)&&x.length>+F.value,H=!mn(q.value)&&x.length<+q.value;if((L||H)&&(K(L,F.message,q.message),!r))return O(M[g].message),M}if(h&&!Y&&In(x)){const{value:F,message:q}=Mi(h);if(fu(F)&&!x.match(F)&&(M[g]={type:Dr.pattern,message:q,ref:s,...N(Dr.pattern,q)},!r))return O(q),M}if(p){if(Zn(p)){const F=await p(x,n),q=eE(F,k);if(q&&(M[g]={...q,...N(Dr.validate,q.message)},!r))return O(q.message),M}else if(Nt(p)){let F={};for(const q in p){if(!nn(F)&&!r)break;const L=eE(await p[q](x,n),k,q);L&&(F={...L,...N(q,L.message)},O(L.message),r&&(M[g]=F))}if(!nn(F)&&(M[g]={ref:k,...F},!r))return M}}return O(!0),M};const GK={mode:Jn.onSubmit,reValidateMode:Jn.onChange,shouldFocusError:!0};function YK(e={}){let t={...GK,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Zn(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=Nt(t.defaultValues)||Nt(t.values)?_t(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:_t(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u};let f={...d};const h={array:Wy(),state:Wy()},p=t.criteriaMode===Jn.all,g=_=>P=>{clearTimeout(c),c=setTimeout(_,P)},y=async _=>{if(!s.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||_)){let P;t.resolver?(P=nn((await z()).errors),b()):P=await N(r,!0),P!==n.isValid&&h.state.next({isValid:P})}},b=(_,P)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((_||Array.from(a.mount)).forEach(U=>{U&&(P?lt(n.validatingFields,U,P):wt(n.validatingFields,U))}),h.state.next({validatingFields:n.validatingFields,isValidating:!nn(n.validatingFields)}))},x=(_,P=[],U,oe,ne=!0,R=!0)=>{if(oe&&U&&!t.disabled){if(s.action=!0,R&&Array.isArray(ce(r,_))){const V=U(ce(r,_),oe.argA,oe.argB);ne&<(r,_,V)}if(R&&Array.isArray(ce(n.errors,_))){const V=U(ce(n.errors,_),oe.argA,oe.argB);ne&<(n.errors,_,V),WK(n.errors,_)}if((d.touchedFields||f.touchedFields)&&R&&Array.isArray(ce(n.touchedFields,_))){const V=U(ce(n.touchedFields,_),oe.argA,oe.argB);ne&<(n.touchedFields,_,V)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=Bi(o,i)),h.state.next({name:_,isDirty:F(_,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else lt(i,_,P)},k=(_,P)=>{lt(n.errors,_,P),h.state.next({errors:n.errors})},O=_=>{n.errors=_,h.state.next({errors:n.errors,isValid:!1})},M=(_,P,U,oe)=>{const ne=ce(r,_);if(ne){const R=ce(i,_,ht(U)?ce(o,_):U);ht(R)||oe&&oe.defaultChecked||P?lt(i,_,P?R:Ky(ne._f)):H(_,R),s.mount&&!s.action&&y()}},A=(_,P,U,oe,ne)=>{let R=!1,V=!1;const ie={name:_};if(!t.disabled){if(!U||oe){(d.isDirty||f.isDirty)&&(V=n.isDirty,n.isDirty=ie.isDirty=F(),R=V!==ie.isDirty);const ae=bo(ce(o,_),P);V=!!ce(n.dirtyFields,_),ae?wt(n.dirtyFields,_):lt(n.dirtyFields,_,!0),ie.dirtyFields=n.dirtyFields,R=R||(d.dirtyFields||f.dirtyFields)&&V!==!ae}if(U){const ae=ce(n.touchedFields,_);ae||(lt(n.touchedFields,_,U),ie.touchedFields=n.touchedFields,R=R||(d.touchedFields||f.touchedFields)&&ae!==U)}R&&ne&&h.state.next(ie)}return R?ie:{}},D=(_,P,U,oe)=>{const ne=ce(n.errors,_),R=(d.isValid||f.isValid)&&hr(P)&&n.isValid!==P;if(t.delayError&&U?(l=g(()=>k(_,U)),l(t.delayError)):(clearTimeout(c),l=null,U?lt(n.errors,_,U):wt(n.errors,_)),(U?!bo(ne,U):ne)||!nn(oe)||R){const V={...oe,...R&&hr(P)?{isValid:P}:{},errors:n.errors,name:_};n={...n,...V},h.state.next(V)}},z=async _=>(b(_,!0),await t.resolver(i,t.context,HK(_||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),Y=async _=>{const{errors:P}=await z(_);if(b(_),_)for(const U of _){const oe=ce(P,U);oe?lt(n.errors,U,oe):wt(n.errors,U)}else n.errors=P;return P},N=async(_,P,U={valid:!0})=>{for(const oe in _){const ne=_[oe];if(ne){const{_f:R,...V}=ne;if(R){const ie=a.array.has(R.name),ae=ne._f&&UK(ne._f);ae&&d.validatingFields&&b([R.name],!0);const xe=await tE(ne,a.disabled,i,p,t.shouldUseNativeValidation&&!P,ie);if(ae&&d.validatingFields&&b([R.name]),xe[R.name]&&(U.valid=!1,P||e.shouldUseNativeValidation))break;!P&&(ce(xe,R.name)?ie?qK(n.errors,xe,R.name):lt(n.errors,R.name,xe[R.name]):wt(n.errors,R.name))}!nn(V)&&await N(V,P,U)}}return U.valid},K=()=>{for(const _ of a.unMount){const P=ce(r,_);P&&(P._f.refs?P._f.refs.every(U=>!Mf(U)):!Mf(P._f.ref))&&Pe(_)}a.unMount=new Set},F=(_,P)=>!t.disabled&&(_&&P&<(i,_,P),!bo(ye(),o)),q=(_,P,U)=>OK(_,a,{...s.mount?i:ht(P)?o:In(_)?{[_]:P}:P},U,P),L=_=>ng(ce(s.mount?i:o,_,t.shouldUnregister?ce(o,_,[]):[])),H=(_,P,U={})=>{const oe=ce(r,_);let ne=P;if(oe){const R=oe._f;R&&(!R.disabled&<(i,_,XS(P,R)),ne=du(R.ref)&&mn(P)?"":P,YS(R.ref)?[...R.ref.options].forEach(V=>V.selected=ne.includes(V.value)):R.refs?za(R.ref)?R.refs.forEach(V=>{(!V.defaultChecked||!V.disabled)&&(Array.isArray(ne)?V.checked=!!ne.find(ie=>ie===V.value):V.checked=ne===V.value||!!ne)}):R.refs.forEach(V=>V.checked=V.value===ne):og(R.ref)?R.ref.value="":(R.ref.value=ne,R.ref.type||h.state.next({name:_,values:_t(i)})))}(U.shouldDirty||U.shouldTouch)&&A(_,ne,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&S(_)},re=(_,P,U)=>{for(const oe in P){if(!P.hasOwnProperty(oe))return;const ne=P[oe],R=_+"."+oe,V=ce(r,R);(a.array.has(_)||Nt(ne)||V&&!V._f)&&!Qo(ne)?re(R,ne,U):H(R,ne,U)}},W=(_,P,U={})=>{const oe=ce(r,_),ne=a.array.has(_),R=_t(P);lt(i,_,R),ne?(h.array.next({name:_,values:_t(i)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&U.shouldDirty&&h.state.next({name:_,dirtyFields:Bi(o,i),isDirty:F(_,R)})):oe&&!oe._f&&!mn(R)?re(_,R,U):H(_,R,U),Zy(_,a)?h.state.next({...n,name:_,values:_t(i)}):h.state.next({name:s.mount?_:void 0,values:_t(i)})},G=async _=>{s.mount=!0;const P=_.target;let U=P.name,oe=!0;const ne=ce(r,U),R=ae=>{oe=Number.isNaN(ae)||Qo(ae)&&isNaN(ae.getTime())||bo(ae,ce(i,U,ae))},V=Qy(t.mode),ie=Qy(t.reValidateMode);if(ne){let ae,xe;const Mt=P.type?Ky(ne._f):vK(_),Wt=_.type===zy.BLUR||_.type===zy.FOCUS_OUT,Yn=!VK(ne._f)&&!t.resolver&&!ce(n.errors,U)&&!ne._f.deps||zK(Wt,ce(n.touchedFields,U),n.isSubmitted,ie,V),Ir=Zy(U,a,Wt);lt(i,U,Mt),Wt?(!P||!P.readOnly)&&(ne._f.onBlur&&ne._f.onBlur(_),l&&l(0)):ne._f.onChange&&ne._f.onChange(_);const Mr=A(U,Mt,Wt),tn=!nn(Mr)||Ir;if(!Wt&&h.state.next({name:U,type:_.type,values:_t(i)}),Yn)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?Wt&&y():Wt||y()),tn&&h.state.next({name:U,...Ir?{}:Mr});if(!Wt&&Ir&&h.state.next({...n}),t.resolver){const{errors:_r}=await z([U]);if(b([U]),R(Mt),oe){const Kn=Jy(n.errors,r,U),cg=Jy(_r,r,Kn.name||U);ae=cg.error,U=cg.name,xe=nn(_r)}}else b([U],!0),ae=(await tE(ne,a.disabled,i,p,t.shouldUseNativeValidation))[U],b([U]),R(Mt),oe&&(ae?xe=!1:(d.isValid||f.isValid)&&(xe=await N(r,!0)));oe&&(ne._f.deps&&(!Array.isArray(ne._f.deps)||ne._f.deps.length>0)&&S(ne._f.deps),D(U,xe,ae,Mr))}},te=(_,P)=>{if(ce(n.errors,P)&&_.focus)return _.focus(),1},S=async(_,P={})=>{let U,oe;const ne=ia(_);if(t.resolver){const R=await Y(ht(_)?_:ne);U=nn(R),oe=_?!ne.some(V=>ce(R,V)):U}else _?(oe=(await Promise.all(ne.map(async R=>{const V=ce(r,R);return await N(V&&V._f?{[R]:V}:V)}))).every(Boolean),!(!oe&&!n.isValid)&&y()):oe=U=await N(r);return h.state.next({...!In(_)||(d.isValid||f.isValid)&&U!==n.isValid?{}:{name:_},...t.resolver||!_?{isValid:U}:{},errors:n.errors}),P.shouldFocus&&!oe&&sa(r,te,_?ne:a.mount),oe},ye=(_,P)=>{let U={...s.mount?i:o};return P&&(U=GS(P.dirtyFields?n.dirtyFields:n.touchedFields,U)),ht(_)?U:In(_)?ce(U,_):_.map(oe=>ce(U,oe))},pe=(_,P)=>({invalid:!!ce((P||n).errors,_),isDirty:!!ce((P||n).dirtyFields,_),error:ce((P||n).errors,_),isValidating:!!ce(n.validatingFields,_),isTouched:!!ce((P||n).touchedFields,_)}),v=_=>{_&&ia(_).forEach(P=>wt(n.errors,P)),h.state.next({errors:_?n.errors:{}})},ze=(_,P,U)=>{const oe=(ce(r,_,{_f:{}})._f||{}).ref,ne=ce(n.errors,_)||{},{ref:R,message:V,type:ie,...ae}=ne;lt(n.errors,_,{...ae,...P,ref:oe}),h.state.next({name:_,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&oe&&oe.focus&&oe.focus()},ve=(_,P)=>Zn(_)?h.state.subscribe({next:U=>"values"in U&&_(q(void 0,P),U)}):q(_,P,!0),Le=_=>h.state.subscribe({next:P=>{jK(_.name,P.name,_.exact)&&$K(P,_.formState||d,Tn,_.reRenderRoot)&&_.callback({values:{...i},...n,...P,defaultValues:o})}}).unsubscribe,Et=_=>(s.mount=!0,f={...f,..._.formState},Le({..._,formState:{...u,..._.formState}})),Pe=(_,P={})=>{for(const U of _?ia(_):a.mount)a.mount.delete(U),a.array.delete(U),P.keepValue||(wt(r,U),wt(i,U)),!P.keepError&&wt(n.errors,U),!P.keepDirty&&wt(n.dirtyFields,U),!P.keepTouched&&wt(n.touchedFields,U),!P.keepIsValidating&&wt(n.validatingFields,U),!t.shouldUnregister&&!P.keepDefaultValue&&wt(o,U);h.state.next({values:_t(i)}),h.state.next({...n,...P.keepDirty?{isDirty:F()}:{}}),!P.keepIsValid&&y()},We=({disabled:_,name:P})=>{if(hr(_)&&s.mount||_||a.disabled.has(P)){const ne=a.disabled.has(P)!==!!_;_?a.disabled.add(P):a.disabled.delete(P),ne&&s.mount&&!s.action&&y()}},dt=(_,P={})=>{let U=ce(r,_);const oe=hr(P.disabled)||hr(t.disabled);return lt(r,_,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:_}},name:_,mount:!0,...P}}),a.mount.add(_),U?We({disabled:hr(P.disabled)?P.disabled:t.disabled,name:_}):M(_,!0,P.value),{...oe?{disabled:P.disabled||t.disabled}:{},...t.progressive?{required:!!P.required,min:vs(P.min),max:vs(P.max),minLength:vs(P.minLength),maxLength:vs(P.maxLength),pattern:vs(P.pattern)}:{},name:_,onChange:G,onBlur:G,ref:ne=>{if(ne){dt(_,P),U=ce(r,_);const R=ht(ne.value)&&ne.querySelectorAll&&ne.querySelectorAll("input,select,textarea")[0]||ne,V=DK(R),ie=U._f.refs||[];if(V?ie.find(ae=>ae===R):R===U._f.ref)return;lt(r,_,{_f:{...U._f,...V?{refs:[...ie.filter(Mf),R,...Array.isArray(ce(o,_))?[{}]:[]],ref:{type:R.type,name:_}}:{ref:R}}}),M(_,!1,void 0,R)}else U=ce(r,_,{}),U._f&&(U._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(NK(a.array,_)&&s.action)&&a.unMount.add(_)}}},xt=()=>t.shouldFocusError&&sa(r,te,a.mount),Ee=_=>{hr(_)&&(h.state.next({disabled:_}),sa(r,(P,U)=>{const oe=ce(r,U);oe&&(P.disabled=oe._f.disabled||_,Array.isArray(oe._f.refs)&&oe._f.refs.forEach(ne=>{ne.disabled=oe._f.disabled||_}))},0,!1))},De=(_,P)=>async U=>{let oe;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let ne=_t(i);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:R,values:V}=await z();b(),n.errors=R,ne=_t(V)}else await N(r);if(a.disabled.size)for(const R of a.disabled)wt(ne,R);if(wt(n.errors,"root"),nn(n.errors)){h.state.next({errors:{}});try{await _(ne,U)}catch(R){oe=R}}else P&&await P({...n.errors},U),xt(),setTimeout(xt);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nn(n.errors)&&!oe,submitCount:n.submitCount+1,errors:n.errors}),oe)throw oe},Ne=(_,P={})=>{ce(r,_)&&(ht(P.defaultValue)?W(_,_t(ce(o,_))):(W(_,P.defaultValue),lt(o,_,_t(P.defaultValue))),P.keepTouched||wt(n.touchedFields,_),P.keepDirty||(wt(n.dirtyFields,_),n.isDirty=P.defaultValue?F(_,_t(ce(o,_))):F()),P.keepError||(wt(n.errors,_),d.isValid&&y()),h.state.next({...n}))},Ke=(_,P={})=>{const U=_?_t(_):o,oe=_t(U),ne=nn(_),R=ne?o:oe;if(P.keepDefaultValues||(o=U),!P.keepValues){if(P.keepDirtyValues){const V=new Set([...a.mount,...Object.keys(Bi(o,i))]);for(const ie of Array.from(V)){const ae=ce(n.dirtyFields,ie),xe=ce(i,ie),Mt=ce(R,ie);ae&&!ht(xe)?lt(R,ie,xe):!ae&&!ht(Mt)&&W(ie,Mt)}}else{if(tg&&ht(_))for(const V of a.mount){const ie=ce(r,V);if(ie&&ie._f){const ae=Array.isArray(ie._f.refs)?ie._f.refs[0]:ie._f.ref;if(du(ae)){const xe=ae.closest("form");if(xe){xe.reset();break}}}}if(P.keepFieldsRef)for(const V of a.mount)W(V,ce(R,V));else r={}}i=t.shouldUnregister?P.keepDefaultValues?_t(o):{}:_t(R),h.array.next({values:{...R}}),h.state.next({values:{...R}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues||!t.shouldUnregister&&!nn(R),s.watch=!!t.shouldUnregister,s.keepIsValid=!!P.keepIsValid,s.action=!1,P.keepErrors||(n.errors={}),h.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:ne?!1:P.keepDirty?n.isDirty:!!(P.keepDefaultValues&&!bo(_,o)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ne?{}:P.keepDirtyValues?P.keepDefaultValues&&i?Bi(o,i):n.dirtyFields:P.keepDefaultValues&&_?Bi(o,_):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},ft=(_,P)=>Ke(Zn(_)?_(i):_,{...t.resetOptions,...P}),Fe=(_,P={})=>{const U=ce(r,_),oe=U&&U._f;if(oe){const ne=oe.refs?oe.refs[0]:oe.ref;ne.focus&&setTimeout(()=>{ne.focus(),P.shouldSelect&&Zn(ne.select)&&ne.select()})}},Tn=_=>{n={...n,..._}},It={control:{register:dt,unregister:Pe,getFieldState:pe,handleSubmit:De,setError:ze,_subscribe:Le,_runSchema:z,_updateIsValidating:b,_focusError:xt,_getWatch:q,_getDirty:F,_setValid:y,_setFieldArray:x,_setDisabledField:We,_setErrors:O,_getFieldArray:L,_reset:Ke,_resetDefaultValues:()=>Zn(t.defaultValues)&&t.defaultValues().then(_=>{ft(_,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:K,_disableForm:Ee,_subjects:h,_proxyFormState:d,get _fields(){return r},get _formValues(){return i},get _state(){return s},set _state(_){s=_},get _defaultValues(){return o},get _names(){return a},set _names(_){a=_},get _formState(){return n},get _options(){return t},set _options(_){t={...t,..._}}},subscribe:Et,trigger:S,register:dt,handleSubmit:De,watch:ve,setValue:W,getValues:ye,reset:ft,resetField:Ne,clearErrors:v,unregister:Pe,setError:ze,setFocus:Fe,getFieldState:pe};return{...It,formControl:It}}function KK(e={}){const t=Re.useRef(void 0),n=Re.useRef(void 0),[r,o]=Re.useState({isDirty:!1,isValidating:!1,isLoading:Zn(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Zn(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!Zn(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...a}=YK(e);t.current={...a,formState:r}}const i=t.current.control;return i._options=e,_K(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),Re.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),Re.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),Re.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),Re.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),Re.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),Re.useEffect(()=>{var s;e.values&&!bo(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((s=i._options.resetOptions)===null||s===void 0)&&s.keepIsValid||i._setValid(),n.current=e.values,o(a=>({...a}))):i._resetDefaultValues()},[i,e.values]),Re.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=Re.useMemo(()=>MK(r,i),[i,r]),t.current}function QK(e,t=[]){let n=[];function r(i,s){const a=C.createContext(s);a.displayName=i+"Context";const l=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,g=f?.[e]?.[l]||a,y=C.useMemo(()=>p,Object.values(p));return E.jsx(g.Provider,{value:y,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[e]?.[l]||a,p=C.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>C.createContext(s));return function(a){const l=a?.[e]||i;return C.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,XK(o,...t)]}function XK(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var sg="Avatar",[ZK]=QK(sg),[JK,JS]=ZK(sg),ev=C.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[o,i]=C.useState("idle");return E.jsx(JK,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:E.jsx(hu.span,{...r,ref:t})})});ev.displayName=sg;var tv="AvatarImage",nv=C.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...i}=e,s=JS(tv,n),a=eQ(r,i),l=_v(c=>{o(c),s.onImageLoadingStatusChange(c)});return Df(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?E.jsx(hu.img,{...i,ref:t,src:r}):null});nv.displayName=tv;var rv="AvatarFallback",ov=C.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...o}=e,i=JS(rv,n),[s,a]=C.useState(r===void 0);return C.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),s&&i.imageLoadingStatus!=="loaded"?E.jsx(hu.span,{...o,ref:t}):null});ov.displayName=rv;function nE(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function eQ(e,{referrerPolicy:t,crossOrigin:n}){const r=Ov(),o=C.useRef(null),i=r?(o.current||(o.current=new window.Image),o.current):null,[s,a]=C.useState(()=>nE(i,e));return Df(()=>{a(nE(i,e))},[i,e]),Df(()=>{const l=d=>()=>{a(d)};if(!i)return;const c=l("loaded"),u=l("error");return i.addEventListener("load",c),i.addEventListener("error",u),t&&(i.referrerPolicy=t),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",c),i.removeEventListener("error",u)}},[i,n,t]),s}var tQ=ev,nQ=nv,rQ=ov;const ag="-",oQ=e=>{const t=sQ(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(ag);return a[0]===""&&a.length!==1&&a.shift(),iv(a,t)||iQ(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},iv=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?iv(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(ag);return t.validators.find(({validator:s})=>s(i))?.classGroupId},rE=/^\[(.+)\]$/,iQ=e=>{if(rE.test(e)){const t=rE.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},sQ=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return lQ(Object.entries(e.classGroups),n).forEach(([i,s])=>{lp(s,r,i,t)}),r},lp=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:oE(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(aQ(o)){lp(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{lp(s,oE(t,i),n,r)})})},oE=(e,t)=>{let n=e;return t.split(ag).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},aQ=e=>e.isThemeGetter,lQ=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[t+s,a])):i);return[n,o]}):e,cQ=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},sv="!",uQ=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,s=a=>{const l=[];let c=0,u=0,d;for(let y=0;y<a.length;y++){let b=a[y];if(c===0){if(b===o&&(r||a.slice(y,y+i)===t)){l.push(a.slice(u,y)),u=y+i;continue}if(b==="/"){d=y;continue}}b==="["?c++:b==="]"&&c--}const f=l.length===0?a:a.substring(u),h=f.startsWith(sv),p=h?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:s}):s},dQ=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},fQ=e=>({cache:cQ(e.cacheSize),parseClassName:uQ(e),...oQ(e)}),hQ=/\s+/,pQ=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(hQ);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=n(c);let p=!!h,g=r(p?f.substring(0,h):f);if(!g){if(!p){a=c+(a.length>0?" "+a:a);continue}if(g=r(f),!g){a=c+(a.length>0?" "+a:a);continue}p=!1}const y=dQ(u).join(":"),b=d?y+sv:y,x=b+g;if(i.includes(x))continue;i.push(x);const k=o(g,p);for(let O=0;O<k.length;++O){const M=k[O];i.push(b+M)}a=c+(a.length>0?" "+a:a)}return a};function mQ(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=av(t))&&(r&&(r+=" "),r+=n);return r}const av=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=av(e[r]))&&(n&&(n+=" "),n+=t);return n};function gQ(e,...t){let n,r,o,i=s;function s(l){const c=t.reduce((u,d)=>d(u),e());return n=fQ(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=pQ(l,n);return o(l,u),u}return function(){return i(mQ.apply(null,arguments))}}const ot=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},lv=/^\[(?:([a-z-]+):)?(.+)\]$/i,bQ=/^\d+\/\d+$/,yQ=new Set(["px","full","screen"]),EQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xQ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,CQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pr=e=>Ki(e)||yQ.has(e)||bQ.test(e),oo=e=>gs(e,"length",_Q),Ki=e=>!!e&&!Number.isNaN(Number(e)),_f=e=>gs(e,"number",Ki),As=e=>!!e&&Number.isInteger(Number(e)),wQ=e=>e.endsWith("%")&&Ki(e.slice(0,-1)),Ce=e=>lv.test(e),io=e=>EQ.test(e),SQ=new Set(["length","size","percentage"]),vQ=e=>gs(e,SQ,cv),AQ=e=>gs(e,"position",cv),NQ=new Set(["image","url"]),IQ=e=>gs(e,NQ,RQ),MQ=e=>gs(e,"",OQ),Ns=()=>!0,gs=(e,t,n)=>{const r=lv.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},_Q=e=>xQ.test(e)&&!CQ.test(e),cv=()=>!1,OQ=e=>kQ.test(e),RQ=e=>TQ.test(e),LQ=()=>{const e=ot("colors"),t=ot("spacing"),n=ot("blur"),r=ot("brightness"),o=ot("borderColor"),i=ot("borderRadius"),s=ot("borderSpacing"),a=ot("borderWidth"),l=ot("contrast"),c=ot("grayscale"),u=ot("hueRotate"),d=ot("invert"),f=ot("gap"),h=ot("gradientColorStops"),p=ot("gradientColorStopPositions"),g=ot("inset"),y=ot("margin"),b=ot("opacity"),x=ot("padding"),k=ot("saturate"),O=ot("scale"),M=ot("sepia"),A=ot("skew"),D=ot("space"),z=ot("translate"),Y=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],K=()=>["auto",Ce,t],F=()=>[Ce,t],q=()=>["",Pr,oo],L=()=>["auto",Ki,Ce],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],re=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["start","end","center","between","around","evenly","stretch"],te=()=>["","0",Ce],S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ye=()=>[Ki,Ce];return{cacheSize:500,separator:":",theme:{colors:[Ns],spacing:[Pr,oo],blur:["none","",io,Ce],brightness:ye(),borderColor:[e],borderRadius:["none","","full",io,Ce],borderSpacing:F(),borderWidth:q(),contrast:ye(),grayscale:te(),hueRotate:ye(),invert:te(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[wQ,oo],inset:K(),margin:K(),opacity:ye(),padding:F(),saturate:ye(),scale:ye(),sepia:te(),skew:ye(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Ce]}],container:["container"],columns:[{columns:[io]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),Ce]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",As,Ce]}],basis:[{basis:K()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ce]}],grow:[{grow:te()}],shrink:[{shrink:te()}],order:[{order:["first","last","none",As,Ce]}],"grid-cols":[{"grid-cols":[Ns]}],"col-start-end":[{col:["auto",{span:["full",As,Ce]},Ce]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Ns]}],"row-start-end":[{row:["auto",{span:[As,Ce]},Ce]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ce]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ce]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ce,t]}],"min-w":[{"min-w":[Ce,t,"min","max","fit"]}],"max-w":[{"max-w":[Ce,t,"none","full","min","max","fit","prose",{screen:[io]},io]}],h:[{h:[Ce,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ce,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ce,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ce,t,"auto","min","max","fit"]}],"font-size":[{text:["base",io,oo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",_f]}],"font-family":[{font:[Ns]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ce]}],"line-clamp":[{"line-clamp":["none",Ki,_f]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Pr,Ce]}],"list-image":[{"list-image":["none",Ce]}],"list-style-type":[{list:["none","disc","decimal",Ce]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Pr,oo]}],"underline-offset":[{"underline-offset":["auto",Pr,Ce]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),AQ]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",vQ]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},IQ]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...re(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:re()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...re()]}],"outline-offset":[{"outline-offset":[Pr,Ce]}],"outline-w":[{outline:[Pr,oo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Pr,oo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",io,MQ]}],"shadow-color":[{shadow:[Ns]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",io,Ce]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[k]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ce]}],duration:[{duration:ye()}],ease:[{ease:["linear","in","out","in-out",Ce]}],delay:[{delay:ye()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ce]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[O]}],"scale-x":[{"scale-x":[O]}],"scale-y":[{"scale-y":[O]}],rotate:[{rotate:[As,Ce]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ce]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Pr,oo,_f]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},DQ=gQ(LQ);const PQ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),BQ=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),iE=e=>{const t=BQ(e);return t.charAt(0).toUpperCase()+t.slice(1)},uv=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),FQ=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var HQ={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 UQ=C.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>C.createElement("svg",{ref:l,...HQ,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:uv("lucide",o),...!i&&!FQ(a)&&{"aria-hidden":"true"},...a},[...s.map(([c,u])=>C.createElement(c,u)),...Array.isArray(i)?i:[i]]));const ld=(e,t)=>{const n=C.forwardRef(({className:r,...o},i)=>C.createElement(UQ,{ref:i,iconNode:t,className:uv(`lucide-${PQ(iE(e))}`,`lucide-${e}`,r),...o}));return n.displayName=iE(e),n};const VQ=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],dv=ld("check",VQ);const $Q=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],fv=ld("chevron-down",$Q);const jQ=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],hv=ld("chevron-right",jQ);const zQ=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],WQ=ld("chevron-up",zQ);var qQ="Label",pv=C.forwardRef((e,t)=>E.jsx(hu.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));pv.displayName=qQ;var GQ=pv;function ue(...e){return DQ(kv(e))}function YQ({className:e,...t}){return E.jsx(tQ,{"data-slot":"avatar",className:ue("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function KQ({className:e,...t}){return E.jsx(nQ,{"data-slot":"avatar-image",className:ue("aspect-square size-full",e),...t})}function QQ({className:e,...t}){return E.jsx(rQ,{"data-slot":"avatar-fallback",className:ue("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var XQ=up("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function ZQ({className:e,variant:t,asChild:n=!1,...r}){return E.jsx(n?vE:"span",{"data-slot":"badge",className:ue(XQ({variant:t}),e),...r})}var JQ=up("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function eX({className:e,variant:t,size:n,asChild:r=!1,...o}){return E.jsx(r?vE:"button",{"data-slot":"button",className:ue(JQ({variant:t,size:n,className:e})),...o})}function tX({className:e,...t}){return E.jsx("div",{"data-slot":"card",className:ue("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function nX({className:e,...t}){return E.jsx("div",{"data-slot":"card-content",className:ue("px-6",e),...t})}function rX({...e}){return E.jsx(dA,{"data-slot":"dropdown-menu",...e})}function oX({...e}){return E.jsx(tA,{"data-slot":"dropdown-menu-trigger",...e})}function iX({className:e,sideOffset:t=4,...n}){return E.jsx(lA,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ue("bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",e),...n})}function sX({className:e,inset:t,variant:n="default",...r}){return E.jsx(aA,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r})}function aX({className:e,children:t,checked:n,...r}){return E.jsxs(cA,{"data-slot":"dropdown-menu-checkbox-item",className:ue("focus:bg-accent focus:text-accent-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),checked:n,...r,children:[E.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:E.jsx(uA,{children:E.jsx(dv,{className:"size-4"})})}),t]})}function lX({className:e,inset:t,...n}){return E.jsx(sA,{"data-slot":"dropdown-menu-label","data-inset":t,className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function cX({className:e,...t}){return E.jsx(iA,{"data-slot":"dropdown-menu-separator",className:ue("bg-border -mx-1 my-1 h-px",e),...t})}function uX({...e}){return E.jsx(oA,{"data-slot":"dropdown-menu-sub",...e})}function dX({className:e,inset:t,children:n,...r}){return E.jsxs(nA,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:ue("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground outline-hidden flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm data-[inset]:pl-8",e),...r,children:[n,E.jsx(hv,{className:"ml-auto size-4"})]})}function fX({className:e,...t}){return E.jsx(rA,{"data-slot":"dropdown-menu-sub-content",className:ue("bg-popover text-popover-foreground 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 origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}function hX({className:e,...t}){return E.jsx(GQ,{"data-slot":"label",className:ue("flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",e),...t})}var pX=RK;C.createContext({}),C.createContext({});function mX({className:e,type:t,...n}){return E.jsx("input",{type:t,"data-slot":"input",className:ue("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}function gX({...e}){return E.jsx(eA,{"data-slot":"popover",...e})}function bX({...e}){return E.jsx(Zv,{"data-slot":"popover-trigger",...e})}function yX({className:e,align:t="center",sideOffset:n=4,...r}){return E.jsx(Jv,{"data-slot":"popover-content",align:t,sideOffset:n,className:ue("bg-popover text-popover-foreground 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 origin-(--radix-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md",e),...r})}function EX({...e}){return E.jsx(Xv,{"data-slot":"select",...e})}function xX({...e}){return E.jsx(jv,{"data-slot":"select-value",...e})}function CX({className:e,size:t="default",children:n,...r}){return E.jsxs(zv,{"data-slot":"select-trigger","data-size":t,className:ue("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 shadow-xs flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,E.jsx(Wv,{asChild:!0,children:E.jsx(fv,{className:"size-4 opacity-50"})})]})}function kX({className:e,children:t,position:n="popper",...r}){return E.jsxs(Kv,{"data-slot":"select-content",className:ue("bg-popover text-popover-foreground 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 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border shadow-md",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:[E.jsx(wX,{}),E.jsx(Qv,{className:ue("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),E.jsx(SX,{})]})}function TX({className:e,children:t,...n}){return E.jsxs(qv,{"data-slot":"select-item",className:ue("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[E.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:E.jsx(Gv,{children:E.jsx(dv,{className:"size-4"})})}),E.jsx(Yv,{children:t})]})}function wX({className:e,...t}){return E.jsx(fA,{"data-slot":"select-scroll-up-button",className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:E.jsx(WQ,{className:"size-4"})})}function SX({className:e,...t}){return E.jsx(hA,{"data-slot":"select-scroll-down-button",className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:E.jsx(fv,{className:"size-4"})})}function vX({className:e,...t}){return E.jsx("div",{"data-slot":"skeleton",className:ue("bg-accent animate-pulse rounded-md",e),...t})}function AX({className:e,...t}){return E.jsx($v,{"data-slot":"tabs",className:ue("flex flex-col gap-2",e),...t})}function NX({className:e,...t}){return E.jsx(Uv,{"data-slot":"tabs-list",className:ue("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function IX({className:e,...t}){return E.jsx(Hv,{"data-slot":"tabs-trigger",className:ue("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...t})}function MX({className:e,...t}){return E.jsx(Vv,{"data-slot":"tabs-content",className:ue("flex-1 outline-none",e),...t})}var _X=up("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function OX({className:e,variant:t,size:n,...r}){return E.jsx(Fv,{"data-slot":"toggle",className:ue(_X({variant:t,size:n,className:e})),...r})}function mv({delayDuration:e=0,...t}){return E.jsx(Lv,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function RX({...e}){return E.jsx(mv,{children:E.jsx(Bv,{"data-slot":"tooltip",...e})})}function LX({...e}){return E.jsx(Rv,{"data-slot":"tooltip-trigger",...e})}function DX({className:e,sideOffset:t=0,children:n,...r}){return E.jsxs(Dv,{"data-slot":"tooltip-content",sideOffset:t,className:ue("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",e),...r,children:[n,E.jsx(Pv,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})}var PX={Avatar:{Avatar:YQ,AvatarFallback:QQ,AvatarImage:KQ},Badge:{Badge:ZQ},Button:{Button:eX},Card:{Card:tX,CardContent:nX},DropdownMenu:{DropdownMenu:rX,DropdownMenuCheckboxItem:aX,DropdownMenuContent:iX,DropdownMenuItem:sX,DropdownMenuLabel:lX,DropdownMenuSeparator:cX,DropdownMenuSub:uX,DropdownMenuSubContent:fX,DropdownMenuSubTrigger:dX,DropdownMenuTrigger:oX},Form:{Form:pX},Input:{Input:mX},Label:{Label:hX},Popover:{Popover:gX,PopoverContent:yX,PopoverTrigger:bX},Select:{Select:EX,SelectContent:kX,SelectItem:TX,SelectTrigger:CX,SelectValue:xX},Skeleton:{Skeleton:vX},Tabs:{Tabs:AX,TabsContent:MX,TabsList:NX,TabsTrigger:IX},Toggle:{Toggle:OX},Tooltip:{Tooltip:RX,TooltipContent:DX,TooltipProvider:mv,TooltipTrigger:LX}},gv=C.createContext(void 0);function Ye(){return C.useContext(gv)}var BX=e=>{let{children:t,...n}=e;Te(n);let r=Ye(),o=KK();return E.jsx(r.Form.Form,{...o,children:t})},FX=C.forwardRef((e,t)=>{let{className:n,name:r,label:o,variant:i,icon:s,value:a,autoFocus:l,placeholder:c,disabled:u,onKeyDown:d,onChange:f,onSubmit:h,autoComplete:p,"aria-activedescendant":g,rightSection:y,...b}=e;Te(b);let x=Ye();return E.jsxs("div",{className:ue(n,"border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","text-foreground items-center gap-2"),children:[s,E.jsxs("div",{className:"flex-1",children:[o&&E.jsx(x.Label.Label,{htmlFor:o,children:o}),E.jsx(x.Input.Input,{className:ue(n,"h-auto border-none p-0"),id:o,name:r,autoFocus:l,placeholder:c,disabled:u,value:a,onKeyDown:d,onChange:f,onSubmit:h,ref:t,"aria-activedescendant":g})]}),y]})}),HX=e=>C.forwardRef((t,n)=>E.jsx(e,{onPointerDown:r=>{r.nativeEvent.fakeEvent||(r.ctrlKey=!0)},onPointerUp:r=>{let o=new PointerEvent("pointerdown",r.nativeEvent);o.fakeEvent=!0,r.target.dispatchEvent(o)},...t,ref:n})),UX=e=>{let{children:t,onOpenChange:n,position:r,sub:o,...i}=e;Te(i);let s=Ye();return o?E.jsx(s.DropdownMenu.DropdownMenuSub,{onOpenChange:n,children:t}):E.jsx(s.DropdownMenu.DropdownMenu,{modal:!1,onOpenChange:n,children:t})},VX=e=>{let{children:t,sub:n,...r}=e;Te(r);let o=Ye(),i=C.useMemo(()=>HX(o.DropdownMenu.DropdownMenuTrigger),[o.DropdownMenu.DropdownMenuTrigger]);return n?E.jsx(o.DropdownMenu.DropdownMenuSubTrigger,{children:t}):E.jsx(i,{asChild:!0,...r,children:t})},$X=C.forwardRef((e,t)=>{let{className:n,children:r,sub:o,...i}=e;Te(i);let s=Ye();return E.jsx(o?s.DropdownMenu.DropdownMenuSubContent:s.DropdownMenu.DropdownMenuContent,{className:n,ref:t,children:r})}),jX=C.forwardRef((e,t)=>{let{className:n,children:r,icon:o,checked:i,subTrigger:s,onClick:a,...l}=e;Te(l);let c=Ye();return s?E.jsxs(E.Fragment,{children:[o,r]}):i===void 0?E.jsxs(c.DropdownMenu.DropdownMenuItem,{className:n,ref:t,onClick:a,...l,children:[o,r,s&&E.jsx(hv,{className:"ml-auto h-4 w-4"})]}):E.jsxs(c.DropdownMenu.DropdownMenuCheckboxItem,{className:ue(n,"gap-1",i?"":"px-2"),ref:t,checked:i,onClick:a,...l,children:[o,r]})}),zX=C.forwardRef((e,t)=>{let{className:n,...r}=e;return Te(r),E.jsx(Ye().DropdownMenu.DropdownMenuSeparator,{className:n,ref:t})}),WX=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx(Ye().DropdownMenu.DropdownMenuLabel,{className:n,ref:t,children:r})}),qX=C.forwardRef((e,t)=>{let{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=e;return Te(u,!1),E.jsxs(Ye().Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:t,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),GX=C.forwardRef((e,t)=>{let{className:n,tabs:r,defaultOpenTab:o,openTab:i,setOpenTab:s,loading:a,...l}=e;Te(l);let c=Ye();return E.jsxs(c.Tabs.Tabs,{className:ue(n,"bg-popover max-w-screen rounded-lg p-2"),ref:t,value:i,defaultValue:o,onValueChange:s,children:[E.jsx(c.Tabs.TabsList,{children:r.map(u=>E.jsx(c.Tabs.TabsTrigger,{value:u.name,children:u.name},u.name))}),r.map(u=>E.jsx(c.Tabs.TabsContent,{value:u.name,children:E.jsx(c.Card.Card,{children:E.jsx(c.Card.CardContent,{className:"p-4",children:u.tabPanel})})},u.name))]})}),YX=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue(n,"flex flex-col items-start justify-center gap-2"),ref:t,children:r})}),KX=C.forwardRef((e,t)=>{let{className:n,value:r,placeholder:o,onKeyDown:i,onChange:s,...a}=e;return Te(a),E.jsx(Ye().Input.Input,{"data-test":"embed-input",className:ue(n,"w-80 max-w-full"),ref:t,value:r,placeholder:o,onKeyDown:i,onChange:s})}),bv=C.createContext(void 0),QX=e=>{let{children:t,open:n,onOpenChange:r,position:o,portalRoot:i,...s}=e;return Te(s),E.jsx(Ye().Popover.Popover,{open:n,onOpenChange:r,children:E.jsx(bv.Provider,{value:i,children:t})})},XX=C.forwardRef((e,t)=>{let{children:n,...r}=e;return Te(r),E.jsx(Ye().Popover.PopoverTrigger,{ref:t,asChild:!0,children:n})}),ZX=C.forwardRef((e,t)=>{let{className:n,variant:r,children:o,...i}=e;Te(i);let s=Ye(),a=C.useContext(bv),l=E.jsx(s.Popover.PopoverContent,{sideOffset:8,className:ue(n,"flex flex-col gap-2",r==="panel-popover"?"w-fit max-w-none border-none p-0 shadow-none":""),ref:t,children:o});return a?Xr.createPortal(l,a):l}),JX=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o,!1),E.jsx("div",{className:n,ref:t,...o,children:r})}),eZ=C.forwardRef((e,t)=>{let{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=e;return Te(u,!1),E.jsxs(Ye().Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:t,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),tZ=C.forwardRef((e,t)=>{let{className:n,children:r,id:o,columns:i,...s}=e;return Te(s),E.jsx("div",{className:ue("bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md","grid",n),style:{gridTemplateColumns:`repeat(${i}, 1fr)`},ref:t,id:o,role:"grid",children:r})}),nZ=C.forwardRef((e,t)=>{let{className:n,children:r,columns:o,...i}=e;return Te(i),E.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:t,children:r})}),rZ=C.forwardRef((e,t)=>{let{className:n,children:r,id:o,...i}=e;return Te(i),E.jsx("div",{id:o,role:"listbox",className:ue("bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",n),ref:t,children:r})}),oZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",n),ref:t,children:E.jsx("div",{children:r})})}),iZ=C.forwardRef((e,t)=>{let n=Ye(),{className:r,item:o,isSelected:i,onClick:s,id:a,...l}=e;Te(l);let c=C.useRef(null);return C.useEffect(()=>{!c.current||!i||$S(c.current,c.current.closest(".bn-suggestion-menu, #ai-suggestion-menu"))!=="none"&&c.current.scrollIntoView({block:"nearest"})},[i]),E.jsxs("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",e.item.size==="small"?"gap-3 py-1":"",r),"data-highlighted":!0,ref:jS([t,c]),id:a,onMouseDown:u=>u.preventDefault(),onClick:s,role:"option","aria-selected":i||void 0,children:[o.icon&&E.jsx("div",{className:ue("p-3",e.item.size==="small"?"p-0":"",r),"data-position":"left",children:o.icon}),E.jsxs("div",{className:"flex-1",children:[E.jsx("div",{className:ue("text-base",e.item.size==="small"?"text-sm":"",r),children:o.title}),E.jsx("div",{className:ue("text-xs",e.item.size==="small"?"hidden":"",r),children:o.subtext})]}),o.badge&&E.jsx("div",{"data-position":"right",className:"text-xs",children:E.jsx(n.Badge.Badge,{variant:"secondary",children:o.badge})})]})}),sZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",n),ref:t,children:r})}),aZ=C.forwardRef((e,t)=>{let{className:n,...r}=e;return Te(r),E.jsx("div",{className:ue(n,"animate-spin"),ref:t,children:E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 -960 960 960",width:"1em",fill:"#e8eaed",children:E.jsx("path",{d:"M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q17 0 28.5 11.5T520-840q0 17-11.5 28.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-17 11.5-28.5T840-520q17 0 28.5 11.5T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Z"})})})}),lZ=C.forwardRef((e,t)=>{let{className:n,children:r,onMouseDown:o,onClick:i,...s}=e;return Te(s,!1),E.jsx(Ye().Button.Button,{variant:"ghost",className:ue(n,"h-full w-full p-0 text-gray-400",n?.includes("extend-button-add-remove-columns")?"ml-1":"mt-1",n?.includes("extend-button-editing")?"bg-accent text-accent-foreground":""),ref:t,onClick:i,onMouseDown:o,...s,children:r})}),cZ=C.forwardRef((e,t)=>{let{className:n,children:r,draggable:o,onDragStart:i,onDragEnd:s,style:a,label:l,...c}=e;return Te(c,!1),E.jsx(Ye().Button.Button,{variant:"ghost",className:ue(n,"h-fit w-fit p-0 text-gray-400"),ref:t,"aria-label":l,draggable:o,onDragStart:i,onDragEnd:s,style:a,...c,children:r})}),Of=C.forwardRef((e,t)=>{let{className:n,children:r,onMouseEnter:o,onMouseLeave:i,variant:s,...a}=e;return Te(a),E.jsx(Ye().Tooltip.TooltipProvider,{delayDuration:0,children:E.jsx("div",{className:ue(n,"bg-popover text-popover-foreground flex h-fit gap-1 rounded-lg border p-1 shadow-md",s==="action-toolbar"?"w-fit":""),ref:t,onMouseEnter:o,onMouseLeave:i,children:r})})}),Rf=C.forwardRef((e,t)=>{let{className:n,children:r,mainTooltip:o,secondaryTooltip:i,icon:s,isSelected:a,isDisabled:l,onClick:c,label:u,variant:d,...f}=e;Te(f,!1);let h=Ye(),p=a===void 0?E.jsxs(h.Button.Button,{className:ue(n,d==="compact"?"h-6 min-w-6 p-0":""),variant:"ghost",size:d==="compact"?"sm":"default",disabled:l,onClick:c,ref:t,"aria-label":u,...f,children:[s,r]}):E.jsxs(h.Toggle.Toggle,{className:ue(n,"data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground",d==="compact"?"h-6 min-w-6 p-0":""),size:d==="compact"?"sm":"default","aria-label":u,onClick:c,pressed:a,disabled:l,"data-state":a?"on":"off","data-disabled":l,ref:t,...f,children:[s,r]});return E.jsxs(h.Tooltip.Tooltip,{children:[E.jsx(h.Tooltip.TooltipTrigger,{asChild:!0,children:p}),E.jsxs(h.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[E.jsx("span",{children:o}),i&&E.jsx("span",{children:i})]})]})}),Lf=C.forwardRef((e,t)=>{let{className:n,items:r,isDisabled:o,...i}=e;Te(i);let s=Ye(),a=c=>E.jsxs("div",{className:"flex items-center gap-1",children:[c.icon,c.text]}),l=r.filter(c=>c.isSelected)[0];return l?E.jsxs(s.Select.Select,{value:l.text,onValueChange:c=>r.find(u=>u.text===c).onClick?.(),disabled:o,children:[E.jsx(s.Select.SelectTrigger,{className:"border-none",children:E.jsx(s.Select.SelectValue,{})}),E.jsx(s.Select.SelectContent,{className:n,ref:t,children:r.map(c=>E.jsx(s.Select.SelectItem,{disabled:c.isDisabled,value:c.text,children:E.jsx(a,{...c})},c.text))})]}):null}),uZ=C.forwardRef((e,t)=>{let{className:n,children:r,selected:o,headerText:i,onFocus:s,onBlur:a,tabIndex:l,...c}=e;return Te(c),E.jsxs(Ye().Card.Card,{className:ue(n,"w-[300px]",o?"bg-accent text-accent-foreground":""),onFocus:s,onBlur:a,tabIndex:l,ref:t,children:[i&&E.jsx("div",{className:"px-4 pt-4 text-sm italic",children:i}),r]})}),dZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue(n,"p-4",n?.includes("thread-comments")?"flex flex-col gap-6 border-b":""),ref:t,children:r})}),fZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o,!1),E.jsx(Ye().Button.Button,{className:ue(n,"text-foreground w-fit bg-transparent p-0 hover:bg-transparent"),ref:t,children:r})}),hZ=C.forwardRef((e,t)=>{let{authorInfo:n,timeString:r,edited:o,...i}=e,s=Se();Te(i,!1);let a=Ye();return n==="loading"?E.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[E.jsx(a.Skeleton.Skeleton,{className:"size-7 animate-pulse rounded-full bg-neutral-400"}),E.jsx(a.Skeleton.Skeleton,{className:"h-3 w-32 animate-pulse rounded-full bg-neutral-400"})]}):E.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[E.jsxs(a.Avatar.Avatar,{children:[E.jsx(a.Avatar.AvatarImage,{src:n.avatarUrl,alt:n.username,className:"h-7 rounded-full"}),E.jsx(a.Avatar.AvatarFallback,{children:n.username[0]})]}),E.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-2",children:[E.jsx("span",{className:"text-sm font-bold",children:n.username}),E.jsxs("span",{className:"text-xs",children:[r," ",o&&`(${s.comments.edited})`]})]})]})}),pZ=C.forwardRef((e,t)=>{let{className:n,showActions:r,authorInfo:o,timeString:i,actions:s,edited:a,emojiPickerOpen:l,children:c,...u}=e;Te(u);let[d,f]=C.useState(!1),{focused:h,ref:p}=SK(),g=s&&(r===!0||r===void 0||r==="hover"&&d||h||l);return E.jsxs("div",{ref:t,className:ue(n,"relative flex flex-col gap-2"),onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[g?E.jsx("div",{className:"absolute right-0 top-0 z-10",ref:p,children:s}):null,E.jsx(hZ,{...e}),c]})}),mZ=C.forwardRef((e,t)=>{let{className:n,onFocus:r,onBlur:o,autoFocus:i,editor:s,editable:a,...l}=e;Te(l);let c=Nr();return E.jsx(yv,{autoFocus:i,className:ue(n,""),theme:c?.colorSchemePreference,editor:e.editor,sideMenu:!1,slashMenu:!1,tableHandles:!1,filePanel:!1,formattingToolbar:!1,editable:a,ref:t,onFocus:r,onBlur:o,children:E.jsx(eg,{formattingToolbar:gZ})})}),gZ=()=>E.jsx(Jm,{blockTypeSelectItems:[],children:Zm([]).filter(e=>e.key!=="nestBlockButton"&&e.key!=="unnestBlockButton")}),bZ=C.forwardRef((e,t)=>{let{className:n,text:r,icon:o,isSelected:i,mainTooltip:s,secondaryTooltip:a,onClick:l,onMouseEnter:c,...u}=e;Te(u,!1);let d=Ye(),f=E.jsxs(d.Button.Button,{variant:i?"secondary":"outline",className:ue(n,"flex h-7 items-center gap-1 rounded-full px-2.5"),onClick:l,onMouseEnter:c,ref:t,children:[E.jsx("span",{children:o}),E.jsx("span",{children:r})]});return s?E.jsxs(d.Tooltip.Tooltip,{children:[E.jsx(d.Tooltip.TooltipTrigger,{asChild:!0,children:f}),E.jsxs(d.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[E.jsx("span",{children:s}),a&&E.jsx("span",{children:a})]})]}):f}),yZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx(Ye().Tooltip.TooltipProvider,{delayDuration:0,children:E.jsx("div",{className:ue(n,"flex w-full flex-row flex-wrap gap-1"),ref:t,children:r})})}),EZ=C.forwardRef((e,t)=>{let{className:n,children:r,onClick:o,label:i,...s}=e;return Te(s),E.jsx(Ye().Button.Button,{type:"submit",className:n,"aria-label":i,ref:t,onClick:o,children:r})}),xZ=C.forwardRef((e,t)=>{let{className:n,accept:r,value:o,placeholder:i,onChange:s,...a}=e;return Te(a),E.jsx(Ye().Input.Input,{type:"file",className:n,ref:t,accept:r,value:o?o.name:void 0,onChange:async l=>s?.(l.target.files[0]),placeholder:i})}),CZ=C.forwardRef((e,t)=>{let{className:n,isSelected:r,onClick:o,item:i,id:s,...a}=e;Te(a);let l=C.useRef(null);return C.useEffect(()=>{!l.current||!r||$S(l.current,l.current.closest(".bn-grid-suggestion-menu"))!=="none"&&l.current.scrollIntoView({block:"nearest"})},[r]),E.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive","text-lg!",n),ref:jS([t,l]),id:s,role:"option",onClick:o,"aria-selected":r||void 0,children:i.icon})}),kZ=C.forwardRef((e,t)=>{let{className:n,children:r,columns:o,...i}=e;return Te(i),E.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:t,children:r})}),TZ={FormattingToolbar:{Root:Of,Button:Rf,Select:Lf},FilePanel:{Root:GX,Button:EZ,FileInput:xZ,TabPanel:YX,TextInput:KX},LinkToolbar:{Root:Of,Button:Rf,Select:Lf},SideMenu:{Root:JX,Button:eZ},SuggestionMenu:{Root:rZ,Item:iZ,EmptyItem:oZ,Label:sZ,Loader:aZ},GridSuggestionMenu:{Root:tZ,Item:CZ,EmptyItem:nZ,Loader:kZ},TableHandle:{Root:cZ,ExtendButton:lZ},Comments:{Comment:pZ,Editor:mZ,Card:uZ,CardSection:dZ,ExpandSectionsPrompt:fZ},Generic:{Badge:{Root:bZ,Group:yZ},Toolbar:{Root:Of,Button:Rf,Select:Lf},Form:{Root:BX,TextInput:FX},Menu:{Root:UX,Trigger:VX,Dropdown:$X,Divider:zX,Label:WX,Item:jX,Button:qX},Popover:{Root:QX,Trigger:XX,Content:ZX}}},yv=e=>{let{className:t,shadCNComponents:n,...r}=e,o=C.useMemo(()=>({...PX,...n}),[n]);return E.jsx(gv.Provider,{value:o,children:E.jsx(nS.Provider,{value:TZ,children:E.jsx(CK,{className:ut("bn-shadcn",t||""),...r})})})};function sE({open:e,onClose:t,onSave:n,initial:r,hideCaption:o}){const[i,s]=C.useState(r?.url??""),[a,l]=C.useState(r?.mediaId??""),[c,u]=C.useState(r?.alt??""),[d,f]=C.useState(r?.caption??""),[h,p]=C.useState(r?.link??""),[g,y]=C.useState(r?.filename??""),[b,x]=C.useState(r?.width??0),[k,O]=C.useState(r?.height??0),[M,A]=C.useState(r?.thumbUrl??""),[D,z]=C.useState(!1),[Y,N]=C.useState(!1),K=!!a,F=i?K&&M?Ff(M):Ff(i):"";function q(W){if(s(W.url),l(W.mediaId),y(W.filename),x(W.width??0),O(W.height??0),A(W.urls?.thumb_md??""),N(!1),!c.trim()){const G=W.filename.replace(/\.[\w]+$/,"").replace(/[._-]+/g," ");u(G)}z(!1)}function L(){s(""),l(""),y(""),x(0),O(0),A(""),N(!1)}function H(W){s(W),l(""),y(""),x(0),O(0),A(""),N(!1)}function re(){n({url:i,mediaId:a,alt:c,caption:d,link:h,filename:g,width:b,height:k})}return E.jsx(cE,{open:e,onOpenChange:()=>t(),children:E.jsxs(uE,{children:[E.jsxs(dE,{children:[E.jsx(fE,{children:r?"Edit Image":"Insert Image"}),E.jsx(hE,{className:"sr-only",children:"Set the image URL, alt text, and caption."})]}),E.jsxs("div",{className:"space-y-4",children:[i&&!Y?E.jsx("div",{className:"flex justify-center",children:E.jsx("img",{src:F,alt:c||"Preview",className:"max-h-48 rounded-md object-contain",onError:()=>N(!0)})}):i&&Y?E.jsx("div",{className:"flex justify-center",children:E.jsx("div",{className:"flex h-32 w-32 items-center justify-center rounded-md bg-muted",children:E.jsx(pE,{className:"h-8 w-8 text-muted-foreground","data-testid":"fallback-icon"})})}):null,E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{children:"Image"}),E.jsxs("div",{className:"flex gap-2",children:[K?E.jsxs(Tv,{variant:"secondary",className:"flex max-w-full items-center gap-1.5 px-3 py-1.5 text-sm",children:[E.jsx(wv,{className:"h-3.5 w-3.5 shrink-0"}),E.jsx("span",{className:"truncate",children:g}),E.jsx("button",{type:"button",onClick:L,className:"ml-1 shrink-0 rounded-full p-0.5 hover:bg-muted","aria-label":"Clear media",children:E.jsx(Sv,{className:"h-3 w-3"})})]}):E.jsx(qa,{placeholder:"https://example.com/image.jpg",value:i,onChange:W=>H(W.target.value)}),E.jsx(Bs,{type:"button",variant:"outline",onClick:()=>z(!0),children:"Select Media"})]})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{htmlFor:"image-alt",children:"Alt Text"}),E.jsx(qa,{id:"image-alt",value:c,onChange:W=>u(W.target.value),placeholder:"Describe the image"})]}),!o&&E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{htmlFor:"image-caption",children:"Caption (optional)"}),E.jsx(qa,{id:"image-caption",value:d,onChange:W=>f(W.target.value),placeholder:"Photo credit or description"})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{htmlFor:"image-link",children:"Link (optional)"}),E.jsx(qa,{id:"image-link",value:h,onChange:W=>p(W.target.value),placeholder:"https://example.com"})]})]}),E.jsxs(mE,{children:[E.jsx(Bs,{variant:"outline",onClick:t,children:"Cancel"}),E.jsx(Bs,{onClick:re,disabled:!i.trim(),children:"Save"})]}),D&&E.jsx(DA,{open:D,onClose:()=>z(!1),onSelect:W=>q(W),allowedTypes:["image/*"]})]})})}const wZ=VS({type:"image",propSchema:{mediaId:{default:""},url:{default:""},alt:{default:""},caption:{default:""},filename:{default:""},link:{default:""},width:{default:0},height:{default:0}},content:"none"},{render:({block:e,editor:t})=>E.jsx(SZ,{block:e,editor:t})});function SZ({block:e,editor:t}){const n=!!e.props.url,[r,o]=C.useState(!n&&t.isEditable),i=n?Ff(e.props.url):"";function s(l){t.updateBlock(e,{props:{url:l.url,mediaId:l.mediaId,alt:l.alt,caption:l.caption,filename:l.filename,link:l.link,width:l.width,height:l.height}}),o(!1)}if(!n)return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"flex cursor-pointer flex-col items-center rounded-lg border-2 border-dashed p-8 text-center",onClick:()=>t.isEditable&&o(!0),children:[E.jsx(pE,{className:"mx-auto h-8 w-8 text-muted-foreground"}),E.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Click to select an image"})]}),r&&E.jsx(sE,{open:r,onClose:()=>o(!1),onSave:s})]});const a=E.jsxs("div",{className:"relative inline-block",children:[E.jsx("img",{src:i,alt:e.props.alt,className:"max-w-full rounded-lg"}),t.isEditable&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-black/0 opacity-0 transition-opacity group-hover:bg-black/20 group-hover:opacity-100",children:E.jsx(gE,{className:"h-6 w-6 text-white drop-shadow"})})]});return E.jsxs(E.Fragment,{children:[E.jsxs("figure",{className:`group my-2${t.isEditable?" cursor-pointer rounded-lg ring-primary hover:ring-2":""}`,onClick:()=>t.isEditable&&o(!0),children:[e.props.link&&!t.isEditable?E.jsx("a",{href:e.props.link,target:"_blank",rel:"noopener noreferrer",children:a}):a,e.props.caption&&E.jsx("figcaption",{className:"mt-1 text-sm text-muted-foreground",children:e.props.caption})]}),r&&E.jsx(sE,{open:r,onClose:()=>o(!1),onSave:s,initial:{url:e.props.url,mediaId:e.props.mediaId,alt:e.props.alt,caption:e.props.caption,filename:e.props.filename,link:e.props.link,width:e.props.width,height:e.props.height}})]})}function vZ({blockType:e,data:t,blocksToHTML:n,onSave:r}){const[o,i]=C.useState(!1),[s,a]=C.useState({}),l=e.fields??[];function c(){a({...t}),i(!0)}function u(){r(s),i(!1)}return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"cursor-pointer",onClick:c,children:[E.jsxs("div",{className:"flex items-center gap-1 pb-1",children:[E.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.icon&&E.jsx(vv,{name:e.icon,className:"h-3 w-3"}),e.label]}),E.jsx(gE,{className:"h-3 w-3 text-muted-foreground"})]}),E.jsx(BA,{blockType:e,props:t,blocksToHTML:n})]}),E.jsx(cE,{open:o,onOpenChange:i,modal:!1,children:E.jsxs(uE,{className:"max-w-lg max-h-[85vh] overflow-y-auto",onPointerDownOutside:d=>{d.target.closest(".bn-suggestion-menu, .bn-toolbar, .bn-popover-content, .bn-menu-dropdown")&&d.preventDefault()},onEscapeKeyDown:d=>{document.activeElement?.closest(".bn-editor")&&d.preventDefault()},children:[E.jsxs(dE,{children:[E.jsxs(fE,{children:["Edit ",e.label]}),E.jsx(hE,{className:"sr-only",children:"Edit block properties"})]}),E.jsx(PA,{fields:l,values:s,onChange:a}),E.jsxs(mE,{children:[E.jsx(Bs,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),E.jsx(Bs,{onClick:u,children:"Save"})]})]})})]})}function AZ(e){const t={};for(const n of e??[])switch(n.type){case"boolean":t[n.name]=!1;break;case"number":t[n.name]=0;break;case"array":case"blocks":t[n.name]=[];break;case"container":t[n.name]={};break;case"media":case"content":t[n.name]=null;break;default:t[n.name]=""}return t}function NZ(e){const{image:t,video:n,audio:r,file:o,...i}=Xk,s={...i,image:wZ()};for(const a of e){const l=AZ(a.fields??[]),c=VS({type:a.name,propSchema:{data:{default:l}},content:"none"},{render:({block:u,editor:d})=>{const f=u,h=d,p=f.props.data??l;return E.jsx(vZ,{blockType:a,data:p,blocksToHTML:g=>h.blocksToHTMLLossy(g),onSave:g=>{h.updateBlock(u,{props:{data:g}});const y=d._tiptapEditor;y.emit("update",{editor:y,transaction:y.state.tr,appendedTransactions:[]})}})}});s[a.name]=c()}return um.create({blockSpecs:s})}function IZ(e){const t=C.useMemo(()=>NZ(e),[e]),n=C.useMemo(()=>e.map(r=>r.name).sort().join(","),[e]);return{schema:t,schemaKey:n}}const lg="headroom://content/";function MZ(e){return e.startsWith(lg)}function _Z(e){if(!MZ(e))return null;const t=e.slice(lg.length),n=t.indexOf("/");if(n===-1)return null;const r=t.slice(0,n),o=t.slice(n+1);return!r||!/^[0-9A-Z]{26}$/.test(o)?null:{collection:r,contentId:o}}function OZ(e,t){return`${lg}${e}/${t}`}function RZ(){const e=be(),t=fe(),{host:n}=lE(),{showSelection:r}=je(va),[o,i]=C.useState(!1);if(C.useEffect(()=>{r(o,"contentLink")},[o,r]),!t||!n)return null;function s(a){const l=OZ(a.collection,a.contentId);e.createLink(l,a.title),i(!1)}return E.jsx(FA,{host:n,selectedIds:[],open:o,onOpenChange:i,onSelect:s,trigger:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"contentLink",label:"Link to Content",icon:E.jsx(Av,{size:18}),onClick:()=>i(!0)})})}function LZ({initialBlocks:e,onChange:t,blockTypes:n,compact:r,collaboration:o}){const{schema:i,schemaKey:s}=IZ(n),a=o?"collab":"solo";return E.jsx(DZ,{schema:i,initialBlocks:e,onChange:t,blockTypes:n,compact:r,collaboration:o},`${s}-${a}`)}function DZ({schema:e,initialBlocks:t,onChange:n,blockTypes:r,compact:o,collaboration:i}){const s=Ym({schema:e,...i?{collaboration:{provider:i.provider,fragment:i.fragment,user:i.user,showCursorLabels:"activity"}}:{initialContent:t&&t.length>0?t:void 0}}),a=C.useRef(n);a.current=n,C.useMemo(()=>{let c=!1;s.onChange(()=>{if(!c){c=!0;return}a.current(s.document)})},[s]),C.useEffect(()=>{if(!i||!t||t.length===0)return;const c=setTimeout(()=>{const u=s.document;(u.length===0||u.length===1&&(!u[0]?.content||Array.isArray(u[0].content)&&u[0].content.length===0))&&s.replaceBlocks(s.document,t)},500);return()=>clearTimeout(c)},[s,i]);const l=C.useMemo(()=>{const c=FS(s),u=r.map(d=>({title:d.label,subtext:`Insert ${d.label} block`,onItemClick:()=>{const f=s.getTextCursorPosition().block;s.insertBlocks([{type:d.name}],f,"after")},aliases:[d.name],group:"Custom Blocks"}));return[...c,...u]},[s,r]);return E.jsx("div",{className:o?"[&_.bn-editor]:min-h-[120px]":"[&_.bn-editor]:min-h-[300px]",children:E.jsxs(yv,{editor:s,slashMenu:!1,filePanel:!1,formattingToolbar:!1,linkToolbar:!1,theme:"light",children:[E.jsx(HS,{triggerCharacter:"/",getItems:async c=>l.filter(u=>u.title.toLowerCase().includes(c.toLowerCase()))}),E.jsx(eg,{formattingToolbar:PZ}),E.jsx(DS,{linkToolbar:BZ})]})})}function PZ(e){return E.jsxs(Jm,{...e,children:[Zm(e.blockTypeSelectItems),E.jsx(RZ,{})]})}function BZ(e){const{host:t}=lE(),n=xv(),r=fe(),o=_Z(e.url);return!o||!r?E.jsx(LS,{...e}):E.jsxs(r.Generic.Toolbar.Root,{className:"bn-toolbar bn-link-toolbar",variant:"action-toolbar",children:[E.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:`Content link · ${o.collection}`,mainTooltip:`Content link · ${o.collection}`,isDisabled:!0,onClick:()=>{}}),E.jsx(RS,{url:e.url,text:e.text,range:e.range,setToolbarPositionFrozen:e.setToolbarPositionFrozen,setToolbarOpen:e.setToolbarOpen}),E.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:"Open",mainTooltip:"Open in editor",onClick:()=>{n(`/sites/${t}/content/${o.contentId}`)}}),E.jsx(OS,{range:e.range,setToolbarOpen:e.setToolbarOpen})]})}const dJ=Object.freeze(Object.defineProperty({__proto__:null,default:LZ},Symbol.toStringTag,{value:"Module"}));export{Se as B,Ym as G,oS as K,be as M,je as N,rt as P,jt as U,rS as W,iS as X,dJ as a,Cu as f,qr as o,xu as s,Yq as t,Jr as v,ut as w,fe as z};
|
|
176
|
+
`)}`},o.emoji)},ES=({comment:e,thread:t,showResolveButton:n})=>{let r=je(Jr),o=Se(),i=Ym({initialContent:e.body,trailingBlock:!1,dictionary:{...o,placeholders:{emptyDocument:o.placeholders.edit_comment}},schema:r.commentEditorSchema||iS}),s=fe(),[a,l]=C.useState(!1),[c,u]=C.useState(!1),d=r.threadStore,f=C.useCallback(()=>{l(!0)},[]),h=C.useCallback(()=>{i.replaceBlocks(i.document,e.body),l(!1)},[i,e.body]),p=C.useCallback(async N=>{await d.updateComment({commentId:e.id,comment:{body:i.document},threadId:t.id}),l(!1)},[e,t.id,i,d]),g=C.useCallback(async()=>{await d.deleteComment({commentId:e.id,threadId:t.id})},[e,t.id,d]),y=C.useCallback(async N=>{d.auth.canAddReaction(e,N)?await d.addReaction({threadId:t.id,commentId:e.id,emoji:N}):d.auth.canDeleteReaction(e,N)&&await d.deleteReaction({threadId:t.id,commentId:e.id,emoji:N})},[d,e,t.id]),b=C.useCallback(async()=>{await d.resolveThread({threadId:t.id})},[t.id,d]),x=C.useCallback(async()=>{await d.unresolveThread({threadId:t.id})},[t.id,d]),k=yS(e.userId);if(!e.body)return null;let O,M=d.auth.canAddReaction(e),A=d.auth.canDeleteComment(e),D=d.auth.canUpdateComment(e),z=n&&(t.resolved?d.auth.canUnresolveThread(t):d.auth.canResolveThread(t));a||(O=E.jsxs(s.Generic.Toolbar.Root,{className:ut("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[M&&E.jsx(Py,{onEmojiSelect:N=>y(N.native),onOpenChange:u,children:E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.add_reaction,variant:"compact",children:E.jsx(Dy,{size:16})},"add-reaction")}),z&&(t.resolved?E.jsx(s.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:x,children:E.jsx(oG,{size:16})},"reopen"):E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.resolve,variant:"compact",onClick:b,children:E.jsx(IG,{size:16})},"resolve")),(A||D)&&E.jsxs(s.Generic.Menu.Root,{position:"bottom-start",children:[E.jsx(s.Generic.Menu.Trigger,{children:E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.more_actions,variant:"compact",children:E.jsx(LG,{size:16})},"more-actions")}),E.jsxs(s.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[D&&E.jsx(s.Generic.Menu.Item,{icon:E.jsx(iG,{}),onClick:f,children:o.comments.actions.edit_comment},"edit-comment"),A&&E.jsx(s.Generic.Menu.Item,{icon:E.jsx(_G,{}),onClick:g,children:o.comments.actions.delete_comment},"delete-comment")]})]})]}));let Y=e.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!e.body)throw Error("soft deletes are not yet supported");return E.jsx(s.Comments.Comment,{authorInfo:k??"loading",timeString:Y,edited:e.updatedAt.getTime()!==e.createdAt.getTime(),showActions:"hover",actions:O,className:"bn-thread-comment",emojiPickerOpen:c,children:E.jsx(oS,{autoFocus:a,editor:i,editable:a,actions:e.reactions.length>0||a?({isEmpty:N})=>E.jsxs(E.Fragment,{children:[e.reactions.length>0&&!a&&E.jsxs(s.Generic.Badge.Group,{className:ut("bn-badge-group","bn-comment-reactions"),children:[e.reactions.map(K=>E.jsx(HG,{comment:e,emoji:K.emoji,onReactionSelect:y},K.emoji)),M&&E.jsx(Py,{onEmojiSelect:K=>y(K.native),onOpenChange:u,children:E.jsx(s.Generic.Badge.Root,{className:ut("bn-badge","bn-comment-add-reaction"),text:"+",icon:E.jsx(Dy,{size:16}),mainTooltip:o.comments.actions.add_reaction})})]}),a&&E.jsxs(s.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:[E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.save_button_text,variant:"compact",onClick:p,isDisabled:N,children:o.comments.save_button_text}),E.jsx(s.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:o.comments.cancel_button_text,variant:"compact",onClick:h,children:o.comments.cancel_button_text})]})]}):void 0})})},xS=({thread:e,maxCommentsBeforeCollapse:t})=>{let n=fe(),r=Se(),o=id(e.resolvedBy?[e.resolvedBy]:[]),i=e.comments.map((s,a)=>E.jsx(ES,{thread:e,comment:s,showResolveButton:a===0},s.id+JSON.stringify(s.body||"{}")));if(e.resolved&&e.resolvedUpdatedAt&&e.resolvedBy){if(!o.get(e.resolvedBy))throw Error(`User ${e.resolvedBy} resolved thread ${e.id}, but their data could not be found.`);let s=e.comments.findLastIndex(a=>e.resolvedUpdatedAt.getTime()>a.createdAt.getTime())+1;i.splice(s,0,E.jsx(n.Comments.Comment,{className:"bn-thread-comment",authorInfo:e.resolvedBy&&o.get(e.resolvedBy)||"loading",timeString:e.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:E.jsx("div",{className:"bn-resolved-text",children:r.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return t&&i.length>t&&i.splice(1,i.length-2,E.jsx(n.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:r.comments.sidebar.more_replies(e.comments.length-2)},"expand-prompt")),i},Qm=({thread:e,selected:t,referenceText:n,maxCommentsBeforeCollapse:r,onFocus:o,onBlur:i,tabIndex:s})=>{let a=fe(),l=Se(),c=je(Jr),u=Ym({trailingBlock:!1,dictionary:{...l,placeholders:{emptyDocument:l.placeholders.comment_reply}},schema:c.commentEditorSchema||iS}),d=C.useCallback(async()=>{await c.threadStore.addComment({comment:{body:u.document},threadId:e.id}),u.removeBlocks(u.document)},[c,u,e.id]);return E.jsxs(a.Comments.Card,{className:"bn-thread",headerText:n,onFocus:o,onBlur:i,selected:t,tabIndex:s,children:[E.jsx(a.Comments.CardSection,{className:"bn-thread-comments",children:E.jsx(xS,{thread:e,maxCommentsBeforeCollapse:t?void 0:r||5})}),t&&E.jsx(a.Comments.CardSection,{className:"bn-thread-composer",children:E.jsx(oS,{autoFocus:!1,editable:!0,editor:u,actions:({isEmpty:f})=>f?null:E.jsx(a.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:E.jsx(a.Generic.Toolbar.Button,{mainTooltip:l.comments.save_button_text,variant:"compact",isDisabled:f,onClick:d,children:l.comments.save_button_text})})})})]})};function CS(){let e=je(Jr).threadStore,t=C.useRef(void 0);return t.current||=e.getThreads(),C.useSyncExternalStore(C.useCallback(n=>e.subscribe(r=>{t.current=r,n()}),[e]),()=>t.current)}var UG=Yq({default:()=>kS});function kS(e){let t=be(),n=je(Jr),r=rt(Jr,{editor:t,selector:l=>l.selectedThreadId?{id:l.selectedThreadId,position:l.threadPositions.get(l.selectedThreadId)}:void 0}),o=CS(),i=C.useMemo(()=>r?o.get(r.id):void 0,[r,o]),s=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:(l,c,u)=>{u==="escape-key"&&t.focus(),l||n.selectThread(void 0)},placement:"bottom",middleware:[qr(10),xu(),Cu()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:30},...e.floatingUIOptions?.elementProps}}),[n,t,e.floatingUIOptions,r]),a=e.floatingThread||Qm;return E.jsx(rS,{position:r?.position,...s,children:i&&E.jsx(a,{thread:i,selected:!0})})}const VG=Object.freeze(Object.defineProperty({__proto__:null,a:xS,c:id,i:Qm,n:UG,o:ES,r:CS,s:yS,t:kS},Symbol.toStringTag,{value:"Module"}));function $G(e){return he({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z"},child:[]},{tag:"path",attr:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z"},child:[]}]})(e)}function TS(e){return he({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(e)}function jG(e){return he({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(e)}var zG=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},WG=({contentComponent:e})=>{const t=Mv.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(t)})};function qG(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Iv.createPortal(r.reactElement,r.element,n)},e.forEach(o=>o())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(o=>o())}}}var GG=class extends Re.Component{constructor(e){var t;super(e),this.editorContentRef=Re.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=e.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),t.contentComponent=qG(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return E.jsxs(E.Fragment,{children:[E.jsx("div",{ref:zG(t,this.editorContentRef),...n}),e?.contentComponent&&E.jsx(WG,{contentComponent:e.contentComponent})]})}},YG=C.forwardRef((e,t)=>{const n=Re.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return Re.createElement(GG,{key:n,innerRef:t,...e})}),KG=Re.memo(YG),wS=C.createContext({editor:null});wS.Consumer;var SS=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),vS=()=>C.useContext(SS),QG=Re.forwardRef((e,t)=>{const{onDragStart:n}=vS(),r=e.as||"div";return E.jsx(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function By(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function Fy(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.forward_ref)"||e.$$typeof.description==="react.forward_ref"))}function XG(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.memo)"||e.$$typeof.description==="react.memo"))}function ZG(e){if(By(e)||Fy(e))return!0;if(XG(e)){const t=e.type;if(t)return By(t)||Fy(t)}return!1}function JG(){try{if(C.version)return parseInt(C.version.split(".")[0],10)>=19}catch{}return!1}var eY=class{constructor(e,{editor:t,props:n={},as:r="div",className:o=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?Xr.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;const t=this.component,n=this.props,r=this.editor,o=JG(),i=ZG(t),s={...n};s.ref&&!(o||i)&&delete s.ref,!s.ref&&(o||i)&&(s.ref=a=>{this.ref=a}),this.reactElement=E.jsx(t,{...s}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){this.destroyed||(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;const t=this.editor;(e=t?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};Re.createContext({markViewContentRef:()=>{}});var tY=class extends YR{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,o){var i;return r==="storage"?(i=e.storage[t.name])!=null?i:{}:Reflect.get(n,r,o)}})}return this.cachedExtensionWithSyncedStorage}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:C.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},o=this.component,i=C.memo(l=>E.jsx(SS.Provider,{value:r,children:C.createElement(o,l)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new eY(i,{editor:this.editor,props:e,as:s,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!((e=this.renderer.element.firstElementChild)!=null&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:e,to:t}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:i,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,n=ya(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function nY(e,t){return n=>n.editor.contentComponent?new tY(e,n,t):{}}var Xm=C.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Xm.displayName="TiptapContext";var rY=()=>C.useContext(Xm);function AS({editor:e,instance:t,children:n}){const r=e??t;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=C.useMemo(()=>({editor:r}),[r]),i=C.useMemo(()=>({editor:r}),[r]);return E.jsx(wS.Provider,{value:i,children:E.jsx(Xm.Provider,{value:o,children:n})})}AS.displayName="Tiptap";function NS({...e}){const{editor:t}=rY();return E.jsx(KG,{editor:t,...e})}NS.displayName="Tiptap.Content";Object.assign(AS,{Content:NS});var IS=e=>{let{blockId:t,children:n,...r}=e,o=be();return E.jsx(mr,{reference:C.useMemo(()=>o.transact(i=>{if(!t)return;let s=cn(t,i.doc);if(!s)return;let{node:a}=o.prosemirrorView.domAtPos(s.posBeforeNode+1);if(a instanceof Element)return{element:a}}),[o,t]),...r,children:t!==void 0&&n})},oY=e=>{let t=fe(),n=Se(),r=be(),o=r.getBlock(e.blockId),[i,s]=C.useState(""),a=C.useCallback(u=>{s(u.currentTarget.value)},[]),l=C.useCallback(u=>{u.key==="Enter"&&!u.nativeEvent.isComposing&&(u.preventDefault(),r.updateBlock(o.id,{props:{name:k1(i),url:i}}))},[r,o.id,i]),c=C.useCallback(()=>{r.updateBlock(o.id,{props:{name:k1(i),url:i}})},[r,o.id,i]);return E.jsxs(t.FilePanel.TabPanel,{className:"bn-tab-panel",children:[E.jsx(t.FilePanel.TextInput,{className:"bn-text-input",placeholder:n.file_panel.embed.url_placeholder,value:i,onChange:a,onKeyDown:l,"data-test":"embed-input"}),E.jsx(t.FilePanel.Button,{className:"bn-button",onClick:c,"data-test":"embed-input-button",children:n.file_panel.embed.embed_button[o.type]||n.file_panel.embed.embed_button.file})]})},iY=e=>{let t=fe(),n=Se(),{setLoading:r}=e,o=be(),i=o.getBlock(e.blockId),[s,a]=C.useState(!1);C.useEffect(()=>{s&&setTimeout(()=>{a(!1)},3e3)},[s]);let l=C.useCallback(d=>{if(d===null)return;async function f(h){if(r(!0),o.uploadFile!==void 0)try{let p=await o.uploadFile(h,e.blockId);typeof p=="string"&&(p={props:{name:h.name,url:p}}),o.updateBlock(e.blockId,p)}catch{a(!0)}finally{r(!1)}}f(d)},[e.blockId,o,r]),c=o.schema.blockSpecs[i.type],u=c.implementation.meta?.fileBlockAccept?.length?c.implementation.meta.fileBlockAccept.join(","):"*/*";return E.jsxs(t.FilePanel.TabPanel,{className:"bn-tab-panel",children:[E.jsx(t.FilePanel.FileInput,{className:"bn-file-input","data-test":"upload-input",accept:u,placeholder:n.file_panel.upload.file_placeholder[i.type]||n.file_panel.upload.file_placeholder.file,value:null,onChange:l}),s&&E.jsx("div",{className:"bn-error-text",children:n.file_panel.upload.upload_error})]})},MS=e=>{let t=fe(),n=Se(),r=be(),[o,i]=C.useState(!1),s=e.tabs??[...r.uploadFile===void 0?[]:[{name:n.file_panel.upload.title,tabPanel:E.jsx(iY,{blockId:e.blockId,setLoading:i})}],{name:n.file_panel.embed.title,tabPanel:E.jsx(oY,{blockId:e.blockId})}],[a,l]=C.useState(e.defaultOpenTab||s[0].name);return E.jsx(t.FilePanel.Root,{className:"bn-panel",defaultOpenTab:a,openTab:a,setOpenTab:l,tabs:s,loading:o})},sY=e=>{let t=be(),n=je(rr),r=rt(rr),o=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:(s,a,l)=>{s||n.closeMenu(),l==="escape-key"&&t.focus()},middleware:[qr(10),Cu()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:90},...e.floatingUIOptions?.elementProps}}),[r,t,n,e.floatingUIOptions]),i=e.filePanel||MS;return E.jsx(IS,{blockId:r,...o,children:r&&E.jsx(i,{blockId:r})})},aY={bold:fG,italic:gG,underline:kG,strike:xG,code:sG};function lY(e,t){return e in t.schema.styleSchema&&t.schema.styleSchema[e].type===e&&t.schema.styleSchema[e].propSchema==="boolean"}var Al=e=>{let t=Se(),n=fe(),r=be(),o=jt({editor:r,selector:({editor:a})=>{if(!(!a.isEditable||!lY(e.basicTextStyle,a)||!(a.getSelection()?.blocks||[a.getTextCursorPosition().block]).find(l=>l.content!==void 0)))return e.basicTextStyle in a.getActiveStyles()?{active:!0}:{active:!1}}}),i=C.useCallback(a=>{r.focus(),r.toggleStyles({[a]:!0})},[r,e]);if(o===void 0)return null;let s=aY[e.basicTextStyle];return E.jsx(n.FormattingToolbar.Button,{className:"bn-button","data-test":e.basicTextStyle,onClick:()=>i(e.basicTextStyle),isSelected:o.active,label:t.formatting_toolbar[e.basicTextStyle].tooltip,mainTooltip:t.formatting_toolbar[e.basicTextStyle].tooltip,secondaryTooltip:Bn(t.formatting_toolbar[e.basicTextStyle].secondary_tooltip,t.generic.ctrl_shortcut),icon:E.jsx(s,{})})},op=e=>{let t=e.textColor||"default",n=e.backgroundColor||"default",r=e.size||16,o=C.useMemo(()=>({pointerEvents:"none",fontSize:(r*.75).toString()+"px",height:r.toString()+"px",lineHeight:r.toString()+"px",textAlign:"center",width:r.toString()+"px"}),[r]);return E.jsx("div",{className:"bn-color-icon","data-background-color":n,"data-text-color":t,style:o,children:"A"})},Hy=["default","gray","brown","red","orange","yellow","green","blue","purple","pink"],sd=e=>{let t=fe(),n=Se();return E.jsxs(E.Fragment,{children:[E.jsx(()=>e.text?E.jsxs(E.Fragment,{children:[E.jsx(t.Generic.Menu.Label,{children:n.color_picker.text_title}),Hy.map(r=>E.jsx(t.Generic.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.text.setColor(r)},"data-test":"text-color-"+r,icon:E.jsx(op,{textColor:r,size:e.iconSize}),checked:e.text.color===r,children:n.color_picker.colors[r]},"text-color-"+r))]}):null,{}),E.jsx(()=>e.background?E.jsxs(E.Fragment,{children:[E.jsx(t.Generic.Menu.Label,{children:n.color_picker.background_title}),Hy.map(r=>E.jsx(t.Generic.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.background.setColor(r)},"data-test":"background-color-"+r,icon:E.jsx(op,{backgroundColor:r,size:e.iconSize}),checked:e.background.color===r,children:n.color_picker.colors[r]},"background-color-"+r))]}):null,{})]})};function Nl(e,t){return`${e}Color`in t.schema.styleSchema&&t.schema.styleSchema[`${e}Color`].type===`${e}Color`&&t.schema.styleSchema[`${e}Color`].propSchema==="string"}var cY=()=>{let e=fe(),t=Se(),n=be(),r=Nl("text",n),o=Nl("background",n),i=jt({editor:n,selector:({editor:l})=>{if(!l.isEditable||!(l.getSelection()?.blocks||[l.getTextCursorPosition().block]).find(d=>d.content!==void 0))return;let c=Nl("text",l),u=Nl("background",l);if(!(!c&&!u))return{textColor:c?l.getActiveStyles().textColor||"default":void 0,backgroundColor:u?l.getActiveStyles().backgroundColor||"default":void 0}}}),s=C.useCallback(l=>{if(!r)throw Error("Tried to set text color, but style does not exist in editor schema.");l==="default"?n.removeStyles({textColor:l}):n.addStyles({textColor:l}),setTimeout(()=>{n.focus()})},[n,r]),a=C.useCallback(l=>{if(!o)throw Error("Tried to set background color, but style does not exist in editor schema.");l==="default"?n.removeStyles({backgroundColor:l}):n.addStyles({backgroundColor:l}),setTimeout(()=>{n.focus()})},[o,n]);return i===void 0?null:E.jsxs(e.Generic.Menu.Root,{children:[E.jsx(e.Generic.Menu.Trigger,{children:E.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"colors",label:t.formatting_toolbar.colors.tooltip,mainTooltip:t.formatting_toolbar.colors.tooltip,icon:E.jsx(op,{textColor:i.textColor,backgroundColor:i.backgroundColor,size:20})})}),E.jsx(e.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{text:i.textColor?{color:i.textColor,setColor:s}:void 0,background:i.backgroundColor?{color:i.backgroundColor,setColor:a}:void 0})})]})},Uy=e=>{for(let t of hw)if(e.startsWith(t))return e;return`${pw}://${e}`},_S=e=>{let t=fe(),n=Se(),{editLink:r}=je(ja),{url:o,text:i,showTextField:s}=e,[a,l]=C.useState(o),[c,u]=C.useState(i);C.useEffect(()=>{l(o),u(i)},[i,o]);let d=C.useCallback(g=>{g.key==="Enter"&&!g.nativeEvent.isComposing&&(g.preventDefault(),r(Uy(a),c,e.range.from),e.setToolbarOpen?.(!1),e.setToolbarPositionFrozen?.(!1))},[r,a,c,e]),f=C.useCallback(g=>l(g.currentTarget.value),[]),h=C.useCallback(g=>u(g.currentTarget.value),[]),p=C.useCallback(()=>{r(Uy(a),c,e.range.from),e.setToolbarOpen?.(!1),e.setToolbarPositionFrozen?.(!1)},[r,a,c,e]);return E.jsxs(t.Generic.Form.Root,{children:[E.jsx(t.Generic.Form.TextInput,{className:"bn-text-input",name:"url",icon:E.jsx(fS,{}),autoFocus:!0,placeholder:n.link_toolbar.form.url_placeholder,value:a,onKeyDown:d,onChange:f,onSubmit:p}),s!==!1&&E.jsx(t.Generic.Form.TextInput,{className:"bn-text-input",name:"title",icon:E.jsx(Km,{}),placeholder:n.link_toolbar.form.title_placeholder,value:c,onKeyDown:d,onChange:h,onSubmit:p})]})};function uY(e){return"link"in e.schema.inlineContentSchema&&e.schema.inlineContentSchema.link==="link"}var dY=()=>{let e=be(),t=fe(),n=Se(),r=je(Lo),{showSelection:o}=je(va),[i,s]=C.useState(!1);C.useEffect(()=>(o(i,"createLinkButton"),()=>o(!1,"createLinkButton")),[i,o]);let a=jt({editor:e,selector:({editor:l})=>{if(!(!l.isEditable||!uY(l)||Th(l.prosemirrorState.selection)||!(l.getSelection()?.blocks||[l.getTextCursorPosition().block]).find(c=>c.content!==void 0)))return{url:l.getSelectedLinkUrl(),text:l.getSelectedText(),range:{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}}}});return C.useEffect(()=>{s(!1)},[a]),C.useEffect(()=>{let l=u=>{(u.ctrlKey||u.metaKey)&&u.key==="k"&&(s(!0),u.preventDefault())},c=e.domElement;return c?.addEventListener("keydown",l),()=>{c?.removeEventListener("keydown",l)}},[e.domElement]),a===void 0?null:E.jsxs(t.Generic.Popover.Root,{open:i,onOpenChange:s,children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"createLink",label:n.formatting_toolbar.link.tooltip,mainTooltip:n.formatting_toolbar.link.tooltip,secondaryTooltip:Bn(n.formatting_toolbar.link.secondary_tooltip,n.generic.ctrl_shortcut),icon:E.jsx(fS,{}),onClick:()=>s(l=>!l)})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(_S,{url:a.url||"",text:a.text,range:a.range,showTextField:!1,setToolbarOpen:l=>r.store.setState(l)})})]})},fY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:l})=>{if(!l.isEditable)return;let c=l.getSelection()?.blocks||[l.getTextCursorPosition().block];if(c.length!==1)return;let u=c[0];if(En(u,l,u.type,{url:"string",caption:"string"}))return u}}),[o,i]=C.useState();C.useEffect(()=>{r!==void 0&&i(r.props.caption)},[r]);let s=C.useCallback(l=>i(l.currentTarget.value),[]),a=C.useCallback(l=>{r!==void 0&&it(n,r.type,{caption:"string"})&&l.key==="Enter"&&!l.nativeEvent.isComposing&&(l.preventDefault(),n.updateBlock(r.id,{props:{caption:o}}))},[r,o,n]);return r===void 0?null:E.jsxs(t.Generic.Popover.Root,{children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_caption.tooltip,mainTooltip:e.formatting_toolbar.file_caption.tooltip,icon:E.jsx(Ly,{})})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(t.Generic.Form.Root,{children:E.jsx(t.Generic.Form.TextInput,{name:"file-caption",icon:E.jsx(Ly,{}),value:o||"",autoFocus:!0,placeholder:e.formatting_toolbar.file_caption.input_placeholder,onKeyDown:a,onChange:s})})})]})},hY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!i.isEditable)return;let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(En(a,i,a.type,{url:"string"}))return a}}),o=C.useCallback(()=>{r!==void 0&&(n.focus(),n.removeBlocks([r.id]))},[r,n]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_delete.tooltip[r.type]||e.formatting_toolbar.file_delete.tooltip.file,mainTooltip:e.formatting_toolbar.file_delete.tooltip[r.type]||e.formatting_toolbar.file_delete.tooltip.file,icon:E.jsx(MG,{}),onClick:o})},pY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:l})=>{if(!l.isEditable)return;let c=l.getSelection()?.blocks||[l.getTextCursorPosition().block];if(c.length!==1)return;let u=c[0];if(En(u,l,u.type,{url:"string",name:"string"}))return u}}),[o,i]=C.useState();C.useEffect(()=>{r!==void 0&&i(r.props.name)},[r]);let s=C.useCallback(l=>i(l.currentTarget.value),[]),a=C.useCallback(l=>{r!==void 0&&it(n,r.type,{name:"string"})&&l.key==="Enter"&&!l.nativeEvent.isComposing&&(l.preventDefault(),n.updateBlock(r.id,{props:{name:o}}))},[r,o,n]);return r===void 0?null:E.jsxs(t.Generic.Popover.Root,{children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_rename.tooltip[r.type]||e.formatting_toolbar.file_rename.tooltip.file,mainTooltip:e.formatting_toolbar.file_rename.tooltip[r.type]||e.formatting_toolbar.file_rename.tooltip.file,icon:E.jsx(Ry,{})})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(t.Generic.Form.Root,{children:E.jsx(t.Generic.Form.TextInput,{name:"file-name",icon:E.jsx(Ry,{}),value:o||"",autoFocus:!0,placeholder:e.formatting_toolbar.file_rename.input_placeholder[r.type]||e.formatting_toolbar.file_rename.input_placeholder.file,onKeyDown:a,onChange:s})})})]})},mY=()=>{let e=Se(),t=fe(),n=jt({editor:be(),selector:({editor:r})=>{if(!r.isEditable)return;let o=r.getSelection()?.blocks||[r.getTextCursorPosition().block];if(o.length!==1)return;let i=o[0];if(En(i,r,i.type,{url:"string"}))return i}});return n===void 0?null:E.jsxs(t.Generic.Popover.Root,{position:"bottom",children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",mainTooltip:e.formatting_toolbar.file_replace.tooltip[n.type]||e.formatting_toolbar.file_replace.tooltip.file,label:e.formatting_toolbar.file_replace.tooltip[n.type]||e.formatting_toolbar.file_replace.tooltip.file,icon:E.jsx(vG,{})})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-panel-popover",variant:"panel-popover",children:E.jsx(MS,{blockId:n.id})})]})},gY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!(!i.isEditable||!(i.getSelection()?.blocks||[i.getTextCursorPosition().block]).find(s=>s.content!==void 0)))return{canNestBlock:i.canNestBlock()}}}),o=C.useCallback(()=>{r!==void 0&&r.canNestBlock&&(n.focus(),n.nestBlock())},[n,r]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"nestBlock",onClick:o,isDisabled:!r.canNestBlock,label:e.formatting_toolbar.nest.tooltip,mainTooltip:e.formatting_toolbar.nest.tooltip,secondaryTooltip:Bn(e.formatting_toolbar.nest.secondary_tooltip,e.generic.ctrl_shortcut),icon:E.jsx(mG,{})})},bY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!(!i.isEditable||!(i.getSelection()?.blocks||[i.getTextCursorPosition().block]).find(s=>s.content!==void 0)))return{canUnnestBlock:i.canUnnestBlock()}}}),o=C.useCallback(()=>{r!==void 0&&r.canUnnestBlock&&(n.focus(),n.unnestBlock())},[n,r]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"unnestBlock",onClick:o,isDisabled:!r.canUnnestBlock,label:e.formatting_toolbar.unnest.tooltip,mainTooltip:e.formatting_toolbar.unnest.tooltip,secondaryTooltip:Bn(e.formatting_toolbar.unnest.secondary_tooltip,e.generic.ctrl_shortcut),icon:E.jsx(pG,{})})},yY=e=>[{name:e.slash_menu.paragraph.title,type:"paragraph",icon:Km},{name:e.slash_menu.heading.title,type:"heading",props:{level:1,isToggleable:!1},icon:lu},{name:e.slash_menu.heading_2.title,type:"heading",props:{level:2,isToggleable:!1},icon:cu},{name:e.slash_menu.heading_3.title,type:"heading",props:{level:3,isToggleable:!1},icon:uu},{name:e.slash_menu.heading_4.title,type:"heading",props:{level:4,isToggleable:!1},icon:cS},{name:e.slash_menu.heading_5.title,type:"heading",props:{level:5,isToggleable:!1},icon:uS},{name:e.slash_menu.heading_6.title,type:"heading",props:{level:6,isToggleable:!1},icon:dS},{name:e.slash_menu.toggle_heading.title,type:"heading",props:{level:1,isToggleable:!0},icon:lu},{name:e.slash_menu.toggle_heading_2.title,type:"heading",props:{level:2,isToggleable:!0},icon:cu},{name:e.slash_menu.toggle_heading_3.title,type:"heading",props:{level:3,isToggleable:!0},icon:uu},{name:e.slash_menu.quote.title,type:"quote",icon:gS},{name:e.slash_menu.toggle_list.title,type:"toggleListItem",icon:bS},{name:e.slash_menu.bullet_list.title,type:"bulletListItem",icon:mS},{name:e.slash_menu.numbered_list.title,type:"numberedListItem",icon:pS},{name:e.slash_menu.check_list.title,type:"checkListItem",icon:hS}],EY=e=>{let t=fe(),n=be(),r=jt({editor:n,selector:({editor:a})=>a.getSelection()?.blocks||[a.getTextCursorPosition().block]}),o=r[0],i=C.useMemo(()=>(e.items||yY(n.dictionary)).filter(a=>it(n,a.type,Object.fromEntries(Object.entries(a.props||{}).map(([l,c])=>[l,typeof c])))),[n,e.items]),s=C.useMemo(()=>i.map(a=>{let l=a.icon,c=a.type===o.type,u=Object.entries(a.props||{}).filter(([d,f])=>f!==o.props[d]).length===0;return{text:a.name,icon:E.jsx(l,{size:16}),onClick:()=>{n.focus(),n.transact(()=>{for(let d of r)n.updateBlock(d,{type:a.type,props:a.props})})},isSelected:c&&u}}),[n,i,o.props,o.type,r]);return!C.useMemo(()=>s.find(a=>a.isSelected)!==void 0,[s])||!n.isEditable?null:E.jsx(t.FormattingToolbar.Select,{className:"bn-select",items:s})},xY=()=>{let e=Se(),t=fe(),n=je("comments"),{store:r}=je(Lo),o=C.useCallback(()=>{n.startPendingComment(),r.setState(!1)},[n,r]);return E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.comment.tooltip,mainTooltip:e.formatting_toolbar.comment.tooltip,icon:E.jsx(lS,{}),onClick:o})},CY=()=>be().getExtension("comments")?E.jsx(xY,{}):null,kY=()=>{let e=Se(),t=fe(),n=be(),r=C.useCallback(()=>{n._tiptapEditor.chain().focus().addPendingComment().run()},[n]);return!n._tiptapEditor.commands.addPendingComment||!n.isEditable?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.comment.tooltip,mainTooltip:e.formatting_toolbar.comment.tooltip,icon:E.jsx(lS,{}),onClick:r})};function ip(e,t){try{let n=new URL(e,t);if(n.protocol!=="javascript:")return n.href}catch{}return"#"}var TY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(En(a,i,a.type,{url:"string"}))return a}}),o=C.useCallback(()=>{r!==void 0&&(n.focus(),n.resolveFileUrl?n.resolveFileUrl(r.props.url).then(i=>window.open(ip(i,window.location.href))):window.open(ip(r.props.url,window.location.href)))},[r,n]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_download.tooltip[r.type]||e.formatting_toolbar.file_download.tooltip.file,mainTooltip:e.formatting_toolbar.file_download.tooltip[r.type]||e.formatting_toolbar.file_download.tooltip.file,icon:E.jsx(OG,{}),onClick:o})},wY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!i.isEditable)return;let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(En(a,i,a.type,{url:"string",showPreview:"boolean"}))return a}}),o=C.useCallback(()=>{r!==void 0&&it(n,r.type,{showPreview:"boolean"})&&n.updateBlock(r.id,{props:{showPreview:!r.props.showPreview}})},[r,n]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:"Toggle preview",mainTooltip:e.formatting_toolbar.file_preview_toggle.tooltip,icon:E.jsx(SG,{}),isSelected:r.props.showPreview,onClick:o})},SY=()=>{let e=Se(),t=fe(),n=be(),r=je(Je),o=jt({editor:n,selector:({editor:s})=>{if(!s.isEditable||!s.settings.tables.splitCells)return;let a=s.getSelection()?.blocks||[s.getTextCursorPosition().block];if(a.length!==1)return;let l=a[0];if(l.type==="table")return{mergeDirection:r.getMergeDirection(l)}}}),i=C.useCallback(()=>{r?.mergeCells()},[r]);return o===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.table_cell_merge.tooltip,mainTooltip:e.formatting_toolbar.table_cell_merge.tooltip,icon:o.mergeDirection==="horizontal"?E.jsx(yG,{}):E.jsx(EG,{}),onClick:i})},vY=()=>be().getExtension(Je)?E.jsx(SY,{}):null,AY={left:uG,center:lG,right:dG,justify:cG},Nf=e=>{let t=fe(),n=Se(),r=be(),o=jt({editor:r,selector:({editor:a})=>{if(!a.isEditable)return;let l=a.getSelection()?.blocks||[a.getTextCursorPosition().block],c=l[0];if(En(c,a,c.type,{textAlignment:Ue.textAlignment}))return{textAlignment:c.props.textAlignment,blocks:l};if(l.length===1&&En(c,a,"table"))return a.getExtension(Je)?.getCellSelection()?{textAlignment:Io(c.content.rows[0].cells[0]).props.textAlignment,blocks:[c]}:void 0}}),i=C.useCallback(a=>{if(o!==void 0){r.focus();for(let l of o.blocks)if(En(l,r,l.type,{textAlignment:Ue.textAlignment})&&it(r,l.type,{textAlignment:Ue.textAlignment}))r.updateBlock(l,{props:{textAlignment:a}});else if(l.type==="table"){let c=r.getExtension(Je)?.getCellSelection();if(!c)continue;let u=l.content.rows.map(d=>({...d,cells:d.cells.map(f=>Io(f))}));c.cells.forEach(({row:d,col:f})=>{u[d].cells[f].props.textAlignment=a}),r.updateBlock(l,{type:"table",content:{...l.content,type:"tableContent",rows:u}}),r.setTextCursorPosition(l)}}},[r,o]);if(o===void 0)return null;let s=AY[e.textAlignment];return E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":`alignText${e.textAlignment.slice(0,1).toUpperCase()+e.textAlignment.slice(1)}`,onClick:()=>i(e.textAlignment),isSelected:o.textAlignment===e.textAlignment,label:n.formatting_toolbar[`align_${e.textAlignment}`].tooltip,mainTooltip:n.formatting_toolbar[`align_${e.textAlignment}`].tooltip,icon:E.jsx(s,{})})},Zm=e=>[E.jsx(EY,{items:e},"blockTypeSelect"),E.jsx(vY,{},"tableCellMergeButton"),E.jsx(fY,{},"fileCaptionButton"),E.jsx(mY,{},"replaceFileButton"),E.jsx(pY,{},"fileRenameButton"),E.jsx(hY,{},"fileDeleteButton"),E.jsx(TY,{},"fileDownloadButton"),E.jsx(wY,{},"filePreviewButton"),E.jsx(Al,{basicTextStyle:"bold"},"boldStyleButton"),E.jsx(Al,{basicTextStyle:"italic"},"italicStyleButton"),E.jsx(Al,{basicTextStyle:"underline"},"underlineStyleButton"),E.jsx(Al,{basicTextStyle:"strike"},"strikeStyleButton"),E.jsx(Nf,{textAlignment:"left"},"textAlignLeftButton"),E.jsx(Nf,{textAlignment:"center"},"textAlignCenterButton"),E.jsx(Nf,{textAlignment:"right"},"textAlignRightButton"),E.jsx(cY,{},"colorStyleButton"),E.jsx(gY,{},"nestBlockButton"),E.jsx(bY,{},"unnestBlockButton"),E.jsx(dY,{},"createLinkButton"),E.jsx(CY,{},"addCommentButton"),E.jsx(kY,{},"addTiptapCommentButton")],Jm=e=>E.jsx(fe().FormattingToolbar.Root,{className:"bn-toolbar bn-formatting-toolbar",children:e.children||Zm(e.blockTypeSelectItems)}),NY=e=>{switch(e){case"left":return"top-start";case"center":return"top";case"right":return"top-end";default:return"top-start"}},eg=e=>{let t=be(),n=je(Lo,{editor:t}),r=rt(Lo,{editor:t}),o=jt({editor:t,selector:({editor:l})=>n.store.state?{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}:void 0}),i=jt({editor:t,selector:({editor:l})=>{let c=l.getTextCursorPosition().block;return En(c,l,c.type,{textAlignment:Ue.textAlignment})?NY(c.props.textAlignment):"top-start"}}),s=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:r,onOpenChange:(l,c,u)=>{n.store.setState(l),u==="escape-key"&&t.focus()},placement:i,middleware:[qr(10),xu(),Cu()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:40},...e.floatingUIOptions?.elementProps}}),[r,i,e.floatingUIOptions,n.store,t]),a=e.formattingToolbar||Jm;return E.jsx(rS,{position:o,...s,children:r&&E.jsx(a,{})})},OS=e=>{let t=fe(),n=Se(),{deleteLink:r}=je(ja);return E.jsx(t.LinkToolbar.Button,{className:"bn-button",label:n.link_toolbar.delete.tooltip,mainTooltip:n.link_toolbar.delete.tooltip,isSelected:!1,onClick:()=>{r(e.range.from),e.setToolbarOpen?.(!1)},icon:E.jsx(bG,{})})},RS=e=>{let t=fe(),n=Se();return E.jsxs(t.Generic.Popover.Root,{onOpenChange:e.setToolbarPositionFrozen,children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.edit.tooltip,isSelected:!1,children:n.link_toolbar.edit.text})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(_S,{url:e.url,text:e.text,range:e.range,setToolbarOpen:e.setToolbarOpen,setToolbarPositionFrozen:e.setToolbarPositionFrozen})})]})},IY=e=>{let t=fe(),n=Se();return E.jsx(t.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.open.tooltip,label:n.link_toolbar.open.tooltip,isSelected:!1,onClick:()=>{window.open(ip(e.url,window.location.href),"_blank")},icon:E.jsx(RG,{})})},LS=e=>E.jsx(fe().LinkToolbar.Root,{className:"bn-toolbar bn-link-toolbar",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(RS,{url:e.url,text:e.text,range:e.range,setToolbarOpen:e.setToolbarOpen,setToolbarPositionFrozen:e.setToolbarPositionFrozen}),E.jsx(IY,{url:e.url}),E.jsx(OS,{range:e.range,setToolbarOpen:e.setToolbarOpen})]})}),DS=e=>{let t=be(),[n,r]=C.useState(!1),[o,i]=C.useState(!1),s=je(ja),[a,l]=C.useState(void 0);C.useEffect(()=>{let f=()=>{let b=s.getLinkAtSelection();if(!b){l(void 0),o||r(!1);return}l({cursorType:"text",url:b.mark.attrs.href,text:b.text,range:b.range,element:s.getLinkElementAtPos(b.range.from)}),o||r(!0)},h=b=>{if(a!==void 0&&a.cursorType==="text"||!(b.target instanceof HTMLElement))return;let x=s.getLinkAtElement(b.target);x&&l({cursorType:"mouse",url:x.mark.attrs.href,text:x.text,range:x.range,element:s.getLinkElementAtPos(x.range.from)})},p=t.onChange(f),g=t.onSelectionChange(f),y=t.domElement;return y?.addEventListener("mouseover",h),()=>{p(),g(),y?.removeEventListener("mouseover",h)}},[t,t.domElement,s,a,o]);let c=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:n,onOpenChange:(f,h,p)=>{o||a!==void 0&&a.cursorType==="text"&&p==="hover"||(p==="escape-key"&&t.focus(),r(f))},placement:"top-start",middleware:[qr(10),Cu()],...e.floatingUIOptions?.useFloatingOptions},useHoverProps:{enabled:a!==void 0&&a.cursorType==="mouse",delay:{open:250,close:250},handleClose:VI(),...e.floatingUIOptions?.useHoverProps},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:50},...e.floatingUIOptions?.elementProps}}),[t,a,e.floatingUIOptions,n,o]),u=C.useMemo(()=>a?.element?{element:a.element}:void 0,[a?.element]);if(!t.isEditable)return null;let d=e.linkToolbar||LS;return E.jsx(mr,{reference:u,...c,children:a&&E.jsx(d,{url:a.url,text:a.text,range:a.range,setToolbarOpen:r,setToolbarPositionFrozen:i})})},MY=()=>{let e=fe(),t=Se(),n=be(),r=je(zn),o=rt(qn,{editor:n,selector:s=>s?.block}),i=C.useCallback(()=>{if(o===void 0)return;let s=o.content;if(s!==void 0&&Array.isArray(s)&&s.length===0)n.setTextCursorPosition(o),r.openSuggestionMenu("/");else{let a=n.insertBlocks([{type:"paragraph"}],o,"after")[0];n.setTextCursorPosition(a),r.openSuggestionMenu("/")}},[o,n,r]);return o===void 0?null:E.jsx(e.SideMenu.Button,{className:"bn-button",label:t.side_menu.add_block_label,icon:E.jsx($G,{size:24,onClick:i,"data-test":"dragHandleAdd"})})},_Y=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:o=>o?.block});return r===void 0||!En(r,n,r.type,{textColor:"string"})&&!En(r,n,r.type,{backgroundColor:"string"})?null:E.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[E.jsx(t.Generic.Menu.Trigger,{sub:!0,children:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children})}),E.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{iconSize:18,text:En(r,n,r.type,{textColor:"string"})&&it(n,r.type,{textColor:"string"})?{color:r.props.textColor,setColor:o=>n.updateBlock(r,{type:r.type,props:{textColor:o}})}:void 0,background:En(r,n,r.type,{backgroundColor:"string"})&&it(n,r.type,{backgroundColor:"string"})?{color:r.props.backgroundColor,setColor:o=>n.updateBlock(r,{props:{backgroundColor:o}})}:void 0})})]})},OY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:o=>o?.block});return r===void 0?null:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",onClick:()=>n.removeBlocks([r]),children:e.children})},RY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:i=>i?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;let o=!!r.content.headerRows;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:o,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerRows:o?void 0:1}})},children:e.children})},LY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:i=>i?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;let o=!!r.content.headerCols;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:o,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerCols:o?void 0:1}})},children:e.children})},DY=e=>{let t=fe(),n=Se();return E.jsx(t.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-drag-handle-menu",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(OY,{children:n.drag_handle.delete_menuitem}),E.jsx(_Y,{children:n.drag_handle.colors_menuitem}),E.jsx(RY,{children:n.drag_handle.header_row_menuitem}),E.jsx(LY,{children:n.drag_handle.header_column_menuitem})]})})},PY=e=>{let t=fe(),n=Se(),r=je(qn),o=rt(qn,{selector:s=>s?.block});if(o===void 0)return null;let i=e.dragHandleMenu||DY;return E.jsxs(t.Generic.Menu.Root,{onOpenChange:s=>{s?r.freezeMenu():r.unfreezeMenu()},position:"left",children:[E.jsx(t.Generic.Menu.Trigger,{children:E.jsx(t.SideMenu.Button,{label:n.side_menu.drag_handle_label,draggable:!0,onDragStart:s=>r.blockDragStart(s,o),onDragEnd:r.blockDragEnd,className:"bn-button",icon:E.jsx(TS,{size:24,"data-test":"dragHandle"})})}),E.jsx(i,{children:e.children})]})},BY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:i=>i?.block}),o=C.useMemo(()=>{if(r===void 0)return{};let i={"data-block-type":r.type};return r.type==="heading"&&(i["data-level"]=r.props.level.toString()),n.schema.blockSpecs[r.type].implementation.meta?.fileBlockAccept&&(r.props.url?i["data-url"]="true":i["data-url"]="false"),i},[r,n.schema.blockSpecs]);return E.jsx(t.SideMenu.Root,{className:"bn-side-menu",...o,children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(MY,{}),E.jsx(PY,{dragHandleMenu:e.dragHandleMenu})]})})},FY=e=>{let t=be(),{show:n,block:r}=rt(qn,{selector:a=>a===void 0?void 0:{show:a.show,block:a.block}})||{},o=C.useCallback((a,l,c)=>{let u=!1;return mp(a,l,()=>{if(!u){u=!0;return}t.getExtension(qn)?.hideMenuIfNotFrozen()},{ancestorScroll:!0,ancestorResize:!1,elementResize:!1,layoutShift:!1})},[t]),i=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:n,placement:"left-start",whileElementsMounted:o,...e.floatingUIOptions?.useFloatingOptions},useDismissProps:{enabled:!1,...e.floatingUIOptions?.useDismissProps},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:20},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,n,o]),s=e.sideMenu||BY;return E.jsx(IS,{blockId:n?r?.id:void 0,...i,children:r?.id&&E.jsx(s,{})})};async function HY(e,t){return(await GV(e,t)).map(({id:n,onItemClick:r})=>({id:n,onItemClick:r,icon:n}))}function UY(e){let t=fe(),n=Se(),{items:r,loadingState:o,selectedIndex:i,onItemClick:s,columns:a}=e,l=o==="loading-initial"||o==="loading"?E.jsx(t.GridSuggestionMenu.Loader,{className:"bn-grid-suggestion-menu-loader",columns:a}):null,c=C.useMemo(()=>{let u=[];for(let d=0;d<r.length;d++){let f=r[d];u.push(E.jsx(t.GridSuggestionMenu.Item,{className:"bn-grid-suggestion-menu-item",item:f,id:`bn-grid-suggestion-menu-item-${d}`,isSelected:d===i,onClick:()=>s?.(f)},f.id))}return u},[t,r,s,i]);return E.jsxs(t.GridSuggestionMenu.Root,{id:"bn-grid-suggestion-menu",columns:a,className:"bn-grid-suggestion-menu",children:[l,c,c.length===0&&e.loadingState==="loaded"&&E.jsx(t.GridSuggestionMenu.EmptyItem,{className:"bn-grid-suggestion-menu-empty-item",columns:a,children:n.suggestion_menu.no_items_title})]})}function PS(e,t,n,r=3){let o=C.useRef(0);C.useEffect(()=>{t!==void 0&&(e.length>0?o.current=t.length:t.length-o.current>r&&n())},[n,r,e.length,t])}function BS(e,t){let[n,r]=C.useState([]),[o,i]=C.useState(!1),s=C.useRef(void 0),a=C.useRef(void 0);return C.useEffect(()=>{let l=e;s.current=e,i(!0),t(e).then(c=>{s.current===l&&(r(c),i(!1),a.current=l)})},[e,t]),{items:n||[],usedQuery:a.current,loadingState:a.current===void 0?"loading-initial":o?"loading":"loaded"}}function VY(e,t,n,r,o){let[i,s]=C.useState(0),a=r!==void 0&&r>1;return C.useEffect(()=>{let l=u=>(u.key==="ArrowLeft"&&(u.preventDefault(),n.length&&s((i-1+n.length)%n.length)),u.key==="ArrowRight"&&(u.preventDefault(),n.length&&s((i+1+n.length)%n.length)),u.key==="ArrowUp"?(u.preventDefault(),n.length&&s((i-r+n.length)%n.length),!0):u.key==="ArrowDown"?(u.preventDefault(),n.length&&s((i+r)%n.length),!0):u.key==="Enter"&&!u.isComposing?(u.stopPropagation(),u.preventDefault(),n.length&&o?.(n[i]),!0):!1),c=e.domElement;return c?.addEventListener("keydown",l,!0),()=>{c?.removeEventListener("keydown",l,!0)}},[e.domElement,n,i,o,r,a]),C.useEffect(()=>{s(0)},[t]),{selectedIndex:n.length===0?void 0:i}}function $Y(e){let t=Nr().setContentEditableProps,n=be(),{getItems:r,gridSuggestionMenuComponent:o,query:i,clearQuery:s,closeMenu:a,onItemClick:l,columns:c}=e,u=C.useCallback(g=>{a(),s(),l?.(g)},[l,a,s]),{items:d,usedQuery:f,loadingState:h}=BS(i,r);PS(d,f,a);let{selectedIndex:p}=VY(n,i,d,c,u);return C.useEffect(()=>(t(g=>({...g,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{t(g=>({...g,"aria-expanded":!1,"aria-controls":void 0}))}),[t]),C.useEffect(()=>(t(g=>({...g,"aria-activedescendant":p?"bn-suggestion-menu-item-"+p:void 0})),()=>{t(g=>({...g,"aria-activedescendant":void 0}))}),[t,p]),E.jsx(o,{items:d,onItemClick:u,loadingState:h,selectedIndex:p,columns:c})}function jY(e){let t=be(),{triggerCharacter:n,gridSuggestionMenuComponent:r,columns:o,shouldOpen:i,minQueryLength:s,onItemClick:a,getItems:l}=e,c=C.useMemo(()=>a||(g=>{g.onItemClick(t)}),[t,a]),u=C.useMemo(()=>l||(async g=>await HY(t,g)),[t,l]),d=je(zn);C.useEffect(()=>{d.addSuggestionMenu({triggerCharacter:n,shouldOpen:i})},[d,n,i]);let f=rt(zn),h=rt(zn,{selector:g=>({element:t.domElement?.firstChild||void 0,getBoundingClientRect:()=>g?.referencePos||new DOMRect})}),p=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:f?.show&&f?.triggerCharacter===n,onOpenChange:g=>{g||d.closeMenu()},placement:"bottom-start",middleware:[qr(10),QE({allowedPlacements:["bottom-start","top-start"],padding:10}),xu(),rc({apply({elements:g,availableHeight:y}){g.floating.style.maxHeight=`${Math.max(0,y)}px`},padding:10})],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{onMouseDownCapture:g=>g.preventDefault(),style:{zIndex:70},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,f?.show,f?.triggerCharacter,d,n]);return!f||!f.ignoreQueryLength&&s&&(f.query.startsWith(" ")||f.query.length<s)?null:E.jsx(mr,{reference:h,...p,children:n&&E.jsx($Y,{query:f.query,closeMenu:d.closeMenu,clearQuery:d.clearQuery,getItems:u,columns:o,gridSuggestionMenuComponent:r||UY,onItemClick:c})})}function zY(e){let t=fe(),n=Se(),{items:r,loadingState:o,selectedIndex:i,onItemClick:s}=e,a=o==="loading-initial"||o==="loading"?E.jsx(t.SuggestionMenu.Loader,{className:"bn-suggestion-menu-loader"}):null,l=C.useMemo(()=>{let c,u=[];for(let d=0;d<r.length;d++){let f=r[d];f.group!==c&&(c=f.group,u.push(E.jsx(t.SuggestionMenu.Label,{className:"bn-suggestion-menu-label",children:c},c))),u.push(E.jsx(t.SuggestionMenu.Item,{className:ut("bn-suggestion-menu-item",f.size==="small"?"bn-suggestion-menu-item-small":""),item:f,id:`bn-suggestion-menu-item-${d}`,isSelected:d===i,onClick:()=>s?.(f)},f.title))}return u},[t,r,s,i]);return E.jsxs(t.SuggestionMenu.Root,{id:"bn-suggestion-menu",className:"bn-suggestion-menu",children:[l,l.length===0&&(e.loadingState==="loading"||e.loadingState==="loaded")&&E.jsx(t.SuggestionMenu.EmptyItem,{className:"bn-suggestion-menu-item",children:n.suggestion_menu.no_items_title}),a]})}function WY(e,t){let[n,r]=C.useState(0);return{selectedIndex:n,setSelectedIndex:r,handler:o=>{if(o.key==="ArrowUp")return o.preventDefault(),e.length&&r((n-1+e.length)%e.length),!0;if(o.key==="ArrowDown")return o.preventDefault(),e.length&&r((n+1)%e.length),!0;if(o.key==="PageUp")return o.preventDefault(),e.length&&r(0),!0;if(o.key==="PageDown")return o.preventDefault(),e.length&&r(e.length-1),!0;let i=qY(o)?o.nativeEvent.isComposing:o.isComposing;return o.key==="Enter"&&!i?(o.preventDefault(),o.stopPropagation(),e.length&&t?.(e[n]),!0):!1}}}function qY(e){return e.nativeEvent!==void 0}function GY(e,t,n,r,o){let{selectedIndex:i,setSelectedIndex:s,handler:a}=WY(n,r);return C.useEffect(()=>{let l=e.domElement;return l?.addEventListener("keydown",a,!0),()=>{l?.removeEventListener("keydown",a,!0)}},[e.domElement,n,i,r,o,a]),C.useEffect(()=>{s(0)},[t,s]),{selectedIndex:n.length===0?void 0:i}}function YY(e){let t=Nr().setContentEditableProps,n=be(),{getItems:r,suggestionMenuComponent:o,query:i,clearQuery:s,closeMenu:a,onItemClick:l}=e,c=C.useCallback(p=>{a(),s(),l?.(p)},[l,a,s]),{items:u,usedQuery:d,loadingState:f}=BS(i,r);PS(u,d,a);let{selectedIndex:h}=GY(n,i,u,c);return C.useEffect(()=>(t(p=>({...p,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{t(p=>({...p,"aria-expanded":!1,"aria-controls":void 0}))}),[t]),C.useEffect(()=>(t(p=>({...p,"aria-activedescendant":h?"bn-suggestion-menu-item-"+h:void 0})),()=>{t(p=>({...p,"aria-activedescendant":void 0}))}),[t,h]),E.jsx(o,{items:u,onItemClick:c,loadingState:f,selectedIndex:h})}var KY={heading:lu,heading_2:cu,heading_3:uu,heading_4:cS,heading_5:uS,heading_6:dS,toggle_heading:lu,toggle_heading_2:cu,toggle_heading_3:uu,quote:gS,toggle_list:bS,numbered_list:pS,bullet_list:mS,check_list:hS,paragraph:Km,table:CG,image:wG,video:TG,audio:AG,file:aG,emoji:PG,code_block:hG,divider:DG};function FS(e){return q6(e).map(t=>{let n=KY[t.key];return{...t,icon:E.jsx(n,{size:18})}})}function HS(e){let t=be(),{triggerCharacter:n,suggestionMenuComponent:r,shouldOpen:o,minQueryLength:i,onItemClick:s,getItems:a}=e,l=C.useMemo(()=>s||(p=>{p.onItemClick(t)}),[t,s]),c=C.useMemo(()=>a||(async p=>G6(FS(t),p)),[t,a]),u=je(zn);C.useEffect(()=>{u.addSuggestionMenu({triggerCharacter:n,shouldOpen:o})},[u,n,o]);let d=rt(zn),f=rt(zn,{selector:p=>({element:t.domElement?.firstChild||void 0,getBoundingClientRect:()=>p?.referencePos||new DOMRect})}),h=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:d?.show&&d?.triggerCharacter===n,onOpenChange:p=>{p||u.closeMenu()},placement:"bottom-start",middleware:[qr(10),QE({allowedPlacements:["bottom-start","top-start"],padding:10}),xu(),rc({apply({elements:p,availableHeight:g}){p.floating.style.maxHeight=`${Math.max(0,g)}px`},padding:10})],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{onMouseDownCapture:p=>p.preventDefault(),style:{zIndex:80},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,d?.show,d?.triggerCharacter,u,n]);return!d||!d.ignoreQueryLength&&i&&(d.query.startsWith(" ")||d.query.length<i)?null:E.jsx(mr,{reference:f,...h,children:n&&E.jsx(YY,{query:d.query,closeMenu:u.closeMenu,clearQuery:u.clearQuery,getItems:c,suggestionMenuComponent:r||zY,onItemClick:l})})}var QY=(e,t=.3)=>{let n=Math.floor(e)+t,r=Math.ceil(e)-t;return e>=n&&e<=r?Math.round(e):e<n?Math.floor(e):Math.ceil(e)},XY=e=>{let t=fe(),n=be(),r=je(Je),o=rt(Je,{selector:u=>u?.block}),i=C.useRef(!1),[s,a]=C.useState(),l=C.useCallback(u=>{r.freezeHandles(),e.hideOtherElements(!0),o&&(a({originalContent:o.content,originalCroppedContent:{rows:r.cropEmptyRowsOrColumns(o,e.orientation==="addOrRemoveColumns"?"columns":"rows")},startPos:e.orientation==="addOrRemoveColumns"?u.clientX:u.clientY}),i.current=!1,u.preventDefault())},[o,e,r]),c=C.useCallback(()=>{!o||i.current||n.updateBlock(o,{type:"table",content:{...o.content,rows:e.orientation==="addOrRemoveColumns"?r.addRowsOrColumns(o,"columns",1):r.addRowsOrColumns(o,"rows",1)}})},[o,n,e.orientation,r]);return C.useEffect(()=>{let u=d=>{if(!o)return;if(!s)throw Error("editingState is undefined");i.current=!0;let f=(e.orientation==="addOrRemoveColumns"?d.clientX:d.clientY)-s.startPos,h=e.orientation==="addOrRemoveColumns"?s.originalCroppedContent.rows[0]?.cells.length??0:s.originalCroppedContent.rows.length,p=e.orientation==="addOrRemoveColumns"?s.originalContent.rows[0]?.cells.length??0:s.originalContent.rows.length,g=e.orientation==="addOrRemoveColumns"?o.content.rows[0].cells.length:o.content.rows.length,y=p+QY(f/(e.orientation==="addOrRemoveColumns"?N6:I6),.3);y>=h&&y>0&&y!==g&&(n.updateBlock(o,{type:"table",content:{...o.content,rows:e.orientation==="addOrRemoveColumns"?r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"columns",y-h):r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"rows",y-h)}}),o.content&&n.setTextCursorPosition(o))};return s&&window.addEventListener("mousemove",u),()=>{window.removeEventListener("mousemove",u)}},[o,s,n,e.orientation,r]),C.useEffect(()=>{let u=()=>{e.hideOtherElements(!1),r.unfreezeHandles(),a(void 0)};return s&&window.addEventListener("mouseup",u),()=>{window.removeEventListener("mouseup",u)}},[s,e,r]),n.isEditable?E.jsx(t.TableHandle.ExtendButton,{className:ut("bn-extend-button",e.orientation==="addOrRemoveColumns"?"bn-extend-button-add-remove-columns":"bn-extend-button-add-remove-rows",s===null?"":"bn-extend-button-editing"),onClick:c,onMouseDown:l,children:e.children||E.jsx(NG,{size:18,"data-test":"extendButton"})}):null},ZY=e=>{let t=fe(),n=Se(),r=be(),{block:o,colIndex:i,rowIndex:s}=rt(Je,{selector:c=>({block:c?.block,colIndex:c?.colIndex,rowIndex:c?.rowIndex})}),a=(c,u)=>{if(o===void 0||i===void 0||s===void 0)return;let d=o.content.rows.map(f=>({...f,cells:f.cells.map(h=>Io(h))}));u==="text"?d[s].cells[i].props.textColor=c:d[s].cells[i].props.backgroundColor=c,r.updateBlock(o,{type:"table",content:{...o.content,rows:d}}),r.setTextCursorPosition(o)};if(o===void 0||i===void 0||s===void 0)return null;let l=o.content.rows[s]?.cells?.[i];return!l||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1?null:E.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[E.jsx(t.Generic.Menu.Trigger,{sub:!0,children:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children||n.drag_handle.colors_menuitem})}),E.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{iconSize:18,text:r.settings.tables.cellTextColor?{color:Mo(l)?l.props.textColor:"default",setColor:c=>a(c,"text")}:void 0,background:r.settings.tables.cellBackgroundColor?{color:Mo(l)?l.props.backgroundColor:"default",setColor:c=>a(c,"background")}:void 0})})]})},JY=()=>{let e=fe(),t=Se(),n=be(),r=je(Je),{block:o,colIndex:i,rowIndex:s}=rt(Je,{selector:l=>({block:l?.block,colIndex:l?.colIndex,rowIndex:l?.rowIndex})});if(o===void 0||i===void 0||s===void 0)return null;let a=o.content.rows[s]?.cells?.[i];return!a||!Mo(a)||ka(a)===1&&pi(a)===1||!n.settings.tables.splitCells?null:E.jsx(e.Generic.Menu.Item,{onClick:()=>{r.splitCell({row:s,col:i})},children:t.table_handle.split_cell_menuitem})},eK=e=>E.jsx(fe().Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-table-handle-menu",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(JY,{}),E.jsx(ZY,{})]})}),tK=e=>{let t=fe(),n=be(),r=je(Je),o=e.tableCellMenu||eK;return!n.settings.tables.splitCells&&!n.settings.tables.cellBackgroundColor&&!n.settings.tables.cellTextColor?null:E.jsxs(t.Generic.Menu.Root,{onOpenChange:i=>{i?(r.freezeHandles(),e.hideOtherElements(!0)):(r.unfreezeHandles(),e.hideOtherElements(!1),n.focus())},position:"right",children:[E.jsx(t.Generic.Menu.Trigger,{children:E.jsx(t.Generic.Menu.Button,{className:"bn-table-cell-handle",children:e.children||E.jsx(jG,{size:12,"data-test":"tableCellHandle"})})}),E.jsx(o,{})]})},Vy=e=>{let t=fe(),n=Se(),r=je(Je),o=rt(Je,{selector:i=>e.orientation==="column"?i?.colIndex:i?.rowIndex});return r===void 0||o===void 0?null:E.jsx(t.Generic.Menu.Item,{onClick:()=>{r.addRowOrColumn(o,e.orientation==="row"?{orientation:"row",side:e.side}:{orientation:"column",side:e.side})},children:n.table_handle[`add_${e.side}_menuitem`]})},nK=e=>{let t=fe(),n=Se(),r=je(Je),o=rt(Je,{selector:i=>e.orientation==="column"?i?.colIndex:i?.rowIndex});return r===void 0||o===void 0?null:E.jsx(t.Generic.Menu.Item,{onClick:()=>r.removeRowOrColumn(o,e.orientation),children:e.orientation==="row"?n.table_handle.delete_row_menuitem:n.table_handle.delete_column_menuitem})},rK=e=>{let t=fe(),n=Se(),r=be(),o=je(Je),{block:i,index:s}=rt(Je,{selector:u=>({block:u?.block,index:e.orientation==="column"?u?.colIndex:u?.rowIndex})}),a=C.useMemo(()=>o===void 0||i===void 0||s===void 0?[]:e.orientation==="row"?o.getCellsAtRowHandle(i,s):o.getCellsAtColumnHandle(i,s),[i,s,e.orientation,o]),l=(u,d)=>{if(i===void 0)return;let f=i.content.rows.map(h=>({...h,cells:h.cells.map(p=>Io(p))}));a.forEach(({row:h,col:p})=>{d==="text"?f[h].cells[p].props.textColor=u:f[h].cells[p].props.backgroundColor=u}),r.updateBlock(i,{type:"table",content:{...i.content,rows:f}}),r.setTextCursorPosition(i)};if(!a||!a[0]||!o||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1)return null;let c=Io(a[0].cell);return E.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[E.jsx(t.Generic.Menu.Trigger,{sub:!0,children:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children||n.drag_handle.colors_menuitem})}),E.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{iconSize:18,text:r.settings.tables.cellTextColor?{color:a.every(({cell:u})=>Mo(u)&&u.props.textColor===c.props.textColor)?c.props.textColor:"default",setColor:u=>{l(u,"text")}}:void 0,background:r.settings.tables.cellBackgroundColor?{color:a.every(({cell:u})=>Mo(u)&&u.props.backgroundColor===c.props.backgroundColor)?c.props.backgroundColor:"default",setColor:u=>l(u,"background")}:void 0})})]})},oK=e=>{let t=fe(),n=Se(),r=be(),o=je(Je),{block:i,index:s}=rt(Je,{selector:l=>({block:l?.block,index:e.orientation==="column"?l?.colIndex:l?.rowIndex})});if(o===void 0||i===void 0||s!==0||e.orientation!=="row"||!r.settings.tables.headers)return null;let a=!!i.content.headerRows;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(i,{...i,content:{...i.content,headerRows:a?void 0:1}})},children:n.drag_handle.header_row_menuitem})},iK=e=>{let t=fe(),n=Se(),r=be(),o=je(Je),i=rt(Je,{selector:l=>l?.block}),s=rt(Je,{selector:l=>e.orientation==="column"?l?.colIndex:l?.rowIndex});if(!o||s!==0||!i||e.orientation!=="column"||!r.settings.tables.headers)return null;let a=!!i.content.headerCols;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(i,{...i,content:{...i.content,headerCols:a?void 0:1}})},children:n.drag_handle.header_column_menuitem})},sK=e=>E.jsx(fe().Generic.Menu.Dropdown,{className:"bn-table-handle-menu",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(nK,{orientation:e.orientation}),E.jsx(Vy,{orientation:e.orientation,side:e.orientation==="row"?"above":"left"}),E.jsx(Vy,{orientation:e.orientation,side:e.orientation==="row"?"below":"right"}),E.jsx(oK,{orientation:e.orientation}),E.jsx(iK,{orientation:e.orientation}),E.jsx(rK,{orientation:e.orientation})]})}),aK=e=>{let t=be(),n=fe(),[r,o]=C.useState(!1),i=e.tableHandleMenu||sK,s=je(Je),a=rt(Je),l=C.useMemo(()=>!s||!a||!a.block||a.block.type!=="table"?!1:e.orientation==="column"?s.getCellsAtColumnHandle(a.block,a.colIndex).every(({cell:c})=>pi(c)===1):s.getCellsAtRowHandle(a.block,a.rowIndex).every(({cell:c})=>ka(c)===1),[e.orientation,a,s]);return a?E.jsxs(n.Generic.Menu.Root,{onOpenChange:c=>{c?(s.freezeHandles(),e.hideOtherElements(!0)):(s.unfreezeHandles(),e.hideOtherElements(!1),t.focus())},position:"right",children:[E.jsx(n.Generic.Menu.Trigger,{children:E.jsx(n.TableHandle.Root,{className:ut("bn-table-handle",r?"bn-table-handle-dragging":"",l?"":"bn-table-handle-not-draggable"),draggable:l,onDragStart:c=>{o(!0),e.hideOtherElements(!0),e.orientation==="column"?s.colDragStart(c):s.rowDragStart(c)},onDragEnd:()=>{s.dragEnd(),e.hideOtherElements(!1),o(!1)},style:e.orientation==="column"?{transform:"rotate(0.25turn)"}:void 0,children:e.children||E.jsx(TS,{size:24,"data-test":"tableHandle"})})}),E.jsx(i,{orientation:e.orientation})]}):null},lK=e=>{let t=be(),[n,r]=C.useState(),o=rt(Je),i=C.useMemo(()=>{let d={};if(o===void 0)return{};let f=cn(o.block.id,t.prosemirrorState.doc);if(!f)return{};let h=f.posBeforeNode+1,p=t.prosemirrorView.domAtPos(h+1).node;if(!(p instanceof Element))return{};if(d.tableReference={element:p},o.rowIndex===void 0||o.colIndex===void 0)return d;let g=t.prosemirrorState.doc.resolve(h+1).posAtIndex(o.rowIndex),y=t.prosemirrorState.doc.resolve(g+1).posAtIndex(o.colIndex),b=t.prosemirrorView.domAtPos(y+1).node;return b instanceof Element?(d.cellReference={element:b},d.rowReference={element:p,getBoundingClientRect:()=>{let x=p.getBoundingClientRect(),k=b.getBoundingClientRect();return new DOMRect(x.x,o.draggingState&&o.draggingState.draggedCellOrientation==="row"?o.draggingState.mousePos-k.height/2:k.y,x.width,k.height)}},d.columnReference={element:p,getBoundingClientRect:()=>{let x=p.getBoundingClientRect(),k=b.getBoundingClientRect();return new DOMRect(o.draggingState&&o.draggingState.draggedCellOrientation==="col"?o.draggingState.mousePos-k.width/2:k.x,x.y,k.width,x.height)}},d):{}},[t,o]),s=C.useCallback((d,f,h)=>{let p=!1;return mp(d,f,()=>{if(!p){p=!0;return}t.getExtension(Je)?.hideHandlesIfNotFrozen()},{ancestorScroll:!0,ancestorResize:!1,elementResize:!1,layoutShift:!1})},[t]),a=C.useMemo(()=>o===void 0?void 0:{rowTableHandle:{useFloatingOptions:{open:o.show&&o.rowIndex!==void 0&&(!n||n==="rowTableHandle"),placement:"left",middleware:[qr(-10)],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},columnTableHandle:{useFloatingOptions:{open:o.show&&o.colIndex!==void 0&&(!n||n==="columnTableHandle"),placement:"top",middleware:[qr(-12)],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},tableCellHandle:{useFloatingOptions:{open:o.show&&o.rowIndex!==void 0&&o.colIndex!==void 0&&(!n||n==="tableCellHandle"),placement:"top-end",middleware:[qr({mainAxis:-15,crossAxis:-1})],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},extendRowsButton:{useFloatingOptions:{open:o.show&&o.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton"),placement:"bottom",whileElementsMounted:s,middleware:[rc({apply({rects:d,elements:f}){Object.assign(f.floating.style,{width:`${d.reference.width}px`})}})]},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},extendColumnsButton:{useFloatingOptions:{open:o.show&&o.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton"),placement:"right",whileElementsMounted:s,middleware:[rc({apply({rects:d,elements:f}){Object.assign(f.floating.style,{height:`${d.reference.height}px`})}})]},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}}},[n,o,s]);if(!o)return null;let l=e.tableHandle||aK,c=e.extendButton||XY,u=e.tableCellHandle||tK;return E.jsxs(E.Fragment,{children:[E.jsx(mr,{reference:i?.rowReference,...a?.rowTableHandle,children:o.show&&o.rowIndex!==void 0&&(!n||n==="rowTableHandle")&&E.jsx(l,{orientation:"row",hideOtherElements:d=>r(d?"rowTableHandle":void 0)})}),E.jsx(mr,{reference:i?.columnReference,...a?.columnTableHandle,children:o.show&&o.colIndex!==void 0&&(!n||n==="columnTableHandle")&&E.jsx(l,{orientation:"column",hideOtherElements:d=>r(d?"columnTableHandle":void 0)})}),E.jsx(mr,{reference:i?.cellReference,...a?.tableCellHandle,children:o.show&&o.rowIndex!==void 0&&o.colIndex!==void 0&&(!n||n==="tableCellHandle")&&E.jsx(u,{hideOtherElements:d=>r(d?"tableCellHandle":void 0)})}),E.jsx(mr,{reference:i?.tableReference,...a?.extendRowsButton,children:o.show&&o.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton")&&E.jsx(c,{orientation:"addOrRemoveRows",hideOtherElements:d=>r(d?"extendRowsButton":void 0)})}),E.jsx(mr,{reference:i?.tableReference,...a?.extendColumnsButton,children:o.show&&o.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton")&&E.jsx(c,{orientation:"addOrRemoveColumns",hideOtherElements:d=>r(d?"extendColumnsButton":void 0)})})]})},cK=C.lazy(()=>Qi(()=>import("./FloatingComposerController-D4uLQfUX-BMIvFCoE.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(e=>e.n)),uK=C.lazy(()=>Qi(()=>Promise.resolve().then(()=>VG),void 0).then(e=>e.n));function dK(e){let t=be();if(!t)throw Error("BlockNoteDefaultUI must be used within a BlockNoteContext.Provider");return E.jsxs(E.Fragment,{children:[t.getExtension(Lo)&&e.formattingToolbar!==!1&&E.jsx(eg,{}),t.getExtension(ja)&&e.linkToolbar!==!1&&E.jsx(DS,{}),t.getExtension(zn)&&e.slashMenu!==!1&&E.jsx(HS,{triggerCharacter:"/",shouldOpen:n=>!n.selection.$from.parent.type.isInGroup("tableContent")}),t.getExtension(zn)&&e.emojiPicker!==!1&&E.jsx(jY,{triggerCharacter:":",columns:10,minQueryLength:2}),t.getExtension(qn)&&e.sideMenu!==!1&&E.jsx(FY,{}),t.getExtension(rr)&&e.filePanel!==!1&&E.jsx(sY,{}),t.getExtension(Je)&&e.tableHandles!==!1&&E.jsx(lK,{}),t.getExtension(Jr)&&e.comments!==!1&&E.jsxs(C.Suspense,{children:[E.jsx(cK,{}),E.jsx(uK,{})]})]})}function fK(e,t){let n=Nr();t||=n?.editor,C.useEffect(()=>{if(!t)throw Error("'editor' is required, either from BlockNoteContext or as a function argument");return t.onChange(e)},[e,t])}function hK(e,t,n){let r=Nr();t||=r?.editor,C.useEffect(()=>{if(!t)throw Error("'editor' is required, either from BlockNoteContext or as a function argument");return t.onSelectionChange(e,n)},[e,t,n])}var pK=()=>{let e=C.useMemo(()=>window.matchMedia?.("(prefers-color-scheme: dark)"),[]),t=C.useMemo(()=>window.matchMedia?.("(prefers-color-scheme: light)"),[]),n=e?.matches,r=t?.matches,[o,i]=C.useState(n?"dark":r?"light":"no-preference");return C.useEffect(()=>{i(n?"dark":r?"light":"no-preference")},[n,r]),C.useEffect(()=>{if(typeof e?.addEventListener=="function"){let s=({matches:l})=>l&&i("dark"),a=({matches:l})=>l&&i("light");return e?.addEventListener("change",s),t?.addEventListener("change",a),()=>{e?.removeEventListener("change",s),t?.removeEventListener("change",a)}}else{let s=()=>i(e.matches?"dark":t.matches?"light":"no-preference");return e?.addEventListener("change",s),t?.addEventListener("change",s),()=>{e?.removeEventListener("change",s),t?.removeEventListener("change",s)}}},[e,t]),o},US=C.createContext(void 0);function mK(){return C.useContext(US)}function gK(){let e=new Set,t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Xr.createPortal(r.reactElement,r.element,n)},e.forEach(o=>o())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(o=>o())}}}var bK=({contentComponent:e})=>{let t=C.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(t)})},yK=C.forwardRef((e,t)=>{let[n,r]=C.useState();return C.useImperativeHandle(t,()=>(o,i)=>{Xr.flushSync(()=>{r({node:o,container:i})}),r(void 0)},[]),E.jsx(E.Fragment,{children:n&&Xr.createPortal(n.node,n.container)})}),$y=()=>{};function EK(e,t){let{editor:n,className:r,theme:o,children:i,editable:s,onSelectionChange:a,onChange:l,formattingToolbar:c,linkToolbar:u,slashMenu:d,emojiPicker:f,sideMenu:h,filePanel:p,tableHandles:g,comments:y,autoFocus:b,renderEditor:x=!0,...k}=e,[O,M]=C.useState(),A=Nr(),D=pK(),z=A?.colorSchemePreference||D,Y=o||(z==="dark"?"dark":"light"),N=fe(),K=C.useMemo(()=>({formattingToolbar:N?c:!1,linkToolbar:N?u:!1,sideMenu:N?h:!1,slashMenu:N?d:!1,filePanel:N?p:!1,tableHandles:N?g:!1,emojiPicker:N?f:!1,comments:N?y:!1}),[y,N,f,p,c,u,h,d,g]);fK(l||$y,n),hK(a||$y,n);let F=C.useCallback(H=>{n.elementRenderer=H},[n]);C.useEffect(()=>{if(!n.portalElement)throw Error("Portal element not found");n.portalElement.className=ut("bn-root",Y,r||""),n.portalElement.setAttribute("data-color-scheme",Y)},[n,Y,r]);let q=C.useMemo(()=>({...A,editor:n,setContentEditableProps:M,colorSchemePreference:Y}),[A,n,Y]),L=C.useMemo(()=>({editorProps:{autoFocus:b,contentEditableProps:O,editable:s},defaultUIProps:K}),[b,O,s,K]);return E.jsx(tS.Provider,{value:q,children:E.jsxs(US.Provider,{value:L,children:[E.jsx(yK,{ref:F}),E.jsx(xK,{className:r,renderEditor:x,editorColorScheme:Y,ref:t,...k,children:i})]})})}var xK=Re.forwardRef(({className:e,renderEditor:t,editorColorScheme:n,children:r,...o},i)=>E.jsx("div",{className:ut("bn-root","bn-container",n,e),"data-color-scheme":n,...o,ref:i,children:t?E.jsx(kK,{children:r}):r})),CK=Re.forwardRef(EK),kK=e=>{let t=mK(),n=be(),r=C.useMemo(()=>gK(),[]),o=C.useCallback(i=>{n.isEditable=t.editorProps.editable!==!1,n._tiptapEditor.contentComponent=r,i?n.mount(i):n.unmount()},[t.editorProps.editable,n,r]);return E.jsxs(E.Fragment,{children:[E.jsx(bK,{contentComponent:r}),E.jsx(TK,{...t.editorProps,...e,mount:o}),E.jsx(dK,{...t.defaultUIProps}),e.children]})},TK=e=>{let{autoFocus:t,mount:n,contentEditableProps:r}=e;return E.jsx("div",{"aria-autocomplete":"list","aria-haspopup":"listbox","data-bn-autofocus":t,ref:n,...r})};function jy(e,t){let n,r=document.createElement("div"),o;if(t?.elementRenderer)t.elementRenderer(e(l=>n=l||void 0),r);else{if(!t?.headless)throw Error("elementRenderer not available, expected headless editor");o=Cv.createRoot(r),Xr.flushSync(()=>{o.render(e(l=>n=l||void 0))})}if(!r.childElementCount)return console.warn("ReactInlineContentSpec: renderHTML() failed"),{dom:document.createElement("span")};n?.setAttribute("data-tmp-find","true");let i=r.cloneNode(!0),s=i.firstElementChild,a=i.querySelector("[data-tmp-find]");return a?.removeAttribute("data-tmp-find"),o?.unmount(),{dom:s,contentDOM:a||void 0}}function If(e){return E.jsx(QG,{onDragOver:t=>t.preventDefault(),...Object.fromEntries(Object.entries(e.domAttributes||{}).filter(([t])=>t!=="class")),className:ut("bn-block-content",e.domAttributes?.class||""),"data-content-type":e.blockType,...Object.fromEntries(Object.entries(e.blockProps).filter(([t,n])=>n!==e.propSchema[t].default).map(([t,n])=>[Tc(t),n])),"data-file-block":e.isFileBlock===!0||void 0,children:e.children})}function VS(e,t,n){return(r={})=>{let o=typeof e=="function"?e(r):e,i=typeof t=="function"?t(r):t;return{config:o,implementation:{...i,toExternalHTML(a,l,c){let u=i.toExternalHTML||i.render;return jy(d=>E.jsx(If,{blockType:a.type,blockProps:a.props,propSchema:o.propSchema,domAttributes:this.blockContentDOMAttributes,isFileBlock:i.meta?.fileBlockAccept!==void 0,children:E.jsx(u,{block:a,editor:l,contentRef:f=>{d(f),f&&(f.className=ut("bn-inline-content",f.className))},context:c})}),l)},render(a,l){if(this.renderType==="nodeView")return nY(c=>{let u=_k(c.getPos,l,c.editor,o.type),d=vS().nodeViewContentRef;if(!d)throw Error("nodeViewContentRef is not set");let f=i.render;return E.jsx(If,{blockType:u.type,blockProps:u.props,propSchema:o.propSchema,isFileBlock:!!i.meta?.fileBlockAccept,domAttributes:this.blockContentDOMAttributes,children:E.jsx(f,{block:u,editor:l,contentRef:h=>{d(h),h&&(h.className=ut("bn-inline-content",h.className),h.dataset.nodeViewContent="")}})})},{className:"bn-react-node-view-renderer"})(this.props);{let c=i.render;return jy(u=>E.jsx(If,{blockType:a.type,blockProps:a.props,propSchema:o.propSchema,domAttributes:this.blockContentDOMAttributes,children:E.jsx(c,{block:a,editor:l,contentRef:d=>{u(d),d&&(d.className=ut("bn-inline-content",d.className))}})}),l)}}},extensions:void 0}}}Re.memo(({thread:e,selectedThreadId:t,maxCommentsBeforeCollapse:n,referenceText:r})=>{let o=je(Jr),i=C.useCallback(a=>{a.target.closest(".bn-action-toolbar")||o.selectThread(e.id)},[o,e.id]),s=C.useCallback(a=>{if(!a.relatedTarget||a.relatedTarget.closest(".bn-action-toolbar"))return;let l=a.target instanceof Node?a.target:null,c=a.relatedTarget instanceof Node?a.relatedTarget.closest(".bn-thread"):null;(!l||!c||!c.contains(l))&&o.selectThread(void 0)},[o]);return E.jsx(Qm,{thread:e,selected:e.id===t,referenceText:r,maxCommentsBeforeCollapse:n,onFocus:i,onBlur:s,tabIndex:0})});function wK(e){return e.currentTarget instanceof HTMLElement&&e.relatedTarget instanceof HTMLElement?e.currentTarget.contains(e.relatedTarget):!1}function SK({onBlur:e,onFocus:t}={}){let n=C.useRef(null),[r,o]=C.useState(!1),i=C.useRef(!1),s=c=>{o(c),i.current=c},a=c=>{i.current||(s(!0),t?.(c))},l=c=>{i.current&&!wK(c)&&(s(!1),e?.(c))};return C.useEffect(()=>{let c=n.current;if(c)return c.addEventListener("focusin",a),c.addEventListener("focusout",l),()=>{c?.removeEventListener("focusin",a),c?.removeEventListener("focusout",l)}},[a,l]),{ref:n,focused:r}}function $S(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=n.top<r.top,i=n.bottom>r.bottom;return o&&i?"both":o?"top":i?"bottom":"none"}function jS(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var za=e=>e.type==="checkbox",Qo=e=>e instanceof Date,mn=e=>e==null;const zS=e=>typeof e=="object";var Nt=e=>!mn(e)&&!Array.isArray(e)&&zS(e)&&!Qo(e),vK=e=>Nt(e)&&e.target?za(e.target)?e.target.checked:e.target.value:e,AK=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,NK=(e,t)=>e.has(AK(t)),IK=e=>{const t=e.constructor&&e.constructor.prototype;return Nt(t)&&t.hasOwnProperty("isPrototypeOf")},tg=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function _t(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(tg&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(Nt(e)&&IK(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=_t(e[o]));return r}var ad=e=>/^\w*$/.test(e),ht=e=>e===void 0,ng=e=>Array.isArray(e)?e.filter(Boolean):[],rg=e=>ng(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ce=(e,t,n)=>{if(!t||!Nt(e))return n;const r=(ad(t)?[t]:rg(t)).reduce((o,i)=>mn(o)?o:o[i],e);return ht(r)||r===e?ht(e[t])?n:e[t]:r},hr=e=>typeof e=="boolean",Zn=e=>typeof e=="function",lt=(e,t,n)=>{let r=-1;const o=ad(t)?[t]:rg(t),i=o.length,s=i-1;for(;++r<i;){const a=o[r];let l=n;if(r!==s){const c=e[a];l=Nt(c)||Array.isArray(c)?c:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=l,e=e[a]}};const zy={BLUR:"blur",FOCUS_OUT:"focusout"},Jn={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Dr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},WS=Re.createContext(null);WS.displayName="HookFormControlContext";var MK=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==Jn.all&&(t._proxyFormState[s]=!r||Jn.all),e[s]}});return o};const _K=typeof window<"u"?Re.useLayoutEffect:Re.useEffect;var In=e=>typeof e=="string",OK=(e,t,n,r,o)=>In(e)?(r&&t.watch.add(e),ce(n,e,o)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),ce(n,i))):(r&&(t.watchAll=!0),n),sp=e=>mn(e)||!zS(e);function bo(e,t,n=new WeakSet){if(sp(e)||sp(t))return Object.is(e,t);if(Qo(e)&&Qo(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const i of r){const s=e[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=t[i];if(Qo(s)&&Qo(a)||Nt(s)&&Nt(a)||Array.isArray(s)&&Array.isArray(a)?!bo(s,a,n):!Object.is(s,a))return!1}}return!0}const qS=Re.createContext(null);qS.displayName="HookFormContext";const RK=e=>{const{children:t,watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:y,subscribe:b}=e;return Re.createElement(qS.Provider,{value:Re.useMemo(()=>({watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:y,subscribe:b}),[s,p,c,o,r,f,g,d,u,i,y,a,b,l,h,n])},Re.createElement(WS.Provider,{value:p},t))};var LK=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},ia=e=>Array.isArray(e)?e:[e],Wy=()=>{let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}};function GS(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const o=e[r],i=t[r];if(o&&Nt(o)&&i){const s=GS(o,i);Nt(s)&&(n[r]=s)}else e[r]&&(n[r]=i)}return n}var nn=e=>Nt(e)&&!Object.keys(e).length,og=e=>e.type==="file",du=e=>{if(!tg)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},YS=e=>e.type==="select-multiple",ig=e=>e.type==="radio",DK=e=>ig(e)||za(e),Mf=e=>du(e)&&e.isConnected;function PK(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=ht(e)?r++:e[t[r++]];return e}function BK(e){for(const t in e)if(e.hasOwnProperty(t)&&!ht(e[t]))return!1;return!0}function wt(e,t){const n=Array.isArray(t)?t:ad(t)?[t]:rg(t),r=n.length===1?e:PK(e,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(Nt(r)&&nn(r)||Array.isArray(r)&&BK(r))&&wt(e,n.slice(0,-1)),e}var FK=e=>{for(const t in e)if(Zn(e[t]))return!0;return!1};function KS(e){return Array.isArray(e)||Nt(e)&&!FK(e)}function ap(e,t={}){for(const n in e){const r=e[n];KS(r)?(t[n]=Array.isArray(r)?[]:{},ap(r,t[n])):ht(r)||(t[n]=!0)}return t}function Bi(e,t,n){n||(n=ap(t));for(const r in e){const o=e[r];if(KS(o))ht(t)||sp(n[r])?n[r]=ap(o,Array.isArray(o)?[]:{}):Bi(o,mn(t)?{}:t[r],n[r]);else{const i=t[r];n[r]=!bo(o,i)}}return n}const qy={value:!1,isValid:!1},Gy={value:!0,isValid:!0};var QS=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ht(e[0].attributes.value)?ht(e[0].value)||e[0].value===""?Gy:{value:e[0].value,isValid:!0}:Gy:qy}return qy},XS=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>ht(e)?e:t?e===""?NaN:e&&+e:n&&In(e)?new Date(e):r?r(e):e;const Yy={isValid:!1,value:null};var ZS=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Yy):Yy;function Ky(e){const t=e.ref;return og(t)?t.files:ig(t)?ZS(e.refs).value:YS(t)?[...t.selectedOptions].map(({value:n})=>n):za(t)?QS(e.refs).value:XS(ht(t.value)?e.ref.value:t.value,e)}var HK=(e,t,n,r)=>{const o={};for(const i of e){const s=ce(t,i);s&<(o,i,s._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},fu=e=>e instanceof RegExp,vs=e=>ht(e)?e:fu(e)?e.source:Nt(e)?fu(e.value)?e.value.source:e.value:e,Qy=e=>({isOnSubmit:!e||e===Jn.onSubmit,isOnBlur:e===Jn.onBlur,isOnChange:e===Jn.onChange,isOnAll:e===Jn.all,isOnTouch:e===Jn.onTouched});const Xy="AsyncFunction";var UK=e=>!!e&&!!e.validate&&!!(Zn(e.validate)&&e.validate.constructor.name===Xy||Nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Xy)),VK=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Zy=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const sa=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const i=ce(e,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!r)return!0;if(s.ref&&t(s.ref,s.name)&&!r)return!0;if(sa(a,t))break}else if(Nt(a)&&sa(a,t))break}}};function Jy(e,t,n){const r=ce(e,n);if(r||ad(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=ce(t,i),a=ce(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:n}}var $K=(e,t,n,r)=>{n(e);const{name:o,...i}=e;return nn(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!r||Jn.all))},jK=(e,t,n)=>!e||!t||e===t||ia(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),zK=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,WK=(e,t)=>!ng(ce(e,t)).length&&wt(e,t),qK=(e,t,n)=>{const r=ia(ce(e,n));return lt(r,"root",t[n]),lt(e,n,r),e};function eE(e,t,n="validate"){if(In(e)||Array.isArray(e)&&e.every(In)||hr(e)&&!e)return{type:n,message:In(e)?e:"",ref:t}}var Mi=e=>Nt(e)&&!fu(e)?e:{value:e,message:""},tE=async(e,t,n,r,o,i)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:y,mount:b}=e._f,x=ce(n,g);if(!b||t.has(g))return{};const k=a?a[0]:s,O=F=>{o&&k.reportValidity&&(k.setCustomValidity(hr(F)?"":F||""),k.reportValidity())},M={},A=ig(s),D=za(s),z=A||D,Y=(y||og(s))&&ht(s.value)&&ht(x)||du(s)&&s.value===""||x===""||Array.isArray(x)&&!x.length,N=LK.bind(null,g,r,M),K=(F,q,L,H=Dr.maxLength,re=Dr.minLength)=>{const W=F?q:L;M[g]={type:F?H:re,message:W,ref:s,...N(F?H:re,W)}};if(i?!Array.isArray(x)||!x.length:l&&(!z&&(Y||mn(x))||hr(x)&&!x||D&&!QS(a).isValid||A&&!ZS(a).isValid)){const{value:F,message:q}=In(l)?{value:!!l,message:l}:Mi(l);if(F&&(M[g]={type:Dr.required,message:q,ref:k,...N(Dr.required,q)},!r))return O(q),M}if(!Y&&(!mn(d)||!mn(f))){let F,q;const L=Mi(f),H=Mi(d);if(!mn(x)&&!isNaN(x)){const re=s.valueAsNumber||x&&+x;mn(L.value)||(F=re>L.value),mn(H.value)||(q=re<H.value)}else{const re=s.valueAsDate||new Date(x),W=S=>new Date(new Date().toDateString()+" "+S),G=s.type=="time",te=s.type=="week";In(L.value)&&x&&(F=G?W(x)>W(L.value):te?x>L.value:re>new Date(L.value)),In(H.value)&&x&&(q=G?W(x)<W(H.value):te?x<H.value:re<new Date(H.value))}if((F||q)&&(K(!!F,L.message,H.message,Dr.max,Dr.min),!r))return O(M[g].message),M}if((c||u)&&!Y&&(In(x)||i&&Array.isArray(x))){const F=Mi(c),q=Mi(u),L=!mn(F.value)&&x.length>+F.value,H=!mn(q.value)&&x.length<+q.value;if((L||H)&&(K(L,F.message,q.message),!r))return O(M[g].message),M}if(h&&!Y&&In(x)){const{value:F,message:q}=Mi(h);if(fu(F)&&!x.match(F)&&(M[g]={type:Dr.pattern,message:q,ref:s,...N(Dr.pattern,q)},!r))return O(q),M}if(p){if(Zn(p)){const F=await p(x,n),q=eE(F,k);if(q&&(M[g]={...q,...N(Dr.validate,q.message)},!r))return O(q.message),M}else if(Nt(p)){let F={};for(const q in p){if(!nn(F)&&!r)break;const L=eE(await p[q](x,n),k,q);L&&(F={...L,...N(q,L.message)},O(L.message),r&&(M[g]=F))}if(!nn(F)&&(M[g]={ref:k,...F},!r))return M}}return O(!0),M};const GK={mode:Jn.onSubmit,reValidateMode:Jn.onChange,shouldFocusError:!0};function YK(e={}){let t={...GK,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Zn(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=Nt(t.defaultValues)||Nt(t.values)?_t(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:_t(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u};let f={...d};const h={array:Wy(),state:Wy()},p=t.criteriaMode===Jn.all,g=_=>P=>{clearTimeout(c),c=setTimeout(_,P)},y=async _=>{if(!s.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||_)){let P;t.resolver?(P=nn((await z()).errors),b()):P=await N(r,!0),P!==n.isValid&&h.state.next({isValid:P})}},b=(_,P)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((_||Array.from(a.mount)).forEach(U=>{U&&(P?lt(n.validatingFields,U,P):wt(n.validatingFields,U))}),h.state.next({validatingFields:n.validatingFields,isValidating:!nn(n.validatingFields)}))},x=(_,P=[],U,oe,ne=!0,R=!0)=>{if(oe&&U&&!t.disabled){if(s.action=!0,R&&Array.isArray(ce(r,_))){const V=U(ce(r,_),oe.argA,oe.argB);ne&<(r,_,V)}if(R&&Array.isArray(ce(n.errors,_))){const V=U(ce(n.errors,_),oe.argA,oe.argB);ne&<(n.errors,_,V),WK(n.errors,_)}if((d.touchedFields||f.touchedFields)&&R&&Array.isArray(ce(n.touchedFields,_))){const V=U(ce(n.touchedFields,_),oe.argA,oe.argB);ne&<(n.touchedFields,_,V)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=Bi(o,i)),h.state.next({name:_,isDirty:F(_,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else lt(i,_,P)},k=(_,P)=>{lt(n.errors,_,P),h.state.next({errors:n.errors})},O=_=>{n.errors=_,h.state.next({errors:n.errors,isValid:!1})},M=(_,P,U,oe)=>{const ne=ce(r,_);if(ne){const R=ce(i,_,ht(U)?ce(o,_):U);ht(R)||oe&&oe.defaultChecked||P?lt(i,_,P?R:Ky(ne._f)):H(_,R),s.mount&&!s.action&&y()}},A=(_,P,U,oe,ne)=>{let R=!1,V=!1;const ie={name:_};if(!t.disabled){if(!U||oe){(d.isDirty||f.isDirty)&&(V=n.isDirty,n.isDirty=ie.isDirty=F(),R=V!==ie.isDirty);const ae=bo(ce(o,_),P);V=!!ce(n.dirtyFields,_),ae?wt(n.dirtyFields,_):lt(n.dirtyFields,_,!0),ie.dirtyFields=n.dirtyFields,R=R||(d.dirtyFields||f.dirtyFields)&&V!==!ae}if(U){const ae=ce(n.touchedFields,_);ae||(lt(n.touchedFields,_,U),ie.touchedFields=n.touchedFields,R=R||(d.touchedFields||f.touchedFields)&&ae!==U)}R&&ne&&h.state.next(ie)}return R?ie:{}},D=(_,P,U,oe)=>{const ne=ce(n.errors,_),R=(d.isValid||f.isValid)&&hr(P)&&n.isValid!==P;if(t.delayError&&U?(l=g(()=>k(_,U)),l(t.delayError)):(clearTimeout(c),l=null,U?lt(n.errors,_,U):wt(n.errors,_)),(U?!bo(ne,U):ne)||!nn(oe)||R){const V={...oe,...R&&hr(P)?{isValid:P}:{},errors:n.errors,name:_};n={...n,...V},h.state.next(V)}},z=async _=>(b(_,!0),await t.resolver(i,t.context,HK(_||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),Y=async _=>{const{errors:P}=await z(_);if(b(_),_)for(const U of _){const oe=ce(P,U);oe?lt(n.errors,U,oe):wt(n.errors,U)}else n.errors=P;return P},N=async(_,P,U={valid:!0})=>{for(const oe in _){const ne=_[oe];if(ne){const{_f:R,...V}=ne;if(R){const ie=a.array.has(R.name),ae=ne._f&&UK(ne._f);ae&&d.validatingFields&&b([R.name],!0);const xe=await tE(ne,a.disabled,i,p,t.shouldUseNativeValidation&&!P,ie);if(ae&&d.validatingFields&&b([R.name]),xe[R.name]&&(U.valid=!1,P||e.shouldUseNativeValidation))break;!P&&(ce(xe,R.name)?ie?qK(n.errors,xe,R.name):lt(n.errors,R.name,xe[R.name]):wt(n.errors,R.name))}!nn(V)&&await N(V,P,U)}}return U.valid},K=()=>{for(const _ of a.unMount){const P=ce(r,_);P&&(P._f.refs?P._f.refs.every(U=>!Mf(U)):!Mf(P._f.ref))&&Pe(_)}a.unMount=new Set},F=(_,P)=>!t.disabled&&(_&&P&<(i,_,P),!bo(ye(),o)),q=(_,P,U)=>OK(_,a,{...s.mount?i:ht(P)?o:In(_)?{[_]:P}:P},U,P),L=_=>ng(ce(s.mount?i:o,_,t.shouldUnregister?ce(o,_,[]):[])),H=(_,P,U={})=>{const oe=ce(r,_);let ne=P;if(oe){const R=oe._f;R&&(!R.disabled&<(i,_,XS(P,R)),ne=du(R.ref)&&mn(P)?"":P,YS(R.ref)?[...R.ref.options].forEach(V=>V.selected=ne.includes(V.value)):R.refs?za(R.ref)?R.refs.forEach(V=>{(!V.defaultChecked||!V.disabled)&&(Array.isArray(ne)?V.checked=!!ne.find(ie=>ie===V.value):V.checked=ne===V.value||!!ne)}):R.refs.forEach(V=>V.checked=V.value===ne):og(R.ref)?R.ref.value="":(R.ref.value=ne,R.ref.type||h.state.next({name:_,values:_t(i)})))}(U.shouldDirty||U.shouldTouch)&&A(_,ne,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&S(_)},re=(_,P,U)=>{for(const oe in P){if(!P.hasOwnProperty(oe))return;const ne=P[oe],R=_+"."+oe,V=ce(r,R);(a.array.has(_)||Nt(ne)||V&&!V._f)&&!Qo(ne)?re(R,ne,U):H(R,ne,U)}},W=(_,P,U={})=>{const oe=ce(r,_),ne=a.array.has(_),R=_t(P);lt(i,_,R),ne?(h.array.next({name:_,values:_t(i)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&U.shouldDirty&&h.state.next({name:_,dirtyFields:Bi(o,i),isDirty:F(_,R)})):oe&&!oe._f&&!mn(R)?re(_,R,U):H(_,R,U),Zy(_,a)?h.state.next({...n,name:_,values:_t(i)}):h.state.next({name:s.mount?_:void 0,values:_t(i)})},G=async _=>{s.mount=!0;const P=_.target;let U=P.name,oe=!0;const ne=ce(r,U),R=ae=>{oe=Number.isNaN(ae)||Qo(ae)&&isNaN(ae.getTime())||bo(ae,ce(i,U,ae))},V=Qy(t.mode),ie=Qy(t.reValidateMode);if(ne){let ae,xe;const Mt=P.type?Ky(ne._f):vK(_),Wt=_.type===zy.BLUR||_.type===zy.FOCUS_OUT,Yn=!VK(ne._f)&&!t.resolver&&!ce(n.errors,U)&&!ne._f.deps||zK(Wt,ce(n.touchedFields,U),n.isSubmitted,ie,V),Ir=Zy(U,a,Wt);lt(i,U,Mt),Wt?(!P||!P.readOnly)&&(ne._f.onBlur&&ne._f.onBlur(_),l&&l(0)):ne._f.onChange&&ne._f.onChange(_);const Mr=A(U,Mt,Wt),tn=!nn(Mr)||Ir;if(!Wt&&h.state.next({name:U,type:_.type,values:_t(i)}),Yn)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?Wt&&y():Wt||y()),tn&&h.state.next({name:U,...Ir?{}:Mr});if(!Wt&&Ir&&h.state.next({...n}),t.resolver){const{errors:_r}=await z([U]);if(b([U]),R(Mt),oe){const Kn=Jy(n.errors,r,U),cg=Jy(_r,r,Kn.name||U);ae=cg.error,U=cg.name,xe=nn(_r)}}else b([U],!0),ae=(await tE(ne,a.disabled,i,p,t.shouldUseNativeValidation))[U],b([U]),R(Mt),oe&&(ae?xe=!1:(d.isValid||f.isValid)&&(xe=await N(r,!0)));oe&&(ne._f.deps&&(!Array.isArray(ne._f.deps)||ne._f.deps.length>0)&&S(ne._f.deps),D(U,xe,ae,Mr))}},te=(_,P)=>{if(ce(n.errors,P)&&_.focus)return _.focus(),1},S=async(_,P={})=>{let U,oe;const ne=ia(_);if(t.resolver){const R=await Y(ht(_)?_:ne);U=nn(R),oe=_?!ne.some(V=>ce(R,V)):U}else _?(oe=(await Promise.all(ne.map(async R=>{const V=ce(r,R);return await N(V&&V._f?{[R]:V}:V)}))).every(Boolean),!(!oe&&!n.isValid)&&y()):oe=U=await N(r);return h.state.next({...!In(_)||(d.isValid||f.isValid)&&U!==n.isValid?{}:{name:_},...t.resolver||!_?{isValid:U}:{},errors:n.errors}),P.shouldFocus&&!oe&&sa(r,te,_?ne:a.mount),oe},ye=(_,P)=>{let U={...s.mount?i:o};return P&&(U=GS(P.dirtyFields?n.dirtyFields:n.touchedFields,U)),ht(_)?U:In(_)?ce(U,_):_.map(oe=>ce(U,oe))},pe=(_,P)=>({invalid:!!ce((P||n).errors,_),isDirty:!!ce((P||n).dirtyFields,_),error:ce((P||n).errors,_),isValidating:!!ce(n.validatingFields,_),isTouched:!!ce((P||n).touchedFields,_)}),v=_=>{_&&ia(_).forEach(P=>wt(n.errors,P)),h.state.next({errors:_?n.errors:{}})},ze=(_,P,U)=>{const oe=(ce(r,_,{_f:{}})._f||{}).ref,ne=ce(n.errors,_)||{},{ref:R,message:V,type:ie,...ae}=ne;lt(n.errors,_,{...ae,...P,ref:oe}),h.state.next({name:_,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&oe&&oe.focus&&oe.focus()},ve=(_,P)=>Zn(_)?h.state.subscribe({next:U=>"values"in U&&_(q(void 0,P),U)}):q(_,P,!0),Le=_=>h.state.subscribe({next:P=>{jK(_.name,P.name,_.exact)&&$K(P,_.formState||d,Tn,_.reRenderRoot)&&_.callback({values:{...i},...n,...P,defaultValues:o})}}).unsubscribe,Et=_=>(s.mount=!0,f={...f,..._.formState},Le({..._,formState:{...u,..._.formState}})),Pe=(_,P={})=>{for(const U of _?ia(_):a.mount)a.mount.delete(U),a.array.delete(U),P.keepValue||(wt(r,U),wt(i,U)),!P.keepError&&wt(n.errors,U),!P.keepDirty&&wt(n.dirtyFields,U),!P.keepTouched&&wt(n.touchedFields,U),!P.keepIsValidating&&wt(n.validatingFields,U),!t.shouldUnregister&&!P.keepDefaultValue&&wt(o,U);h.state.next({values:_t(i)}),h.state.next({...n,...P.keepDirty?{isDirty:F()}:{}}),!P.keepIsValid&&y()},We=({disabled:_,name:P})=>{if(hr(_)&&s.mount||_||a.disabled.has(P)){const ne=a.disabled.has(P)!==!!_;_?a.disabled.add(P):a.disabled.delete(P),ne&&s.mount&&!s.action&&y()}},dt=(_,P={})=>{let U=ce(r,_);const oe=hr(P.disabled)||hr(t.disabled);return lt(r,_,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:_}},name:_,mount:!0,...P}}),a.mount.add(_),U?We({disabled:hr(P.disabled)?P.disabled:t.disabled,name:_}):M(_,!0,P.value),{...oe?{disabled:P.disabled||t.disabled}:{},...t.progressive?{required:!!P.required,min:vs(P.min),max:vs(P.max),minLength:vs(P.minLength),maxLength:vs(P.maxLength),pattern:vs(P.pattern)}:{},name:_,onChange:G,onBlur:G,ref:ne=>{if(ne){dt(_,P),U=ce(r,_);const R=ht(ne.value)&&ne.querySelectorAll&&ne.querySelectorAll("input,select,textarea")[0]||ne,V=DK(R),ie=U._f.refs||[];if(V?ie.find(ae=>ae===R):R===U._f.ref)return;lt(r,_,{_f:{...U._f,...V?{refs:[...ie.filter(Mf),R,...Array.isArray(ce(o,_))?[{}]:[]],ref:{type:R.type,name:_}}:{ref:R}}}),M(_,!1,void 0,R)}else U=ce(r,_,{}),U._f&&(U._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(NK(a.array,_)&&s.action)&&a.unMount.add(_)}}},xt=()=>t.shouldFocusError&&sa(r,te,a.mount),Ee=_=>{hr(_)&&(h.state.next({disabled:_}),sa(r,(P,U)=>{const oe=ce(r,U);oe&&(P.disabled=oe._f.disabled||_,Array.isArray(oe._f.refs)&&oe._f.refs.forEach(ne=>{ne.disabled=oe._f.disabled||_}))},0,!1))},De=(_,P)=>async U=>{let oe;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let ne=_t(i);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:R,values:V}=await z();b(),n.errors=R,ne=_t(V)}else await N(r);if(a.disabled.size)for(const R of a.disabled)wt(ne,R);if(wt(n.errors,"root"),nn(n.errors)){h.state.next({errors:{}});try{await _(ne,U)}catch(R){oe=R}}else P&&await P({...n.errors},U),xt(),setTimeout(xt);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nn(n.errors)&&!oe,submitCount:n.submitCount+1,errors:n.errors}),oe)throw oe},Ne=(_,P={})=>{ce(r,_)&&(ht(P.defaultValue)?W(_,_t(ce(o,_))):(W(_,P.defaultValue),lt(o,_,_t(P.defaultValue))),P.keepTouched||wt(n.touchedFields,_),P.keepDirty||(wt(n.dirtyFields,_),n.isDirty=P.defaultValue?F(_,_t(ce(o,_))):F()),P.keepError||(wt(n.errors,_),d.isValid&&y()),h.state.next({...n}))},Ke=(_,P={})=>{const U=_?_t(_):o,oe=_t(U),ne=nn(_),R=ne?o:oe;if(P.keepDefaultValues||(o=U),!P.keepValues){if(P.keepDirtyValues){const V=new Set([...a.mount,...Object.keys(Bi(o,i))]);for(const ie of Array.from(V)){const ae=ce(n.dirtyFields,ie),xe=ce(i,ie),Mt=ce(R,ie);ae&&!ht(xe)?lt(R,ie,xe):!ae&&!ht(Mt)&&W(ie,Mt)}}else{if(tg&&ht(_))for(const V of a.mount){const ie=ce(r,V);if(ie&&ie._f){const ae=Array.isArray(ie._f.refs)?ie._f.refs[0]:ie._f.ref;if(du(ae)){const xe=ae.closest("form");if(xe){xe.reset();break}}}}if(P.keepFieldsRef)for(const V of a.mount)W(V,ce(R,V));else r={}}i=t.shouldUnregister?P.keepDefaultValues?_t(o):{}:_t(R),h.array.next({values:{...R}}),h.state.next({values:{...R}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues||!t.shouldUnregister&&!nn(R),s.watch=!!t.shouldUnregister,s.keepIsValid=!!P.keepIsValid,s.action=!1,P.keepErrors||(n.errors={}),h.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:ne?!1:P.keepDirty?n.isDirty:!!(P.keepDefaultValues&&!bo(_,o)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ne?{}:P.keepDirtyValues?P.keepDefaultValues&&i?Bi(o,i):n.dirtyFields:P.keepDefaultValues&&_?Bi(o,_):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},ft=(_,P)=>Ke(Zn(_)?_(i):_,{...t.resetOptions,...P}),Fe=(_,P={})=>{const U=ce(r,_),oe=U&&U._f;if(oe){const ne=oe.refs?oe.refs[0]:oe.ref;ne.focus&&setTimeout(()=>{ne.focus(),P.shouldSelect&&Zn(ne.select)&&ne.select()})}},Tn=_=>{n={...n,..._}},It={control:{register:dt,unregister:Pe,getFieldState:pe,handleSubmit:De,setError:ze,_subscribe:Le,_runSchema:z,_updateIsValidating:b,_focusError:xt,_getWatch:q,_getDirty:F,_setValid:y,_setFieldArray:x,_setDisabledField:We,_setErrors:O,_getFieldArray:L,_reset:Ke,_resetDefaultValues:()=>Zn(t.defaultValues)&&t.defaultValues().then(_=>{ft(_,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:K,_disableForm:Ee,_subjects:h,_proxyFormState:d,get _fields(){return r},get _formValues(){return i},get _state(){return s},set _state(_){s=_},get _defaultValues(){return o},get _names(){return a},set _names(_){a=_},get _formState(){return n},get _options(){return t},set _options(_){t={...t,..._}}},subscribe:Et,trigger:S,register:dt,handleSubmit:De,watch:ve,setValue:W,getValues:ye,reset:ft,resetField:Ne,clearErrors:v,unregister:Pe,setError:ze,setFocus:Fe,getFieldState:pe};return{...It,formControl:It}}function KK(e={}){const t=Re.useRef(void 0),n=Re.useRef(void 0),[r,o]=Re.useState({isDirty:!1,isValidating:!1,isLoading:Zn(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Zn(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!Zn(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...a}=YK(e);t.current={...a,formState:r}}const i=t.current.control;return i._options=e,_K(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),Re.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),Re.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),Re.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),Re.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),Re.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),Re.useEffect(()=>{var s;e.values&&!bo(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((s=i._options.resetOptions)===null||s===void 0)&&s.keepIsValid||i._setValid(),n.current=e.values,o(a=>({...a}))):i._resetDefaultValues()},[i,e.values]),Re.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=Re.useMemo(()=>MK(r,i),[i,r]),t.current}function QK(e,t=[]){let n=[];function r(i,s){const a=C.createContext(s);a.displayName=i+"Context";const l=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,g=f?.[e]?.[l]||a,y=C.useMemo(()=>p,Object.values(p));return E.jsx(g.Provider,{value:y,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[e]?.[l]||a,p=C.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>C.createContext(s));return function(a){const l=a?.[e]||i;return C.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,XK(o,...t)]}function XK(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var sg="Avatar",[ZK]=QK(sg),[JK,JS]=ZK(sg),ev=C.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[o,i]=C.useState("idle");return E.jsx(JK,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:E.jsx(hu.span,{...r,ref:t})})});ev.displayName=sg;var tv="AvatarImage",nv=C.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...i}=e,s=JS(tv,n),a=eQ(r,i),l=_v(c=>{o(c),s.onImageLoadingStatusChange(c)});return Df(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?E.jsx(hu.img,{...i,ref:t,src:r}):null});nv.displayName=tv;var rv="AvatarFallback",ov=C.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...o}=e,i=JS(rv,n),[s,a]=C.useState(r===void 0);return C.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),s&&i.imageLoadingStatus!=="loaded"?E.jsx(hu.span,{...o,ref:t}):null});ov.displayName=rv;function nE(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function eQ(e,{referrerPolicy:t,crossOrigin:n}){const r=Ov(),o=C.useRef(null),i=r?(o.current||(o.current=new window.Image),o.current):null,[s,a]=C.useState(()=>nE(i,e));return Df(()=>{a(nE(i,e))},[i,e]),Df(()=>{const l=d=>()=>{a(d)};if(!i)return;const c=l("loaded"),u=l("error");return i.addEventListener("load",c),i.addEventListener("error",u),t&&(i.referrerPolicy=t),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",c),i.removeEventListener("error",u)}},[i,n,t]),s}var tQ=ev,nQ=nv,rQ=ov;const ag="-",oQ=e=>{const t=sQ(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(ag);return a[0]===""&&a.length!==1&&a.shift(),iv(a,t)||iQ(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},iv=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?iv(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(ag);return t.validators.find(({validator:s})=>s(i))?.classGroupId},rE=/^\[(.+)\]$/,iQ=e=>{if(rE.test(e)){const t=rE.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},sQ=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return lQ(Object.entries(e.classGroups),n).forEach(([i,s])=>{lp(s,r,i,t)}),r},lp=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:oE(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(aQ(o)){lp(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{lp(s,oE(t,i),n,r)})})},oE=(e,t)=>{let n=e;return t.split(ag).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},aQ=e=>e.isThemeGetter,lQ=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[t+s,a])):i);return[n,o]}):e,cQ=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},sv="!",uQ=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,s=a=>{const l=[];let c=0,u=0,d;for(let y=0;y<a.length;y++){let b=a[y];if(c===0){if(b===o&&(r||a.slice(y,y+i)===t)){l.push(a.slice(u,y)),u=y+i;continue}if(b==="/"){d=y;continue}}b==="["?c++:b==="]"&&c--}const f=l.length===0?a:a.substring(u),h=f.startsWith(sv),p=h?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:s}):s},dQ=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},fQ=e=>({cache:cQ(e.cacheSize),parseClassName:uQ(e),...oQ(e)}),hQ=/\s+/,pQ=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(hQ);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=n(c);let p=!!h,g=r(p?f.substring(0,h):f);if(!g){if(!p){a=c+(a.length>0?" "+a:a);continue}if(g=r(f),!g){a=c+(a.length>0?" "+a:a);continue}p=!1}const y=dQ(u).join(":"),b=d?y+sv:y,x=b+g;if(i.includes(x))continue;i.push(x);const k=o(g,p);for(let O=0;O<k.length;++O){const M=k[O];i.push(b+M)}a=c+(a.length>0?" "+a:a)}return a};function mQ(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=av(t))&&(r&&(r+=" "),r+=n);return r}const av=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=av(e[r]))&&(n&&(n+=" "),n+=t);return n};function gQ(e,...t){let n,r,o,i=s;function s(l){const c=t.reduce((u,d)=>d(u),e());return n=fQ(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=pQ(l,n);return o(l,u),u}return function(){return i(mQ.apply(null,arguments))}}const ot=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},lv=/^\[(?:([a-z-]+):)?(.+)\]$/i,bQ=/^\d+\/\d+$/,yQ=new Set(["px","full","screen"]),EQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xQ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,CQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pr=e=>Ki(e)||yQ.has(e)||bQ.test(e),oo=e=>gs(e,"length",_Q),Ki=e=>!!e&&!Number.isNaN(Number(e)),_f=e=>gs(e,"number",Ki),As=e=>!!e&&Number.isInteger(Number(e)),wQ=e=>e.endsWith("%")&&Ki(e.slice(0,-1)),Ce=e=>lv.test(e),io=e=>EQ.test(e),SQ=new Set(["length","size","percentage"]),vQ=e=>gs(e,SQ,cv),AQ=e=>gs(e,"position",cv),NQ=new Set(["image","url"]),IQ=e=>gs(e,NQ,RQ),MQ=e=>gs(e,"",OQ),Ns=()=>!0,gs=(e,t,n)=>{const r=lv.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},_Q=e=>xQ.test(e)&&!CQ.test(e),cv=()=>!1,OQ=e=>kQ.test(e),RQ=e=>TQ.test(e),LQ=()=>{const e=ot("colors"),t=ot("spacing"),n=ot("blur"),r=ot("brightness"),o=ot("borderColor"),i=ot("borderRadius"),s=ot("borderSpacing"),a=ot("borderWidth"),l=ot("contrast"),c=ot("grayscale"),u=ot("hueRotate"),d=ot("invert"),f=ot("gap"),h=ot("gradientColorStops"),p=ot("gradientColorStopPositions"),g=ot("inset"),y=ot("margin"),b=ot("opacity"),x=ot("padding"),k=ot("saturate"),O=ot("scale"),M=ot("sepia"),A=ot("skew"),D=ot("space"),z=ot("translate"),Y=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],K=()=>["auto",Ce,t],F=()=>[Ce,t],q=()=>["",Pr,oo],L=()=>["auto",Ki,Ce],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],re=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["start","end","center","between","around","evenly","stretch"],te=()=>["","0",Ce],S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ye=()=>[Ki,Ce];return{cacheSize:500,separator:":",theme:{colors:[Ns],spacing:[Pr,oo],blur:["none","",io,Ce],brightness:ye(),borderColor:[e],borderRadius:["none","","full",io,Ce],borderSpacing:F(),borderWidth:q(),contrast:ye(),grayscale:te(),hueRotate:ye(),invert:te(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[wQ,oo],inset:K(),margin:K(),opacity:ye(),padding:F(),saturate:ye(),scale:ye(),sepia:te(),skew:ye(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Ce]}],container:["container"],columns:[{columns:[io]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),Ce]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",As,Ce]}],basis:[{basis:K()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ce]}],grow:[{grow:te()}],shrink:[{shrink:te()}],order:[{order:["first","last","none",As,Ce]}],"grid-cols":[{"grid-cols":[Ns]}],"col-start-end":[{col:["auto",{span:["full",As,Ce]},Ce]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Ns]}],"row-start-end":[{row:["auto",{span:[As,Ce]},Ce]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ce]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ce]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ce,t]}],"min-w":[{"min-w":[Ce,t,"min","max","fit"]}],"max-w":[{"max-w":[Ce,t,"none","full","min","max","fit","prose",{screen:[io]},io]}],h:[{h:[Ce,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ce,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ce,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ce,t,"auto","min","max","fit"]}],"font-size":[{text:["base",io,oo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",_f]}],"font-family":[{font:[Ns]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ce]}],"line-clamp":[{"line-clamp":["none",Ki,_f]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Pr,Ce]}],"list-image":[{"list-image":["none",Ce]}],"list-style-type":[{list:["none","disc","decimal",Ce]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Pr,oo]}],"underline-offset":[{"underline-offset":["auto",Pr,Ce]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),AQ]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",vQ]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},IQ]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...re(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:re()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...re()]}],"outline-offset":[{"outline-offset":[Pr,Ce]}],"outline-w":[{outline:[Pr,oo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Pr,oo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",io,MQ]}],"shadow-color":[{shadow:[Ns]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",io,Ce]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[k]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ce]}],duration:[{duration:ye()}],ease:[{ease:["linear","in","out","in-out",Ce]}],delay:[{delay:ye()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ce]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[O]}],"scale-x":[{"scale-x":[O]}],"scale-y":[{"scale-y":[O]}],rotate:[{rotate:[As,Ce]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ce]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Pr,oo,_f]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},DQ=gQ(LQ);const PQ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),BQ=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),iE=e=>{const t=BQ(e);return t.charAt(0).toUpperCase()+t.slice(1)},uv=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),FQ=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var HQ={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 UQ=C.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>C.createElement("svg",{ref:l,...HQ,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:uv("lucide",o),...!i&&!FQ(a)&&{"aria-hidden":"true"},...a},[...s.map(([c,u])=>C.createElement(c,u)),...Array.isArray(i)?i:[i]]));const ld=(e,t)=>{const n=C.forwardRef(({className:r,...o},i)=>C.createElement(UQ,{ref:i,iconNode:t,className:uv(`lucide-${PQ(iE(e))}`,`lucide-${e}`,r),...o}));return n.displayName=iE(e),n};const VQ=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],dv=ld("check",VQ);const $Q=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],fv=ld("chevron-down",$Q);const jQ=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],hv=ld("chevron-right",jQ);const zQ=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],WQ=ld("chevron-up",zQ);var qQ="Label",pv=C.forwardRef((e,t)=>E.jsx(hu.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));pv.displayName=qQ;var GQ=pv;function ue(...e){return DQ(kv(e))}function YQ({className:e,...t}){return E.jsx(tQ,{"data-slot":"avatar",className:ue("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function KQ({className:e,...t}){return E.jsx(nQ,{"data-slot":"avatar-image",className:ue("aspect-square size-full",e),...t})}function QQ({className:e,...t}){return E.jsx(rQ,{"data-slot":"avatar-fallback",className:ue("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var XQ=up("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function ZQ({className:e,variant:t,asChild:n=!1,...r}){return E.jsx(n?vE:"span",{"data-slot":"badge",className:ue(XQ({variant:t}),e),...r})}var JQ=up("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function eX({className:e,variant:t,size:n,asChild:r=!1,...o}){return E.jsx(r?vE:"button",{"data-slot":"button",className:ue(JQ({variant:t,size:n,className:e})),...o})}function tX({className:e,...t}){return E.jsx("div",{"data-slot":"card",className:ue("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function nX({className:e,...t}){return E.jsx("div",{"data-slot":"card-content",className:ue("px-6",e),...t})}function rX({...e}){return E.jsx(dA,{"data-slot":"dropdown-menu",...e})}function oX({...e}){return E.jsx(tA,{"data-slot":"dropdown-menu-trigger",...e})}function iX({className:e,sideOffset:t=4,...n}){return E.jsx(lA,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ue("bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",e),...n})}function sX({className:e,inset:t,variant:n="default",...r}){return E.jsx(aA,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r})}function aX({className:e,children:t,checked:n,...r}){return E.jsxs(cA,{"data-slot":"dropdown-menu-checkbox-item",className:ue("focus:bg-accent focus:text-accent-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),checked:n,...r,children:[E.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:E.jsx(uA,{children:E.jsx(dv,{className:"size-4"})})}),t]})}function lX({className:e,inset:t,...n}){return E.jsx(sA,{"data-slot":"dropdown-menu-label","data-inset":t,className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function cX({className:e,...t}){return E.jsx(iA,{"data-slot":"dropdown-menu-separator",className:ue("bg-border -mx-1 my-1 h-px",e),...t})}function uX({...e}){return E.jsx(oA,{"data-slot":"dropdown-menu-sub",...e})}function dX({className:e,inset:t,children:n,...r}){return E.jsxs(nA,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:ue("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground outline-hidden flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm data-[inset]:pl-8",e),...r,children:[n,E.jsx(hv,{className:"ml-auto size-4"})]})}function fX({className:e,...t}){return E.jsx(rA,{"data-slot":"dropdown-menu-sub-content",className:ue("bg-popover text-popover-foreground 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 origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}function hX({className:e,...t}){return E.jsx(GQ,{"data-slot":"label",className:ue("flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",e),...t})}var pX=RK;C.createContext({}),C.createContext({});function mX({className:e,type:t,...n}){return E.jsx("input",{type:t,"data-slot":"input",className:ue("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}function gX({...e}){return E.jsx(eA,{"data-slot":"popover",...e})}function bX({...e}){return E.jsx(Zv,{"data-slot":"popover-trigger",...e})}function yX({className:e,align:t="center",sideOffset:n=4,...r}){return E.jsx(Jv,{"data-slot":"popover-content",align:t,sideOffset:n,className:ue("bg-popover text-popover-foreground 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 origin-(--radix-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md",e),...r})}function EX({...e}){return E.jsx(Xv,{"data-slot":"select",...e})}function xX({...e}){return E.jsx(jv,{"data-slot":"select-value",...e})}function CX({className:e,size:t="default",children:n,...r}){return E.jsxs(zv,{"data-slot":"select-trigger","data-size":t,className:ue("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 shadow-xs flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,E.jsx(Wv,{asChild:!0,children:E.jsx(fv,{className:"size-4 opacity-50"})})]})}function kX({className:e,children:t,position:n="popper",...r}){return E.jsxs(Kv,{"data-slot":"select-content",className:ue("bg-popover text-popover-foreground 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 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border shadow-md",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:[E.jsx(wX,{}),E.jsx(Qv,{className:ue("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),E.jsx(SX,{})]})}function TX({className:e,children:t,...n}){return E.jsxs(qv,{"data-slot":"select-item",className:ue("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[E.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:E.jsx(Gv,{children:E.jsx(dv,{className:"size-4"})})}),E.jsx(Yv,{children:t})]})}function wX({className:e,...t}){return E.jsx(fA,{"data-slot":"select-scroll-up-button",className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:E.jsx(WQ,{className:"size-4"})})}function SX({className:e,...t}){return E.jsx(hA,{"data-slot":"select-scroll-down-button",className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:E.jsx(fv,{className:"size-4"})})}function vX({className:e,...t}){return E.jsx("div",{"data-slot":"skeleton",className:ue("bg-accent animate-pulse rounded-md",e),...t})}function AX({className:e,...t}){return E.jsx($v,{"data-slot":"tabs",className:ue("flex flex-col gap-2",e),...t})}function NX({className:e,...t}){return E.jsx(Uv,{"data-slot":"tabs-list",className:ue("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function IX({className:e,...t}){return E.jsx(Hv,{"data-slot":"tabs-trigger",className:ue("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...t})}function MX({className:e,...t}){return E.jsx(Vv,{"data-slot":"tabs-content",className:ue("flex-1 outline-none",e),...t})}var _X=up("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function OX({className:e,variant:t,size:n,...r}){return E.jsx(Fv,{"data-slot":"toggle",className:ue(_X({variant:t,size:n,className:e})),...r})}function mv({delayDuration:e=0,...t}){return E.jsx(Lv,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function RX({...e}){return E.jsx(mv,{children:E.jsx(Bv,{"data-slot":"tooltip",...e})})}function LX({...e}){return E.jsx(Rv,{"data-slot":"tooltip-trigger",...e})}function DX({className:e,sideOffset:t=0,children:n,...r}){return E.jsxs(Dv,{"data-slot":"tooltip-content",sideOffset:t,className:ue("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",e),...r,children:[n,E.jsx(Pv,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})}var PX={Avatar:{Avatar:YQ,AvatarFallback:QQ,AvatarImage:KQ},Badge:{Badge:ZQ},Button:{Button:eX},Card:{Card:tX,CardContent:nX},DropdownMenu:{DropdownMenu:rX,DropdownMenuCheckboxItem:aX,DropdownMenuContent:iX,DropdownMenuItem:sX,DropdownMenuLabel:lX,DropdownMenuSeparator:cX,DropdownMenuSub:uX,DropdownMenuSubContent:fX,DropdownMenuSubTrigger:dX,DropdownMenuTrigger:oX},Form:{Form:pX},Input:{Input:mX},Label:{Label:hX},Popover:{Popover:gX,PopoverContent:yX,PopoverTrigger:bX},Select:{Select:EX,SelectContent:kX,SelectItem:TX,SelectTrigger:CX,SelectValue:xX},Skeleton:{Skeleton:vX},Tabs:{Tabs:AX,TabsContent:MX,TabsList:NX,TabsTrigger:IX},Toggle:{Toggle:OX},Tooltip:{Tooltip:RX,TooltipContent:DX,TooltipProvider:mv,TooltipTrigger:LX}},gv=C.createContext(void 0);function Ye(){return C.useContext(gv)}var BX=e=>{let{children:t,...n}=e;Te(n);let r=Ye(),o=KK();return E.jsx(r.Form.Form,{...o,children:t})},FX=C.forwardRef((e,t)=>{let{className:n,name:r,label:o,variant:i,icon:s,value:a,autoFocus:l,placeholder:c,disabled:u,onKeyDown:d,onChange:f,onSubmit:h,autoComplete:p,"aria-activedescendant":g,rightSection:y,...b}=e;Te(b);let x=Ye();return E.jsxs("div",{className:ue(n,"border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","text-foreground items-center gap-2"),children:[s,E.jsxs("div",{className:"flex-1",children:[o&&E.jsx(x.Label.Label,{htmlFor:o,children:o}),E.jsx(x.Input.Input,{className:ue(n,"h-auto border-none p-0"),id:o,name:r,autoFocus:l,placeholder:c,disabled:u,value:a,onKeyDown:d,onChange:f,onSubmit:h,ref:t,"aria-activedescendant":g})]}),y]})}),HX=e=>C.forwardRef((t,n)=>E.jsx(e,{onPointerDown:r=>{r.nativeEvent.fakeEvent||(r.ctrlKey=!0)},onPointerUp:r=>{let o=new PointerEvent("pointerdown",r.nativeEvent);o.fakeEvent=!0,r.target.dispatchEvent(o)},...t,ref:n})),UX=e=>{let{children:t,onOpenChange:n,position:r,sub:o,...i}=e;Te(i);let s=Ye();return o?E.jsx(s.DropdownMenu.DropdownMenuSub,{onOpenChange:n,children:t}):E.jsx(s.DropdownMenu.DropdownMenu,{modal:!1,onOpenChange:n,children:t})},VX=e=>{let{children:t,sub:n,...r}=e;Te(r);let o=Ye(),i=C.useMemo(()=>HX(o.DropdownMenu.DropdownMenuTrigger),[o.DropdownMenu.DropdownMenuTrigger]);return n?E.jsx(o.DropdownMenu.DropdownMenuSubTrigger,{children:t}):E.jsx(i,{asChild:!0,...r,children:t})},$X=C.forwardRef((e,t)=>{let{className:n,children:r,sub:o,...i}=e;Te(i);let s=Ye();return E.jsx(o?s.DropdownMenu.DropdownMenuSubContent:s.DropdownMenu.DropdownMenuContent,{className:n,ref:t,children:r})}),jX=C.forwardRef((e,t)=>{let{className:n,children:r,icon:o,checked:i,subTrigger:s,onClick:a,...l}=e;Te(l);let c=Ye();return s?E.jsxs(E.Fragment,{children:[o,r]}):i===void 0?E.jsxs(c.DropdownMenu.DropdownMenuItem,{className:n,ref:t,onClick:a,...l,children:[o,r,s&&E.jsx(hv,{className:"ml-auto h-4 w-4"})]}):E.jsxs(c.DropdownMenu.DropdownMenuCheckboxItem,{className:ue(n,"gap-1",i?"":"px-2"),ref:t,checked:i,onClick:a,...l,children:[o,r]})}),zX=C.forwardRef((e,t)=>{let{className:n,...r}=e;return Te(r),E.jsx(Ye().DropdownMenu.DropdownMenuSeparator,{className:n,ref:t})}),WX=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx(Ye().DropdownMenu.DropdownMenuLabel,{className:n,ref:t,children:r})}),qX=C.forwardRef((e,t)=>{let{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=e;return Te(u,!1),E.jsxs(Ye().Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:t,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),GX=C.forwardRef((e,t)=>{let{className:n,tabs:r,defaultOpenTab:o,openTab:i,setOpenTab:s,loading:a,...l}=e;Te(l);let c=Ye();return E.jsxs(c.Tabs.Tabs,{className:ue(n,"bg-popover max-w-screen rounded-lg p-2"),ref:t,value:i,defaultValue:o,onValueChange:s,children:[E.jsx(c.Tabs.TabsList,{children:r.map(u=>E.jsx(c.Tabs.TabsTrigger,{value:u.name,children:u.name},u.name))}),r.map(u=>E.jsx(c.Tabs.TabsContent,{value:u.name,children:E.jsx(c.Card.Card,{children:E.jsx(c.Card.CardContent,{className:"p-4",children:u.tabPanel})})},u.name))]})}),YX=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue(n,"flex flex-col items-start justify-center gap-2"),ref:t,children:r})}),KX=C.forwardRef((e,t)=>{let{className:n,value:r,placeholder:o,onKeyDown:i,onChange:s,...a}=e;return Te(a),E.jsx(Ye().Input.Input,{"data-test":"embed-input",className:ue(n,"w-80 max-w-full"),ref:t,value:r,placeholder:o,onKeyDown:i,onChange:s})}),bv=C.createContext(void 0),QX=e=>{let{children:t,open:n,onOpenChange:r,position:o,portalRoot:i,...s}=e;return Te(s),E.jsx(Ye().Popover.Popover,{open:n,onOpenChange:r,children:E.jsx(bv.Provider,{value:i,children:t})})},XX=C.forwardRef((e,t)=>{let{children:n,...r}=e;return Te(r),E.jsx(Ye().Popover.PopoverTrigger,{ref:t,asChild:!0,children:n})}),ZX=C.forwardRef((e,t)=>{let{className:n,variant:r,children:o,...i}=e;Te(i);let s=Ye(),a=C.useContext(bv),l=E.jsx(s.Popover.PopoverContent,{sideOffset:8,className:ue(n,"flex flex-col gap-2",r==="panel-popover"?"w-fit max-w-none border-none p-0 shadow-none":""),ref:t,children:o});return a?Xr.createPortal(l,a):l}),JX=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o,!1),E.jsx("div",{className:n,ref:t,...o,children:r})}),eZ=C.forwardRef((e,t)=>{let{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=e;return Te(u,!1),E.jsxs(Ye().Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:t,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),tZ=C.forwardRef((e,t)=>{let{className:n,children:r,id:o,columns:i,...s}=e;return Te(s),E.jsx("div",{className:ue("bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md","grid",n),style:{gridTemplateColumns:`repeat(${i}, 1fr)`},ref:t,id:o,role:"grid",children:r})}),nZ=C.forwardRef((e,t)=>{let{className:n,children:r,columns:o,...i}=e;return Te(i),E.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:t,children:r})}),rZ=C.forwardRef((e,t)=>{let{className:n,children:r,id:o,...i}=e;return Te(i),E.jsx("div",{id:o,role:"listbox",className:ue("bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",n),ref:t,children:r})}),oZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",n),ref:t,children:E.jsx("div",{children:r})})}),iZ=C.forwardRef((e,t)=>{let n=Ye(),{className:r,item:o,isSelected:i,onClick:s,id:a,...l}=e;Te(l);let c=C.useRef(null);return C.useEffect(()=>{!c.current||!i||$S(c.current,c.current.closest(".bn-suggestion-menu, #ai-suggestion-menu"))!=="none"&&c.current.scrollIntoView({block:"nearest"})},[i]),E.jsxs("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",e.item.size==="small"?"gap-3 py-1":"",r),"data-highlighted":!0,ref:jS([t,c]),id:a,onMouseDown:u=>u.preventDefault(),onClick:s,role:"option","aria-selected":i||void 0,children:[o.icon&&E.jsx("div",{className:ue("p-3",e.item.size==="small"?"p-0":"",r),"data-position":"left",children:o.icon}),E.jsxs("div",{className:"flex-1",children:[E.jsx("div",{className:ue("text-base",e.item.size==="small"?"text-sm":"",r),children:o.title}),E.jsx("div",{className:ue("text-xs",e.item.size==="small"?"hidden":"",r),children:o.subtext})]}),o.badge&&E.jsx("div",{"data-position":"right",className:"text-xs",children:E.jsx(n.Badge.Badge,{variant:"secondary",children:o.badge})})]})}),sZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",n),ref:t,children:r})}),aZ=C.forwardRef((e,t)=>{let{className:n,...r}=e;return Te(r),E.jsx("div",{className:ue(n,"animate-spin"),ref:t,children:E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 -960 960 960",width:"1em",fill:"#e8eaed",children:E.jsx("path",{d:"M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q17 0 28.5 11.5T520-840q0 17-11.5 28.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-17 11.5-28.5T840-520q17 0 28.5 11.5T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Z"})})})}),lZ=C.forwardRef((e,t)=>{let{className:n,children:r,onMouseDown:o,onClick:i,...s}=e;return Te(s,!1),E.jsx(Ye().Button.Button,{variant:"ghost",className:ue(n,"h-full w-full p-0 text-gray-400",n?.includes("extend-button-add-remove-columns")?"ml-1":"mt-1",n?.includes("extend-button-editing")?"bg-accent text-accent-foreground":""),ref:t,onClick:i,onMouseDown:o,...s,children:r})}),cZ=C.forwardRef((e,t)=>{let{className:n,children:r,draggable:o,onDragStart:i,onDragEnd:s,style:a,label:l,...c}=e;return Te(c,!1),E.jsx(Ye().Button.Button,{variant:"ghost",className:ue(n,"h-fit w-fit p-0 text-gray-400"),ref:t,"aria-label":l,draggable:o,onDragStart:i,onDragEnd:s,style:a,...c,children:r})}),Of=C.forwardRef((e,t)=>{let{className:n,children:r,onMouseEnter:o,onMouseLeave:i,variant:s,...a}=e;return Te(a),E.jsx(Ye().Tooltip.TooltipProvider,{delayDuration:0,children:E.jsx("div",{className:ue(n,"bg-popover text-popover-foreground flex h-fit gap-1 rounded-lg border p-1 shadow-md",s==="action-toolbar"?"w-fit":""),ref:t,onMouseEnter:o,onMouseLeave:i,children:r})})}),Rf=C.forwardRef((e,t)=>{let{className:n,children:r,mainTooltip:o,secondaryTooltip:i,icon:s,isSelected:a,isDisabled:l,onClick:c,label:u,variant:d,...f}=e;Te(f,!1);let h=Ye(),p=a===void 0?E.jsxs(h.Button.Button,{className:ue(n,d==="compact"?"h-6 min-w-6 p-0":""),variant:"ghost",size:d==="compact"?"sm":"default",disabled:l,onClick:c,ref:t,"aria-label":u,...f,children:[s,r]}):E.jsxs(h.Toggle.Toggle,{className:ue(n,"data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground",d==="compact"?"h-6 min-w-6 p-0":""),size:d==="compact"?"sm":"default","aria-label":u,onClick:c,pressed:a,disabled:l,"data-state":a?"on":"off","data-disabled":l,ref:t,...f,children:[s,r]});return E.jsxs(h.Tooltip.Tooltip,{children:[E.jsx(h.Tooltip.TooltipTrigger,{asChild:!0,children:p}),E.jsxs(h.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[E.jsx("span",{children:o}),i&&E.jsx("span",{children:i})]})]})}),Lf=C.forwardRef((e,t)=>{let{className:n,items:r,isDisabled:o,...i}=e;Te(i);let s=Ye(),a=c=>E.jsxs("div",{className:"flex items-center gap-1",children:[c.icon,c.text]}),l=r.filter(c=>c.isSelected)[0];return l?E.jsxs(s.Select.Select,{value:l.text,onValueChange:c=>r.find(u=>u.text===c).onClick?.(),disabled:o,children:[E.jsx(s.Select.SelectTrigger,{className:"border-none",children:E.jsx(s.Select.SelectValue,{})}),E.jsx(s.Select.SelectContent,{className:n,ref:t,children:r.map(c=>E.jsx(s.Select.SelectItem,{disabled:c.isDisabled,value:c.text,children:E.jsx(a,{...c})},c.text))})]}):null}),uZ=C.forwardRef((e,t)=>{let{className:n,children:r,selected:o,headerText:i,onFocus:s,onBlur:a,tabIndex:l,...c}=e;return Te(c),E.jsxs(Ye().Card.Card,{className:ue(n,"w-[300px]",o?"bg-accent text-accent-foreground":""),onFocus:s,onBlur:a,tabIndex:l,ref:t,children:[i&&E.jsx("div",{className:"px-4 pt-4 text-sm italic",children:i}),r]})}),dZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue(n,"p-4",n?.includes("thread-comments")?"flex flex-col gap-6 border-b":""),ref:t,children:r})}),fZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o,!1),E.jsx(Ye().Button.Button,{className:ue(n,"text-foreground w-fit bg-transparent p-0 hover:bg-transparent"),ref:t,children:r})}),hZ=C.forwardRef((e,t)=>{let{authorInfo:n,timeString:r,edited:o,...i}=e,s=Se();Te(i,!1);let a=Ye();return n==="loading"?E.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[E.jsx(a.Skeleton.Skeleton,{className:"size-7 animate-pulse rounded-full bg-neutral-400"}),E.jsx(a.Skeleton.Skeleton,{className:"h-3 w-32 animate-pulse rounded-full bg-neutral-400"})]}):E.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[E.jsxs(a.Avatar.Avatar,{children:[E.jsx(a.Avatar.AvatarImage,{src:n.avatarUrl,alt:n.username,className:"h-7 rounded-full"}),E.jsx(a.Avatar.AvatarFallback,{children:n.username[0]})]}),E.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-2",children:[E.jsx("span",{className:"text-sm font-bold",children:n.username}),E.jsxs("span",{className:"text-xs",children:[r," ",o&&`(${s.comments.edited})`]})]})]})}),pZ=C.forwardRef((e,t)=>{let{className:n,showActions:r,authorInfo:o,timeString:i,actions:s,edited:a,emojiPickerOpen:l,children:c,...u}=e;Te(u);let[d,f]=C.useState(!1),{focused:h,ref:p}=SK(),g=s&&(r===!0||r===void 0||r==="hover"&&d||h||l);return E.jsxs("div",{ref:t,className:ue(n,"relative flex flex-col gap-2"),onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[g?E.jsx("div",{className:"absolute right-0 top-0 z-10",ref:p,children:s}):null,E.jsx(hZ,{...e}),c]})}),mZ=C.forwardRef((e,t)=>{let{className:n,onFocus:r,onBlur:o,autoFocus:i,editor:s,editable:a,...l}=e;Te(l);let c=Nr();return E.jsx(yv,{autoFocus:i,className:ue(n,""),theme:c?.colorSchemePreference,editor:e.editor,sideMenu:!1,slashMenu:!1,tableHandles:!1,filePanel:!1,formattingToolbar:!1,editable:a,ref:t,onFocus:r,onBlur:o,children:E.jsx(eg,{formattingToolbar:gZ})})}),gZ=()=>E.jsx(Jm,{blockTypeSelectItems:[],children:Zm([]).filter(e=>e.key!=="nestBlockButton"&&e.key!=="unnestBlockButton")}),bZ=C.forwardRef((e,t)=>{let{className:n,text:r,icon:o,isSelected:i,mainTooltip:s,secondaryTooltip:a,onClick:l,onMouseEnter:c,...u}=e;Te(u,!1);let d=Ye(),f=E.jsxs(d.Button.Button,{variant:i?"secondary":"outline",className:ue(n,"flex h-7 items-center gap-1 rounded-full px-2.5"),onClick:l,onMouseEnter:c,ref:t,children:[E.jsx("span",{children:o}),E.jsx("span",{children:r})]});return s?E.jsxs(d.Tooltip.Tooltip,{children:[E.jsx(d.Tooltip.TooltipTrigger,{asChild:!0,children:f}),E.jsxs(d.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[E.jsx("span",{children:s}),a&&E.jsx("span",{children:a})]})]}):f}),yZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx(Ye().Tooltip.TooltipProvider,{delayDuration:0,children:E.jsx("div",{className:ue(n,"flex w-full flex-row flex-wrap gap-1"),ref:t,children:r})})}),EZ=C.forwardRef((e,t)=>{let{className:n,children:r,onClick:o,label:i,...s}=e;return Te(s),E.jsx(Ye().Button.Button,{type:"submit",className:n,"aria-label":i,ref:t,onClick:o,children:r})}),xZ=C.forwardRef((e,t)=>{let{className:n,accept:r,value:o,placeholder:i,onChange:s,...a}=e;return Te(a),E.jsx(Ye().Input.Input,{type:"file",className:n,ref:t,accept:r,value:o?o.name:void 0,onChange:async l=>s?.(l.target.files[0]),placeholder:i})}),CZ=C.forwardRef((e,t)=>{let{className:n,isSelected:r,onClick:o,item:i,id:s,...a}=e;Te(a);let l=C.useRef(null);return C.useEffect(()=>{!l.current||!r||$S(l.current,l.current.closest(".bn-grid-suggestion-menu"))!=="none"&&l.current.scrollIntoView({block:"nearest"})},[r]),E.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive","text-lg!",n),ref:jS([t,l]),id:s,role:"option",onClick:o,"aria-selected":r||void 0,children:i.icon})}),kZ=C.forwardRef((e,t)=>{let{className:n,children:r,columns:o,...i}=e;return Te(i),E.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:t,children:r})}),TZ={FormattingToolbar:{Root:Of,Button:Rf,Select:Lf},FilePanel:{Root:GX,Button:EZ,FileInput:xZ,TabPanel:YX,TextInput:KX},LinkToolbar:{Root:Of,Button:Rf,Select:Lf},SideMenu:{Root:JX,Button:eZ},SuggestionMenu:{Root:rZ,Item:iZ,EmptyItem:oZ,Label:sZ,Loader:aZ},GridSuggestionMenu:{Root:tZ,Item:CZ,EmptyItem:nZ,Loader:kZ},TableHandle:{Root:cZ,ExtendButton:lZ},Comments:{Comment:pZ,Editor:mZ,Card:uZ,CardSection:dZ,ExpandSectionsPrompt:fZ},Generic:{Badge:{Root:bZ,Group:yZ},Toolbar:{Root:Of,Button:Rf,Select:Lf},Form:{Root:BX,TextInput:FX},Menu:{Root:UX,Trigger:VX,Dropdown:$X,Divider:zX,Label:WX,Item:jX,Button:qX},Popover:{Root:QX,Trigger:XX,Content:ZX}}},yv=e=>{let{className:t,shadCNComponents:n,...r}=e,o=C.useMemo(()=>({...PX,...n}),[n]);return E.jsx(gv.Provider,{value:o,children:E.jsx(nS.Provider,{value:TZ,children:E.jsx(CK,{className:ut("bn-shadcn",t||""),...r})})})};function sE({open:e,onClose:t,onSave:n,initial:r,hideCaption:o}){const[i,s]=C.useState(r?.url??""),[a,l]=C.useState(r?.mediaId??""),[c,u]=C.useState(r?.alt??""),[d,f]=C.useState(r?.caption??""),[h,p]=C.useState(r?.link??""),[g,y]=C.useState(r?.filename??""),[b,x]=C.useState(r?.width??0),[k,O]=C.useState(r?.height??0),[M,A]=C.useState(r?.thumbUrl??""),[D,z]=C.useState(!1),[Y,N]=C.useState(!1),K=!!a,F=i?K&&M?Ff(M):Ff(i):"";function q(W){if(s(W.url),l(W.mediaId),y(W.filename),x(W.width??0),O(W.height??0),A(W.urls?.thumb_md??""),N(!1),!c.trim()){const G=W.filename.replace(/\.[\w]+$/,"").replace(/[._-]+/g," ");u(G)}z(!1)}function L(){s(""),l(""),y(""),x(0),O(0),A(""),N(!1)}function H(W){s(W),l(""),y(""),x(0),O(0),A(""),N(!1)}function re(){n({url:i,mediaId:a,alt:c,caption:d,link:h,filename:g,width:b,height:k})}return E.jsx(cE,{open:e,onOpenChange:()=>t(),children:E.jsxs(uE,{children:[E.jsxs(dE,{children:[E.jsx(fE,{children:r?"Edit Image":"Insert Image"}),E.jsx(hE,{className:"sr-only",children:"Set the image URL, alt text, and caption."})]}),E.jsxs("div",{className:"space-y-4",children:[i&&!Y?E.jsx("div",{className:"flex justify-center",children:E.jsx("img",{src:F,alt:c||"Preview",className:"max-h-48 rounded-md object-contain",onError:()=>N(!0)})}):i&&Y?E.jsx("div",{className:"flex justify-center",children:E.jsx("div",{className:"flex h-32 w-32 items-center justify-center rounded-md bg-muted",children:E.jsx(pE,{className:"h-8 w-8 text-muted-foreground","data-testid":"fallback-icon"})})}):null,E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{children:"Image"}),E.jsxs("div",{className:"flex gap-2",children:[K?E.jsxs(Tv,{variant:"secondary",className:"flex max-w-full items-center gap-1.5 px-3 py-1.5 text-sm",children:[E.jsx(wv,{className:"h-3.5 w-3.5 shrink-0"}),E.jsx("span",{className:"truncate",children:g}),E.jsx("button",{type:"button",onClick:L,className:"ml-1 shrink-0 rounded-full p-0.5 hover:bg-muted","aria-label":"Clear media",children:E.jsx(Sv,{className:"h-3 w-3"})})]}):E.jsx(qa,{placeholder:"https://example.com/image.jpg",value:i,onChange:W=>H(W.target.value)}),E.jsx(Bs,{type:"button",variant:"outline",onClick:()=>z(!0),children:"Select Media"})]})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{htmlFor:"image-alt",children:"Alt Text"}),E.jsx(qa,{id:"image-alt",value:c,onChange:W=>u(W.target.value),placeholder:"Describe the image"})]}),!o&&E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{htmlFor:"image-caption",children:"Caption (optional)"}),E.jsx(qa,{id:"image-caption",value:d,onChange:W=>f(W.target.value),placeholder:"Photo credit or description"})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{htmlFor:"image-link",children:"Link (optional)"}),E.jsx(qa,{id:"image-link",value:h,onChange:W=>p(W.target.value),placeholder:"https://example.com"})]})]}),E.jsxs(mE,{children:[E.jsx(Bs,{variant:"outline",onClick:t,children:"Cancel"}),E.jsx(Bs,{onClick:re,disabled:!i.trim(),children:"Save"})]}),D&&E.jsx(DA,{open:D,onClose:()=>z(!1),onSelect:W=>q(W),allowedTypes:["image/*"]})]})})}const wZ=VS({type:"image",propSchema:{mediaId:{default:""},url:{default:""},alt:{default:""},caption:{default:""},filename:{default:""},link:{default:""},width:{default:0},height:{default:0}},content:"none"},{render:({block:e,editor:t})=>E.jsx(SZ,{block:e,editor:t})});function SZ({block:e,editor:t}){const n=!!e.props.url,[r,o]=C.useState(!n&&t.isEditable),i=n?Ff(e.props.url):"";function s(l){t.updateBlock(e,{props:{url:l.url,mediaId:l.mediaId,alt:l.alt,caption:l.caption,filename:l.filename,link:l.link,width:l.width,height:l.height}}),o(!1)}if(!n)return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"flex cursor-pointer flex-col items-center rounded-lg border-2 border-dashed p-8 text-center",onClick:()=>t.isEditable&&o(!0),children:[E.jsx(pE,{className:"mx-auto h-8 w-8 text-muted-foreground"}),E.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Click to select an image"})]}),r&&E.jsx(sE,{open:r,onClose:()=>o(!1),onSave:s})]});const a=E.jsxs("div",{className:"relative inline-block",children:[E.jsx("img",{src:i,alt:e.props.alt,className:"max-w-full rounded-lg"}),t.isEditable&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-black/0 opacity-0 transition-opacity group-hover:bg-black/20 group-hover:opacity-100",children:E.jsx(gE,{className:"h-6 w-6 text-white drop-shadow"})})]});return E.jsxs(E.Fragment,{children:[E.jsxs("figure",{className:`group my-2${t.isEditable?" cursor-pointer rounded-lg ring-primary hover:ring-2":""}`,onClick:()=>t.isEditable&&o(!0),children:[e.props.link&&!t.isEditable?E.jsx("a",{href:e.props.link,target:"_blank",rel:"noopener noreferrer",children:a}):a,e.props.caption&&E.jsx("figcaption",{className:"mt-1 text-sm text-muted-foreground",children:e.props.caption})]}),r&&E.jsx(sE,{open:r,onClose:()=>o(!1),onSave:s,initial:{url:e.props.url,mediaId:e.props.mediaId,alt:e.props.alt,caption:e.props.caption,filename:e.props.filename,link:e.props.link,width:e.props.width,height:e.props.height}})]})}function vZ({blockType:e,data:t,blocksToHTML:n,onSave:r}){const[o,i]=C.useState(!1),[s,a]=C.useState({}),l=e.fields??[];function c(){a({...t}),i(!0)}function u(){r(s),i(!1)}return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"cursor-pointer",onClick:c,children:[E.jsxs("div",{className:"flex items-center gap-1 pb-1",children:[E.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.icon&&E.jsx(vv,{name:e.icon,className:"h-3 w-3"}),e.label]}),E.jsx(gE,{className:"h-3 w-3 text-muted-foreground"})]}),E.jsx(BA,{blockType:e,props:t,blocksToHTML:n})]}),E.jsx(cE,{open:o,onOpenChange:i,modal:!1,children:E.jsxs(uE,{className:"max-w-lg max-h-[85vh] overflow-y-auto",onPointerDownOutside:d=>{d.target.closest(".bn-suggestion-menu, .bn-toolbar, .bn-popover-content, .bn-menu-dropdown")&&d.preventDefault()},onEscapeKeyDown:d=>{document.activeElement?.closest(".bn-editor")&&d.preventDefault()},children:[E.jsxs(dE,{children:[E.jsxs(fE,{children:["Edit ",e.label]}),E.jsx(hE,{className:"sr-only",children:"Edit block properties"})]}),E.jsx(PA,{fields:l,values:s,onChange:a}),E.jsxs(mE,{children:[E.jsx(Bs,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),E.jsx(Bs,{onClick:u,children:"Save"})]})]})})]})}function AZ(e){const t={};for(const n of e??[])switch(n.type){case"boolean":t[n.name]=!1;break;case"number":t[n.name]=0;break;case"array":case"blocks":t[n.name]=[];break;case"container":t[n.name]={};break;case"media":case"content":t[n.name]=null;break;default:t[n.name]=""}return t}function NZ(e){const{image:t,video:n,audio:r,file:o,...i}=Xk,s={...i,image:wZ()};for(const a of e){const l=AZ(a.fields??[]),c=VS({type:a.name,propSchema:{data:{default:l}},content:"none"},{render:({block:u,editor:d})=>{const f=u,h=d,p=f.props.data??l;return E.jsx(vZ,{blockType:a,data:p,blocksToHTML:g=>h.blocksToHTMLLossy(g),onSave:g=>{h.updateBlock(u,{props:{data:g}});const y=d._tiptapEditor;y.emit("update",{editor:y,transaction:y.state.tr,appendedTransactions:[]})}})}});s[a.name]=c()}return um.create({blockSpecs:s})}function IZ(e){const t=C.useMemo(()=>NZ(e),[e]),n=C.useMemo(()=>e.map(r=>r.name).sort().join(","),[e]);return{schema:t,schemaKey:n}}const lg="headroom://content/";function MZ(e){return e.startsWith(lg)}function _Z(e){if(!MZ(e))return null;const t=e.slice(lg.length),n=t.indexOf("/");if(n===-1)return null;const r=t.slice(0,n),o=t.slice(n+1);return!r||!/^[0-9A-Z]{26}$/.test(o)?null:{collection:r,contentId:o}}function OZ(e,t){return`${lg}${e}/${t}`}function RZ(){const e=be(),t=fe(),{host:n}=lE(),{showSelection:r}=je(va),[o,i]=C.useState(!1);if(C.useEffect(()=>{r(o,"contentLink")},[o,r]),!t||!n)return null;function s(a){const l=OZ(a.collection,a.contentId);e.createLink(l,a.title),i(!1)}return E.jsx(FA,{host:n,selectedIds:[],open:o,onOpenChange:i,onSelect:s,trigger:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"contentLink",label:"Link to Content",icon:E.jsx(Av,{size:18}),onClick:()=>i(!0)})})}function LZ({initialBlocks:e,onChange:t,blockTypes:n,compact:r,collaboration:o}){const{schema:i,schemaKey:s}=IZ(n),a=o?"collab":"solo";return E.jsx(DZ,{schema:i,initialBlocks:e,onChange:t,blockTypes:n,compact:r,collaboration:o},`${s}-${a}`)}function DZ({schema:e,initialBlocks:t,onChange:n,blockTypes:r,compact:o,collaboration:i}){const s=Ym({schema:e,...i?{collaboration:{provider:i.provider,fragment:i.fragment,user:i.user,showCursorLabels:"activity"}}:{initialContent:t&&t.length>0?t:void 0}}),a=C.useRef(n);a.current=n,C.useMemo(()=>{s.onChange(()=>{a.current(s.document)})},[s]),C.useEffect(()=>{if(!i||!t||t.length===0)return;const c=setTimeout(()=>{const u=s.document;(u.length===0||u.length===1&&(!u[0]?.content||Array.isArray(u[0].content)&&u[0].content.length===0))&&s.replaceBlocks(s.document,t)},500);return()=>clearTimeout(c)},[s,i]);const l=C.useMemo(()=>{const c=FS(s),u=r.map(d=>({title:d.label,subtext:`Insert ${d.label} block`,onItemClick:()=>{const f=s.getTextCursorPosition().block;s.insertBlocks([{type:d.name}],f,"after")},aliases:[d.name],group:"Custom Blocks"}));return[...c,...u]},[s,r]);return E.jsx("div",{className:o?"[&_.bn-editor]:min-h-[120px]":"[&_.bn-editor]:min-h-[300px]",children:E.jsxs(yv,{editor:s,slashMenu:!1,filePanel:!1,formattingToolbar:!1,linkToolbar:!1,theme:"light",children:[E.jsx(HS,{triggerCharacter:"/",getItems:async c=>l.filter(u=>u.title.toLowerCase().includes(c.toLowerCase()))}),E.jsx(eg,{formattingToolbar:PZ}),E.jsx(DS,{linkToolbar:BZ})]})})}function PZ(e){return E.jsxs(Jm,{...e,children:[Zm(e.blockTypeSelectItems),E.jsx(RZ,{})]})}function BZ(e){const{host:t}=lE(),n=xv(),r=fe(),o=_Z(e.url);return!o||!r?E.jsx(LS,{...e}):E.jsxs(r.Generic.Toolbar.Root,{className:"bn-toolbar bn-link-toolbar",variant:"action-toolbar",children:[E.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:`Content link · ${o.collection}`,mainTooltip:`Content link · ${o.collection}`,isDisabled:!0,onClick:()=>{}}),E.jsx(RS,{url:e.url,text:e.text,range:e.range,setToolbarPositionFrozen:e.setToolbarPositionFrozen,setToolbarOpen:e.setToolbarOpen}),E.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:"Open",mainTooltip:"Open in editor",onClick:()=>{n(`/sites/${t}/content/${o.contentId}`)}}),E.jsx(OS,{range:e.range,setToolbarOpen:e.setToolbarOpen})]})}const dJ=Object.freeze(Object.defineProperty({__proto__:null,default:LZ},Symbol.toStringTag,{value:"Module"}));export{Se as B,Ym as G,oS as K,be as M,je as N,rt as P,jt as U,rS as W,iS as X,dJ as a,Cu as f,qr as o,xu as s,Yq as t,Jr as v,ut as w,fe as z};
|