@inkeep/open-knowledge 0.0.0-dev-20260430220436 → 0.0.0-dev-20260501033542

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.
Files changed (59) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +44 -0
  2. package/dist/cli.mjs +10 -10
  3. package/dist/constants-C4c9G6bx.mjs +2 -0
  4. package/dist/{dist-7GgIDlwG.mjs → dist-BKxD-v-w.mjs} +12 -12
  5. package/dist/{dist-BEzp6mq0.mjs → dist-Bk22-nn7.mjs} +12 -12
  6. package/dist/{dist-BnZHVzE4.mjs → dist-BuWOuGGO.mjs} +1 -1
  7. package/dist/index.mjs +1 -1
  8. package/dist/{init-CrWt5I5H.mjs → init-B110s1wM.mjs} +2 -2
  9. package/dist/{init-Dame1GG3.mjs → init-BgvX0Sq8.mjs} +3 -3
  10. package/dist/init-CCv_Zp9V.mjs +1 -0
  11. package/dist/init-DLXU6VrK.mjs +1 -0
  12. package/dist/loader-CXRhSZPN.mjs +1 -0
  13. package/dist/{loader-m7I7pd_0.mjs → loader-DmdfaHaq.mjs} +2 -2
  14. package/dist/paths-RkbKkMl_.mjs +2 -0
  15. package/dist/paths-r4eAorwU.mjs +1 -0
  16. package/dist/preview-CnsTM1D_.mjs +1 -0
  17. package/dist/{preview-Dd3l-KWB.mjs → preview-jvjjfAtM.mjs} +2 -2
  18. package/dist/public/assets/{ActivityModeContent-DWssAqaG.js → ActivityModeContent-Dh5iGi22.js} +1 -1
  19. package/dist/public/assets/DocumentContext-BtLDstmc.js +34 -0
  20. package/dist/public/assets/{GraphPanel-aktIAtaE.js → GraphPanel-jbwIk-JX.js} +2 -2
  21. package/dist/public/assets/{McpConsentDialogBody-BKRS2Qm0.js → McpConsentDialogBody-Dx67JoKA.js} +1 -1
  22. package/dist/public/assets/SettingsPane-C93_FdcE.js +5 -0
  23. package/dist/public/assets/SourceEditor-Bo2dIeu9.js +2 -0
  24. package/dist/public/assets/{agent-presence-XtMgnv3n.js → agent-presence-BxT9uQ-C.js} +1 -1
  25. package/dist/public/assets/{button-CXhPNzpp.js → button-Dyz7QGIk.js} +1 -1
  26. package/dist/public/assets/circle-check-C-DpX4dU.js +1 -0
  27. package/dist/public/assets/clipboard-B19FK6nN.js +5 -0
  28. package/dist/public/assets/{config-validation-events-5erczoJ8.js → config-validation-events-ClxIZ8iZ.js} +1 -1
  29. package/dist/public/assets/dialog-FUclf-NK.js +45 -0
  30. package/dist/public/assets/index-D3IFbquY.js +1848 -0
  31. package/dist/public/assets/index-sRsZ2bXw.css +1 -0
  32. package/dist/public/assets/{panel-DiSt1efw.js → panel-DT62BXGr.js} +1 -1
  33. package/dist/public/assets/{target-navigation-intent-rQkR_SWG.js → target-navigation-intent-CK4Ee17H.js} +1 -1
  34. package/dist/public/assets/{toggle-group-DUoJt_Lj.js → toggle-group-n36XMgMC.js} +137 -136
  35. package/dist/public/assets/tooltip-BM5o_T0o.js +1 -0
  36. package/dist/public/index.html +13 -13
  37. package/dist/{server-C3JdctFI.mjs → server-CYax-BjV.mjs} +2 -2
  38. package/dist/src-DKAFRzZc.mjs +1 -0
  39. package/dist/start-B8KGCnGd.mjs +1 -0
  40. package/dist/{start-Bz9pi8fW.mjs → start-M53xqMIa.mjs} +2 -2
  41. package/package.json +1 -1
  42. package/dist/constants-BcJMCJN9.mjs +0 -2
  43. package/dist/init-BANhgZmt.mjs +0 -1
  44. package/dist/init-CXCzna7i.mjs +0 -1
  45. package/dist/loader-CA834Giw.mjs +0 -1
  46. package/dist/paths-Bcq8_cdi.mjs +0 -1
  47. package/dist/paths-DOJDdHR7.mjs +0 -2
  48. package/dist/preview-CD7jAwMP.mjs +0 -1
  49. package/dist/public/assets/DocumentContext-GbmGcVzS.js +0 -34
  50. package/dist/public/assets/SettingsPane-HKf0Vtow.js +0 -5
  51. package/dist/public/assets/SourceEditor-D5eu9Dbl.js +0 -2
  52. package/dist/public/assets/circle-check-bKAq6pcI.js +0 -1
  53. package/dist/public/assets/clipboard-D2LwhWD3.js +0 -5
  54. package/dist/public/assets/dialog-CJazZw1E.js +0 -45
  55. package/dist/public/assets/index-C_wVGFTR.css +0 -1
  56. package/dist/public/assets/index-DWZjAcTk.js +0 -1844
  57. package/dist/public/assets/tooltip-CSwVg9kb.js +0 -1
  58. package/dist/src-C3CKMgF-.mjs +0 -1
  59. package/dist/start-B3XZX6TH.mjs +0 -1
@@ -1,5 +0,0 @@
1
- import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{Et as i,G as a,Mt as o,Rt as s,T as c,gt as l,n as u,t as d,w as f,zt as p}from"./toggle-group-DUoJt_Lj.js";import{t as m,x as h}from"./button-CXhPNzpp.js";import{N as g,V as _,Z as v,n as y,w as b}from"./DocumentContext-GbmGcVzS.js";import{i as x,n as S,r as C,s as w}from"./config-validation-events-5erczoJ8.js";import{S as T,x as E}from"./dialog-CJazZw1E.js";import{i as D,n as O,t as k}from"./tooltip-CSwVg9kb.js";var A=h(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),j=e(t(),1),M=r();function N(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:N(r,t)}}function P(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[String(e)]}return n}function F(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function I(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function ee(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}var L=n(),R=[{id:`content`,title:`Content`,description:`Where Open Knowledge looks for documents.`,fields:[{path:[`content`,`dir`],label:`Content directory`,description:`Project-relative path containing your markdown files.`},{path:[`content`,`include`],label:`Include patterns`,description:`Glob patterns selecting which files are content. One per line.`},{path:[`content`,`exclude`],label:`Exclude patterns`,description:`Glob patterns to skip. One per line.`}]},{id:`server`,title:`Server`,description:`Local server bind and behavior.`,fields:[{path:[`server`,`host`],label:`Host`,description:`Bind interface (e.g. localhost, 0.0.0.0).`},{path:[`server`,`openOnAgentEdit`],label:`Open preview on agent edit`,description:`When enabled, an agent write opens the preview tab if not already open.`}]},{id:`github`,title:`GitHub`,description:`OAuth app identity for sign-in. Tokens are stored in your OS keychain, not here.`,fields:[{path:[`github`,`oauthAppClientId`],label:`OAuth App client ID`,description:`Public client ID for the GitHub OAuth app. Defaults to the published Open Knowledge app.`}]},{id:`preview`,title:`Preview`,description:`Where the preview tab points when no local UI is running.`,fields:[{path:[`preview`,`baseUrl`],label:`Preview base URL`,description:`URL of your team’s deployed wiki (project-only).`}]},{id:`mcp`,title:`MCP`,description:`Model Context Protocol agent integration tuning.`,fields:[{path:[`mcp`,`autoStart`],label:`Auto-start server`,description:"When enabled, `ok mcp` spawns `ok start` automatically."},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],label:`read_document history depth`,description:`How many history entries the agent’s read_document tool returns.`},{path:[`mcp`,`tools`,`search`,`maxResults`],label:`search max results`,description:`Cap on results returned by the agent’s search tool.`}]},{id:`appearance`,title:`Appearance`,description:`UI preferences. Editor toggles continue to write localStorage as a cache.`,fields:[{path:[`appearance`,`theme`],label:`Theme`,description:`Light, dark, or follow the OS.`,control:`enum-toggle`},{path:[`appearance`,`editorModeDefault`],label:`Default editor mode`,description:`Which mode new docs open in by default.`,control:`enum-toggle`}]}];function z(e,t){let n=(0,M.c)(4),[r,i]=(0,j.useState)(null),o,s;return n[0]!==e||n[1]!==t?(o=()=>{if(e===null)return;let n=t===`project`?f:c,r=new v,o=new _({url:e,name:n,document:r}),s=a(o,t),l=!0,u=()=>{l&&i(e=>e?.provider===o?{...e,synced:!0,config:s.current()}:e)};o.on(`synced`,u);let d=s.subscribe(e=>{l&&i(t=>t?.provider===o?t&&{...t,config:e}:t)});return i({provider:o,binding:s,config:s.current(),synced:!1}),()=>{l=!1,d(),o.off(`synced`,u),s.dispose(),o.destroy(),r.destroy(),i(e=>e?.provider===o?null:e)}},s=[e,t],n[0]=e,n[1]=t,n[2]=o,n[3]=s):(o=n[2],s=n[3]),(0,j.useEffect)(o,s),r}function B(e){let t=(0,M.c)(28),{scope:n,onClose:r,onScopeChange:i}=e,{collabUrl:a}=y(),o=z(a,n),[s,c]=(0,j.useState)(null),f=(0,j.useRef)(null),p,h;t[0]===n?(p=t[1],h=t[2]):(p=()=>{let e=S(e=>{if(!(n===`project`&&e.docName===`__config__/project`||n===`user`&&e.docName===`__user__/config.yml`))return;E.error(l(e.error),{duration:8e3});let t=V(e.error);t&&(c(t),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>c(null),600))});return()=>{e(),f.current&&clearTimeout(f.current)}},h=[n],t[0]=n,t[1]=p,t[2]=h),(0,j.useEffect)(p,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,L.jsx)(`h1`,{className:`text-sm font-semibold`,children:`Settings`}),t[3]=g):g=t[3];let _;t[4]===i?_=t[5]:(_=e=>{(e===`project`||e===`user`)&&i(e)},t[4]=i,t[5]=_);let v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,L.jsx)(u,{value:`project`,className:`text-xs`,children:`This project`}),b=(0,L.jsx)(u,{value:`user`,className:`text-xs`,children:`User`}),t[6]=v,t[7]=b):(v=t[6],b=t[7]);let x;t[8]!==n||t[9]!==_?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g,(0,L.jsxs)(d,{type:`single`,value:n,onValueChange:_,"aria-label":`Settings scope`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,children:[v,b]})]}),t[8]=n,t[9]=_,t[10]=x):x=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,L.jsx)(T,{className:`size-4`}),t[11]=C):C=t[11];let w;t[12]===r?w=t[13]:(w=(0,L.jsx)(D,{asChild:!0,children:(0,L.jsx)(m,{variant:`ghost`,size:`icon`,onClick:r,"aria-label":`Close settings`,className:`text-muted-foreground`,children:C})}),t[12]=r,t[13]=w);let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,L.jsx)(O,{children:`Close`}),t[14]=A):A=t[14];let N;t[15]===w?N=t[16]:(N=(0,L.jsxs)(k,{children:[w,A]}),t[15]=w,t[16]=N);let P;t[17]!==N||t[18]!==x?(P=(0,L.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between border-b px-4`,children:[x,N]}),t[17]=N,t[18]=x,t[19]=P):P=t[19];let F;t[20]!==o||t[21]!==s||t[22]!==n?(F=(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:o===null||!o.synced?(0,L.jsx)(H,{}):(0,L.jsx)(W,{scope:n,binding:o.binding,config:o.config,flashedPath:s})}),t[20]=o,t[21]=s,t[22]=n,t[23]=F):F=t[23];let I;return t[24]!==n||t[25]!==P||t[26]!==F?(I=(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-testid":`settings-pane`,"data-scope":n,children:[P,F]}),t[24]=n,t[25]=P,t[26]=F,t[27]=I):I=t[27],I}function V(e){if(!i(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function H(){let e=(0,M.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`space-y-6 p-6`,children:Array.from({length:3}).map(U)}),e[0]=t):t=e[0],t}function U(e,t){return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(x,{className:`h-5 w-32`}),(0,L.jsx)(x,{className:`h-4 w-64`}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(x,{className:`h-9 w-full`}),(0,L.jsx)(x,{className:`h-9 w-full`})]})]},t)}function W(e){let t=(0,M.c)(8),{scope:n,binding:r,config:i,flashedPath:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==n?(o=R.map(e=>{let t=e.fields.filter(e=>G(e.path,n));return t.length===0?null:(0,L.jsx)(K,{section:e,children:t.map(e=>(0,L.jsx)(q,{field:e,scope:n,binding:r,config:i,isFlashed:a===e.path.join(`.`)},e.path.join(`.`)))},e.id)}),t[0]=r,t[1]=i,t[2]=a,t[3]=n,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(se,{}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,L.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-6`,children:[o,s]}),t[6]=o,t[7]=c),c}function G(e,t){let n=o(s,e);if(!n)return!0;let r=p(n);return r?!(r.scope===`project`&&t!==`project`||r.scope===`user`&&t!==`user`):!0}function K(e){let t=(0,M.c)(14),{section:n,children:r}=e,i=`settings-${n.id}-title`,a=`settings-${n.id}-title`,o;t[0]!==n.title||t[1]!==a?(o=(0,L.jsx)(`h2`,{id:a,className:`text-base font-semibold`,children:n.title}),t[0]=n.title,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n.description?s=t[4]:(s=(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[3]=n.description,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,L.jsxs)(`div`,{className:`space-y-1`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===r?l=t[9]:(l=(0,L.jsx)(`div`,{className:`space-y-4`,children:r}),t[8]=r,t[9]=l);let u;return t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,L.jsxs)(`section`,{"aria-labelledby":i,className:`space-y-3`,children:[c,l]}),t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function q(e){let t=(0,M.c)(55),{field:n,scope:r,binding:i,config:a,isFlashed:c}=e,l,u,d,f,h,g;if(t[0]!==a||t[1]!==n.path){let e=o(s,n.path);g=e?I(e):void 0,u=e?F(e):void 0,l=P(a,n.path),f=e?p(e):void 0,d=e?ee(e):void 0,h=u===void 0?l!=null:!$(l,u),t[0]=a,t[1]=n.path,t[2]=l,t[3]=u,t[4]=d,t[5]=f,t[6]=h,t[7]=g}else l=t[2],u=t[3],d=t[4],f=t[5],h=t[6],g=t[7];let _=h,v;t[8]===n.path?v=t[9]:(v=n.path.join(`-`),t[8]=n.path,t[9]=v);let y=v,b=`${y}-error`,[x,S]=(0,j.useState)(null),C;t[10]!==i||t[11]!==n.path?(C=e=>{let t=N(n.path,e),r=i.patch(t);return r.ok?(S(null),!0):(S(oe(r.error)),!1)},t[10]=i,t[11]=n.path,t[12]=C):C=t[12];let w=C,T;t[13]!==w||t[14]!==u?(T=()=>{w(u===void 0?null:u)},t[13]=w,t[14]=u,t[15]=T):T=t[15];let E=T,R;t[16]===_?R=t[17]:(R=_?(0,L.jsx)(`span`,{"data-modified":`true`,"aria-hidden":`true`,className:`absolute -left-3 top-1 h-5 w-0.5 rounded-full bg-primary`}):null,t[16]=_,t[17]=R);let z=R,B=`relative space-y-1 ${c?`animate-settings-flash`:``}`,V;t[18]===n.path?V=t[19]:(V=n.path.join(`.`),t[18]=n.path,t[19]=V);let H;t[20]!==n.label||t[21]!==y?(H=(0,L.jsx)(`label`,{htmlFor:y,className:`text-sm font-medium`,children:n.label}),t[20]=n.label,t[21]=y,t[22]=H):H=t[22];let U;t[23]!==l||t[24]!==u||t[25]!==n.label||t[26]!==E?(U=u!==void 0||l!==void 0?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{asChild:!0,children:(0,L.jsx)(m,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-muted-foreground opacity-60 hover:opacity-100`,onClick:E,"aria-label":`Reset ${n.label} to default`,children:(0,L.jsx)(A,{className:`size-3.5`})})}),(0,L.jsx)(O,{children:`Reset to default`})]}):null,t[23]=l,t[24]=u,t[25]=n.label,t[26]=E,t[27]=U):U=t[27];let W;t[28]!==H||t[29]!==U?(W=(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[H,U]}),t[28]=H,t[29]=U,t[30]=W):W=t[30];let G;t[31]===n.description?G=t[32]:(G=n.description?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.description}):null,t[31]=n.description,t[32]=G);let K=x?b:void 0,q=f?.scope===`project`&&r!==`project`?`This field can only be set per-project. Switch to the 'This project' tab to edit it.`:f?.scope===`user`&&r!==`user`?`This field can only be set globally. Switch to the 'User' tab to edit it.`:null,J;t[33]!==w||t[34]!==l||t[35]!==d||t[36]!==n||t[37]!==y||t[38]!==K||t[39]!==q||t[40]!==g?(J=(0,L.jsx)(te,{field:n,fieldId:y,errorId:K,typeTag:g,currentValue:l,enumOptions:d,onCommit:w,readonlyReason:q}),t[33]=w,t[34]=l,t[35]=d,t[36]=n,t[37]=y,t[38]=K,t[39]=q,t[40]=g,t[41]=J):J=t[41];let Y;t[42]!==x||t[43]!==b||t[44]!==n.path?(Y=x?(0,L.jsx)(`p`,{id:b,role:`alert`,className:`text-xs text-destructive`,"data-field-error":n.path.join(`.`),children:x}):null,t[42]=x,t[43]=b,t[44]=n.path,t[45]=Y):Y=t[45];let X;return t[46]!==z||t[47]!==r||t[48]!==G||t[49]!==J||t[50]!==Y||t[51]!==V||t[52]!==W||t[53]!==B?(X=(0,L.jsxs)(`div`,{className:B,"data-field":V,"data-scope":r,children:[z,W,G,J,Y]}),t[46]=z,t[47]=r,t[48]=G,t[49]=J,t[50]=Y,t[51]=V,t[52]=W,t[53]=B,t[54]=X):X=t[54],X}function te(e){let t=(0,M.c)(32),{field:n,fieldId:r,errorId:i,typeTag:a,currentValue:o,enumOptions:s,onCommit:c,readonlyReason:l}=e;if(l){let e;return t[0]!==r||t[1]!==l?(e=(0,L.jsx)(`div`,{id:r,role:`note`,className:`rounded border border-dashed border-muted px-3 py-2 text-xs text-muted-foreground`,children:l}),t[0]=r,t[1]=l,t[2]=e):e=t[2],e}if(a===`boolean`){let e=!!o,n;return t[3]!==i||t[4]!==r||t[5]!==c||t[6]!==e?(n=(0,L.jsx)(X,{fieldId:r,errorId:i,value:e,onCommit:c}),t[3]=i,t[4]=r,t[5]=c,t[6]=e,t[7]=n):n=t[7],n}if(a===`enum`&&s&&s.length>0&&(n.control===`enum-toggle`||s.length<=4)){let e=typeof o==`string`?o:``,a;return t[8]!==s||t[9]!==i||t[10]!==n.label||t[11]!==r||t[12]!==c||t[13]!==e?(a=(0,L.jsx)(ne,{fieldId:r,errorId:i,ariaLabel:n.label,options:s,value:e,onCommit:c}),t[8]=s,t[9]=i,t[10]=n.label,t[11]=r,t[12]=c,t[13]=e,t[14]=a):a=t[14],a}if(a===`number`||a===`int`){let e=typeof o==`number`?o:0,n;return t[15]!==i||t[16]!==r||t[17]!==c||t[18]!==e?(n=(0,L.jsx)(Y,{fieldId:r,errorId:i,value:e,onCommit:c}),t[15]=i,t[16]=r,t[17]=c,t[18]=e,t[19]=n):n=t[19],n}if(a===`array`){let e;t[20]===o?e=t[21]:(e=Array.isArray(o)?o:[],t[20]=o,t[21]=e);let n;return t[22]!==i||t[23]!==r||t[24]!==c||t[25]!==e?(n=(0,L.jsx)(re,{fieldId:r,errorId:i,value:e,onCommit:c}),t[22]=i,t[23]=r,t[24]=c,t[25]=e,t[26]=n):n=t[26],n}let u=typeof o==`string`?o:``,d;return t[27]!==i||t[28]!==r||t[29]!==c||t[30]!==u?(d=(0,L.jsx)(J,{fieldId:r,errorId:i,value:u,onCommit:c}),t[27]=i,t[28]=r,t[29]=c,t[30]=u,t[31]=d):d=t[31],d}function J(e){let t=(0,M.c)(22),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(i),[c,l]=(0,j.useState)(!1),u=(0,j.useRef)(i),d,f;t[0]!==o||t[1]!==i?(d=()=>{o===u.current&&(s(i),u.current=i)},f=[i,o],t[0]=o,t[1]=i,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,j.useEffect)(d,f);let p;t[4]!==a||t[5]!==o?(p=()=>{o!==u.current&&a(o)&&(u.current=o,Q(l))},t[4]=a,t[5]=o,t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>s(e.target.value),t[7]=h):h=t[7];let _;t[8]===m?_=t[9]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),m())},t[8]=m,t[9]=_);let v=r?!0:void 0,y;t[10]!==m||t[11]!==r||t[12]!==n||t[13]!==o||t[14]!==_||t[15]!==v?(y=(0,L.jsx)(g,{id:n,value:o,onChange:h,onBlur:m,onKeyDown:_,"aria-describedby":r,"aria-invalid":v,className:`h-8 text-sm`}),t[10]=m,t[11]=r,t[12]=n,t[13]=o,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===c?b=t[18]:(b=(0,L.jsx)(Z,{visible:c}),t[17]=c,t[18]=b);let x;return t[19]!==y||t[20]!==b?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21],x}function Y(e){let t=(0,M.c)(22),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(String(i)),[c,l]=(0,j.useState)(!1),u=(0,j.useRef)(String(i)),d,f;t[0]!==o||t[1]!==i?(d=()=>{o===u.current&&(s(String(i)),u.current=String(i))},f=[i,o],t[0]=o,t[1]=i,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,j.useEffect)(d,f);let p;t[4]!==a||t[5]!==o?(p=()=>{if(o===u.current)return;let e=Number(o);if(!Number.isFinite(e)){a(o);return}a(e)&&(u.current=o,Q(l))},t[4]=a,t[5]=o,t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>s(e.target.value),t[7]=h):h=t[7];let _;t[8]===m?_=t[9]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),m())},t[8]=m,t[9]=_);let v=r?!0:void 0,y;t[10]!==m||t[11]!==r||t[12]!==n||t[13]!==o||t[14]!==_||t[15]!==v?(y=(0,L.jsx)(g,{id:n,type:`number`,value:o,onChange:h,onBlur:m,onKeyDown:_,"aria-describedby":r,"aria-invalid":v,className:`h-8 w-28 text-sm`}),t[10]=m,t[11]=r,t[12]=n,t[13]=o,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===c?b=t[18]:(b=(0,L.jsx)(Z,{visible:c}),t[17]=c,t[18]=b);let x;return t[19]!==y||t[20]!==b?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21],x}function X(e){let t=(0,M.c)(12),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(!1),c;t[0]===a?c=t[1]:(c=e=>{a(e)&&Q(s)},t[0]=a,t[1]=c);let l;t[2]!==r||t[3]!==n||t[4]!==c||t[5]!==i?(l=(0,L.jsx)(b,{id:n,checked:i,"aria-describedby":r,onCheckedChange:c}),t[2]=r,t[3]=n,t[4]=c,t[5]=i,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=(0,L.jsx)(Z,{visible:o}),t[7]=o,t[8]=u);let d;return t[9]!==l||t[10]!==u?(d=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function ne(e){let t=(0,M.c)(18),{fieldId:n,errorId:r,ariaLabel:i,options:a,value:o,onCommit:s}=e,[c,l]=(0,j.useState)(!1),f;t[0]===s?f=t[1]:(f=e=>{e&&s(e)&&Q(l)},t[0]=s,t[1]=f);let p;if(t[2]!==n||t[3]!==a){let e;t[5]===n?e=t[6]:(e=(e,t)=>(0,L.jsx)(u,{value:e,id:t===0?n:void 0,className:`text-xs capitalize`,children:e},e),t[5]=n,t[6]=e),p=a.map(e),t[2]=n,t[3]=a,t[4]=p}else p=t[4];let m;t[7]!==i||t[8]!==f||t[9]!==p||t[10]!==o?(m=(0,L.jsx)(d,{type:`single`,value:o,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":i,onValueChange:f,children:p}),t[7]=i,t[8]=f,t[9]=p,t[10]=o,t[11]=m):m=t[11];let h;t[12]===c?h=t[13]:(h=(0,L.jsx)(Z,{visible:c}),t[12]=c,t[13]=h);let g;return t[14]!==r||t[15]!==m||t[16]!==h?(g=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,"aria-describedby":r,children:[m,h]}),t[14]=r,t[15]=m,t[16]=h,t[17]=g):g=t[17],g}function re(e){let t=(0,M.c)(24),{fieldId:n,errorId:r,value:i,onCommit:a}=e,o;t[0]===i?o=t[1]:(o=i.join(`
2
- `),t[0]=i,t[1]=o);let s=o,[c,l]=(0,j.useState)(s),[u,d]=(0,j.useState)(!1),f=(0,j.useRef)(s),p,m;t[2]!==c||t[3]!==i?(p=()=>{let e=i.join(`
3
- `);c===f.current&&(l(e),f.current=e)},m=[i,c],t[2]=c,t[3]=i,t[4]=p,t[5]=m):(p=t[4],m=t[5]),(0,j.useEffect)(p,m);let h;t[6]!==a||t[7]!==c?(h=()=>{c!==f.current&&a(c.split(`
4
- `).map(ae).filter(ie))&&(f.current=c,Q(d))},t[6]=a,t[7]=c,t[8]=h):h=t[8];let g=h,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>l(e.target.value),t[9]=_):_=t[9];let v;t[10]===c?v=t[11]:(v=c.split(`
5
- `),t[10]=c,t[11]=v);let y=Math.max(2,Math.min(6,v.length)),b=r?!0:void 0,x;t[12]!==g||t[13]!==r||t[14]!==n||t[15]!==c||t[16]!==y||t[17]!==b?(x=(0,L.jsx)(`textarea`,{id:n,value:c,onChange:_,onBlur:g,rows:y,"aria-describedby":r,"aria-invalid":b,className:`min-h-16 w-full rounded-md border bg-background px-3 py-1.5 font-mono text-xs`}),t[12]=g,t[13]=r,t[14]=n,t[15]=c,t[16]=y,t[17]=b,t[18]=x):x=t[18];let S;t[19]===u?S=t[20]:(S=(0,L.jsx)(Z,{visible:u}),t[19]=u,t[20]=S);let C;return t[21]!==S||t[22]!==x?(C=(0,L.jsxs)(`div`,{className:`flex items-start gap-2`,children:[x,S]}),t[21]=S,t[22]=x,t[23]=C):C=t[23],C}function ie(e){return e.length>0}function ae(e){return e.trim()}function Z(e){let t=(0,M.c)(4),{visible:n}=e,r;t[0]===n?r=t[1]:(r=n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Saved`})]}):null,t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,L.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-emerald-600`,children:r}),t[2]=r,t[3]=i),i}function Q(e){e(!0),setTimeout(()=>e(!1),1200)}function $(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!$(e[n],t[n]))return!1;return!0}if(e&&t&&typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!$(e[r],t[r]))return!1;return!0}return!1}function oe(e){if(i(e)&&e.code===`SCHEMA_INVALID`){let t=e.issues[0];if(t)return t.message}return l(e)}function se(){let e=(0,M.c)(7),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(!0),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=(typeof window<`u`?window.okDesktop:void 0)?.skill?.detectClaudeDesktop;if(!e){i(!0);return}let t=!1;return e().then(e=>{t||i(e)}).catch(()=>{t||i(!0)}),()=>{t=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,j.useEffect)(a,o),!r)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`h2`,{id:`settings-integrations-title`,className:`text-base font-semibold`,children:`Integrations`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect Open Knowledge to other tools you use.`})]}),e[2]=s):s=e[2];let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-sm font-medium`,children:`Install in Claude Desktop`}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Make this knowledge base available as a Claude Skill.`})]}),e[3]=c):c=e[3];let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(`div`,{className:`rounded-md border p-3`,children:(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,(0,L.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>n(!0),"data-testid":`settings-install-claude-desktop`,children:`Install…`})]})}),e[4]=l):l=e[4];let u;return e[5]===t?u=e[6]:(u=(0,L.jsxs)(`section`,{"aria-labelledby":`settings-integrations-title`,className:`space-y-3`,children:[s,l,(0,L.jsx)(C,{open:t,onOpenChange:n})]}),e[5]=t,e[6]=u),u}export{B as SettingsPane};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{Hn as i,rt as a}from"./toggle-group-DUoJt_Lj.js";import{$ as o,H as s,Q as c,W as l,X as u,at as d,b as f,ct as p,et as m,h,it as g,m as _,nt as v,ot as y,p as ee,rt as b,st as x,tt as S}from"./DocumentContext-GbmGcVzS.js";import{At as C,Dt as w,Et as te,N as T,Pt as E,Q as D,Tt as O,Y as k,Z as A,bt as j,ft as M,lt as ne,q as N,wt as P}from"./dist-dkPJvrfr.js";import{a as F,c as re,l as ie,s as ae,t as oe,u as se}from"./clipboard-D2LwhWD3.js";var I=e(t(),1),ce=r(),L=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:b(this.yanchor),yhead:b(this.yhead)}}static fromJSON(t){return new e(S(t.yanchor),S(t.yhead))}},le=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new c(e)}toYPos(e,t=0){return v(this.ytext,e,t)}fromYPos(e){let t=m(S(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new L(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?O.cursor(n.pos,n.assoc):O.range(t.pos,n.pos)}},R=w.define({combine(e){return e[e.length-1]}}),z=j.define(),B=class{constructor(e){this.view=e,this.conf=e.state.facet(R),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[z.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(z)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
2
- `);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},V=A.fromClass(B),H=k.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),U=j.define(),W=class extends D{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return g(`span`,[y(`class`,`cm-ySelectionCaret`),y(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[d(`⁠`),g(`div`,[y(`class`,`cm-ySelectionCaretDot`)]),d(`⁠`),g(`div`,[y(`class`,`cm-ySelectionInfo`)],[d(this.name)]),d(`⁠`)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},ue=class{constructor(e){this.conf=e.state.facet(R),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[U.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=C.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,i=[],a=this.conf.awareness.getLocalState();if(a!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,s=a.cursor==null?null:S(a.cursor.anchor),c=a.cursor==null?null:S(a.cursor.head);if(i!=null){let e=v(t,i.anchor),n=v(t,i.head);(a.cursor==null||!o(s,e)||!o(c,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else a.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((a,o)=>{if(o===r.doc.clientID)return;let s=a.cursor;if(s==null||s.anchor==null||s.head==null)return;let c=m(s.anchor,n),l=m(s.head,n);if(c==null||l==null||c.type!==t||l.type!==t)return;let{color:u=`#30bced`,name:d=`Anonymous`}=a.user||{},f=a.user&&a.user.colorLight||u+`33`,h=p(c.index,l.index),g=x(c.index,l.index),_=e.view.state.doc.lineAt(h),v=e.view.state.doc.lineAt(g);if(_.number===v.number)i.push({from:h,to:g,value:N.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});else{i.push({from:h,to:_.from+_.length,value:N.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})}),i.push({from:v.from,to:g,value:N.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});for(let t=_.number+1;t<v.number;t++){let n=e.view.state.doc.line(t).from;i.push({from:n,to:n,value:N.line({attributes:{style:`background-color: ${f}`,class:`cm-yLineSelection`}})})}}i.push({from:l.index,to:l.index,value:N.widget({side:l.index-c.index>0?-1:1,block:!1,widget:new W(u,d)})})}),this.decorations=N.set(i,!0)}},de=A.fromClass(ue,{decorations:e=>e.decorations}),fe=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},G=w.define({combine(e){return e[e.length-1]}});j.define();var pe=class{constructor(e){this.view=e,this.conf=e.state.facet(G),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(R),this._beforeChangeSelection=null,this._mux=u(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[k.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(z)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},K=A.fromClass(pe),me=({state:e,dispatch:t})=>e.facet(G).undo()||!0,he=({state:e,dispatch:t})=>e.facet(G).redo()||!0,ge=(e,t,{undoManager:n=new c(e)}={})=>{let r=new le(e,t),i=[R.of(r),V];return t&&i.push(H,de),n!==!1&&i.push(G.of(new fe(n)),K,k.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?me(t):e.inputType===`historyRedo`?he(t):!1}})),i},_e=N.mark({class:`cm-link-ref-broken`}),q=/^\s{0,3}\[([^\]]+)\]:\s/,J=/\[([^\]]*)\]\[([^\]]*)\]/g,ve=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function Y(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function ye(e){let t=[];return T(e).iterate({enter(e){if(ve.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function X(e){let t=new Set,n=[],r=e.doc,i=ye(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(Y(n.from,i))continue;let a=q.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!Y(t.from,i)&&!q.test(t.text))for(J.lastIndex=0;;){let e=J.exec(t.text);if(!e)break;let r=t.from+e.index;if(Y(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(_e.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),N.set(a)}var be=E.define({create(e){return X(e)},update(e,t){return t.docChanged?X(t.state):e},provide:e=>k.decorations.from(e)}),xe=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,Se=N.mark({class:`cm-del`}),Ce=N.line({class:`cm-table-header`}),Z=N.line({class:`cm-table-row`});function we(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function Q(e,t){let n=[],r=T(e);for(let{from:i,to:a}of t)r.iterate({from:i,to:a,enter(t){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(Se.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=xe.exec(r.text),a=i?i[1].length:2,o=N.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=we(r.text),a=N.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(Ce.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(Z.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(Z.range(r.from)),!1}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),N.set(n)}var Te=class{decorations;constructor(e){this.decorations=Q(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||T(e.startState)!==T(e.state))&&(this.decorations=Q(e.view.state,e.view.visibleRanges))}},Ee=A.fromClass(Te,{decorations:e=>e.decorations});function De(){return[Ee,be]}var Oe=n();function $(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&n.line(1).text===`---`){for(let e=2;e<=n.lines;e++)if(n.line(e).text===`---`){r=e+1;break}}let i=a(),o=0;for(let a=r;a<=n.lines;a++){let r=n.line(a);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(o===t.index){e.dispatch({selection:O.cursor(r.from),effects:k.scrollIntoView(r.from,{y:`start`})}),e.focus();return}o++}}}function ke(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:O.cursor(r),effects:k.scrollIntoView(r,{y:`center`})}),e.focus()})}function Ae(e){let t=(0,ce.c)(25),{docName:n,ytext:r,provider:a,placeholder:o,isSourceModeActive:c}=e,u=(0,I.useRef)(null),d=(0,I.useRef)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=new P,t[0]=f):f=t[0];let p=(0,I.useRef)(f),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=new P,t[1]=m):m=t[1];let g=(0,I.useRef)(m),[v,y]=(0,I.useState)(null);if(v)throw v;let{resolvedTheme:b}=i(),x=(0,I.useRef)(null),S;t[2]!==o||t[3]!==a||t[4]!==b||t[5]!==r?(S=()=>{let e=u.current;if(!e)return;let t=a.configuration.name??``,n,i=je;try{n=s({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let t=oe({ydoc:a.document,ytext:r}),n=new k({state:te.create({doc:r.toString(),extensions:[ae,ne.of([re]),ge(r,a.awareness),...ee({themeCompartment:p.current,resolvedTheme:b,ydoc:a.document}),De(),t,g.current.of(M(o??``)),k.theme({"&":{height:`100%`}})]}),parent:e}),s=n.contentDOM;return s.addEventListener(`keydown`,i),s.addEventListener(`paste`,i),s.addEventListener(`drop`,i),s.addEventListener(`cut`,i),{view:n,ydoc:a.document,ytext:r,provider:a}}}),x.current=n,d.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),x.current=null,d.current=null,y(t instanceof Error?t:Error(String(t)))}return()=>{let e=x.current;e&&l(e),x.current=null,d.current=null}},t[2]=o,t[3]=a,t[4]=b,t[5]=r,t[6]=S):S=t[6];let C;t[7]!==a||t[8]!==r?(C=[r,a],t[7]=a,t[8]=r,t[9]=C):C=t[9],(0,I.useEffect)(S,C);let w,T;t[10]===b?(w=t[11],T=t[12]):(w=()=>{d.current&&d.current.dispatch({effects:p.current.reconfigure(b===`dark`?_:h)})},T=[b],t[10]=b,t[11]=w,t[12]=T),(0,I.useEffect)(w,T);let E,D;t[13]===o?(E=t[14],D=t[15]):(E=()=>{d.current&&d.current.dispatch({effects:g.current.reconfigure(M(o??``))})},D=[o],t[13]=o,t[14]=E,t[15]=D),(0,I.useEffect)(E,D);let O,A;t[16]!==n||t[17]!==c?(A=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!c)return;let r=d.current;r&&($(r,t),ie(n))};return window.addEventListener(F,e),()=>window.removeEventListener(F,e)},O=[n,c],t[16]=n,t[17]=c,t[18]=O,t[19]=A):(O=t[18],A=t[19]),(0,I.useEffect)(A,O);let j,N;t[20]!==n||t[21]!==c?(j=()=>{if(!c)return;let e=d.current;if(!e)return;let t=se(n);if(t){if(t.kind===`outline`){$(e,t.detail);return}ke(e,t.detail)}},N=[n,c],t[20]=n,t[21]=c,t[22]=j,t[23]=N):(j=t[22],N=t[23]),(0,I.useEffect)(j,N);let L;return t[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Oe.jsx)(`div`,{ref:u,className:`source-editor h-full py-3`}),t[24]=L):L=t[24],L}function je(){return f()}export{Ae as SourceEditor};
@@ -1 +0,0 @@
1
- import{x as e}from"./button-CXhPNzpp.js";var t=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);export{t};
@@ -1,5 +0,0 @@
1
- import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d,u as f}from"./panel-DiSt1efw.js";import{E as p,Ot as m,Z as ee,hn as te,ht as ne,i as re,j as ie,kt as ae,vn as h}from"./toggle-group-DUoJt_Lj.js";import{n as oe}from"./button-CXhPNzpp.js";import{et as g,ft as _,n as se,nt as ce}from"./DocumentContext-GbmGcVzS.js";import{x as v}from"./dialog-CJazZw1E.js";import{$ as y,A as b,B as x,Bt as S,Ct as C,D as le,Dt as w,E as T,Et as ue,Ft as de,Ht as fe,It as pe,J as E,Lt as me,M as he,N as D,Nt as O,Pt as ge,Q as _e,Rt as ve,S as k,St as A,T as j,Tt as M,Vt as N,Y as P,Z as ye,at as be,bt as xe,c as Se,ct as Ce,d as we,et as Te,g as Ee,gt as De,ht as Oe,jt as ke,kt as Ae,lt as je,mt as Me,n as Ne,nt as Pe,ot as Fe,pt as Ie,q as F,st as Le,tt as Re,ut as ze,v as Be,vt as I,x as Ve,xt as He,zt as Ue}from"./dist-dkPJvrfr.js";import{i as We,n as Ge,o as Ke,r as qe}from"./dist-oNAFjGrp.js";var Je=e(t(),1),Ye=r(),Xe=new Map;function Ze(e,t){Xe.set(e,t)}function Qe(e){let t=Xe.get(e)??null;return Xe.delete(e),t}function $e(e){Xe.delete(e)}var et=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=at(e.state,n.from);return r.line?nt(e):r.block?it(e):!1};function tt(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var nt=tt(ut,0),rt=tt(lt,0),it=tt((e,t)=>lt(e,t,ct(t)),0);function at(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var ot=50;function st(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-ot,r),o=e.sliceDoc(i,i+ot),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=2*ot?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+ot),d=e.sliceDoc(i-ot,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function ct(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function lt(e,t,n=t.selection.ranges){let r=n.map(e=>at(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>st(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function ut(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=at(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}else if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var dt=xe.define(),ft=xe.define(),pt=w.define(),mt=w.define({combine(e){return Ue(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),ht=ge.define({create(){return Mt.empty},update(e,t){let n=t.state.facet(mt),r=t.annotation(dt);if(r){let i=L.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?St(o,o.length,n.minDepth,i):Dt(o,t.startState.selection),new Mt(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(ft);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(pe.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=L.fromTransaction(t),o=t.annotation(pe.time),s=t.annotation(pe.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new Mt(e.done.map(L.fromJSON),e.undone.map(L.fromJSON))}});function gt(e={}){return[ht,mt.of(e),P.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?vt:e.inputType==`historyRedo`?yt:null;return n?(e.preventDefault(),n(t)):!1}})]}function _t(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(ht,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var vt=_t(0,!1),yt=_t(1,!1),bt=_t(0,!0),xt=_t(1,!0),L=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&A.fromJSON(t.changes),[],t.mapped&&He.fromJSON(t.mapped),t.startSelection&&M.fromJSON(t.startSelection),t.selectionsAfter.map(M.fromJSON))}static fromTransaction(t,n){let r=R;for(let e of t.startState.facet(pt)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,R)}static selection(t){return new e(void 0,R,void 0,void 0,t)}};function St(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function Ct(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function wt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Tt(e,t){return e.length?t.length?e.concat(t):e:t}var R=[],Et=200;function Dt(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Et));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),St(e,e.length-1,1e9,n.setSelAfter(r)))}else return[L.selection([t])]}function Ot(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function kt(e,t){if(!e.length)return e;let n=e.length,r=R;for(;n;){let i=At(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[L.selection(r)]:R}function At(e,t,n){let r=Tt(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):R,n);if(!e.changes)return L.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new L(i,O.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var jt=/^(input\.type|delete)($|\.)/,Mt=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||jt.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Ct(s.changes,t.changes))||r==`input.type.compose`)?St(o,o.length-1,i.minDepth,new L(t.changes.compose(s.changes),Tt(O.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,R)):St(o,o.length,i.minDepth,t),new e(o,R,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:R;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&wt(a[a.length-1],t)?this:new e(Dt(this.done,t),this.undone,n,r)}addMapping(t){return new e(kt(this.done,t),kt(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:dt.of({side:e,rest:Ot(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?R:r.slice(0,r.length-1);return i.mapped&&(n=kt(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:dt.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};Mt.empty=new Mt(R,R);var Nt=[{key:`Mod-z`,run:vt,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:yt,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:yt,preventDefault:!0},{key:`Mod-u`,run:bt,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:xt,preventDefault:!0}];function Pt(e,t){return M.create(e.ranges.map(t),e.mainIndex)}function z(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function B({state:e,dispatch:t},n){let r=Pt(e.selection,n);return r.eq(e.selection,!0)?!1:(t(z(e,r)),!0)}function Ft(e,t){return M.cursor(t?e.to:e.from)}function It(e,t){return B(e,n=>n.empty?e.moveByChar(n,t):Ft(n,t))}function V(e){return e.textDirectionAt(e.state.selection.main.head)==E.LTR}var Lt=e=>It(e,!V(e)),Rt=e=>It(e,V(e));function zt(e,t){return B(e,n=>n.empty?e.moveByGroup(n,t):Ft(n,t))}var Bt=e=>zt(e,!V(e)),Vt=e=>zt(e,V(e));typeof Intl<`u`&&Intl.Segmenter;function Ht(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Ut(e,t,n){let r=D(e).resolveInner(t.head),i=n?x.closedBy:x.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;Ht(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?b(e,r.from,1):b(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,M.cursor(s,n?-1:1)}var Wt=e=>B(e,t=>Ut(e.state,t,!V(e))),Gt=e=>B(e,t=>Ut(e.state,t,V(e)));function Kt(e,t){return B(e,n=>{if(!n.empty)return Ft(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var qt=e=>Kt(e,!1),Jt=e=>Kt(e,!0);function Yt(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(P.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function Xt(e,t){let n=Yt(e),{state:r}=e,i=Pt(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):Ft(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=P.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(z(r,i),{effects:a}),!0}var Zt=e=>Xt(e,!1),Qt=e=>Xt(e,!0);function H(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=M.cursor(r.from+n))}return i}var $t=e=>B(e,t=>H(e,t,!0)),en=e=>B(e,t=>H(e,t,!1)),tn=e=>B(e,t=>H(e,t,!V(e))),nn=e=>B(e,t=>H(e,t,V(e))),rn=e=>B(e,t=>M.cursor(e.lineBlockAt(t.head).from,1)),an=e=>B(e,t=>M.cursor(e.lineBlockAt(t.head).to,-1));function on(e,t,n){let r=!1,i=Pt(e.selection,t=>{let i=b(e,t.head,-1)||b(e,t.head,1)||t.head>0&&b(e,t.head-1,1)||t.head<e.doc.length&&b(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?M.range(t.anchor,a):M.cursor(a)});return r?(t(z(e,i)),!0):!1}var sn=({state:e,dispatch:t})=>on(e,t,!1);function U(e,t){let n=Pt(e.state.selection,e=>{let n=t(e);return M.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(z(e.state,n)),!0)}function cn(e,t){return U(e,n=>e.moveByChar(n,t))}var ln=e=>cn(e,!V(e)),un=e=>cn(e,V(e));function dn(e,t){return U(e,n=>e.moveByGroup(n,t))}var fn=e=>dn(e,!V(e)),pn=e=>dn(e,V(e)),mn=e=>U(e,t=>Ut(e.state,t,!V(e))),hn=e=>U(e,t=>Ut(e.state,t,V(e)));function gn(e,t){return U(e,n=>e.moveVertically(n,t))}var _n=e=>gn(e,!1),vn=e=>gn(e,!0);function yn(e,t){return U(e,n=>e.moveVertically(n,t,Yt(e).height))}var bn=e=>yn(e,!1),xn=e=>yn(e,!0),Sn=e=>U(e,t=>H(e,t,!0)),Cn=e=>U(e,t=>H(e,t,!1)),wn=e=>U(e,t=>H(e,t,!V(e))),Tn=e=>U(e,t=>H(e,t,V(e))),En=e=>U(e,t=>M.cursor(e.lineBlockAt(t.head).from)),Dn=e=>U(e,t=>M.cursor(e.lineBlockAt(t.head).to)),On=({state:e,dispatch:t})=>(t(z(e,{anchor:0})),!0),kn=({state:e,dispatch:t})=>(t(z(e,{anchor:e.doc.length})),!0),An=({state:e,dispatch:t})=>(t(z(e,{anchor:e.selection.main.anchor,head:0})),!0),jn=({state:e,dispatch:t})=>(t(z(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Mn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Nn=({state:e,dispatch:t})=>{let n=Qn(e).map(({from:t,to:n})=>M.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:M.create(n),userEvent:`select`})),!0},Pn=({state:e,dispatch:t})=>{let n=Pt(e.selection,t=>{let n=D(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return M.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(z(e,n)),!0)};function Fn(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}else if(r.head==n.head)break;else n=r}}return i.length==r.ranges.length?!1:(e.dispatch(z(n,M.create(i,i.length-1))),!0)}var In=e=>Fn(e,!1),Ln=e=>Fn(e,!0),Rn=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=M.create([n.main]):n.main.empty||(r=M.create([M.cursor(n.main.head)])),r?(t(z(e,r)),!0):!1};function zn(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=Bn(e,o,!1)):o>i&&(n=`delete.forward`,o=Bn(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Bn(e,i,!1),a=Bn(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:M.cursor(i,i<r.head?-1:1)}});return i.changes.empty?!1:(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?P.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function Bn(e,t,n){if(e instanceof P)for(let r of e.state.facet(P.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var Vn=(e,t,n)=>zn(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=S(s,a.tabSize)%Ve(a)||Ve(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=N(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=N(o.text,c-o.from,!1,!1)+o.from);return c}),Hn=e=>Vn(e,!1,!0),Un=e=>Vn(e,!0,!1),Wn=(e,t)=>zn(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=N(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),Gn=e=>Wn(e,!1),Kn=e=>Wn(e,!0),qn=e=>zn(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Jn=e=>zn(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Yn=e=>zn(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Xn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:de.of([``,``])},range:M.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},Zn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:N(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:N(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:M.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Qn(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function $n(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of Qn(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(M.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(M.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:M.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var er=({state:e,dispatch:t})=>$n(e,t,!1),tr=({state:e,dispatch:t})=>$n(e,t,!0);function nr(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Qn(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var rr=({state:e,dispatch:t})=>nr(e,t,!1),ir=({state:e,dispatch:t})=>nr(e,t,!0),ar=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Qn(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Pt(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function or(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=D(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(x.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var sr=lr(!1),cr=lr(!0);function lr(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&or(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new Ne(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=k(s,r);for(c??=S(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,T(t,c)];return o&&l.push(T(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:de.of(l)},range:M.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function ur(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:M.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var dr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Ne(e,{overrideIndentation:e=>n[e]??-1}),i=ur(e,(t,i,a)=>{let o=k(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=T(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},fr=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(ur(e,(t,n)=>{n.push({from:t.from,insert:e.facet(le)})}),{userEvent:`input.indent`})),!0),pr=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(ur(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=S(r,e.tabSize),a=0,o=T(e,Math.max(0,i-Ve(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),mr=e=>(e.setTabFocusMode(),!0),hr=[{key:`Ctrl-b`,run:Lt,shift:ln,preventDefault:!0},{key:`Ctrl-f`,run:Rt,shift:un},{key:`Ctrl-p`,run:qt,shift:_n},{key:`Ctrl-n`,run:Jt,shift:vn},{key:`Ctrl-a`,run:rn,shift:En},{key:`Ctrl-e`,run:an,shift:Dn},{key:`Ctrl-d`,run:Un},{key:`Ctrl-h`,run:Hn},{key:`Ctrl-k`,run:qn},{key:`Ctrl-Alt-h`,run:Gn},{key:`Ctrl-o`,run:Xn},{key:`Ctrl-t`,run:Zn},{key:`Ctrl-v`,run:Qt}],gr=[{key:`ArrowLeft`,run:Lt,shift:ln,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Bt,shift:fn,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:tn,shift:wn,preventDefault:!0},{key:`ArrowRight`,run:Rt,shift:un,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Vt,shift:pn,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:nn,shift:Tn,preventDefault:!0},{key:`ArrowUp`,run:qt,shift:_n,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:On,shift:An},{mac:`Ctrl-ArrowUp`,run:Zt,shift:bn},{key:`ArrowDown`,run:Jt,shift:vn,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:kn,shift:jn},{mac:`Ctrl-ArrowDown`,run:Qt,shift:xn},{key:`PageUp`,run:Zt,shift:bn},{key:`PageDown`,run:Qt,shift:xn},{key:`Home`,run:en,shift:Cn,preventDefault:!0},{key:`Mod-Home`,run:On,shift:An},{key:`End`,run:$t,shift:Sn,preventDefault:!0},{key:`Mod-End`,run:kn,shift:jn},{key:`Enter`,run:sr,shift:sr},{key:`Mod-a`,run:Mn},{key:`Backspace`,run:Hn,shift:Hn,preventDefault:!0},{key:`Delete`,run:Un,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Gn,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:Kn,preventDefault:!0},{mac:`Mod-Backspace`,run:Jn,preventDefault:!0},{mac:`Mod-Delete`,run:Yn,preventDefault:!0}].concat(hr.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),_r=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Wt,shift:mn},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:Gt,shift:hn},{key:`Alt-ArrowUp`,run:er},{key:`Shift-Alt-ArrowUp`,run:rr},{key:`Alt-ArrowDown`,run:tr},{key:`Shift-Alt-ArrowDown`,run:ir},{key:`Mod-Alt-ArrowUp`,run:In},{key:`Mod-Alt-ArrowDown`,run:Ln},{key:`Escape`,run:Rn},{key:`Mod-Enter`,run:cr},{key:`Alt-l`,mac:`Ctrl-l`,run:Nn},{key:`Mod-i`,run:Pn,preventDefault:!0},{key:`Mod-[`,run:pr},{key:`Mod-]`,run:fr},{key:`Mod-Alt-\\`,run:dr},{key:`Shift-Mod-k`,run:ar},{key:`Shift-Mod-\\`,run:sn},{key:`Mod-/`,run:et},{key:`Alt-A`,run:rt},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:mr}].concat(gr),vr={key:`Tab`,run:fr,shift:pr},yr=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,W=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(yr(e)):yr,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return me(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=fe(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ve(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(W.prototype[Symbol.iterator]=function(){return this});var br={from:-1,to:-1,match:/.*/.exec(``)},xr=`gm`+(/x/.unicode==null?``:`u`),Sr=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=br,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Tr(e,t,n,r,i);this.re=new RegExp(t,xr+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=Dr(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Dr(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},Cr=new WeakMap,wr=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=Cr.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Cr.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),Cr.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Tr=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=br,this.matchPos=Dr(e,r),this.re=new RegExp(t,xr+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=wr.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=Dr(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=wr.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Sr.prototype[Symbol.iterator]=Tr.prototype[Symbol.iterator]=function(){return this});function Er(e){try{return new RegExp(e,xr),!0}catch{return!1}}function Dr(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Or=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=Oe(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),p=M.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,P.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},kr={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Ar=w.define({combine(e){return Ue(e,kr,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function jr(e){let t=[Lr,Ir];return e&&t.push(Ar.of(e)),t}var Mr=F.mark({class:`cm-selectionMatch`}),Nr=F.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function Pr(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=C.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=C.Word)}function Fr(e,t,n,r){return e(t.sliceDoc(n,n+1))==C.Word&&e(t.sliceDoc(r-1,r))==C.Word}var Ir=ye.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Ar),{state:n}=e,r=n.selection;if(r.ranges.length>1)return F.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return F.none;let e=n.wordAt(i.head);if(!e)return F.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return F.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Pr(o,n,i.from,i.to)&&Fr(o,n,i.from,i.to)))return F.none}else if(a=n.sliceDoc(i.from,i.to),!a)return F.none}let s=[];for(let r of e.visibleRanges){let e=new W(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||Pr(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(Nr.range(r,a)):(r>=i.to||a<=i.from)&&s.push(Mr.range(r,a)),s.length>t.maxMatches))return F.none}}return F.set(s)}},{decorations:e=>e.decorations}),Lr=P.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Rr=({state:e,dispatch:t})=>{let{selection:n}=e,r=M.create(n.ranges.map(t=>e.wordAt(t.head)||M.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function zr(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new W(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new W(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Br=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Rr({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=zr(e,r);return i?(t(e.update({selection:e.selection.addRange(M.range(i.from,i.to),!1),effects:P.scrollIntoView(i.to)})),!0):!1},Vr=w.define({combine(e){return Ue(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new bi(e),scrollToMatch:e=>P.scrollIntoView(e)})}}),Hr=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||Er(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
2
- `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new $r(this):new qr(this)}getCursor(e,t=0,n){let r=e.doc?e:ue.create({doc:e});return n??=r.doc.length,this.regexp?Yr(this,r,t,n):Gr(this,r,t,n)}},Ur=class{constructor(e){this.spec=e}};function Wr(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function Gr(e,t,n,r){let i;return e.wholeWord&&(i=Kr(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=Wr(e.test,t,i)),new W(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function Kr(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(Xr(i,n-a))!=C.Word||t(Zr(i,n-a))!=C.Word)&&(t(Zr(i,r-a))!=C.Word||t(Xr(i,r-a))!=C.Word))}var qr=class extends Ur{constructor(e){super(e)}nextMatch(e,t,n){let r=Gr(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=Gr(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=Gr(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=Gr(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Gr(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function Jr(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function Yr(e,t,n,r){let i;return e.wholeWord&&(i=Qr(t.charCategorizer(t.selection.main.head))),e.test&&(i=Jr(e.test,t,i)),new Sr(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function Xr(e,t){return e.slice(N(e,t,!1),t)}function Zr(e,t){return e.slice(t,N(e,t))}function Qr(e){return(t,n,r)=>!r[0].length||(e(Xr(r.input,r.index))!=C.Word||e(Zr(r.input,r.index))!=C.Word)&&(e(Zr(r.input,r.index+r[0].length))!=C.Word||e(Xr(r.input,r.index+r[0].length))!=C.Word)}var $r=class extends Ur{nextMatch(e,t,n){let r=Yr(this.spec,e,n,e.doc.length).next();return r.done&&(r=Yr(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=Yr(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=Yr(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Yr(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},ei=O.define(),ti=O.define(),G=ge.define({create(e){return new ni(mi(e).create(),null)},update(e,t){for(let n of t.effects)n.is(ei)?e=new ni(n.value.create(),e.panel):n.is(ti)&&(e=new ni(e.query,n.value?pi:null));return e},provide:e=>De.from(e,e=>e.panel)}),ni=class{constructor(e,t){this.query=e,this.panel=t}},ri=F.mark({class:`cm-searchMatch`}),ii=F.mark({class:`cm-searchMatch cm-searchMatch-selected`}),ai=ye.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(G))}update(e){let t=e.state.field(G);(t!=e.startState.field(G)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return F.none;let{view:n}=this,r=new ke;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?ii:ri)})}return r.finish()}},{decorations:e=>e.decorations});function oi(e){return t=>{let n=t.state.field(G,!1);return n&&n.query.spec.valid?e(t,n):_i(t)}}var si=oi((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=M.single(r.from,r.to),a=e.state.facet(Vr);return e.dispatch({selection:i,effects:[Ci(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),gi(e),!0}),ci=oi((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=M.single(i.from,i.to),o=e.state.facet(Vr);return e.dispatch({selection:a,effects:[Ci(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),gi(e),!0}),li=oi((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:M.create(n.map(e=>M.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),ui=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new W(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(M.range(t.value.from,t.value.to))}return t(e.update({selection:M.create(a,o),userEvent:`select.search.matches`})),!0},di=oi((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(P.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=M.single(o.from,o.to).map(d),u.push(Ci(e,o)),u.push(n.facet(Vr).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),fi=oi((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:P.announce.of(r),userEvent:`input.replace.all`}),!0});function pi(e){return e.state.facet(Vr).createPanel(e)}function mi(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(Vr);return new Hr({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function hi(e){let t=Pe(e,pi);return t&&t.dom.querySelector(`[main-field]`)}function gi(e){let t=hi(e);t&&t==e.root.activeElement&&t.select()}var _i=e=>{let t=e.state.field(G,!1);if(t&&t.panel){let n=hi(e);if(n&&n!=e.root.activeElement){let r=mi(e.state,t.query.spec);r.valid&&e.dispatch({effects:ei.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[ti.of(!0),t?ei.of(mi(e.state,t.query.spec)):O.appendConfig.of(Ti)]});return!0},vi=e=>{let t=e.state.field(G,!1);if(!t||!t.panel)return!1;let n=Pe(e,pi);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:ti.of(!1)}),!0},yi=[{key:`Mod-f`,run:_i,scope:`editor search-panel`},{key:`F3`,run:si,shift:ci,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:si,shift:ci,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:vi,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:ui},{key:`Mod-Alt-g`,run:Or},{key:`Mod-d`,run:Br,preventDefault:!0}],bi=class{constructor(e){this.view=e;let t=this.query=e.state.field(G).query.spec;this.commit=this.commit.bind(this),this.searchField=I(`input`,{value:t.search,placeholder:K(e,`Find`),"aria-label":K(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=I(`input`,{value:t.replace,placeholder:K(e,`Replace`),"aria-label":K(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=I(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=I(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=I(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return I(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=I(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>si(e),[K(e,`next`)]),n(`prev`,()=>ci(e),[K(e,`previous`)]),n(`select`,()=>li(e),[K(e,`all`)]),I(`label`,null,[this.caseField,K(e,`match case`)]),I(`label`,null,[this.reField,K(e,`regexp`)]),I(`label`,null,[this.wordField,K(e,`by word`)]),...e.state.readOnly?[]:[I(`br`),this.replaceField,n(`replace`,()=>di(e),[K(e,`replace`)]),n(`replaceAll`,()=>fi(e),[K(e,`replace all`)])],I(`button`,{name:`close`,onclick:()=>vi(e),"aria-label":K(e,`close`),type:`button`},[`×`])])}commit(){let e=new Hr({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:ei.of(e)}))}keydown(e){Me(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ci:si)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),di(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(ei)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Vr).top}};function K(e,t){return e.state.phrase(t)}var xi=30,Si=/[\s\.,:;?!]/;function Ci(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-xi),o=Math.min(i,n+xi),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<xi;e++)if(!Si.test(s[e+1])&&Si.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-xi;e--)if(!Si.test(s[e-1])&&Si.test(s[e])){s=s.slice(0,e);break}}return P.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var wi=P.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Ti=[G,Ae.low(ai),wi],Ei=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},Di=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(zi).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new ke,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=Xi(s);if(i)o.add(n,n,F.widget({widget:new Ui(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,F.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,q(f))}};function q(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new Ei(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Ei(r.from,n,r.diagnostic)}),r}function Oi(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(zi).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Ai))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function ki(e,t){return e.field(J,!1)?t:t.concat(O.appendConfig.of(Zi))}var Ai=O.define(),ji=O.define(),Mi=O.define(),J=ge.define({create(){return new Di(F.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=q(n,e.selected.diagnostic,i)||q(n,null,i)}!n.size&&i&&t.state.facet(zi).autoPanel&&(i=null),e=new Di(n,i,r)}for(let n of t.effects)if(n.is(Ai)){let r=t.state.facet(zi).autoPanel?n.value.length?Gi.open:null:e.panel;e=Di.init(n.value,r,t.state)}else n.is(ji)?e=new Di(e.diagnostics,n.value?Gi.open:null,e.selected):n.is(Mi)&&(e=new Di(e.diagnostics,e.panel,n.value));return e},provide:e=>[De.from(e,e=>e.panel),P.decorations.from(e,e=>e.diagnostics)]}),Ni=F.mark({class:`cm-lintRange cm-lintRange-active`});function Pi(e,t,n){let{diagnostics:r}=e.state.field(J),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(zi).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:Fi(e,i)}}}:null}function Fi(e,t){return I(`ul`,{class:`cm-tooltip-lint`},t.map(t=>Hi(e,t,!1)))}var Ii=e=>{let t=e.state.field(J,!1);(!t||!t.panel)&&e.dispatch({effects:ki(e.state,[ji.of(!0)])});let n=Pe(e,Gi.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},Li=e=>{let t=e.state.field(J,!1);return!t||!t.panel?!1:(e.dispatch({effects:ji.of(!1)}),!0)},Ri=[{key:`Mod-Shift-m`,run:Ii,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(J,!1);if(!t)return!1;let n=e.state.selection.main,r=q(t.diagnostics,null,n.to+1);return!r&&(r=q(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],zi=w.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...Ue(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Bi,tooltipFilter:Bi,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function Bi(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Vi(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function Hi(e,t,n){let r=n?Vi(t.actions):[];return I(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},I(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=q(e.state.field(J).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),I(`u`,s.slice(c,c+1)),s.slice(c+1)];return I(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&I(`div`,{class:`cm-diagnosticSource`},t.source))}var Ui=class extends _e{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return I(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},Wi=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=Hi(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},Gi=class e{constructor(e){this.view=e,this.items=[],this.list=I(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)Li(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=Vi(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=q(this.view.state.field(J).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=I(`div`,{class:`cm-panel-lint`},this.list,I(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>Li(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(J).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(J),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new Wi(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new Wi(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=q(this.view.state.field(J).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Mi.of(t)})}static open(t){return new e(t)}};function Ki(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function qi(e){return Ki(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var Ji=P.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:qi(`#d11`)},".cm-lintRange-warning":{backgroundImage:qi(`orange`)},".cm-lintRange-info":{backgroundImage:qi(`#999`)},".cm-lintRange-hint":{backgroundImage:qi(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function Yi(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function Xi(e){let t=`hint`,n=1;for(let r of e){let e=Yi(r.severity);e>n&&(n=e,t=r.severity)}return t}var Zi=[J,P.decorations.compute([J],e=>{let{selected:t,panel:n}=e.field(J);return!t||!n||t.from==t.to?F.none:F.set([Ni.range(t.from,t.to)])}),Ce(Pi,{hideOn:Oi}),Ji],Qi=[ze(),Fe(),Le(),gt(),Ee(),Te(),Re(),ue.allowMultipleSelections.of(!0),j(),he(we,{fallback:!0}),Se(),qe(),Ge(),Ie(),y(),be(),jr(),je.of([...We,..._r,...yi,...Nt,...Be,...Ke,...Ri])];Le(),gt(),Te(),he(we,{fallback:!0}),je.of([..._r,...Nt]);function $i(e,t){let n=(0,Ye.c)(4),r=t===void 0?!1:t,[i,a]=(0,Je.useState)(void 0),o=(0,Je.useRef)(null),s,c;return n[0]!==r||n[1]!==e?(s=()=>{if(r||e.length===0){a(void 0);return}let t=function(){let t=window.innerHeight/2,n,r;for(let i of e){let e=document.getElementById(i);if(!e)continue;let a=e.getBoundingClientRect().top;a<0?n=i:r===void 0&&a<t&&(r=i)}a(r??n??e[0])},n=function(){o.current===null&&(o.current=requestAnimationFrame(()=>{o.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}},c=[e,r],n[0]=r,n[1]=e,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,Je.useEffect)(s,c),i}var Y=n(),ea=300;async function ta(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Server error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.ok)throw Error(n.error??`Failed to load headings`);return n.headings??[]}var na=32,ra=6,ia=6,aa=8;function oa(e){return(e-1)*aa+.5}function sa(e){if(e.length===0)return``;let t=[];for(let n=0;n<e.length;n++){let r=oa(e[n].level),i=n*na+ra,a=n*na+na-ia;t.push(`${n===0?`M`:`L`}${r} ${i}`),t.push(`L${r} ${a}`)}return t.join(` `)}var ca=`open-knowledge:outline-nav`;function la(e){let t=(0,Ye.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Y.jsx)(_,{name:`outline-panel`,children:(0,Y.jsx)(ua,{...e})}),t[0]=e,t[1]=n),n}function ua(e){let t=(0,Ye.c)(54),{docName:n,isSourceMode:r,className:p}=e,m=p===void 0?``:p,{pages:ee,loading:te}=re(),ne=f(),{activeProvider:ie,activeDocName:ae}=se(),h,g;t[0]===n?(h=t[1],g=t[2]):(h=[`page-headings`,n],g=()=>ta(n),t[0]=n,t[1]=h,t[2]=g);let _;t[3]!==n||t[4]!==te||t[5]!==ee?(_=!te&&ee.has(n),t[3]=n,t[4]=te,t[5]=ee,t[6]=_):_=t[6];let ce;t[7]!==h||t[8]!==g||t[9]!==_?(ce={queryKey:h,queryFn:g,enabled:_,staleTime:1/0},t[7]=h,t[8]=g,t[9]=_,t[10]=ce):ce=t[10];let{data:v,isLoading:y,error:b}=a(ce),x;t[11]===v?x=t[12]:(x=v===void 0?[]:v,t[11]=v,t[12]=x);let S=x,C,le;t[13]!==ae||t[14]!==ie||t[15]!==n||t[16]!==ne?(C=()=>{if(!ie||ae!==n)return;let e=ie.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,ne.invalidateQueries({queryKey:[`page-headings`,n]})},ea)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},le=[ie,ae,n,ne],t[13]=ae,t[14]=ie,t[15]=n,t[16]=ne,t[17]=C,t[18]=le):(C=t[17],le=t[18]),(0,Je.useEffect)(C,le);let w;t[19]===S?w=t[20]:(w=S.map(fa),t[19]=S,t[20]=w);let T=$i(w,r),ue;t[21]!==T||t[22]!==S?(ue=T?S.findIndex(e=>e.slug===T):-1,t[21]=T,t[22]=S,t[23]=ue):ue=t[23];let de=ue,fe;t[24]!==n||t[25]!==r?(fe=function(e,t){let i={index:e,slug:t,mode:r?`source`:`wysiwyg`};i.mode===`source`&&Ze(n,{kind:`outline`,detail:i}),window.dispatchEvent(new CustomEvent(ca,{detail:i}))},t[24]=n,t[25]=r,t[26]=fe):fe=t[26];let pe=fe,E=(S.reduce(da,1)-1)*aa+1,me=S.length*na,he;t[27]===S?he=t[28]:(he=sa(S),t[27]=S,t[28]=he);let D=he,O=D?`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${E} ${me}"><path d="${D}" stroke="black" stroke-width="2" fill="none" /></svg>`)}")`:void 0,ge=de>=0?de*na+ra:0,_e=de>=0?na-ra-ia:0,ve;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Y.jsx)(u,{children:`Outline`}),t[29]=ve):ve=t[29];let k;t[30]!==S.length||t[31]!==y?(k=!y&&(0,Y.jsx)(l,{children:S.length}),t[30]=S.length,t[31]=y,t[32]=k):k=t[32];let A;t[33]===k?A=t[34]:(A=(0,Y.jsxs)(c,{children:[ve,k]}),t[33]=k,t[34]=A);let j;t[35]!==T||t[36]!==b||t[37]!==pe||t[38]!==S||t[39]!==y||t[40]!==D||t[41]!==O||t[42]!==me||t[43]!==E||t[44]!==_e||t[45]!==ge?(j=b?(0,Y.jsx)(i,{className:`px-2`,children:b instanceof Error?b.message:`Failed to load headings`}):S.length===0&&!y?(0,Y.jsx)(o,{className:`px-2`,children:`No headings yet.`}):(0,Y.jsxs)(`nav`,{"aria-label":`Document outline`,className:`relative`,children:[(0,Y.jsx)(`svg`,{width:E,height:me,className:`pointer-events-none absolute left-0 top-0`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:D,fill:`none`,strokeWidth:`1`,style:{stroke:`var(--border)`}})}),O&&(0,Y.jsx)(`div`,{className:`pointer-events-none absolute left-0 top-0`,style:{width:E,height:me,maskImage:O,WebkitMaskImage:O},children:(0,Y.jsx)(`div`,{className:`w-full motion-safe:[transition:transform_0.25s_var(--ease-out-strong),height_0.1s_var(--ease-out-strong)]`,style:{transform:`translateY(${ge}px)`,height:_e,backgroundColor:`var(--primary)`}})}),S.map((e,t)=>{let n=e.slug===T;return(0,Y.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>pe(t,e.slug),className:oe(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*aa+16}px`},title:e.text,children:e.text},t)})]}),t[35]=T,t[36]=b,t[37]=pe,t[38]=S,t[39]=y,t[40]=D,t[41]=O,t[42]=me,t[43]=E,t[44]=_e,t[45]=ge,t[46]=j):j=t[46];let M;t[47]!==y||t[48]!==j?(M=(0,Y.jsx)(s,{className:`px-3 py-2`,"aria-busy":y,children:j}),t[47]=y,t[48]=j,t[49]=M):M=t[49];let N;return t[50]!==m||t[51]!==A||t[52]!==M?(N=(0,Y.jsxs)(d,{className:m,children:[A,M]}),t[50]=m,t[51]=A,t[52]=M,t[53]=N):N=t[53],N}function da(e,t){return Math.max(e,t.level)}function fa(e){return e.slug}function pa(e){if(!e)return`plaintext`;if(e.types.includes(`vscode-editor-data`))return`vscode`;if(e.types.includes(`text/x-gfm`))return`gfm`;let t=e.getData(`text/html`);return t?/data-pm-slice/i.test(t)?`pm-origin`:/docs-internal-guid-/i.test(t)?`gdocs`:/xmlns:o="urn:schemas-microsoft-com:office/i.test(t)||/<meta[^>]*Generator[^>]*Microsoft Word/i.test(t)?`word`:/class="gmail_|class='gmail_/i.test(t)?`gmail`:/notionvc:/i.test(t)?`notion`:/Cocoa HTML Writer/i.test(t)?`apple`:/c-message_kit__|c-message__|c-compose/i.test(t)?`slack`:/google-sheets-html-origin/i.test(t)?`gsheets`:/data-hovercard-type=/i.test(t)?`github`:`generic`:`plaintext`}var ma=250,ha=100;function X(e,t){let n=performance.now()-e;n<(t.op===`paste`?ma:ha)||console.warn(JSON.stringify({event:`clipboard-slow-op`,op:t.op,view:t.view,elapsedMs:Math.round(n),branch:t.branch,source:t.source,...t.htmlBytes==null?{}:{htmlBytes:t.htmlBytes}}))}function Z(e){console.warn(JSON.stringify({event:`clipboard-source-detected`,view:e.view,source:e.source,branch:e.branch}))}function Q(e){console.warn(JSON.stringify({event:`clipboard-html-conversion-failed`,view:e.view,stage:e.stage,source:e.source,...e.branch==null?{}:{branch:e.branch},reason:e.reason,...e.errorClass==null?{}:{errorClass:e.errorClass},...e.htmlBytes==null?{}:{htmlBytes:e.htmlBytes}}))}function ga(e){console.warn(JSON.stringify({event:`clipboard-serialize-failed`,view:e.view,kind:e.kind,reason:e.reason}))}function _a(e){console.warn(JSON.stringify({event:`clipboard-chunked-insert-failed`,view:e.view,chunksCompleted:e.chunksCompleted,totalChunks:e.totalChunks,bytesWritten:e.bytesWritten,bytesRemaining:e.bytesRemaining,reason:e.reason}))}function $(e){if(e instanceof ie)return`HtmlPayloadTooLargeError`;if(e instanceof p)return`ChunkedInsertError`;if(e instanceof Error&&e.name&&e.name!==`Error`)return e.name}var va=/^```/m,ya=/^#{1,6} /m,ba=/^[-*+] /m,xa=/^\d+[.)] /m,Sa=/\[[^\]\n]+\]\([^)\n]+\)/,Ca=/^\|.*\|$/m,wa=/^\|?\s*(:?-+:?)(\s*\|\s*:?-+:?)+\s*\|?$/m,Ta=/\$\$[\s\S]+?\$\$/;function Ea(e){if(!e)return!1;let t=0;va.test(e)&&t++,ya.test(e)&&t++,ba.test(e)&&t++,xa.test(e)&&t++,Sa.test(e)&&t++,Ca.test(e)&&wa.test(e)&&t++,Ta.test(e)&&t++;let n=e.split(`
3
- `).length,r=Math.min(3,Math.floor(n/5));return t>=Math.max(1,r)}var Da=3e3,Oa=new Map;function ka(e,t=`Pasted as plain text — some formatting could not be converted.`){let n=Date.now();return n-(Oa.get(e)??0)<Da?!1:(Oa.set(e,n),v.error(t),!0)}var Aa=!1,ja=!1;function Ma(e){Aa=e.shiftKey}function Na(e){(e.key===`Shift`||!e.shiftKey)&&(Aa=!1)}function Pa(){Aa=!1}function Fa(){ja||typeof window>`u`||(window.addEventListener(`keydown`,Ma,!0),window.addEventListener(`keyup`,Na,!0),window.addEventListener(`blur`,Pa,!0),ja=!0)}function Ia(){Fa()}function La(){return Fa(),Aa}function Ra(e){return La()?!0:e.shiftKey===!0}function za(e){return(t,n)=>{let r=n.clipboardData;if(!r||r.types.length===0)return!1;let i=performance.now(),a=pa(r),o=r.getData(`text/plain`),s=r.getData(`text/html`);if(Ra(n))return o&&Va(t,o),Z({view:`wysiwyg`,branch:`shift`,source:a}),X(i,{op:`paste`,view:`wysiwyg`,branch:`shift`,source:a}),!0;if(Ba(t))return o&&Va(t,o),Z({view:`wysiwyg`,branch:`codeblock`,source:a}),X(i,{op:`paste`,view:`wysiwyg`,branch:`codeblock`,source:a}),!0;let c=r.getData(`vscode-editor-data`);if(c&&o&&Ua(t,c,o,a))return Z({view:`wysiwyg`,branch:`A`,source:a}),X(i,{op:`paste`,view:`wysiwyg`,branch:`A`,source:a}),!0;let l=r.getData(`text/x-gfm`);return l&&Wa(t,l,e,`B`,a)?(Z({view:`wysiwyg`,branch:`B`,source:a}),X(i,{op:`paste`,view:`wysiwyg`,branch:`B`,source:a}),!0):s&&/data-pm-slice/i.test(s)?(Z({view:`wysiwyg`,branch:`C`,source:a}),X(i,{op:`paste`,view:`wysiwyg`,branch:`C`,source:a}),!1):o&&s&&Ea(o)&&Wa(t,o,e,`B`,a)?(Z({view:`wysiwyg`,branch:`B`,source:a}),X(i,{op:`paste`,view:`wysiwyg`,branch:`B`,source:a}),!0):s&&Ga(t,s,e,a)?(Z({view:`wysiwyg`,branch:`D`,source:a}),X(i,{op:`paste`,view:`wysiwyg`,branch:`D`,source:a,htmlBytes:s.length}),!0):o?Ea(o)&&Wa(t,o,e,`E`,`markdown-text`)?(Z({view:`wysiwyg`,branch:`E`,source:`markdown-text`}),X(i,{op:`paste`,view:`wysiwyg`,branch:`E`,source:`markdown-text`}),!0):(Va(t,o),Z({view:`wysiwyg`,branch:`E`,source:`plaintext`}),X(i,{op:`paste`,view:`wysiwyg`,branch:`E`,source:`plaintext`}),!0):!1}}function Ba(e){let{$from:t}=e.state.selection;for(let e=t.depth;e>=0;e--)if(t.node(e).type.name===`codeBlock`)return!0;return!1}function Va(e,t){let{schema:n,tr:r}=e.state;t&&e.dispatch(r.replaceSelectionWith(n.text(t)).scrollIntoView())}var Ha=/^[A-Za-z0-9_+-]+$/;function Ua(e,t,n,r){try{let r=JSON.parse(t),i=typeof r.mode==`string`?r.mode:``,a=Ha.test(i)?i:``,o=e.state.schema.nodes.codeBlock;if(!o)return!1;let s=o.create({language:a},n?e.state.schema.text(n):null);return e.dispatch(e.state.tr.replaceSelectionWith(s).scrollIntoView()),!0}catch(e){return Q({view:`wysiwyg`,stage:`branchA`,source:r,branch:`A`,reason:e?.message??`unknown`,errorClass:$(e)}),!1}}function Wa(e,t,n,r,i){let a;try{a=n.mdManager.parse(t)}catch(e){return Q({view:`wysiwyg`,stage:`mdManagerParse`,source:i,branch:r,reason:e?.message??`unknown`,errorClass:$(e)}),!1}return Ka(e,a,i,r)}function Ga(e,t,n,r){let i;try{i=ne(t)}catch(e){return Q({view:`wysiwyg`,stage:`htmlToMdast`,source:r,branch:`D`,reason:e?.message??`unknown`,errorClass:$(e),htmlBytes:t.length}),ka(`wysiwyg`),!1}let a;try{a=ae(i)}catch(e){return Q({view:`wysiwyg`,stage:`mdastToMarkdown`,source:r,branch:`D`,reason:e?.message??`unknown`,errorClass:$(e),htmlBytes:t.length}),ka(`wysiwyg`),!1}let o;try{o=n.mdManager.parse(a)}catch(e){return Q({view:`wysiwyg`,stage:`mdManagerParse`,source:r,branch:`D`,reason:e?.message??`unknown`,errorClass:$(e),htmlBytes:t.length}),ka(`wysiwyg`),!1}return Ka(e,o,r,`D`,t.length)}function Ka(e,t,n,r,i){try{let n=e.state.schema.nodeFromJSON(t);return e.dispatch(e.state.tr.replaceSelection(n.slice(0,n.content.size)).scrollIntoView()),!0}catch(e){return Q({view:`wysiwyg`,stage:`applyJsonSlice`,source:n,branch:r,reason:e?.message??`unknown`,errorClass:$(e),...i==null?{}:{htmlBytes:i}}),!1}}function qa(e){return(t,n)=>{try{return Xa(t,n.state.schema,e.mdManager)}catch(e){return console.warn(`[clipboard] text serialize fell through — PM default textBetween`,e),t.content.textBetween(0,t.content.size,`
4
-
5
- `)}}}var Ja=class extends te{mdManager;constructor(e){super({},{}),this.mdManager=e}serializeFragment(e,t,n){try{let t=e.firstChild?.type.schema;if(!t)return n??document.createDocumentFragment();let r=$a(Za(e,t,this.mdManager));if(n){for(let e of Array.from(r.childNodes))n.appendChild(e);return n}return r}catch(e){return console.warn(`[clipboard] HTML serialize fell through — PM default DOMSerializer`,e),n??document.createDocumentFragment()}}};function Ya(e){return new Ja(e.mdManager)}function Xa(e,t,n){return n.serialize(Qa(e,t))}function Za(e,t,n){return m(Xa(new h(e,0,0),t,n))}function Qa(e,t){let n=t.topNodeType.createAndFill(null,e.content);if(!n){let e=t.topNodeType.createAndFill();if(!e)throw Error(`[clipboard] schema cannot fill topNodeType`);return e.toJSON()}return n.toJSON()}function $a(e){let t=new DOMParser().parseFromString(e,`text/html`),n=document.createDocumentFragment();for(let e of Array.from(t.body.childNodes))n.appendChild(e);return n}function eo(e){return Ia(),P.domEventHandlers({copy:(e,t)=>to(e,t,`copy`),cut:(e,t)=>to(e,t,`cut`),paste:(t,n)=>no(t,n,e)})}function to(e,t,n){let{from:r,to:i}=t.state.selection.main;if(r===i)return e.preventDefault(),!0;let a=e.clipboardData;if(!a)return!1;let o=performance.now();try{let s=t.state.sliceDoc(r,i);a.setData(`text/plain`,s);try{a.setData(`text/html`,m(s))}catch(e){ga({view:`source`,kind:`html`,reason:e?.message??`unknown`})}return e.preventDefault(),n===`cut`&&t.dispatch({changes:{from:r,to:i,insert:``}}),X(o,{op:n,view:`source`,branch:`serialize`,source:`local`}),!0}catch(e){return ga({view:`source`,kind:`text`,reason:e?.message??`unknown`}),!1}}function no(e,t,n){let r=e.clipboardData;if(!r||r.types.length===0)return!1;let i=performance.now(),a=pa(r),o=r.getData(`text/plain`),s=r.getData(`text/html`);if(Ra(e))return Z({view:`source`,branch:`shift`,source:a}),X(i,{op:`paste`,view:`source`,branch:`shift`,source:a}),!1;let c=r.getData(`vscode-editor-data`);return c&&o&&io(t,c,o,a)?(e.preventDefault(),Z({view:`source`,branch:`A`,source:a}),X(i,{op:`paste`,view:`source`,branch:`A`,source:a}),!0):s&&/data-pm-slice/i.test(s)?(Z({view:`source`,branch:`C`,source:a}),X(i,{op:`paste`,view:`source`,branch:`C`,source:a}),!1):s&&ao(t,s,n,a)?(e.preventDefault(),Z({view:`source`,branch:`D`,source:a}),X(i,{op:`paste`,view:`source`,branch:`D`,source:a,htmlBytes:s.length}),!0):(Z({view:`source`,branch:`E`,source:a}),X(i,{op:`paste`,view:`source`,branch:`E`,source:a}),!1)}var ro=/^[A-Za-z0-9_+-]+$/;function io(e,t,n,r){try{let r=JSON.parse(t),i=typeof r.mode==`string`?r.mode:``,a=`\`\`\`${ro.test(i)?i:``}\n${n}\n\`\`\`\n`,{from:o,to:s}=e.state.selection.main;return e.dispatch({changes:{from:o,to:s,insert:a},selection:{anchor:o+a.length}}),!0}catch(e){return Q({view:`source`,stage:`branchA`,source:r,branch:`A`,reason:e?.message??`unknown`,errorClass:$(e)}),!1}}function ao(e,t,n,r){let i;try{i=ne(t)}catch(e){return Q({view:`source`,stage:`htmlToMdast`,source:r,branch:`D`,reason:e?.message??`unknown`,errorClass:$(e),htmlBytes:t.length}),!1}let a;try{a=ae(i)}catch(e){return Q({view:`source`,stage:`mdastToMarkdown`,source:r,branch:`D`,reason:e?.message??`unknown`,errorClass:$(e),htmlBytes:t.length}),!1}let{from:o,to:s}=e.state.selection.main;if(!(a.length>500*1024))return e.dispatch({changes:{from:o,to:s,insert:a},selection:{anchor:o+a.length}}),!0;let c=o===s?``:e.state.sliceDoc(o,s);o!==s&&e.dispatch({changes:{from:o,to:s,insert:``}});let l=o,u=ce(n.ytext,l);return ee(n.ydoc,n.ytext,l,a,{resolveOffset:e=>{let t=g(u,n.ydoc);return t==null?e:t.index+(e-l)}}).catch(i=>{oo({view:e,source:r,html:t,restoreText:c,anchorIndex:l,anchorRelPos:u,ydoc:n.ydoc,err:i})}),!0}function oo(e){let{view:t,source:n,html:r,restoreText:i,anchorIndex:a,anchorRelPos:o,ydoc:s,err:c}=e;if(c instanceof p&&c.bytesWritten>0){let e=o&&s?g(o,s)?.index??a:a,n=Math.min(e+c.bytesWritten,t.state.doc.length);try{t.dispatch({changes:{from:e,to:n,insert:i}})}catch(e){console.warn(`[clipboard] partial-chunk rollback dispatch failed`,e)}}else if(i.length>0)try{t.dispatch({changes:{from:a,to:a,insert:i}})}catch(e){console.warn(`[clipboard] selection-restore dispatch failed`,e)}if(c instanceof p){_a({view:`source`,chunksCompleted:c.chunksCompleted,totalChunks:c.totalChunks,bytesWritten:c.bytesWritten,bytesRemaining:c.bytesRemaining,reason:c.message}),v.error(`Paste was incomplete — ${c.chunksCompleted} of ${c.totalChunks} chunks landed. Your selection has been restored.`);return}Q({view:`source`,stage:`chunkedYTextInsert`,source:n,branch:`D`,reason:c?.message??`unknown`,errorClass:$(c),htmlBytes:r.length}),v.error(`Paste failed. Your selection has been restored.`)}export{ca as a,vr as c,Ze as d,za as i,$e as l,Ya as n,la as o,qa as r,Qi as s,eo as t,Qe as u};
@@ -1,45 +0,0 @@
1
- import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{S as i,a,c as o,d as s,f as c,g as l,i as u,n as d,o as f,p,r as m,s as h,t as g,u as _,x as v,y}from"./button-CXhPNzpp.js";var b=v(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),x=e(t(),1),ee=e(i(),1);function S(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var C=e=>{switch(e){case`success`:return T;case`info`:return E;case`warning`:return ne;case`error`:return D;default:return null}},w=Array(12).fill(0),te=({visible:e,className:t})=>x.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},x.createElement(`div`,{className:`sonner-spinner`},w.map((e,t)=>x.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),T=x.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},x.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),ne=x.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},x.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),E=x.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},x.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),D=x.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},x.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),re=x.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},x.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),x.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),ie=()=>{let[e,t]=x.useState(document.hidden);return x.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},O=1,k=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:O++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],x.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(j(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!x.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!x.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!x.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!x.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||O++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},A=(e,t)=>{let n=t?.id||O++;return k.addToast({title:e,...t,id:n}),n},j=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,ae=Object.assign(A,{success:k.success,info:k.info,warning:k.warning,error:k.error,custom:k.custom,message:k.message,promise:k.promise,dismiss:k.dismiss,loading:k.loading},{getHistory:()=>k.toasts,getToasts:()=>k.getActiveToasts()});S(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function M(e){return e.label!==void 0}var oe=3,N=`24px`,se=`16px`,ce=4e3,le=356,ue=14,de=45,fe=200;function P(...e){return e.filter(Boolean).join(` `)}function pe(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var me=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:ee,expandByDefault:S,classNames:w,icons:T,closeButtonAriaLabel:ne=`Close toast`}=e,[E,D]=x.useState(null),[O,k]=x.useState(null),[A,j]=x.useState(!1),[ae,oe]=x.useState(!1),[N,se]=x.useState(!1),[le,ue]=x.useState(!1),[me,he]=x.useState(!1),[ge,_e]=x.useState(0),[F,I]=x.useState(0),L=x.useRef(n.duration||y||ce),ve=x.useRef(null),R=x.useRef(null),ye=c===0,be=c+1<=o,z=n.type,B=n.dismissible!==!1,xe=n.className||``,Se=n.descriptionClassName||``,V=x.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),H=x.useMemo(()=>n.closeButton??p,[n.closeButton,p]),Ce=x.useMemo(()=>n.duration||y||ce,[n.duration,y]),we=x.useRef(0),U=x.useRef(0),Te=x.useRef(0),W=x.useRef(null),[Ee,De]=b.split(`-`),G=x.useMemo(()=>s.reduce((e,t,n)=>n>=V?e:e+t.height,0),[s,V]),Oe=ie(),ke=n.invert||t,K=z===`loading`;U.current=x.useMemo(()=>V*ee+G,[V,G]),x.useEffect(()=>{L.current=Ce},[Ce]),x.useEffect(()=>{j(!0)},[]),x.useEffect(()=>{let e=R.current;if(e){let t=e.getBoundingClientRect().height;return I(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),x.useLayoutEffect(()=>{if(!A)return;let e=R.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,I(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let q=x.useCallback(()=>{oe(!0),_e(U.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},fe)},[n,d,a,U]);x.useEffect(()=>{if(n.promise&&z===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Oe?(()=>{if(Te.current<we.current){let e=new Date().getTime()-we.current;L.current-=e}Te.current=new Date().getTime()})():L.current!==1/0&&(we.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),q()},L.current)),()=>clearTimeout(e)},[u,i,n,z,Oe,q]),x.useEffect(()=>{n.delete&&(q(),n.onDismiss==null||n.onDismiss.call(n,n))},[q,n.delete]);function Ae(){return T?.loading?x.createElement(`div`,{className:P(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":z===`loading`},T.loading):x.createElement(te,{className:P(w?.loader,n?.classNames?.loader),visible:z===`loading`})}let je=n.icon||T?.[z]||C(z);return x.createElement(`li`,{tabIndex:0,ref:R,className:P(_,xe,w?.toast,n?.classNames?.toast,w?.default,w?.[z],n?.classNames?.[z]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":A,"data-promise":!!n.promise,"data-swiped":me,"data-removed":ae,"data-visible":be,"data-y-position":Ee,"data-x-position":De,"data-index":c,"data-front":ye,"data-swiping":N,"data-dismissible":B,"data-type":z,"data-invert":ke,"data-swipe-out":le,"data-swipe-direction":O,"data-expanded":!!(u||S&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${ae?ge:U.current}px`,"--initial-height":S?`auto`:`${F}px`,...m,...n.style},onDragEnd:()=>{se(!1),D(null),W.current=null},onPointerDown:e=>{e.button!==2&&(K||!B||(ve.current=new Date,_e(U.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(se(!0),W.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(le||!B)return;W.current=null;let e=Number(R.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(R.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ve.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=de||a>.11){_e(U.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),q(),ue(!0);return}else{var o,s;(o=R.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=R.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}he(!1),se(!1),D(null)},onPointerMove:t=>{var n,r;if(!W.current||!B||window.getSelection()?.toString().length>0)return;let i=t.clientY-W.current.y,a=t.clientX-W.current.x,o=e.swipeDirections??pe(b);!E&&(Math.abs(a)>1||Math.abs(i)>1)&&D(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(E===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&he(!0),(n=R.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=R.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},H&&!n.jsx&&z!==`loading`?x.createElement(`button`,{"aria-label":ne,"data-disabled":K,"data-close-button":!0,onClick:K||!B?()=>{}:()=>{q(),n.onDismiss==null||n.onDismiss.call(n,n)},className:P(w?.closeButton,n?.classNames?.closeButton)},T?.close??re):null,(z||n.icon||n.promise)&&n.icon!==null&&(T?.[z]!==null||n.icon)?x.createElement(`div`,{"data-icon":``,className:P(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ae():null,n.type===`loading`?null:je):null,x.createElement(`div`,{"data-content":``,className:P(w?.content,n?.classNames?.content)},x.createElement(`div`,{"data-title":``,className:P(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?x.createElement(`div`,{"data-description":``,className:P(v,Se,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),x.isValidElement(n.cancel)?n.cancel:n.cancel&&M(n.cancel)?x.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{M(n.cancel)&&B&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),q())},className:P(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,x.isValidElement(n.action)?n.action:n.action&&M(n.action)?x.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{M(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&q())},className:P(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function he(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function ge(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?se:N;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var _e=x.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=oe,toastOptions:g,dir:_=he(),gap:v=ue,icons:y,containerAriaLabel:b=`Notifications`}=e,[S,C]=x.useState([]),w=x.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),te=x.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[T,ne]=x.useState([]),[E,D]=x.useState(!1),[re,ie]=x.useState(!1),[O,A]=x.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),j=x.useRef(null),ae=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),M=x.useRef(null),N=x.useRef(!1),se=x.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||k.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return x.useEffect(()=>k.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{ee.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[S]),x.useEffect(()=>{if(d!==`system`){A(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?A(`dark`):A(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{A(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{A(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),x.useEffect(()=>{S.length<=1&&D(!1)},[S]),x.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;D(!0),(t=j.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===j.current||j.current?.contains(document.activeElement))&&D(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),x.useEffect(()=>{if(j.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,N.current=!1)}},[j.current]),x.createElement(`section`,{ref:t,"aria-label":`${b} ${ae}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},te.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?x.createElement(`ol`,{key:t,dir:_===`auto`?he():_,tabIndex:-1,ref:j,className:c,"data-sonner-toaster":!0,"data-sonner-theme":O,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${le}px`,"--gap":`${v}px`,...m,...ge(l,u)},onBlur:e=>{N.current&&!e.currentTarget.contains(e.relatedTarget)&&(N.current=!1,M.current&&=(M.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||N.current||(N.current=!0,M.current=e.relatedTarget)},onMouseEnter:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{re||D(!1)},onDragEnd:()=>D(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ie(!0)},onPointerUp:()=>ie(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>x.createElement(me,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:re,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:se,toasts:w.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:ne,expandByDefault:o,gap:v,expanded:E,swipeDirections:e.swipeDirections}))):null}))}),F=n(),I=`focusScope.autoFocusOnMount`,L=`focusScope.autoFocusOnUnmount`,ve={bubbles:!1,cancelable:!0},R=`FocusScope`,ye=x.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[c,l]=x.useState(null),u=a(i),d=a(o),f=x.useRef(null),m=y(t,e=>l(e)),h=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let e=function(e){if(h.paused||!c)return;let t=e.target;c.contains(t)?f.current=t:H(f.current,{select:!0})},t=function(e){if(h.paused||!c)return;let t=e.relatedTarget;t!==null&&(c.contains(t)||H(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&H(c)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,c,h.paused]),x.useEffect(()=>{if(c){Ce.add(h);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(I,ve);c.addEventListener(I,u),c.dispatchEvent(t),t.defaultPrevented||(be(Te(B(c)),{select:!0}),document.activeElement===e&&H(c))}return()=>{c.removeEventListener(I,u),setTimeout(()=>{let t=new CustomEvent(L,ve);c.addEventListener(L,d),c.dispatchEvent(t),t.defaultPrevented||H(e??document.body,{select:!0}),c.removeEventListener(L,d),Ce.remove(h)},0)}}},[c,u,d,h]);let g=x.useCallback(e=>{if(!n&&!r||h.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=z(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&H(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&H(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,h.paused]);return(0,F.jsx)(p.div,{tabIndex:-1,...s,ref:m,onKeyDown:g})});ye.displayName=R;function be(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(H(r,{select:t}),document.activeElement!==n)return}function z(e){let t=B(e);return[xe(t,e),xe(t.reverse(),e)]}function B(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function xe(e,t){for(let n of e)if(!Se(n,{upTo:t}))return n}function Se(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function V(e){return e instanceof HTMLInputElement&&`select`in e}function H(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&V(e)&&t&&e.select()}}var Ce=we();function we(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=U(e,t),e.unshift(t)},remove(t){e=U(e,t),e[0]?.resume()}}}function U(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Te(e){return e.filter(e=>e.tagName!==`A`)}var W=0;function Ee(){x.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??De()),document.body.insertAdjacentElement(`beforeend`,e[1]??De()),W++,()=>{W===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),W--}},[])}function De(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var G=function(){return G=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},G.apply(this,arguments)};function Oe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ke(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var K=`right-scroll-bar-position`,q=`width-before-scroll-bar`,Ae=`with-scroll-bars-hidden`,je=`--removed-body-scroll-bar-size`;function Me(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ne(e,t){var n=(0,x.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Pe=typeof window<`u`?x.useLayoutEffect:x.useEffect,Fe=new WeakMap;function Ie(e,t){var n=Ne(t||null,function(t){return e.forEach(function(e){return Me(e,t)})});return Pe(function(){var t=Fe.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Me(e,null)}),i.forEach(function(e){r.has(e)||Me(e,a)})}Fe.set(n,e)},[e]),n}function Le(e){return e}function Re(e,t){t===void 0&&(t=Le);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function ze(e){e===void 0&&(e={});var t=Re(null);return t.options=G({async:!0,ssr:!1},e),t}var Be=function(e){var t=e.sideCar,n=Oe(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return x.createElement(r,G({},n))};Be.isSideCarExport=!0;function Ve(e,t){return e.useMedium(t),Be}var He=ze(),Ue=function(){},We=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Ue,onWheelCapture:Ue,onTouchMoveCapture:Ue}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Oe(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),ee=f,S=Ie([n,t]),C=G(G({},b),i);return x.createElement(x.Fragment,null,u&&x.createElement(ee,{sideCar:He,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?x.cloneElement(x.Children.only(s),G(G({},C),{ref:S})):x.createElement(v,G({},C,{className:c,ref:S}),s))});We.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},We.classNames={fullWidth:q,zeroRight:K};var Ge,Ke=function(){if(Ge)return Ge;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function qe(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ke();return t&&e.setAttribute(`nonce`,t),e}function Je(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ye(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Xe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qe())&&(Je(t,n),Ye(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ze=function(){var e=Xe();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Qe=function(){var e=Ze();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},$e={left:0,top:0,right:0,gap:0},et=function(e){return parseInt(e||``,10)||0},tt=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[et(n),et(r),et(i)]},nt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return $e;var t=tt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},rt=Qe(),it=`data-scroll-locked`,at=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
- .${Ae} {
3
- overflow: hidden ${r};
4
- padding-right: ${s}px ${r};
5
- }
6
- body[${it}] {
7
- overflow: hidden ${r};
8
- overscroll-behavior: contain;
9
- ${[t&&`position: relative ${r};`,n===`margin`&&`
10
- padding-left: ${i}px;
11
- padding-top: ${a}px;
12
- padding-right: ${o}px;
13
- margin-left:0;
14
- margin-top:0;
15
- margin-right: ${s}px ${r};
16
- `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
- }
18
-
19
- .${K} {
20
- right: ${s}px ${r};
21
- }
22
-
23
- .${q} {
24
- margin-right: ${s}px ${r};
25
- }
26
-
27
- .${K} .${K} {
28
- right: 0 ${r};
29
- }
30
-
31
- .${q} .${q} {
32
- margin-right: 0 ${r};
33
- }
34
-
35
- body[${it}] {
36
- ${je}: ${s}px;
37
- }
38
- `},ot=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},st=function(){x.useEffect(function(){return document.body.setAttribute(it,(ot()+1).toString()),function(){var e=ot()-1;e<=0?document.body.removeAttribute(it):document.body.setAttribute(it,e.toString())}},[])},ct=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;st();var a=x.useMemo(function(){return nt(i)},[i]);return x.createElement(rt,{styles:at(a,!t,i,n?``:`!important`)})},lt=!1;if(typeof window<`u`)try{var ut=Object.defineProperty({},`passive`,{get:function(){return lt=!0,!0}});window.addEventListener(`test`,ut,ut),window.removeEventListener(`test`,ut,ut)}catch{lt=!1}var J=lt?{passive:!1}:!1,dt=function(e){return e.tagName===`TEXTAREA`},ft=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!dt(e)&&n[t]===`visible`)},pt=function(e){return ft(e,`overflowY`)},mt=function(e){return ft(e,`overflowX`)},ht=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),vt(e,r)){var i=yt(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},gt=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},_t=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},vt=function(e,t){return e===`v`?pt(t):mt(t)},yt=function(e,t){return e===`v`?gt(t):_t(t)},bt=function(e,t){return e===`h`&&t===`rtl`?-1:1},xt=function(e,t,n,r,i){var a=bt(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=yt(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&vt(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},St=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ct=function(e){return[e.deltaX,e.deltaY]},wt=function(e){return e&&`current`in e?e.current:e},Tt=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Et=function(e){return`
39
- .block-interactivity-${e} {pointer-events: none;}
40
- .allow-interactivity-${e} {pointer-events: all;}
41
- `},Dt=0,Y=[];function Ot(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),i=x.useState(Dt++)[0],a=x.useState(Qe)[0],o=x.useRef(e);x.useEffect(function(){o.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=ke([e.lockRef.current],(e.shards||[]).map(wt),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=x.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=St(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ht(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ht(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return xt(h,t,e,h===`h`?s:c,!0)},[]),c=x.useCallback(function(e){var n=e;if(!(!Y.length||Y[Y.length-1]!==a)){var r=`deltaY`in n?Ct(n):St(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Tt(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(wt).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=x.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:kt(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=x.useCallback(function(e){n.current=St(e),r.current=void 0},[]),d=x.useCallback(function(t){l(t.type,Ct(t),t.target,s(t,e.lockRef.current))},[]),f=x.useCallback(function(t){l(t.type,St(t),t.target,s(t,e.lockRef.current))},[]);x.useEffect(function(){return Y.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,J),document.addEventListener(`touchmove`,c,J),document.addEventListener(`touchstart`,u,J),function(){Y=Y.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,J),document.removeEventListener(`touchmove`,c,J),document.removeEventListener(`touchstart`,u,J)}},[]);var p=e.removeScrollBar,m=e.inert;return x.createElement(x.Fragment,null,m?x.createElement(a,{styles:Et(i)}):null,p?x.createElement(ct,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function kt(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var At=Ve(He,Ot),jt=x.forwardRef(function(e,t){return x.createElement(We,G({},e,{ref:t,sideCar:At}))});jt.classNames=We.classNames;var Mt=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},X=new WeakMap,Nt=new WeakMap,Pt={},Ft=0,It=function(e){return e&&(e.host||It(e.parentNode))},Lt=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=It(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Rt=function(e,t,n,r){var i=Lt(t,Array.isArray(e)?e:[e]);Pt[n]||(Pt[n]=new WeakMap);var a=Pt[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(X.get(e)||0)+1,l=(a.get(e)||0)+1;X.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Nt.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Ft++,function(){o.forEach(function(e){var t=X.get(e)-1,i=a.get(e)-1;X.set(e,t),a.set(e,i),t||(Nt.has(e)||e.removeAttribute(r),Nt.delete(e)),i||e.removeAttribute(n)}),Ft--,Ft||(X=new WeakMap,X=new WeakMap,Nt=new WeakMap,Pt={})}},zt=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Mt(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Rt(r,i,n,`aria-hidden`)):function(){return null}},Bt=`Dialog`,[Vt,Ht]=c(Bt),[Ut,Z]=Vt(Bt),Wt=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:s=!0}=e,c=x.useRef(null),l=x.useRef(null),[u,d]=o({prop:r,defaultProp:i??!1,onChange:a,caller:Bt});return(0,F.jsx)(Ut,{scope:t,triggerRef:c,contentRef:l,contentId:f(),titleId:f(),descriptionId:f(),open:u,onOpenChange:d,onOpenToggle:x.useCallback(()=>d(e=>!e),[d]),modal:s,children:n})};Wt.displayName=Bt;var Gt=`DialogTrigger`,Kt=x.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Z(Gt,n),a=y(t,i.triggerRef);return(0,F.jsx)(p.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":fn(i.open),...r,ref:a,onClick:_(e.onClick,i.onOpenToggle)})});Kt.displayName=Gt;var qt=`DialogPortal`,[Jt,Yt]=Vt(qt,{forceMount:void 0}),Xt=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Z(qt,t);return(0,F.jsx)(Jt,{scope:t,forceMount:n,children:x.Children.map(r,e=>(0,F.jsx)(h,{present:n||a.open,children:(0,F.jsx)(m,{asChild:!0,container:i,children:e})}))})};Xt.displayName=qt;var Zt=`DialogOverlay`,Qt=x.forwardRef((e,t)=>{let n=Yt(Zt,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Z(Zt,e.__scopeDialog);return a.modal?(0,F.jsx)(h,{present:r||a.open,children:(0,F.jsx)(en,{...i,ref:t})}):null});Qt.displayName=Zt;var $t=l(`DialogOverlay.RemoveScroll`),en=x.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Z(Zt,n);return(0,F.jsx)(jt,{as:$t,allowPinchZoom:!0,shards:[i.contentRef],children:(0,F.jsx)(p.div,{"data-state":fn(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Q=`DialogContent`,tn=x.forwardRef((e,t)=>{let n=Yt(Q,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Z(Q,e.__scopeDialog);return(0,F.jsx)(h,{present:r||a.open,children:a.modal?(0,F.jsx)(nn,{...i,ref:t}):(0,F.jsx)(rn,{...i,ref:t})})});tn.displayName=Q;var nn=x.forwardRef((e,t)=>{let n=Z(Q,e.__scopeDialog),r=x.useRef(null),i=y(t,n.contentRef,r);return x.useEffect(()=>{let e=r.current;if(e)return zt(e)},[]),(0,F.jsx)(an,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:_(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:_(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:_(e.onFocusOutside,e=>e.preventDefault())})}),rn=x.forwardRef((e,t)=>{let n=Z(Q,e.__scopeDialog),r=x.useRef(!1),i=x.useRef(!1);return(0,F.jsx)(an,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),an=x.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Z(Q,n),c=x.useRef(null),l=y(t,c);return Ee(),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(ye,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,F.jsx)(u,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":fn(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(gn,{titleId:s.titleId}),(0,F.jsx)(vn,{contentRef:c,descriptionId:s.descriptionId})]})]})}),on=`DialogTitle`,sn=x.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Z(on,n);return(0,F.jsx)(p.h2,{id:i.titleId,...r,ref:t})});sn.displayName=on;var cn=`DialogDescription`,ln=x.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Z(cn,n);return(0,F.jsx)(p.p,{id:i.descriptionId,...r,ref:t})});ln.displayName=cn;var un=`DialogClose`,dn=x.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Z(un,n);return(0,F.jsx)(p.button,{type:`button`,...r,ref:t,onClick:_(e.onClick,()=>i.onOpenChange(!1))})});dn.displayName=un;function fn(e){return e?`open`:`closed`}var pn=`DialogTitleWarning`,[mn,hn]=s(pn,{contentName:Q,titleName:on,docsSlug:`dialog`}),gn=({titleId:e})=>{let t=hn(pn),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
42
-
43
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
44
-
45
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},_n=`DialogDescriptionWarning`,vn=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hn(_n).contentName}}.`;return x.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},yn=Wt,bn=Xt,xn=Qt,Sn=tn,Cn=sn,wn=ln,Tn=dn,$=r();function En(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,F.jsx)(yn,{"data-slot":`dialog`,...n}),t[2]=n,t[3]=r),r}function Dn(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,F.jsx)(bn,{"data-slot":`dialog-portal`,...n}),t[2]=n,t[3]=r),r}function On(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,F.jsx)(Tn,{"data-slot":`dialog-close`,className:`font-mono uppercase`,...n}),t[2]=n,t[3]=r),r}function kn(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=d(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,F.jsx)(xn,{"data-slot":`dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function An(e){let t=(0,$.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,showCloseButton:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?!0:a,s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(kn,{}),t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=d(`fixed top-1/2 left-1/2 z-50 flex w-full max-h-[calc(100dvh-2rem)] max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col gap-6 overflow-hidden rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,r),t[6]=r,t[7]=c);let l;t[8]===o?l=t[9]:(l=o&&(0,F.jsx)(Tn,{"data-slot":`dialog-close`,asChild:!0,children:(0,F.jsxs)(g,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,F.jsx)(b,{}),(0,F.jsx)(`span`,{className:`sr-only`,children:`Close`})]})}),t[8]=o,t[9]=l);let u;return t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==l?(u=(0,F.jsxs)(Dn,{children:[s,(0,F.jsxs)(Sn,{"data-slot":`dialog-content`,className:c,...i,children:[n,l]})]}),t[10]=n,t[11]=i,t[12]=c,t[13]=l,t[14]=u):u=t[14],u}function jn(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=d(`flex shrink-0 flex-col gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,F.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mn(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=d(`-mx-6 min-h-0 flex-1 overflow-y-auto px-6 subtle-scrollbar scroll-fade-mask`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,F.jsx)(`div`,{"data-slot":`dialog-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nn(e){let t=(0,$.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,showCloseButton:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?!1:a,s;t[5]===r?s=t[6]:(s=d(`-mx-6 -mb-6 flex shrink-0 flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 px-6 py-4 sm:flex-row sm:justify-end`,r),t[5]=r,t[6]=s);let c;t[7]===o?c=t[8]:(c=o&&(0,F.jsx)(Tn,{asChild:!0,children:(0,F.jsx)(g,{variant:`outline`,children:`Close`})}),t[7]=o,t[8]=c);let l;return t[9]!==n||t[10]!==i||t[11]!==s||t[12]!==c?(l=(0,F.jsxs)(`div`,{"data-slot":`dialog-footer`,className:s,...i,children:[n,c]}),t[9]=n,t[10]=i,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Pn(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=d(`font-heading text-base leading-none font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,F.jsx)(Cn,{"data-slot":`dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fn(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=d(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,F.jsx)(wn,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}export{b as S,jt as _,Fn as a,_e as b,Pn as c,wn as d,xn as f,zt as g,Cn as h,An as i,Tn as l,yn as m,Mn as n,Nn as o,bn as p,On as r,jn as s,En as t,Sn as u,Ee as v,ae as x,ye as y};