@inkeep/open-knowledge 0.31.0-beta.4 → 0.31.0-beta.5

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 (74) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +7 -7
  4. package/dist/constants-DK10Qbwz.mjs +2 -0
  5. package/dist/{dist-BX5OZ5Db.mjs → dist-D-bO1Mlq.mjs} +1 -1
  6. package/dist/{dist-DBTiY_Nn.mjs → dist-DEBa6nkk.mjs} +3 -3
  7. package/dist/{gh-detect-CSEtnBcE.mjs → gh-detect-Cm8hekXk.mjs} +2 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/init-BGGQ3ing.mjs +1 -0
  10. package/dist/{init-C0QGLO6F.mjs → init-reB4XeLP.mjs} +3 -3
  11. package/dist/{launch-json-removal-0NlwQB8W.mjs → launch-json-removal-v_ZIEJ04.mjs} +2 -2
  12. package/dist/{loader-C61jjZiw.mjs → loader-C3crD0ZW.mjs} +2 -2
  13. package/dist/loader-pzsmJGfG.mjs +1 -0
  14. package/dist/{open-browser-C2K4_AGB.mjs → open-browser-B5KfPH4H.mjs} +2 -2
  15. package/dist/preview-GYvJ1m2X.mjs +1 -0
  16. package/dist/{preview-BXznrh51.mjs → preview-yptAXY9Q.mjs} +2 -2
  17. package/dist/public/assets/{ActivityModeContent-C1jtV-hU.js → ActivityModeContent-DIN900Tw.js} +1 -1
  18. package/dist/public/assets/{CodeMirrorPropInput-DiXxMe7E.js → CodeMirrorPropInput-ZO7IAXY4.js} +1 -1
  19. package/dist/public/assets/{DocumentContext-5toIZ8hA.js → DocumentContext-yguu7wL1.js} +1 -1
  20. package/dist/public/assets/{EnableSyncConfirmDialog-BRUoKGlI.js → EnableSyncConfirmDialog-CDm2rW8c.js} +1 -1
  21. package/dist/public/assets/{GraphPanel-CAT7ozBx.js → GraphPanel-BSBoTUuF.js} +1 -1
  22. package/dist/public/assets/{ManagedArtifactProperties-CGEPiwpI.js → ManagedArtifactProperties-DCr0fsi-.js} +1 -1
  23. package/dist/public/assets/{McpConsentDialogBody-DfJ3dXdV.js → McpConsentDialogBody-DZr8d0vu.js} +1 -1
  24. package/dist/public/assets/{MermaidDocEditor-Dg8dOZ9W.js → MermaidDocEditor-DqKOZzfV.js} +1 -1
  25. package/dist/public/assets/{PropertyPanel-BMHDSIGn.js → PropertyPanel-C_ExYapZ.js} +1 -1
  26. package/dist/public/assets/{SettingsDialogBody-CfzWeNyS.js → SettingsDialogBody-ILc_zuoi.js} +1 -1
  27. package/dist/public/assets/{ShareBranchSwitchDialog-CWwC7UJv.js → ShareBranchSwitchDialog-Dv66XosJ.js} +1 -1
  28. package/dist/public/assets/{ShareReceiveDialog-4FwHQsF4.js → ShareReceiveDialog-DcJrhi3C.js} +1 -1
  29. package/dist/public/assets/{ShareReceiveMissDialog-o0LerOQ_.js → ShareReceiveMissDialog-8AKkkTF9.js} +1 -1
  30. package/dist/public/assets/{SkillEditorActions-C3Pt-Yag.js → SkillEditorActions-D7GmHyae.js} +1 -1
  31. package/dist/public/assets/{SourceEditor-Bem9oxYY.js → SourceEditor-F7MHMYDQ.js} +1 -1
  32. package/dist/public/assets/{TerminalPanel-Dnfkoo0l.js → TerminalPanel-Z0XhL8rx.js} +1 -1
  33. package/dist/public/assets/{agent-presence-Dp6Wg18I.js → agent-presence-Bf_k8RmI.js} +1 -1
  34. package/dist/public/assets/{auth-state-cache-xkP6pnyp.js → auth-state-cache-Ck3G6jUi.js} +1 -1
  35. package/dist/public/assets/{config-provider-2uXvVEZR.js → config-provider-CQL47dca.js} +1 -1
  36. package/dist/public/assets/{dist-DLPICmSw.js → dist-BmgoHUkm.js} +5 -5
  37. package/dist/public/assets/{dist-C0zHgAnC.js → dist-LUHivJAB.js} +1 -1
  38. package/dist/public/assets/{doc-hash-B37_BwmO.js → doc-hash-W5LZeE0c.js} +1 -1
  39. package/dist/public/assets/{documents-events-Bf8O52Ha.js → documents-events-CijCy-Sc.js} +1 -1
  40. package/dist/public/assets/{file-tree-adapter-3d-SPVop.js → file-tree-adapter-Bjoeiw_B.js} +1 -1
  41. package/dist/public/assets/{index-Byr-pQd3.css → index-A8hej5b5.css} +1 -1
  42. package/dist/public/assets/{index-C6gsky75.js → index-BpZF8EJT.js} +7 -7
  43. package/dist/public/assets/{keyboard-shortcuts-BxD83XhC.js → keyboard-shortcuts-DDw4HRe3.js} +1 -1
  44. package/dist/public/assets/{navigation-targets-DFne-srR.js → navigation-targets-V0noaD6h.js} +1 -1
  45. package/dist/public/assets/{open-managed-artifact-tab-B1BoyKiE.js → open-managed-artifact-tab-_d-k5W-o.js} +1 -1
  46. package/dist/public/assets/{pending-receive-nav-store-DCHjTg-k.js → pending-receive-nav-store-Cqe-Gc-y.js} +1 -1
  47. package/dist/public/assets/{prop-types-DXfg1BnH.js → prop-types-DK0zwiLA.js} +1 -1
  48. package/dist/public/assets/{receive-store-vDvyLF_T.js → receive-store-DIQKaDkz.js} +1 -1
  49. package/dist/public/assets/{selection-context-CaK5JqJX.js → selection-context-D7Vmm-jV.js} +1 -1
  50. package/dist/public/assets/{skill-actions-z_sZDeWy.js → skill-actions-C3jnKy6a.js} +1 -1
  51. package/dist/public/assets/{skills-api-CQ8dGACz.js → skills-api-FVkz2ZvD.js} +1 -1
  52. package/dist/public/assets/{src-D_zlKpkH.js → src-BfQVXkAq.js} +1 -1
  53. package/dist/public/assets/{target-navigation-intent-fp9D_EWj.js → target-navigation-intent-BF4mAnMq.js} +1 -1
  54. package/dist/public/assets/{typing-burst-detector-D2Bw0GR2.js → typing-burst-detector-D0BBhVWB.js} +1 -1
  55. package/dist/public/assets/{workspace-paths-DkmFj3_t.js → workspace-paths-B1R7zp-q.js} +1 -1
  56. package/dist/public/index.html +26 -26
  57. package/dist/{repair-launch-json-CWlCWLWQ.mjs → repair-launch-json-DJL0xXvL.mjs} +2 -2
  58. package/dist/{repair-mcp-configs-D7PsV_5H.mjs → repair-mcp-configs-DsGk5WD7.mjs} +2 -2
  59. package/dist/repair-skills-UdFUgcgx.mjs +1 -0
  60. package/dist/{repair-skills-NaoxQmHc.mjs → repair-skills-wFFbPc3w.mjs} +2 -2
  61. package/dist/server-lock-GuuouVft-CPaJpyJ7.mjs +1 -0
  62. package/dist/{server-lock-iLcBw_q0-CRHu2BK6.mjs → server-lock-iLcBw_q0-CEih6ZHm.mjs} +6 -6
  63. package/dist/{src-CtkUCvS1.mjs → src-DHfQops5.mjs} +2 -2
  64. package/dist/start-esyH-MiN.mjs +1 -0
  65. package/dist/{start-DlaVc6b9.mjs → start-r9b4OB7D.mjs} +2 -2
  66. package/dist/{write-project-skill-DMrjtHrd.mjs → write-project-skill-CAZzOEUh.mjs} +2 -2
  67. package/package.json +1 -1
  68. package/dist/constants-BA922dQX.mjs +0 -2
  69. package/dist/init-B3upuqT1.mjs +0 -1
  70. package/dist/loader-BLESzzLh.mjs +0 -1
  71. package/dist/preview-4OfJtTyQ.mjs +0 -1
  72. package/dist/repair-skills-D3xs9x2T.mjs +0 -1
  73. package/dist/server-lock-GuuouVft-Cz-UWwuo.mjs +0 -1
  74. package/dist/start-D00lFRDq.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"./chunk-CFjPhJqf.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{Bt as a,C as o,E as s,Ht as c,M as l,Qt as u,S as d,T as f,Ut as p,fn as m,lt as h,w as g,x as _}from"./DocumentContext-5toIZ8hA.js";import{n as v,r as y}from"./dist-CQw2y-s3.js";import{n as b}from"./dist-BVOt51sU.js";import{i as x,n as S,t as C,u as w}from"./createLucideIcon-BPhNPfG7.js";import{i as T,n as E,t as D}from"./tooltip-DZYAkZo5.js";import{n as O,r as k,t as A}from"./collapsible-Cc4bgirL.js";import{a as j,c as M,i as N,n as P,o as F,r as I,s as L,t as R}from"./dialog-CZK_GJbX.js";import{t as z}from"./checkbox-09LNjybZ.js";import{E as B,h as V,p as H}from"./skills-api-CQ8dGACz.js";import{t as U}from"./label-BpH34DoN.js";import{n as W,r as ee,t as te}from"./radio-group-CkH5F_ZT.js";import{$ as ne,A as re,B as ie,C as ae,E as G,H as K,M as q,Q as oe,S as se,T as J,U as Y,V as ce,W as le,_ as ue,at as de,c as fe,d as pe,f as me,g as he,h as ge,i as _e,j as ve,l as ye,lt as be,m as xe,n as Se,o as Ce,p as we,q as Te,st as Ee,u as De,v as Oe,w as ke,x as Ae,y as je,z as Me}from"./auth-state-cache-xkP6pnyp.js";import{n as Ne,t as Pe}from"./toggle-group-B_aSxEq-.js";import{A as Fe,Fi as Ie,Gi as Le,Ji as Re,Ni as ze,Sr as Be,Ui as Ve,Vi as He,Wi as Ue,Yi as We,_ as Ge,et as Ke,h as qe,it as Je,k as Ye,wt as Xe,xt as Ze}from"./dist-DLPICmSw.js";import{a as Qe,c as $e,i as et,r as tt,t as nt}from"./EnableSyncConfirmDialog-BRUoKGlI.js";import{t as rt}from"./arrow-up-right-Vg7lRNno.js";import{t as it}from"./check-CBLIjSIa.js";import{t as at}from"./chevron-right-C6588edp.js";import{i as ot}from"./prop-types-DXfg1BnH.js";import{C as st,E as ct,T as lt,c as ut,d as dt,f as ft,i as pt,l as mt,p as ht,r as gt,t as _t,w as vt,y as yt}from"./skill-actions-z_sZDeWy.js";import{i as bt,l as xt,r as St,s as Ct}from"./workspace-paths-DkmFj3_t.js";import{_ as wt,b as Tt,d as Et,f as Dt,g as Ot,h as kt,l as At,m as jt,o as Mt,t as Nt,u as Pt,v as Ft,y as It}from"./open-managed-artifact-tab-B1BoyKiE.js";import{t as Lt}from"./info-p7xnknfW.js";import{t as Rt}from"./triangle-alert-Bo8gNh02.js";import{t as zt}from"./x-BIoRq4ww.js";import{n as X}from"./dist-K3kyyBcW.js";import{t as Bt}from"./input-DBQZgTXT.js";import{t as Vt}from"./parse-api-error-D_SUnYAN.js";import{r as Ht}from"./documents-events-Bf8O52Ha.js";import{a as Ut,n as Wt,r as Gt,s as Kt,t as qt}from"./keyboard-shortcuts-BxD83XhC.js";import"./config-provider-2uXvVEZR.js";import{n as Jt}from"./config-context-GBTLA0Td.js";import{t as Yt}from"./external-link-PPmVWR7S.js";var Xt=C(`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`}]]),Z=i(),Q=e(n(),1),$=r(),Zt=`settings-sharing-title`;function Qt(){let e=(0,Z.c)(1),t=(typeof window<`u`?window.okDesktop:void 0)?.sharing,n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=t===void 0?(0,$.jsx)($t,{}):(0,$.jsx)(en,{}),e[0]=n):n=e[0],n}function $t(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:Zt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`section`,{"aria-labelledby":Zt,className:`space-y-3`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[t,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})]})}),e[1]=n):n=e[1],n}function en(){let e=(0,Z.c)(28),{_:t}=y(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c;e[0]===t?c=e[1]:(c=async function(){let e=window.okDesktop?.sharing;if(e)try{r(await e.status())}catch(e){let n=e;X.error(n instanceof Error?n.message:t({id:`K0N7zS`})),r(nn)}},e[0]=t,e[1]=c);let l=c,u;e[2]===l?u=e[3]:(u=()=>{l()},e[2]=l,e[3]=u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],e[4]=d):d=e[4],(0,Q.useEffect)(u,d);let f;e[5]!==t||e[6]!==i||e[7]!==l||e[8]!==n?(f=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),s(null);let o=null,c=null;try{o=await r.setMode(e)}catch(e){c=e}if(a(!1),c!==null){X.error(c instanceof Error?c.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(s({tracked:o.tracked,remediation:o.remediation}),X.error(t({id:`z2JdQ-`}),{duration:5e3})):o.kind===`no-exclude`?X.warning(o.reason===`no-git`?t({id:`YSFv5w`}):t({id:`8cS0nH`,values:{0:o.reason}})):X.success(t(e===`local-only`?{id:`VvS_k_`}:{id:`k_pade`})),await l())},e[5]=t,e[6]=i,e[7]=l,e[8]=n,e[9]=f):f=e[9];let p=f;if(n===null){let t;return e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":Zt,className:`space-y-3`,children:[(0,$.jsx)(`h3`,{id:Zt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),(0,$.jsx)(Y,{className:`h-24`})]}),e[10]=t):t=e[10],t}let m=n.mode===`no-git`,h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`h3`,{id:Zt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),(0,$.jsx)(ee,{})]}),e[11]=h):h=e[11];let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[h,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`N55YNr`})})]}),e[12]=g):g=e[12];let _;e[13]!==i||e[14]!==m||e[15]!==p||e[16]!==n.mode?(_=m?(0,$.jsx)(`p`,{className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,role:`status`,"data-testid":`settings-sharing-no-git`,children:(0,$.jsx)(v,{id:`ju38ms`})}):(0,$.jsxs)(te,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Zt,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(W,{id:`settings-sharing-shared`,value:`shared`,"data-testid":`settings-sharing-shared`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`dJw2_7`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(W,{id:`settings-sharing-local-only`,value:`local-only`,"data-testid":`settings-sharing-local-only`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`OgyJSr`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`cZ_8zB`})})]})]})]}),e[13]=i,e[14]=m,e[15]=p,e[16]=n.mode,e[17]=_):_=e[17];let b;e[18]===o?b=e[19]:(b=o===null?null:(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm`,role:`alert`,"data-testid":`settings-sharing-refusal`,children:[(0,$.jsx)(`p`,{className:`font-semibold`,children:(0,$.jsx)(v,{id:`Kgdbkt`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(S,{variant:`outline`,size:`sm`,onClick:()=>s(null),children:(0,$.jsx)(v,{id:`1QfxQT`})})]}),e[18]=o,e[19]=b);let x;e[20]!==o||e[21]!==n.mode||e[22]!==n.trackedUpstream?(x=n.trackedUpstream.length>0&&n.mode!==`no-git`&&o===null?(0,$.jsxs)(`div`,{className:`space-y-1 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-tracked-info`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(tn)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[20]=o,e[21]=n.mode,e[22]=n.trackedUpstream,e[23]=x):x=e[23];let C;return e[24]!==_||e[25]!==b||e[26]!==x?(C=(0,$.jsxs)(`section`,{"aria-labelledby":Zt,className:`space-y-4`,"data-testid":`settings-sharing`,children:[g,_,b,x]}),e[24]=_,e[25]=b,e[26]=x,e[27]=C):C=e[27],C}function tn(e){return(0,$.jsx)(`li`,{children:e},e)}function nn(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}var rn=G,an=Q.createContext({}),on=e=>{let t=(0,Z.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i;t[4]===n?i=t[5]:(i=(0,$.jsx)(J,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==r||t[7]!==i?(a=(0,$.jsx)(an.Provider,{value:r,children:i}),t[6]=r,t[7]=i,t[8]=a):a=t[8],a},sn=()=>{let e=(0,Z.c)(13),t=Q.use(an),n=Q.use(cn),{getFieldState:r}=ve(),i;e[0]===t.name?i=e[1]:(i={name:t.name},e[0]=t.name,e[1]=i);let a=q(i),o;e[2]!==t.name||e[3]!==a||e[4]!==r?(o=r(t.name,a),e[2]=t.name,e[3]=a,e[4]=r,e[5]=o):o=e[5];let s=o;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:c}=n,l=`${c}-form-item`,u=`${c}-form-item-description`,d=`${c}-form-item-message`,f;return e[6]!==t.name||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==u||e[11]!==d?(f={id:c,name:t.name,formItemId:l,formDescriptionId:u,formMessageId:d,...s},e[6]=t.name,e[7]=s,e[8]=c,e[9]=l,e[10]=u,e[11]=d,e[12]=f):f=e[12],f},cn=Q.createContext({});function ln(e){let t=(0,Z.c)(13),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=Q.useId(),a;t[3]===i?a=t[4]:(a={id:i},t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=w(`grid gap-2`,n),t[5]=n,t[6]=o);let s;t[7]!==r||t[8]!==o?(s=(0,$.jsx)(`div`,{"data-slot":`form-item`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,$.jsx)(cn.Provider,{value:a,children:s}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function un(e){let t=(0,Z.c)(10),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{error:i,formItemId:a}=sn(),o=!!i,s;t[3]===n?s=t[4]:(s=w(`data-[error=true]:text-destructive`,n),t[3]=n,t[4]=s);let c;return t[5]!==a||t[6]!==r||t[7]!==o||t[8]!==s?(c=(0,$.jsx)(U,{"data-slot":`form-label`,"data-error":o,className:s,htmlFor:a,...r}),t[5]=a,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function dn(e){let t=(0,Z.c)(7),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{error:r,formItemId:i,formDescriptionId:a,formMessageId:o}=sn(),s=r?`${a} ${o}`:`${a}`,c=!!r,l;return t[2]!==i||t[3]!==n||t[4]!==s||t[5]!==c?(l=(0,$.jsx)(x,{"data-slot":`form-control`,id:i,"aria-describedby":s,"aria-invalid":c,...n}),t[2]=i,t[3]=n,t[4]=s,t[5]=c,t[6]=l):l=t[6],l}function fn(e){let t=(0,Z.c)(9),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{formDescriptionId:i}=sn(),a;t[3]===n?a=t[4]:(a=w(`text-1sm text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==r||t[7]!==a?(o=(0,$.jsx)(`p`,{"data-slot":`form-description`,id:i,className:a,...r}),t[5]=i,t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function pn(e){let t=(0,Z.c)(11),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{error:i,formMessageId:a}=sn(),o=i?String(i?.message??``):r.children;if(!o)return null;let s=i?`alert`:void 0,c;t[3]===n?c=t[4]:(c=w(`text-sm text-destructive`,n),t[3]=n,t[4]=c);let l;return t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s||t[9]!==c?(l=(0,$.jsx)(`p`,{"data-slot":`form-message`,id:a,role:s,className:c,...r,children:o}),t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function mn(e){let t=(0,Z.c)(30),{authQueryTransport:n,authTransport:r}=e,{_:i}=y(),a;t[0]===n?a=t[1]:(a=n??Te(),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={phase:`loading`},t[2]=s):s=t[2];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),_;t[3]===o?_=t[4]:(_=async function(){l({phase:`loading`});try{let e=await o.status();l({phase:`loaded`,result:e}),Se(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),l({phase:`check-failed`})}},t[3]=o,t[4]=_);let b=_,x;t[5]===b?x=t[6]:(x=()=>{b()},t[5]=b,t[6]=x);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[7]=C):C=t[7],(0,Q.useEffect)(x,C);let w;t[8]!==i||t[9]!==b||t[10]!==o?(w=async function(){if(g.current)return;g.current=!0,d(!1),p(!0),h(null);let e=null;try{let t=o.signout?await o.signout():{ok:!1,error:i({id:`8cpOa8`})};t.ok||(e=t.error??i({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=i({id:`8cpOa8`})}await b(),e&&h(e),p(!1),g.current=!1},t[8]=i,t[9]=b,t[10]=o,t[11]=w):w=t[11];let T=w,E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(`h3`,{id:`settings-account-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`AeXO77`})}),t[12]=E):E=t[12];let D;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[E,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`E6lrpp`})})]}),t[13]=D):D=t[13];let O;t[14]!==m||t[15]!==f||t[16]!==T||t[17]!==b||t[18]!==c.phase||t[19]!==c.result?(O=c.phase===`loading`?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`IWGfGF`})}),(0,$.jsx)(Y,{className:`h-4 w-40`}),(0,$.jsx)(Y,{className:`h-8 w-32`})]}):c.phase===`check-failed`?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`T_wG4n`})}),(0,$.jsx)(S,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(v,{id:`KDw4GX`})})]}):c.result.authenticated?c.result.tier===`A`?(0,$.jsx)(gn,{login:c.result.login}):(0,$.jsx)(hn,{login:c.result.login,disconnecting:f,error:m,onDisconnect:()=>void T()}):(0,$.jsx)(_n,{onConnect:()=>d(!0)}),t[14]=m,t[15]=f,t[16]=T,t[17]=b,t[18]=c.phase,t[19]=c.result,t[20]=O):O=t[20];let k;t[21]===b?k=t[22]:(k=()=>{b()},t[21]=b,t[22]=k);let A;t[23]!==u||t[24]!==r||t[25]!==k?(A=(0,$.jsx)(le,{open:u,onOpenChange:d,transport:r,onSuccess:k}),t[23]=u,t[24]=r,t[25]=k,t[26]=A):A=t[26];let j;return t[27]!==A||t[28]!==O?(j=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[D,O,A]}),t[27]=A,t[28]=O,t[29]=j):j=t[29],j}function hn(e){let t=(0,Z.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`nxlOpL`})}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[3]=o,t[4]=c);let l;t[5]===r?l=t[6]:(l=r?(0,$.jsx)(v,{id:`rppgXF`}):(0,$.jsx)(v,{id:`-K0AvT`}),t[5]=r,t[6]=l);let u;t[7]!==r||t[8]!==a||t[9]!==l?(u=(0,$.jsx)(S,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:l}),t[7]=r,t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==c||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(v,{id:`msOK6I`})}),t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:i}):null,t[15]=i,t[16]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[d,f,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function gn(e){let t=(0,Z.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`ny6vNn`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[r,i]})}),t[3]=r,t[4]=a),a}function _n(e){let t=(0,Z.c)(5),{onConnect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`S33tz3`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(v,{id:`3jod3l`}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,(0,$.jsx)(S,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function vn(e){return e.kind===`editor`?`editor:${e.id}`:e.kind===`skill`?`skill:${e.id}`:`path`}function yn(e){let t=(0,Z.c)(11),{testId:n,children:r}=e,{_:i}=y(),a;t[0]===i?a=t[1]:(a=i({id:`2B6eYX`}),t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Lt,{className:`size-3.5`}),t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==n?(s=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(S,{variant:`ghost`,size:`icon`,className:`mt-1.5 mr-1.5 h-6 w-6 shrink-0 text-muted-foreground opacity-60 hover:opacity-100`,"aria-label":a,"data-testid":n,children:o})}),t[3]=a,t[4]=n,t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=(0,$.jsx)(E,{side:`left`,className:`max-w-sm text-left`,children:(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:r})}),t[6]=r,t[7]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(D,{children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function bn(){let e=(0,Z.c)(38),{_:t}=y(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l,u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{if(!n)return;let e=!1;return n.integrations.status().then(t=>{e||i(t)}).catch(()=>{e||o(!0)}),()=>{e=!0}},u=[n],e[0]=l,e[1]=u):(l=e[0],u=e[1]),(0,Q.useEffect)(l,u);let d;e[2]===t?d=e[3]:(d=async function(e,r){if(n){c(vn(e));try{let t=await n.integrations.setComponent({component:e,enabled:r});i(t.status),t.ok||X.error(t.error)}catch(e){let n=e;X.error(t({id:`gfdqcY`,values:{0:n instanceof Error?n.message:String(n)}}))}c(null)}},e[2]=t,e[3]=d);let f=d,p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`h3`,{id:`settings-ai-tools-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`_5qBNl`})}),e[4]=p):p=e[4];let m;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[p,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`mLAjyL`})})]}),e[5]=m):m=e[5];let h=m;if(!n||a){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`ai-tools-unavailable`,children:(0,$.jsx)(v,{id:`O4PnDd`})})]}),e[6]=t):t=e[6],t}if(r===null){let t;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`ai-tools-loading`,children:[(0,$.jsx)(Y,{className:`h-10 w-full`}),(0,$.jsx)(Y,{className:`h-10 w-full`}),(0,$.jsx)(Y,{className:`h-10 w-full`})]})]}),e[7]=t):t=e[7],t}let g=s!==null||!r.available,_=r.path.shellDetected||r.path.installed,b;e[8]===r.available?b=e[9]:(b=!r.available&&(0,$.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,"data-testid":`ai-tools-read-only`,children:(0,$.jsx)(v,{id:`OplnBG`})}),e[8]=r.available,e[9]=b);let x;e[10]!==t||e[11]!==f||e[12]!==g||e[13]!==_||e[14]!==r.path.installed||e[15]!==r.path.rcFilesToTouch?(x=_&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`ALhMYW`})}),(0,$.jsxs)(`div`,{className:`flex items-start overflow-hidden rounded-md border border-border bg-card/50 hover:bg-accent`,children:[(0,$.jsxs)(U,{htmlFor:`ai-tools-path`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(z,{id:`ai-tools-path`,checked:r.path.installed,disabled:g,onCheckedChange:()=>void f({kind:`path`},!r.path.installed),className:`mt-0.5`,"data-testid":`ai-tools-path-checkbox`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(v,{id:`Fsx78O`,components:{0:(0,$.jsx)(`code`,{className:`inline-code`})}})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-path-status`,children:r.path.installed?t({id:`yhdqox`}):t({id:`04XyCH`,values:{0:r.path.rcFilesToTouch.join(`, `)}})})]})]}),(0,$.jsxs)(yn,{testId:`ai-tools-path-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`f9lQNJ`})}),r.path.rcFilesToTouch.map(Sn),(0,$.jsx)(`p`,{className:`pt-1`,children:(0,$.jsx)(v,{id:`CWzc2T`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]})]})]}),e[10]=t,e[11]=f,e[12]=g,e[13]=_,e[14]=r.path.installed,e[15]=r.path.rcFilesToTouch,e[16]=x):x=e[16];let S;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`psfGPX`})}),e[17]=S):S=e[17];let C;if(e[18]!==t||e[19]!==f||e[20]!==g||e[21]!==r.editors){let n;e[23]!==t||e[24]!==f||e[25]!==g?(n=e=>{let n=e.state===`installed`||e.state===`foreign`,r=g||e.state===`unmanageable`,i=e.state===`not-installed`&&!e.detected,a=`https://openknowledge.ai/docs/integrations/${Fe[e.id]}`,o=e.state===`installed`?t({id:`eQkgKV`}):e.state===`foreign`?t({id:`AczYxH`}):e.state===`unmanageable`?t({id:`LbmLyU`}):e.detected?t({id:`bBE5tC`}):null,s=e.state===`foreign`||e.state===`unmanageable`?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`;return(0,$.jsxs)(`li`,{className:r?`flex items-start`:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(U,{htmlFor:`ai-tools-editor-${e.id}`,className:r?`flex flex-1 items-start gap-2.5 px-3 py-2.5 font-normal`:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(z,{id:`ai-tools-editor-${e.id}`,checked:n,disabled:r,onCheckedChange:()=>void f({kind:`editor`,id:e.id},!n),className:`mt-0.5`,"data-testid":`ai-tools-editor-checkbox-${e.id}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.label}),o!==null&&(0,$.jsx)(`span`,{className:s,"data-testid":`ai-tools-editor-status-${e.id}`,children:o})]})]}),i&&(0,$.jsxs)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Yt(e,a),onAuxClick:e=>Yt(e,a),"aria-label":t({id:`D-Oh1s`,values:{0:e.label}}),className:`flex shrink-0 items-center gap-0.5 px-2 py-2.5 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`ai-tools-editor-status-${e.id}`,children:[(0,$.jsx)(v,{id:`P_bX4O`}),(0,$.jsx)(rt,{className:`size-3`,"aria-hidden":!0})]}),(0,$.jsxs)(yn,{testId:`ai-tools-editor-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`J2eKUI`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.configPath??t({id:`ndwmea`})})}),(0,$.jsx)(`p`,{className:`pt-1 opacity-70`,children:(0,$.jsx)(v,{id:`VIwCaD`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.entryLocator})})]})]},e.id)},e[23]=t,e[24]=f,e[25]=g,e[26]=n):n=e[26],C=r.editors.map(n),e[18]=t,e[19]=f,e[20]=g,e[21]=r.editors,e[22]=C}else C=e[22];let w;e[27]===C?w=e[28]:(w=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[S,(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:C})]}),e[27]=C,e[28]=w);let T;e[29]!==f||e[30]!==g||e[31]!==r.skills?(T=r.skills.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`28B21t`})}),(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:r.skills.map(e=>(0,$.jsxs)(`li`,{className:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(U,{htmlFor:`ai-tools-skill-${e.id}`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(z,{id:`ai-tools-skill-${e.id}`,checked:e.installed,disabled:g,onCheckedChange:()=>void f({kind:`skill`,id:e.id},!e.installed),className:`mt-0.5`,"data-testid":`ai-tools-skill-checkbox-${e.id}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(`code`,{children:e.name})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-skill-status-${e.id}`,children:e.id===`discovery`?(0,$.jsx)(v,{id:`0inVGS`}):(0,$.jsx)(v,{id:`FXk_zY`})})]})]}),(0,$.jsxs)(yn,{testId:`ai-tools-skill-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`HSh8u_`})}),e.paths.map(xn)]})]},e.id))})]}),e[29]=f,e[30]=g,e[31]=r.skills,e[32]=T):T=e[32];let E;return e[33]!==T||e[34]!==b||e[35]!==x||e[36]!==w?(E=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[h,b,x,w,T]}),e[33]=T,e[34]=b,e[35]=x,e[36]=w,e[37]=E):E=e[37],E}function xn(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function Sn(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}async function Cn(e){try{let t=Je.safeParse(await e.json());if(t.success)return t.data.title}catch{}}async function wn(e,t){try{let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return n.ok?{ok:!0}:{ok:!1,error:await Cn(n)}}catch{return{ok:!1}}}function Tn(){return{setKey:e=>wn(`/api/local-op/embeddings/set-key`,{key:e}),clearKey:()=>wn(`/api/local-op/embeddings/clear-key`,{})}}function En(e){let t=(0,Z.c)(29),{transport:n}=e,{_:r}=y(),i;t[0]===n?i=t[1]:(i=n??Tn(),t[0]=n,t[1]=i);let a=i,{status:o,refresh:s}=ne(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),m=o?.keyPresent??!1,h=o?.keySource??null,g=o?.keyHint??null,_;t[2]!==r||t[3]!==u||t[4]!==c||t[5]!==s||t[6]!==a?(_=async function(){let e=c.trim();if(!e||u)return;d(!0),p(null);let t=await a.setKey(e);d(!1),t.ok?(l(``),s()):p(t.error??r({id:`Ck9XRt`}))},t[2]=r,t[3]=u,t[4]=c,t[5]=s,t[6]=a,t[7]=_):_=t[7];let b=_,x;t[8]!==r||t[9]!==u||t[10]!==s||t[11]!==a?(x=async function(){if(u)return;d(!0),p(null);let e=await a.clearKey();d(!1),e.ok?s():p(e.error??r({id:`CSL0l1`}))},t[8]=r,t[9]=u,t[10]=s,t[11]=a,t[12]=x):x=t[12];let C=x,w;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(`h3`,{id:`settings-embeddings-key-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`nh3wwx`})}),t[13]=w):w=t[13];let T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[w,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`wccmX0`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),t[14]=T):T=t[14];let E;t[15]!==r||t[16]!==u||t[17]!==g||t[18]!==c||t[19]!==m||t[20]!==h||t[21]!==C||t[22]!==b?(E=h===`env`?(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-embeddings-key-env`,children:(0,$.jsx)(v,{id:`KH5bQi`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}):(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,"data-testid":`settings-embeddings-key-set`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-1.5 text-sm font-medium`,children:(0,$.jsx)(v,{id:`AqnqMJ`})}),g?(0,$.jsxs)(`p`,{className:`truncate font-mono text-muted-foreground text-xs`,title:r({id:`qEIFZu`,values:{keyHint:g}}),"data-testid":`settings-embeddings-key-hint`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`••••••••`}),g]}):null,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`3TCafD`})})]}),(0,$.jsx)(S,{variant:`outline`,onClick:()=>void C(),disabled:u,"data-testid":`settings-embeddings-key-clear`,children:(0,$.jsx)(v,{id:`xCJdfg`})})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`settings-embeddings-key-input`,className:`mb-2 block text-sm font-medium`,children:m?(0,$.jsx)(v,{id:`UW93oq`}):(0,$.jsx)(v,{id:`K6jxcj`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Bt,{id:`settings-embeddings-key-input`,type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:r({id:`tsiTqO`}),autoComplete:`off`,spellCheck:!1,disabled:u,"data-testid":`settings-embeddings-key-input`,className:`h-8 font-mono text-sm`}),(0,$.jsx)(S,{onClick:()=>void b(),disabled:u||c.trim().length===0,"data-testid":`settings-embeddings-key-save`,children:u?(0,$.jsx)(v,{id:`uF9ruK`}):(0,$.jsx)(v,{id:`tfDRzk`})})]})]})]}),t[15]=r,t[16]=u,t[17]=g,t[18]=c,t[19]=m,t[20]=h,t[21]=C,t[22]=b,t[23]=E):E=t[23];let D;t[24]===f?D=t[25]:(D=f?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-embeddings-key-error`,children:f}):null,t[24]=f,t[25]=D);let O;return t[26]!==E||t[27]!==D?(O=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-embeddings-key-title`,className:`space-y-3`,"data-testid":`settings-embeddings-key`,children:[T,(0,$.jsxs)(`div`,{className:`space-y-3 rounded-md border p-3`,children:[E,D]})]}),t[26]=E,t[27]=D,t[28]=O):O=t[28],O}var Dn=e(t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}var r=``,i=` `,a=`\\`,o=/^\s+$/,s=/(?:[^\\]|^)\\$/,c=/^\\!/,l=/^\\#/,u=/\r?\n/g,d=/^\.*\/|^\.+$/,f=`/`,p=`node-ignore`;typeof Symbol<`u`&&(p=Symbol.for(`node-ignore`));var m=p,h=(e,t,n)=>Object.defineProperty(e,t,{value:n}),g=/([0-z])-([0-z])/g,_=()=>!1,v=e=>e.replace(g,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:r),y=e=>{let{length:t}=e;return e.slice(0,t-t%2)},b=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?i:r)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+i}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>a],[/\\\\/g,()=>a],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===a?`\\[${n}${y(r)}${i}`:i===`]`&&r.length%2==0?`[${v(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],x=Object.create(null),S=(e,t)=>{let n=x[e];return n||(n=b.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),x[e]=n),t?new RegExp(n,`i`):new RegExp(n)},C=e=>typeof e==`string`,w=e=>e&&C(e)&&!o.test(e)&&!s.test(e)&&e.indexOf(`#`)!==0,T=e=>e.split(u),E=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}},D=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(c,`!`).replace(l,`#`);let i=S(e,t);return new E(n,e,r,i)},O=(e,t)=>{throw new t(e)},k=(e,t,n)=>C(e)?e?k.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),A=e=>d.test(e);k.isNotRelative=A,k.convert=e=>e;var j=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){h(this,m,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[m]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(w(e)){let t=D(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(C(e)?T(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&k.convert(e);return k(i,e,this._allowRelativePaths?_:O),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(f),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(f)+f,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},M=e=>new j(e);if(M.isPathValid=e=>k(e&&k.convert(e),e,_),M.default=M,t.exports=M,typeof process<`u`&&({}.IGNORE_TEST_WIN32||process.platform===`win32`)){k.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;k.isNotRelative=t=>e.test(t)||A(t)}}))(),1),On=new Map;function kn(e){let t=On.get(e);if(t)return On.delete(e),On.set(e,t),t;let n=(0,Dn.default)();if(n.add(e),On.set(e,n),On.size>256){let e=On.keys().next().value;e!==void 0&&On.delete(e)}return n}function An(e,t){let n=e.trim();if(n.length===0||n.startsWith(`#`))return 0;let r=kn(n),i=0;for(let e of t)e.length!==0&&r.ignores(e)&&(i+=1);return i}var jn={"trailing-backslash":`Trailing backslash — line continuation isn't supported.`,"unmatched-bracket":`Unmatched [ — character class is open.`,"lone-bang":`Lone ! — negation needs a pattern after it.`,"leading-whitespace":`Leading whitespace — the rule may not match as expected.`,"embedded-newline":`Embedded line break — the row spans multiple lines.`};function Mn(e){let t=[];if(e.length===0||e.trimStart().startsWith(`#`))return t;/[\r\n]/.test(e)&&t.push({code:`embedded-newline`,message:jn[`embedded-newline`]}),/^\s/.test(e)&&t.push({code:`leading-whitespace`,message:jn[`leading-whitespace`]});let n=e.trim();return n===`!`&&t.push({code:`lone-bang`,message:jn[`lone-bang`]}),n.endsWith(`\\`)&&t.push({code:`trailing-backslash`,message:jn[`trailing-backslash`]}),Nn(n,`[`)>Nn(n,`]`)&&t.push({code:`unmatched-bracket`,message:jn[`unmatched-bracket`]}),t}function Nn(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}var Pn=`https://openknowledge.ai/docs/features/ignore-patterns`,Fn=1200,In=150,Ln=150,Rn=5e3,zn=600,Bn=400,Vn=`okignore-show-advanced`;function Hn(e){let t=(0,Z.c)(3),{binding:n,synced:r}=e;if(n===null||!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Un,{}),t[0]=e):e=t[0],e}let i;return t[1]===n?i=t[2]:(i=(0,$.jsx)(Wn,{binding:n}),t[1]=n,t[2]=i),i}function Un(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-skeleton`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3zyg_A`})}),(0,$.jsx)(Y,{className:`h-4 w-72`})]}),(0,$.jsx)(Y,{className:`h-20 w-full`})]}),e[0]=t):t=e[0],t}function Wn(e){let t=(0,Z.c)(72),{binding:n}=e,{_:r}=y(),i;t[0]===n?i=t[1]:(i=()=>n.current(),t[0]=n,t[1]=i);let[a,o]=(0,Q.useState)(i),s,c;t[2]===n?(s=t[3],c=t[4]):(s=()=>n.subscribe(e=>{o(e)}),c=[n],t[2]=n,t[3]=s,t[4]=c),(0,Q.useEffect)(s,c);let{pages:l,pageMeta:u,assetPaths:d}=ot(),f;t[5]!==d||t[6]!==u||t[7]!==l?(f=dr(l,u,d),t[5]=d,t[6]=u,t[7]=l,t[8]=f):f=t[8];let p=f,m,h;t[9]===a?(m=t[10],h=t[11]):(m=xe(a),h=we(m),t[9]=a,t[10]=m,t[11]=h);let g=h,_=g.length===0,[b,x]=(0,Q.useState)(null),S=(0,Q.useRef)(null),C,w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>()=>{S.current&&clearTimeout(S.current)},w=[],t[12]=C,t[13]=w):(C=t[12],w=t[13]),(0,Q.useEffect)(C,w);let T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{x({key:e,ts:Date.now()}),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>x(null),Fn)},t[14]=T):T=t[14];let E=T,[D,O]=(0,Q.useState)(null),k=(0,Q.useRef)(null),A,j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>{k.current&&clearTimeout(k.current)},A=[],t[15]=A,t[16]=j):(A=t[15],j=t[16]),(0,Q.useEffect)(j,A);let M,N;t[17]===n?(M=t[18],N=t[19]):(M=()=>_e(e=>{e.docName===`__config__/okignore`&&n.notifyRejection(e.error)}),N=[n],t[17]=n,t[18]=M,t[19]=N),(0,Q.useEffect)(M,N);let P,F;t[20]===n?(P=t[21],F=t[22]):(P=()=>n.subscribeRejection(e=>{let{error:t}=e,n=sr(t);O({message:n?.detail??Ue(t),lineNumber:n?.lineNumber,ts:Date.now()}),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>O(null),Rn)}),F=[n],t[20]=n,t[21]=P,t[22]=F),(0,Q.useEffect)(P,F);let I,L;t[23]===r?(I=t[24],L=t[25]):(I=()=>Ce(e=>{let{path:t}=e;X.error(r({id:`3oh0nQ`,values:{path:t}}),{description:e.error,id:`okignore-nested-error:${e.path}`,duration:8e3})}),L=[r],t[23]=r,t[24]=I,t[25]=L),(0,Q.useEffect)(I,L);let R;t[26]===n?R=t[27]:(R=e=>{n.patch(e)},t[26]=n,t[27]=R);let z=R,B;t[28]!==z||t[29]!==m||t[30]!==g?(B=(e,t)=>{let n=t.trim(),r=g[e];if(r&&n!==r.text){if(n.length===0){z(ue(ge(m,e)));return}z(ue(pe(m,e,n))),E(or(n,e))}},t[28]=z,t[29]=m,t[30]=g,t[31]=B):B=t[31];let V=B,H;t[32]!==z||t[33]!==m?(H=e=>{z(ue(ge(m,e)))},t[32]=z,t[33]=m,t[34]=H):H=t[34];let U=H,W;t[35]!==z||t[36]!==m||t[37]!==g.length?(W=e=>{let t=e.trim();if(t.length===0)return;let n=me(m,t);if(n>=0){E(or(t,n));return}z(ue(De(m,t))),E(or(t,g.length))},t[35]=z,t[36]=m,t[37]=g.length,t[38]=W):W=t[38];let ee=W,te;t[39]!==z||t[40]!==m?(te=e=>{let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=ar(t),i=ar(n);r<0||i<0||r===i||z(ue(he(m,r,i)))},t[39]=z,t[40]=m,t[41]=te):te=t[41];let ne=te,re;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(re={activationConstraint:{distance:4}},t[42]=re):re=t[42];let ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ie={coordinateGetter:At},t[43]=ie):ie=t[43];let ae=Ft(wt(kt,re),wt(jt,ie)),G=D===null?null:`rejection-${D.ts}`,[K,q]=mr(),oe;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3zyg_A`})}),t[44]=oe):oe=t[44];let se;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[oe,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`Z5h97D`,components:{0:(0,$.jsx)(`a`,{href:Pn,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline-offset-2 hover:underline`,"data-testid":`settings-okignore-primer`})}})})]}),t[45]=se):se=t[45];let J;t[46]===D?J=t[47]:(J=D===null?null:(0,$.jsx)(qn,{rejection:D}),t[46]=D,t[47]=J);let Y;t[48]!==n||t[49]!==p||t[50]!==ee||t[51]!==ne||t[52]!==V||t[53]!==U||t[54]!==_||t[55]!==g||t[56]!==G||t[57]!==b||t[58]!==ae||t[59]!==K||t[60]!==a?(Y=K?(0,$.jsx)(Gn,{binding:n,text:a}):_?(0,$.jsx)(Jn,{onAdd:ee,rejectionFlashKey:G,filePaths:p}):(0,$.jsx)(Yn,{patterns:g,sensors:ae,onDragEnd:ne,onEdit:V,onRemove:U,onAdd:ee,savedFlash:b,rejectionFlashKey:G,filePaths:p}),t[48]=n,t[49]=p,t[50]=ee,t[51]=ne,t[52]=V,t[53]=U,t[54]=_,t[55]=g,t[56]=G,t[57]=b,t[58]=ae,t[59]=K,t[60]=a,t[61]=Y):Y=t[61];let ce;t[62]!==q||t[63]!==K?(ce=()=>q(!K),t[62]=q,t[63]=K,t[64]=ce):ce=t[64];let le;t[65]!==K||t[66]!==ce?(le=(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(Kn,{enabled:K,onToggle:ce})}),t[65]=K,t[66]=ce,t[67]=le):le=t[67];let de;return t[68]!==J||t[69]!==Y||t[70]!==le?(de=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-section`,children:[se,J,Y,le]}),t[68]=J,t[69]=Y,t[70]=le,t[71]=de):de=t[71],de}function Gn(e){let t=(0,Z.c)(31),{binding:n,text:r}=e,{_:i}=y(),[a,o]=(0,Q.useState)(r),s=(0,Q.useRef)(r),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(r),u=(0,Q.useRef)(null),d,f;t[0]===r?(d=t[1],f=t[2]):(d=()=>{c.current||r!==s.current&&(o(r),l.current=r,s.current=r)},f=[r],t[0]=r,t[1]=d,t[2]=f),(0,Q.useEffect)(d,f);let p,m;t[3]===a?(p=t[4],m=t[5]):(p=()=>{l.current=a},m=[a],t[3]=a,t[4]=p,t[5]=m),(0,Q.useEffect)(p,m);let h,g;t[6]===n?(h=t[7],g=t[8]):(h=()=>()=>{u.current&&(clearTimeout(u.current),u.current=null,l.current!==s.current&&(n.patch(l.current),s.current=l.current))},g=[n],t[6]=n,t[7]=h,t[8]=g),(0,Q.useEffect)(h,g);let _;t[9]===n?_=t[10]:(_=e=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,e!==s.current&&(s.current=e,n.patch(e))},Bn)},t[9]=n,t[10]=_);let v=_,b;t[11]===n?b=t[12]:(b=()=>{u.current&&=(clearTimeout(u.current),null),l.current!==s.current&&(s.current=l.current,n.patch(l.current))},t[11]=n,t[12]=b);let x=b,S;t[13]===v?S=t[14]:(S=e=>{o(e.target.value),v(e.target.value)},t[13]=v,t[14]=S);let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{c.current=!0},t[15]=C):C=t[15];let w;t[16]===x?w=t[17]:(w=()=>{c.current=!1,x()},t[16]=x,t[17]=w);let T;t[18]===a?T=t[19]:(T=a.split(`
1
+ import{o as e,t}from"./chunk-CFjPhJqf.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{Bt as a,C as o,E as s,Ht as c,M as l,Qt as u,S as d,T as f,Ut as p,fn as m,lt as h,w as g,x as _}from"./DocumentContext-yguu7wL1.js";import{n as v,r as y}from"./dist-CQw2y-s3.js";import{n as b}from"./dist-BVOt51sU.js";import{i as x,n as S,t as C,u as w}from"./createLucideIcon-BPhNPfG7.js";import{i as T,n as E,t as D}from"./tooltip-DZYAkZo5.js";import{n as O,r as k,t as A}from"./collapsible-Cc4bgirL.js";import{a as j,c as M,i as N,n as P,o as F,r as I,s as L,t as R}from"./dialog-CZK_GJbX.js";import{t as z}from"./checkbox-09LNjybZ.js";import{E as B,h as V,p as H}from"./skills-api-FVkz2ZvD.js";import{t as U}from"./label-BpH34DoN.js";import{n as W,r as ee,t as te}from"./radio-group-CkH5F_ZT.js";import{$ as ne,A as re,B as ie,C as ae,E as G,H as K,M as q,Q as oe,S as se,T as J,U as Y,V as ce,W as le,_ as ue,at as de,c as fe,d as pe,f as me,g as he,h as ge,i as _e,j as ve,l as ye,lt as be,m as xe,n as Se,o as Ce,p as we,q as Te,st as Ee,u as De,v as Oe,w as ke,x as Ae,y as je,z as Me}from"./auth-state-cache-Ck3G6jUi.js";import{n as Ne,t as Pe}from"./toggle-group-B_aSxEq-.js";import{A as Fe,Fi as Ie,Gi as Le,Ji as Re,Ni as ze,Sr as Be,Ui as Ve,Vi as He,Wi as Ue,Yi as We,_ as Ge,et as Ke,h as qe,it as Je,k as Ye,wt as Xe,xt as Ze}from"./dist-BmgoHUkm.js";import{a as Qe,c as $e,i as et,r as tt,t as nt}from"./EnableSyncConfirmDialog-CDm2rW8c.js";import{t as rt}from"./arrow-up-right-Vg7lRNno.js";import{t as it}from"./check-CBLIjSIa.js";import{t as at}from"./chevron-right-C6588edp.js";import{i as ot}from"./prop-types-DK0zwiLA.js";import{C as st,E as ct,T as lt,c as ut,d as dt,f as ft,i as pt,l as mt,p as ht,r as gt,t as _t,w as vt,y as yt}from"./skill-actions-C3jnKy6a.js";import{i as bt,l as xt,r as St,s as Ct}from"./workspace-paths-B1R7zp-q.js";import{_ as wt,b as Tt,d as Et,f as Dt,g as Ot,h as kt,l as At,m as jt,o as Mt,t as Nt,u as Pt,v as Ft,y as It}from"./open-managed-artifact-tab-_d-k5W-o.js";import{t as Lt}from"./info-p7xnknfW.js";import{t as Rt}from"./triangle-alert-Bo8gNh02.js";import{t as zt}from"./x-BIoRq4ww.js";import{n as X}from"./dist-K3kyyBcW.js";import{t as Bt}from"./input-DBQZgTXT.js";import{t as Vt}from"./parse-api-error-D_SUnYAN.js";import{r as Ht}from"./documents-events-CijCy-Sc.js";import{a as Ut,n as Wt,r as Gt,s as Kt,t as qt}from"./keyboard-shortcuts-DDw4HRe3.js";import"./config-provider-CQL47dca.js";import{n as Jt}from"./config-context-GBTLA0Td.js";import{t as Yt}from"./external-link-PPmVWR7S.js";var Xt=C(`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`}]]),Z=i(),Q=e(n(),1),$=r(),Zt=`settings-sharing-title`;function Qt(){let e=(0,Z.c)(1),t=(typeof window<`u`?window.okDesktop:void 0)?.sharing,n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=t===void 0?(0,$.jsx)($t,{}):(0,$.jsx)(en,{}),e[0]=n):n=e[0],n}function $t(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:Zt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`section`,{"aria-labelledby":Zt,className:`space-y-3`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[t,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})]})}),e[1]=n):n=e[1],n}function en(){let e=(0,Z.c)(28),{_:t}=y(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c;e[0]===t?c=e[1]:(c=async function(){let e=window.okDesktop?.sharing;if(e)try{r(await e.status())}catch(e){let n=e;X.error(n instanceof Error?n.message:t({id:`K0N7zS`})),r(nn)}},e[0]=t,e[1]=c);let l=c,u;e[2]===l?u=e[3]:(u=()=>{l()},e[2]=l,e[3]=u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],e[4]=d):d=e[4],(0,Q.useEffect)(u,d);let f;e[5]!==t||e[6]!==i||e[7]!==l||e[8]!==n?(f=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),s(null);let o=null,c=null;try{o=await r.setMode(e)}catch(e){c=e}if(a(!1),c!==null){X.error(c instanceof Error?c.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(s({tracked:o.tracked,remediation:o.remediation}),X.error(t({id:`z2JdQ-`}),{duration:5e3})):o.kind===`no-exclude`?X.warning(o.reason===`no-git`?t({id:`YSFv5w`}):t({id:`8cS0nH`,values:{0:o.reason}})):X.success(t(e===`local-only`?{id:`VvS_k_`}:{id:`k_pade`})),await l())},e[5]=t,e[6]=i,e[7]=l,e[8]=n,e[9]=f):f=e[9];let p=f;if(n===null){let t;return e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":Zt,className:`space-y-3`,children:[(0,$.jsx)(`h3`,{id:Zt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),(0,$.jsx)(Y,{className:`h-24`})]}),e[10]=t):t=e[10],t}let m=n.mode===`no-git`,h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`h3`,{id:Zt,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`cs4mps`})}),(0,$.jsx)(ee,{})]}),e[11]=h):h=e[11];let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[h,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`N55YNr`})})]}),e[12]=g):g=e[12];let _;e[13]!==i||e[14]!==m||e[15]!==p||e[16]!==n.mode?(_=m?(0,$.jsx)(`p`,{className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,role:`status`,"data-testid":`settings-sharing-no-git`,children:(0,$.jsx)(v,{id:`ju38ms`})}):(0,$.jsxs)(te,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Zt,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(W,{id:`settings-sharing-shared`,value:`shared`,"data-testid":`settings-sharing-shared`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`dJw2_7`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(W,{id:`settings-sharing-local-only`,value:`local-only`,"data-testid":`settings-sharing-local-only`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`OgyJSr`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`cZ_8zB`})})]})]})]}),e[13]=i,e[14]=m,e[15]=p,e[16]=n.mode,e[17]=_):_=e[17];let b;e[18]===o?b=e[19]:(b=o===null?null:(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm`,role:`alert`,"data-testid":`settings-sharing-refusal`,children:[(0,$.jsx)(`p`,{className:`font-semibold`,children:(0,$.jsx)(v,{id:`Kgdbkt`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(S,{variant:`outline`,size:`sm`,onClick:()=>s(null),children:(0,$.jsx)(v,{id:`1QfxQT`})})]}),e[18]=o,e[19]=b);let x;e[20]!==o||e[21]!==n.mode||e[22]!==n.trackedUpstream?(x=n.trackedUpstream.length>0&&n.mode!==`no-git`&&o===null?(0,$.jsxs)(`div`,{className:`space-y-1 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-tracked-info`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:(0,$.jsx)(v,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(tn)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[20]=o,e[21]=n.mode,e[22]=n.trackedUpstream,e[23]=x):x=e[23];let C;return e[24]!==_||e[25]!==b||e[26]!==x?(C=(0,$.jsxs)(`section`,{"aria-labelledby":Zt,className:`space-y-4`,"data-testid":`settings-sharing`,children:[g,_,b,x]}),e[24]=_,e[25]=b,e[26]=x,e[27]=C):C=e[27],C}function tn(e){return(0,$.jsx)(`li`,{children:e},e)}function nn(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}var rn=G,an=Q.createContext({}),on=e=>{let t=(0,Z.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i;t[4]===n?i=t[5]:(i=(0,$.jsx)(J,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==r||t[7]!==i?(a=(0,$.jsx)(an.Provider,{value:r,children:i}),t[6]=r,t[7]=i,t[8]=a):a=t[8],a},sn=()=>{let e=(0,Z.c)(13),t=Q.use(an),n=Q.use(cn),{getFieldState:r}=ve(),i;e[0]===t.name?i=e[1]:(i={name:t.name},e[0]=t.name,e[1]=i);let a=q(i),o;e[2]!==t.name||e[3]!==a||e[4]!==r?(o=r(t.name,a),e[2]=t.name,e[3]=a,e[4]=r,e[5]=o):o=e[5];let s=o;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:c}=n,l=`${c}-form-item`,u=`${c}-form-item-description`,d=`${c}-form-item-message`,f;return e[6]!==t.name||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==u||e[11]!==d?(f={id:c,name:t.name,formItemId:l,formDescriptionId:u,formMessageId:d,...s},e[6]=t.name,e[7]=s,e[8]=c,e[9]=l,e[10]=u,e[11]=d,e[12]=f):f=e[12],f},cn=Q.createContext({});function ln(e){let t=(0,Z.c)(13),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=Q.useId(),a;t[3]===i?a=t[4]:(a={id:i},t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=w(`grid gap-2`,n),t[5]=n,t[6]=o);let s;t[7]!==r||t[8]!==o?(s=(0,$.jsx)(`div`,{"data-slot":`form-item`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,$.jsx)(cn.Provider,{value:a,children:s}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function un(e){let t=(0,Z.c)(10),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{error:i,formItemId:a}=sn(),o=!!i,s;t[3]===n?s=t[4]:(s=w(`data-[error=true]:text-destructive`,n),t[3]=n,t[4]=s);let c;return t[5]!==a||t[6]!==r||t[7]!==o||t[8]!==s?(c=(0,$.jsx)(U,{"data-slot":`form-label`,"data-error":o,className:s,htmlFor:a,...r}),t[5]=a,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function dn(e){let t=(0,Z.c)(7),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{error:r,formItemId:i,formDescriptionId:a,formMessageId:o}=sn(),s=r?`${a} ${o}`:`${a}`,c=!!r,l;return t[2]!==i||t[3]!==n||t[4]!==s||t[5]!==c?(l=(0,$.jsx)(x,{"data-slot":`form-control`,id:i,"aria-describedby":s,"aria-invalid":c,...n}),t[2]=i,t[3]=n,t[4]=s,t[5]=c,t[6]=l):l=t[6],l}function fn(e){let t=(0,Z.c)(9),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{formDescriptionId:i}=sn(),a;t[3]===n?a=t[4]:(a=w(`text-1sm text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==r||t[7]!==a?(o=(0,$.jsx)(`p`,{"data-slot":`form-description`,id:i,className:a,...r}),t[5]=i,t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function pn(e){let t=(0,Z.c)(11),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{error:i,formMessageId:a}=sn(),o=i?String(i?.message??``):r.children;if(!o)return null;let s=i?`alert`:void 0,c;t[3]===n?c=t[4]:(c=w(`text-sm text-destructive`,n),t[3]=n,t[4]=c);let l;return t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s||t[9]!==c?(l=(0,$.jsx)(`p`,{"data-slot":`form-message`,id:a,role:s,className:c,...r,children:o}),t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function mn(e){let t=(0,Z.c)(30),{authQueryTransport:n,authTransport:r}=e,{_:i}=y(),a;t[0]===n?a=t[1]:(a=n??Te(),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={phase:`loading`},t[2]=s):s=t[2];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),_;t[3]===o?_=t[4]:(_=async function(){l({phase:`loading`});try{let e=await o.status();l({phase:`loaded`,result:e}),Se(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),l({phase:`check-failed`})}},t[3]=o,t[4]=_);let b=_,x;t[5]===b?x=t[6]:(x=()=>{b()},t[5]=b,t[6]=x);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[7]=C):C=t[7],(0,Q.useEffect)(x,C);let w;t[8]!==i||t[9]!==b||t[10]!==o?(w=async function(){if(g.current)return;g.current=!0,d(!1),p(!0),h(null);let e=null;try{let t=o.signout?await o.signout():{ok:!1,error:i({id:`8cpOa8`})};t.ok||(e=t.error??i({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=i({id:`8cpOa8`})}await b(),e&&h(e),p(!1),g.current=!1},t[8]=i,t[9]=b,t[10]=o,t[11]=w):w=t[11];let T=w,E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(`h3`,{id:`settings-account-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`AeXO77`})}),t[12]=E):E=t[12];let D;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[E,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`E6lrpp`})})]}),t[13]=D):D=t[13];let O;t[14]!==m||t[15]!==f||t[16]!==T||t[17]!==b||t[18]!==c.phase||t[19]!==c.result?(O=c.phase===`loading`?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`IWGfGF`})}),(0,$.jsx)(Y,{className:`h-4 w-40`}),(0,$.jsx)(Y,{className:`h-8 w-32`})]}):c.phase===`check-failed`?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`T_wG4n`})}),(0,$.jsx)(S,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(v,{id:`KDw4GX`})})]}):c.result.authenticated?c.result.tier===`A`?(0,$.jsx)(gn,{login:c.result.login}):(0,$.jsx)(hn,{login:c.result.login,disconnecting:f,error:m,onDisconnect:()=>void T()}):(0,$.jsx)(_n,{onConnect:()=>d(!0)}),t[14]=m,t[15]=f,t[16]=T,t[17]=b,t[18]=c.phase,t[19]=c.result,t[20]=O):O=t[20];let k;t[21]===b?k=t[22]:(k=()=>{b()},t[21]=b,t[22]=k);let A;t[23]!==u||t[24]!==r||t[25]!==k?(A=(0,$.jsx)(le,{open:u,onOpenChange:d,transport:r,onSuccess:k}),t[23]=u,t[24]=r,t[25]=k,t[26]=A):A=t[26];let j;return t[27]!==A||t[28]!==O?(j=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[D,O,A]}),t[27]=A,t[28]=O,t[29]=j):j=t[29],j}function hn(e){let t=(0,Z.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`nxlOpL`})}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[3]=o,t[4]=c);let l;t[5]===r?l=t[6]:(l=r?(0,$.jsx)(v,{id:`rppgXF`}):(0,$.jsx)(v,{id:`-K0AvT`}),t[5]=r,t[6]=l);let u;t[7]!==r||t[8]!==a||t[9]!==l?(u=(0,$.jsx)(S,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:l}),t[7]=r,t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==c||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(v,{id:`msOK6I`})}),t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:i}):null,t[15]=i,t[16]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[d,f,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function gn(e){let t=(0,Z.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`ny6vNn`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[r,i]})}),t[3]=r,t[4]=a),a}function _n(e){let t=(0,Z.c)(5),{onConnect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`S33tz3`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(v,{id:`3jod3l`}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,(0,$.jsx)(S,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function vn(e){return e.kind===`editor`?`editor:${e.id}`:e.kind===`skill`?`skill:${e.id}`:`path`}function yn(e){let t=(0,Z.c)(11),{testId:n,children:r}=e,{_:i}=y(),a;t[0]===i?a=t[1]:(a=i({id:`2B6eYX`}),t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Lt,{className:`size-3.5`}),t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==n?(s=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(S,{variant:`ghost`,size:`icon`,className:`mt-1.5 mr-1.5 h-6 w-6 shrink-0 text-muted-foreground opacity-60 hover:opacity-100`,"aria-label":a,"data-testid":n,children:o})}),t[3]=a,t[4]=n,t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=(0,$.jsx)(E,{side:`left`,className:`max-w-sm text-left`,children:(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:r})}),t[6]=r,t[7]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(D,{children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function bn(){let e=(0,Z.c)(38),{_:t}=y(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l,u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{if(!n)return;let e=!1;return n.integrations.status().then(t=>{e||i(t)}).catch(()=>{e||o(!0)}),()=>{e=!0}},u=[n],e[0]=l,e[1]=u):(l=e[0],u=e[1]),(0,Q.useEffect)(l,u);let d;e[2]===t?d=e[3]:(d=async function(e,r){if(n){c(vn(e));try{let t=await n.integrations.setComponent({component:e,enabled:r});i(t.status),t.ok||X.error(t.error)}catch(e){let n=e;X.error(t({id:`gfdqcY`,values:{0:n instanceof Error?n.message:String(n)}}))}c(null)}},e[2]=t,e[3]=d);let f=d,p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`h3`,{id:`settings-ai-tools-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`_5qBNl`})}),e[4]=p):p=e[4];let m;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[p,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`mLAjyL`})})]}),e[5]=m):m=e[5];let h=m;if(!n||a){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`ai-tools-unavailable`,children:(0,$.jsx)(v,{id:`O4PnDd`})})]}),e[6]=t):t=e[6],t}if(r===null){let t;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`ai-tools-loading`,children:[(0,$.jsx)(Y,{className:`h-10 w-full`}),(0,$.jsx)(Y,{className:`h-10 w-full`}),(0,$.jsx)(Y,{className:`h-10 w-full`})]})]}),e[7]=t):t=e[7],t}let g=s!==null||!r.available,_=r.path.shellDetected||r.path.installed,b;e[8]===r.available?b=e[9]:(b=!r.available&&(0,$.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,"data-testid":`ai-tools-read-only`,children:(0,$.jsx)(v,{id:`OplnBG`})}),e[8]=r.available,e[9]=b);let x;e[10]!==t||e[11]!==f||e[12]!==g||e[13]!==_||e[14]!==r.path.installed||e[15]!==r.path.rcFilesToTouch?(x=_&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`ALhMYW`})}),(0,$.jsxs)(`div`,{className:`flex items-start overflow-hidden rounded-md border border-border bg-card/50 hover:bg-accent`,children:[(0,$.jsxs)(U,{htmlFor:`ai-tools-path`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(z,{id:`ai-tools-path`,checked:r.path.installed,disabled:g,onCheckedChange:()=>void f({kind:`path`},!r.path.installed),className:`mt-0.5`,"data-testid":`ai-tools-path-checkbox`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(v,{id:`Fsx78O`,components:{0:(0,$.jsx)(`code`,{className:`inline-code`})}})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-path-status`,children:r.path.installed?t({id:`yhdqox`}):t({id:`04XyCH`,values:{0:r.path.rcFilesToTouch.join(`, `)}})})]})]}),(0,$.jsxs)(yn,{testId:`ai-tools-path-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`f9lQNJ`})}),r.path.rcFilesToTouch.map(Sn),(0,$.jsx)(`p`,{className:`pt-1`,children:(0,$.jsx)(v,{id:`CWzc2T`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]})]})]}),e[10]=t,e[11]=f,e[12]=g,e[13]=_,e[14]=r.path.installed,e[15]=r.path.rcFilesToTouch,e[16]=x):x=e[16];let S;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`psfGPX`})}),e[17]=S):S=e[17];let C;if(e[18]!==t||e[19]!==f||e[20]!==g||e[21]!==r.editors){let n;e[23]!==t||e[24]!==f||e[25]!==g?(n=e=>{let n=e.state===`installed`||e.state===`foreign`,r=g||e.state===`unmanageable`,i=e.state===`not-installed`&&!e.detected,a=`https://openknowledge.ai/docs/integrations/${Fe[e.id]}`,o=e.state===`installed`?t({id:`eQkgKV`}):e.state===`foreign`?t({id:`AczYxH`}):e.state===`unmanageable`?t({id:`LbmLyU`}):e.detected?t({id:`bBE5tC`}):null,s=e.state===`foreign`||e.state===`unmanageable`?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`;return(0,$.jsxs)(`li`,{className:r?`flex items-start`:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(U,{htmlFor:`ai-tools-editor-${e.id}`,className:r?`flex flex-1 items-start gap-2.5 px-3 py-2.5 font-normal`:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(z,{id:`ai-tools-editor-${e.id}`,checked:n,disabled:r,onCheckedChange:()=>void f({kind:`editor`,id:e.id},!n),className:`mt-0.5`,"data-testid":`ai-tools-editor-checkbox-${e.id}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.label}),o!==null&&(0,$.jsx)(`span`,{className:s,"data-testid":`ai-tools-editor-status-${e.id}`,children:o})]})]}),i&&(0,$.jsxs)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Yt(e,a),onAuxClick:e=>Yt(e,a),"aria-label":t({id:`D-Oh1s`,values:{0:e.label}}),className:`flex shrink-0 items-center gap-0.5 px-2 py-2.5 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`ai-tools-editor-status-${e.id}`,children:[(0,$.jsx)(v,{id:`P_bX4O`}),(0,$.jsx)(rt,{className:`size-3`,"aria-hidden":!0})]}),(0,$.jsxs)(yn,{testId:`ai-tools-editor-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`J2eKUI`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.configPath??t({id:`ndwmea`})})}),(0,$.jsx)(`p`,{className:`pt-1 opacity-70`,children:(0,$.jsx)(v,{id:`VIwCaD`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.entryLocator})})]})]},e.id)},e[23]=t,e[24]=f,e[25]=g,e[26]=n):n=e[26],C=r.editors.map(n),e[18]=t,e[19]=f,e[20]=g,e[21]=r.editors,e[22]=C}else C=e[22];let w;e[27]===C?w=e[28]:(w=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[S,(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:C})]}),e[27]=C,e[28]=w);let T;e[29]!==f||e[30]!==g||e[31]!==r.skills?(T=r.skills.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`28B21t`})}),(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:r.skills.map(e=>(0,$.jsxs)(`li`,{className:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(U,{htmlFor:`ai-tools-skill-${e.id}`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(z,{id:`ai-tools-skill-${e.id}`,checked:e.installed,disabled:g,onCheckedChange:()=>void f({kind:`skill`,id:e.id},!e.installed),className:`mt-0.5`,"data-testid":`ai-tools-skill-checkbox-${e.id}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(`code`,{children:e.name})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-skill-status-${e.id}`,children:e.id===`discovery`?(0,$.jsx)(v,{id:`0inVGS`}):(0,$.jsx)(v,{id:`FXk_zY`})})]})]}),(0,$.jsxs)(yn,{testId:`ai-tools-skill-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`HSh8u_`})}),e.paths.map(xn)]})]},e.id))})]}),e[29]=f,e[30]=g,e[31]=r.skills,e[32]=T):T=e[32];let E;return e[33]!==T||e[34]!==b||e[35]!==x||e[36]!==w?(E=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[h,b,x,w,T]}),e[33]=T,e[34]=b,e[35]=x,e[36]=w,e[37]=E):E=e[37],E}function xn(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function Sn(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}async function Cn(e){try{let t=Je.safeParse(await e.json());if(t.success)return t.data.title}catch{}}async function wn(e,t){try{let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return n.ok?{ok:!0}:{ok:!1,error:await Cn(n)}}catch{return{ok:!1}}}function Tn(){return{setKey:e=>wn(`/api/local-op/embeddings/set-key`,{key:e}),clearKey:()=>wn(`/api/local-op/embeddings/clear-key`,{})}}function En(e){let t=(0,Z.c)(29),{transport:n}=e,{_:r}=y(),i;t[0]===n?i=t[1]:(i=n??Tn(),t[0]=n,t[1]=i);let a=i,{status:o,refresh:s}=ne(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),m=o?.keyPresent??!1,h=o?.keySource??null,g=o?.keyHint??null,_;t[2]!==r||t[3]!==u||t[4]!==c||t[5]!==s||t[6]!==a?(_=async function(){let e=c.trim();if(!e||u)return;d(!0),p(null);let t=await a.setKey(e);d(!1),t.ok?(l(``),s()):p(t.error??r({id:`Ck9XRt`}))},t[2]=r,t[3]=u,t[4]=c,t[5]=s,t[6]=a,t[7]=_):_=t[7];let b=_,x;t[8]!==r||t[9]!==u||t[10]!==s||t[11]!==a?(x=async function(){if(u)return;d(!0),p(null);let e=await a.clearKey();d(!1),e.ok?s():p(e.error??r({id:`CSL0l1`}))},t[8]=r,t[9]=u,t[10]=s,t[11]=a,t[12]=x):x=t[12];let C=x,w;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(`h3`,{id:`settings-embeddings-key-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`nh3wwx`})}),t[13]=w):w=t[13];let T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[w,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`wccmX0`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),t[14]=T):T=t[14];let E;t[15]!==r||t[16]!==u||t[17]!==g||t[18]!==c||t[19]!==m||t[20]!==h||t[21]!==C||t[22]!==b?(E=h===`env`?(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-embeddings-key-env`,children:(0,$.jsx)(v,{id:`KH5bQi`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}):(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,"data-testid":`settings-embeddings-key-set`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-1.5 text-sm font-medium`,children:(0,$.jsx)(v,{id:`AqnqMJ`})}),g?(0,$.jsxs)(`p`,{className:`truncate font-mono text-muted-foreground text-xs`,title:r({id:`qEIFZu`,values:{keyHint:g}}),"data-testid":`settings-embeddings-key-hint`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`••••••••`}),g]}):null,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`3TCafD`})})]}),(0,$.jsx)(S,{variant:`outline`,onClick:()=>void C(),disabled:u,"data-testid":`settings-embeddings-key-clear`,children:(0,$.jsx)(v,{id:`xCJdfg`})})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`settings-embeddings-key-input`,className:`mb-2 block text-sm font-medium`,children:m?(0,$.jsx)(v,{id:`UW93oq`}):(0,$.jsx)(v,{id:`K6jxcj`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Bt,{id:`settings-embeddings-key-input`,type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:r({id:`tsiTqO`}),autoComplete:`off`,spellCheck:!1,disabled:u,"data-testid":`settings-embeddings-key-input`,className:`h-8 font-mono text-sm`}),(0,$.jsx)(S,{onClick:()=>void b(),disabled:u||c.trim().length===0,"data-testid":`settings-embeddings-key-save`,children:u?(0,$.jsx)(v,{id:`uF9ruK`}):(0,$.jsx)(v,{id:`tfDRzk`})})]})]})]}),t[15]=r,t[16]=u,t[17]=g,t[18]=c,t[19]=m,t[20]=h,t[21]=C,t[22]=b,t[23]=E):E=t[23];let D;t[24]===f?D=t[25]:(D=f?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-embeddings-key-error`,children:f}):null,t[24]=f,t[25]=D);let O;return t[26]!==E||t[27]!==D?(O=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-embeddings-key-title`,className:`space-y-3`,"data-testid":`settings-embeddings-key`,children:[T,(0,$.jsxs)(`div`,{className:`space-y-3 rounded-md border p-3`,children:[E,D]})]}),t[26]=E,t[27]=D,t[28]=O):O=t[28],O}var Dn=e(t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}var r=``,i=` `,a=`\\`,o=/^\s+$/,s=/(?:[^\\]|^)\\$/,c=/^\\!/,l=/^\\#/,u=/\r?\n/g,d=/^\.*\/|^\.+$/,f=`/`,p=`node-ignore`;typeof Symbol<`u`&&(p=Symbol.for(`node-ignore`));var m=p,h=(e,t,n)=>Object.defineProperty(e,t,{value:n}),g=/([0-z])-([0-z])/g,_=()=>!1,v=e=>e.replace(g,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:r),y=e=>{let{length:t}=e;return e.slice(0,t-t%2)},b=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?i:r)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+i}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>a],[/\\\\/g,()=>a],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===a?`\\[${n}${y(r)}${i}`:i===`]`&&r.length%2==0?`[${v(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],x=Object.create(null),S=(e,t)=>{let n=x[e];return n||(n=b.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),x[e]=n),t?new RegExp(n,`i`):new RegExp(n)},C=e=>typeof e==`string`,w=e=>e&&C(e)&&!o.test(e)&&!s.test(e)&&e.indexOf(`#`)!==0,T=e=>e.split(u),E=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}},D=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(c,`!`).replace(l,`#`);let i=S(e,t);return new E(n,e,r,i)},O=(e,t)=>{throw new t(e)},k=(e,t,n)=>C(e)?e?k.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),A=e=>d.test(e);k.isNotRelative=A,k.convert=e=>e;var j=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){h(this,m,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[m]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(w(e)){let t=D(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(C(e)?T(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&k.convert(e);return k(i,e,this._allowRelativePaths?_:O),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(f),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(f)+f,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},M=e=>new j(e);if(M.isPathValid=e=>k(e&&k.convert(e),e,_),M.default=M,t.exports=M,typeof process<`u`&&({}.IGNORE_TEST_WIN32||process.platform===`win32`)){k.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;k.isNotRelative=t=>e.test(t)||A(t)}}))(),1),On=new Map;function kn(e){let t=On.get(e);if(t)return On.delete(e),On.set(e,t),t;let n=(0,Dn.default)();if(n.add(e),On.set(e,n),On.size>256){let e=On.keys().next().value;e!==void 0&&On.delete(e)}return n}function An(e,t){let n=e.trim();if(n.length===0||n.startsWith(`#`))return 0;let r=kn(n),i=0;for(let e of t)e.length!==0&&r.ignores(e)&&(i+=1);return i}var jn={"trailing-backslash":`Trailing backslash — line continuation isn't supported.`,"unmatched-bracket":`Unmatched [ — character class is open.`,"lone-bang":`Lone ! — negation needs a pattern after it.`,"leading-whitespace":`Leading whitespace — the rule may not match as expected.`,"embedded-newline":`Embedded line break — the row spans multiple lines.`};function Mn(e){let t=[];if(e.length===0||e.trimStart().startsWith(`#`))return t;/[\r\n]/.test(e)&&t.push({code:`embedded-newline`,message:jn[`embedded-newline`]}),/^\s/.test(e)&&t.push({code:`leading-whitespace`,message:jn[`leading-whitespace`]});let n=e.trim();return n===`!`&&t.push({code:`lone-bang`,message:jn[`lone-bang`]}),n.endsWith(`\\`)&&t.push({code:`trailing-backslash`,message:jn[`trailing-backslash`]}),Nn(n,`[`)>Nn(n,`]`)&&t.push({code:`unmatched-bracket`,message:jn[`unmatched-bracket`]}),t}function Nn(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}var Pn=`https://openknowledge.ai/docs/features/ignore-patterns`,Fn=1200,In=150,Ln=150,Rn=5e3,zn=600,Bn=400,Vn=`okignore-show-advanced`;function Hn(e){let t=(0,Z.c)(3),{binding:n,synced:r}=e;if(n===null||!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Un,{}),t[0]=e):e=t[0],e}let i;return t[1]===n?i=t[2]:(i=(0,$.jsx)(Wn,{binding:n}),t[1]=n,t[2]=i),i}function Un(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-skeleton`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3zyg_A`})}),(0,$.jsx)(Y,{className:`h-4 w-72`})]}),(0,$.jsx)(Y,{className:`h-20 w-full`})]}),e[0]=t):t=e[0],t}function Wn(e){let t=(0,Z.c)(72),{binding:n}=e,{_:r}=y(),i;t[0]===n?i=t[1]:(i=()=>n.current(),t[0]=n,t[1]=i);let[a,o]=(0,Q.useState)(i),s,c;t[2]===n?(s=t[3],c=t[4]):(s=()=>n.subscribe(e=>{o(e)}),c=[n],t[2]=n,t[3]=s,t[4]=c),(0,Q.useEffect)(s,c);let{pages:l,pageMeta:u,assetPaths:d}=ot(),f;t[5]!==d||t[6]!==u||t[7]!==l?(f=dr(l,u,d),t[5]=d,t[6]=u,t[7]=l,t[8]=f):f=t[8];let p=f,m,h;t[9]===a?(m=t[10],h=t[11]):(m=xe(a),h=we(m),t[9]=a,t[10]=m,t[11]=h);let g=h,_=g.length===0,[b,x]=(0,Q.useState)(null),S=(0,Q.useRef)(null),C,w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>()=>{S.current&&clearTimeout(S.current)},w=[],t[12]=C,t[13]=w):(C=t[12],w=t[13]),(0,Q.useEffect)(C,w);let T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{x({key:e,ts:Date.now()}),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>x(null),Fn)},t[14]=T):T=t[14];let E=T,[D,O]=(0,Q.useState)(null),k=(0,Q.useRef)(null),A,j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>{k.current&&clearTimeout(k.current)},A=[],t[15]=A,t[16]=j):(A=t[15],j=t[16]),(0,Q.useEffect)(j,A);let M,N;t[17]===n?(M=t[18],N=t[19]):(M=()=>_e(e=>{e.docName===`__config__/okignore`&&n.notifyRejection(e.error)}),N=[n],t[17]=n,t[18]=M,t[19]=N),(0,Q.useEffect)(M,N);let P,F;t[20]===n?(P=t[21],F=t[22]):(P=()=>n.subscribeRejection(e=>{let{error:t}=e,n=sr(t);O({message:n?.detail??Ue(t),lineNumber:n?.lineNumber,ts:Date.now()}),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>O(null),Rn)}),F=[n],t[20]=n,t[21]=P,t[22]=F),(0,Q.useEffect)(P,F);let I,L;t[23]===r?(I=t[24],L=t[25]):(I=()=>Ce(e=>{let{path:t}=e;X.error(r({id:`3oh0nQ`,values:{path:t}}),{description:e.error,id:`okignore-nested-error:${e.path}`,duration:8e3})}),L=[r],t[23]=r,t[24]=I,t[25]=L),(0,Q.useEffect)(I,L);let R;t[26]===n?R=t[27]:(R=e=>{n.patch(e)},t[26]=n,t[27]=R);let z=R,B;t[28]!==z||t[29]!==m||t[30]!==g?(B=(e,t)=>{let n=t.trim(),r=g[e];if(r&&n!==r.text){if(n.length===0){z(ue(ge(m,e)));return}z(ue(pe(m,e,n))),E(or(n,e))}},t[28]=z,t[29]=m,t[30]=g,t[31]=B):B=t[31];let V=B,H;t[32]!==z||t[33]!==m?(H=e=>{z(ue(ge(m,e)))},t[32]=z,t[33]=m,t[34]=H):H=t[34];let U=H,W;t[35]!==z||t[36]!==m||t[37]!==g.length?(W=e=>{let t=e.trim();if(t.length===0)return;let n=me(m,t);if(n>=0){E(or(t,n));return}z(ue(De(m,t))),E(or(t,g.length))},t[35]=z,t[36]=m,t[37]=g.length,t[38]=W):W=t[38];let ee=W,te;t[39]!==z||t[40]!==m?(te=e=>{let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=ar(t),i=ar(n);r<0||i<0||r===i||z(ue(he(m,r,i)))},t[39]=z,t[40]=m,t[41]=te):te=t[41];let ne=te,re;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(re={activationConstraint:{distance:4}},t[42]=re):re=t[42];let ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ie={coordinateGetter:At},t[43]=ie):ie=t[43];let ae=Ft(wt(kt,re),wt(jt,ie)),G=D===null?null:`rejection-${D.ts}`,[K,q]=mr(),oe;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(`h3`,{id:`settings-okignore-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3zyg_A`})}),t[44]=oe):oe=t[44];let se;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[oe,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`Z5h97D`,components:{0:(0,$.jsx)(`a`,{href:Pn,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline-offset-2 hover:underline`,"data-testid":`settings-okignore-primer`})}})})]}),t[45]=se):se=t[45];let J;t[46]===D?J=t[47]:(J=D===null?null:(0,$.jsx)(qn,{rejection:D}),t[46]=D,t[47]=J);let Y;t[48]!==n||t[49]!==p||t[50]!==ee||t[51]!==ne||t[52]!==V||t[53]!==U||t[54]!==_||t[55]!==g||t[56]!==G||t[57]!==b||t[58]!==ae||t[59]!==K||t[60]!==a?(Y=K?(0,$.jsx)(Gn,{binding:n,text:a}):_?(0,$.jsx)(Jn,{onAdd:ee,rejectionFlashKey:G,filePaths:p}):(0,$.jsx)(Yn,{patterns:g,sensors:ae,onDragEnd:ne,onEdit:V,onRemove:U,onAdd:ee,savedFlash:b,rejectionFlashKey:G,filePaths:p}),t[48]=n,t[49]=p,t[50]=ee,t[51]=ne,t[52]=V,t[53]=U,t[54]=_,t[55]=g,t[56]=G,t[57]=b,t[58]=ae,t[59]=K,t[60]=a,t[61]=Y):Y=t[61];let ce;t[62]!==q||t[63]!==K?(ce=()=>q(!K),t[62]=q,t[63]=K,t[64]=ce):ce=t[64];let le;t[65]!==K||t[66]!==ce?(le=(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(Kn,{enabled:K,onToggle:ce})}),t[65]=K,t[66]=ce,t[67]=le):le=t[67];let de;return t[68]!==J||t[69]!==Y||t[70]!==le?(de=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-okignore-title`,className:`space-y-3`,"data-testid":`settings-okignore-section`,children:[se,J,Y,le]}),t[68]=J,t[69]=Y,t[70]=le,t[71]=de):de=t[71],de}function Gn(e){let t=(0,Z.c)(31),{binding:n,text:r}=e,{_:i}=y(),[a,o]=(0,Q.useState)(r),s=(0,Q.useRef)(r),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(r),u=(0,Q.useRef)(null),d,f;t[0]===r?(d=t[1],f=t[2]):(d=()=>{c.current||r!==s.current&&(o(r),l.current=r,s.current=r)},f=[r],t[0]=r,t[1]=d,t[2]=f),(0,Q.useEffect)(d,f);let p,m;t[3]===a?(p=t[4],m=t[5]):(p=()=>{l.current=a},m=[a],t[3]=a,t[4]=p,t[5]=m),(0,Q.useEffect)(p,m);let h,g;t[6]===n?(h=t[7],g=t[8]):(h=()=>()=>{u.current&&(clearTimeout(u.current),u.current=null,l.current!==s.current&&(n.patch(l.current),s.current=l.current))},g=[n],t[6]=n,t[7]=h,t[8]=g),(0,Q.useEffect)(h,g);let _;t[9]===n?_=t[10]:(_=e=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,e!==s.current&&(s.current=e,n.patch(e))},Bn)},t[9]=n,t[10]=_);let v=_,b;t[11]===n?b=t[12]:(b=()=>{u.current&&=(clearTimeout(u.current),null),l.current!==s.current&&(s.current=l.current,n.patch(l.current))},t[11]=n,t[12]=b);let x=b,S;t[13]===v?S=t[14]:(S=e=>{o(e.target.value),v(e.target.value)},t[13]=v,t[14]=S);let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{c.current=!0},t[15]=C):C=t[15];let w;t[16]===x?w=t[17]:(w=()=>{c.current=!1,x()},t[16]=x,t[17]=w);let T;t[18]===a?T=t[19]:(T=a.split(`
2
2
  `),t[18]=a,t[19]=T);let E=Math.max(6,Math.min(20,T.length+1)),D;t[20]===i?D=t[21]:(D=i({id:`rssK8c`}),t[20]=i,t[21]=D);let O;t[22]===i?O=t[23]:(O=i({id:`AeHuzT`}),t[22]=i,t[23]=O);let k;return t[24]!==a||t[25]!==w||t[26]!==E||t[27]!==D||t[28]!==O||t[29]!==S?(k=(0,$.jsx)(`textarea`,{value:a,onChange:S,onFocus:C,onBlur:w,spellCheck:!1,rows:E,"aria-label":D,placeholder:O,className:`min-h-32 w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,"data-testid":`settings-okignore-advanced-textarea`}),t[24]=a,t[25]=w,t[26]=E,t[27]=D,t[28]=O,t[29]=S,t[30]=k):k=t[30],k}function Kn(e){let t=(0,Z.c)(6),{enabled:n,onToggle:r}=e,i;t[0]===n?i=t[1]:(i=n?(0,$.jsx)(v,{id:`9PQysm`}):(0,$.jsx)(v,{id:`Nv3mUj`}),t[0]=n,t[1]=i);let a;return t[2]!==n||t[3]!==r||t[4]!==i?(a=(0,$.jsx)(S,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,"aria-pressed":n,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,"data-testid":`settings-okignore-show-advanced-toggle`,children:i}),t[2]=n,t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function qn(e){let t=(0,Z.c)(7),{rejection:n}=e,{_:r}=y(),{lineNumber:i,message:a}=n,o;t[0]!==r||t[1]!==i||t[2]!==a?(o=r(i===void 0?{id:`G7-rf8`,values:{message:a}}:{id:`P3NS4G`,values:{lineNumber:i,message:a}}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3];let s=o,c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(Rt,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0`}),t[4]=c):c=t[4];let l;return t[5]===s?l=t[6]:(l=(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`settings-okignore-rejection-banner`,className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive animate-in fade-in`,children:[c,(0,$.jsx)(`span`,{children:s})]}),t[5]=s,t[6]=l),l}function Jn(e){let t=(0,Z.c)(8),{onAdd:n,rejectionFlashKey:r,filePaths:i}=e,{_:a}=y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`makN88`})}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=a({id:`Gx0VS1`}),t[1]=a,t[2]=s);let c;return t[3]!==i||t[4]!==n||t[5]!==r||t[6]!==s?(c=(0,$.jsxs)(`div`,{className:`space-y-3 rounded-md border border-dashed p-4`,"data-testid":`settings-okignore-empty`,children:[o,(0,$.jsx)($n,{onAdd:n,placeholder:s,rejectionFlashKey:r,filePaths:i})]}),t[3]=i,t[4]=n,t[5]=r,t[6]=s,t[7]=c):c=t[7],c}function Yn(e){let t=(0,Z.c)(35),{patterns:n,sensors:r,onDragEnd:i,onEdit:a,onRemove:o,onAdd:s,savedFlash:c,rejectionFlashKey:l,filePaths:u}=e,{_:d}=y(),f;t[0]===n?f=t[1]:(f=n.map(Xn),t[0]=n,t[1]=f);let p=f,m;t[2]===d?m=t[3]:(m=d({id:`3zyg_A`}),t[2]=d,t[3]=m);let h;if(t[4]!==u||t[5]!==a||t[6]!==o||t[7]!==n||t[8]!==c){let e;t[10]!==u||t[11]!==a||t[12]!==o||t[13]!==c?(e=(e,t)=>{let n=or(e.text,t),r=c!==null&&c.key===n;return(0,$.jsx)(Zn,{sortableId:ir(t),patternIndex:t,pattern:e,onEdit:a,onRemove:o,flashActive:r,filePaths:u},ir(t))},t[10]=u,t[11]=a,t[12]=o,t[13]=c,t[14]=e):e=t[14],h=n.map(e),t[4]=u,t[5]=a,t[6]=o,t[7]=n,t[8]=c,t[9]=h}else h=t[9];let g;t[15]!==m||t[16]!==h?(g=(0,$.jsx)(`ul`,{"aria-label":m,className:`divide-y rounded-md border`,"data-testid":`settings-okignore-list`,children:h}),t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;t[18]!==p||t[19]!==g?(_=(0,$.jsx)(Mt,{items:p,strategy:Et,children:g}),t[18]=p,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==i||t[22]!==r||t[23]!==_?(v=(0,$.jsx)(Dt,{sensors:r,collisionDetection:Ot,onDragEnd:i,children:_}),t[21]=i,t[22]=r,t[23]=_,t[24]=v):v=t[24];let b;t[25]===d?b=t[26]:(b=d({id:`cZGNlb`}),t[25]=d,t[26]=b);let x;t[27]!==u||t[28]!==s||t[29]!==l||t[30]!==b?(x=(0,$.jsx)($n,{onAdd:s,placeholder:b,rejectionFlashKey:l,filePaths:u}),t[27]=u,t[28]=s,t[29]=l,t[30]=b,t[31]=x):x=t[31];let S;return t[32]!==v||t[33]!==x?(S=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[v,x]}),t[32]=v,t[33]=x,t[34]=S):S=t[34],S}function Xn(e,t){return ir(t)}function Zn(e){let t=(0,Z.c)(47),{sortableId:n,patternIndex:r,pattern:i,onEdit:a,onRemove:o,flashActive:s,filePaths:c}=e,{_:l}=y(),u;t[0]===n?u=t[1]:(u={id:n},t[0]=n,t[1]=u);let{attributes:d,listeners:f,setNodeRef:p,transform:m,transition:h,isDragging:g}=Pt(u),_=i.text,v;t[2]===m?v=t[3]:(v=It.Transform.toString(m),t[2]=m,t[3]=v);let b=g?.5:void 0,x=g?1:void 0,C;t[4]!==v||t[5]!==b||t[6]!==x||t[7]!==h?(C={transform:v,transition:h,opacity:b,zIndex:x},t[4]=v,t[5]=b,t[6]=x,t[7]=h,t[8]=C):C=t[8];let w=C,T;t[9]!==l||t[10]!==_?(T=l({id:`7_bFEL`,values:{patternText:_}}),t[9]=l,t[10]=_,t[11]=T):T=t[11];let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Tt,{className:`size-3.5`}),t[12]=E):E=t[12];let D;t[13]!==d||t[14]!==f||t[15]!==T?(D=(0,$.jsx)(S,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`settings-okignore-drag-handle`,"aria-label":T,...d,...f,className:`h-7 w-4 shrink-0 cursor-grab touch-none px-0 text-muted-foreground/40 hover:text-foreground focus-visible:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing`,children:E}),t[13]=d,t[14]=f,t[15]=T,t[16]=D):D=t[16];let O;t[17]!==a||t[18]!==r?(O=e=>a(r,e),t[17]=a,t[18]=r,t[19]=O):O=t[19];let k;t[20]!==c||t[21]!==i.text||t[22]!==r||t[23]!==O?(k=(0,$.jsx)(Qn,{patternIndex:r,initialText:i.text,onCommit:O,filePaths:c}),t[20]=c,t[21]=i.text,t[22]=r,t[23]=O,t[24]=k):k=t[24];let A;t[25]===s?A=t[26]:(A=(0,$.jsx)(rr,{visible:s}),t[25]=s,t[26]=A);let j;t[27]!==l||t[28]!==_?(j=l({id:`S9Vnum`,values:{patternText:_}}),t[27]=l,t[28]=_,t[29]=j):j=t[29];let M;t[30]!==o||t[31]!==r?(M=()=>o(r),t[30]=o,t[31]=r,t[32]=M):M=t[32];let N;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(zt,{className:`size-3.5`}),t[33]=N):N=t[33];let P;t[34]!==j||t[35]!==M?(P=(0,$.jsx)(S,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`settings-okignore-remove`,"aria-label":j,onClick:M,className:`h-7 w-7 shrink-0 text-muted-foreground hover:text-destructive`,children:N}),t[34]=j,t[35]=M,t[36]=P):P=t[36];let F;t[37]!==k||t[38]!==A||t[39]!==P||t[40]!==D?(F=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[D,k,A,P]}),t[37]=k,t[38]=A,t[39]=P,t[40]=D,t[41]=F):F=t[41];let I;return t[42]!==r||t[43]!==p||t[44]!==w||t[45]!==F?(I=(0,$.jsx)(`li`,{ref:p,style:w,className:`flex flex-col gap-0.5 px-2 py-1.5`,"data-testid":`settings-okignore-row`,"data-pattern-index":r,children:F}),t[42]=r,t[43]=p,t[44]=w,t[45]=F,t[46]=I):I=t[46],I}function Qn(e){let t=(0,Z.c)(31),{patternIndex:n,initialText:r,onCommit:i,filePaths:a}=e,{_:o}=y(),[s,c]=(0,Q.useState)(r),l=(0,Q.useRef)(r),u=(0,Q.useRef)(!1),d,f;t[0]===r?(d=t[1],f=t[2]):(d=()=>{u.current||r!==l.current&&(c(r),l.current=r)},f=[r],t[0]=r,t[1]=d,t[2]=f),(0,Q.useEffect)(d,f);let p=cr(s),m=lr(s,a),h=n+1,g;t[3]!==s||t[4]!==i?(g=()=>{s!==l.current&&(l.current=s,i(s))},t[3]=s,t[4]=i,t[5]=g):g=t[5];let _=g,v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>c(e.target.value),b=()=>{u.current=!0},t[6]=v,t[7]=b):(v=t[6],b=t[7]);let x;t[8]===_?x=t[9]:(x=()=>{u.current=!1,_()},t[8]=_,t[9]=x);let S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{e.key===`Enter`?(e.preventDefault(),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),c(l.current),e.currentTarget.blur())},t[10]=S):S=t[10];let C;t[11]!==o||t[12]!==h?(C=o({id:`-YV1Uo`,values:{patternNumber:h}}),t[11]=o,t[12]=h,t[13]=C):C=t[13];let T=p.length>0?`border-amber-500/60 focus-visible:ring-amber-500/40`:``,E;t[14]===T?E=t[15]:(E=w(`h-7 flex-1 font-mono text-xs`,T),t[14]=T,t[15]=E);let D;t[16]!==s||t[17]!==E||t[18]!==x||t[19]!==C?(D=(0,$.jsx)(Bt,{value:s,onChange:v,onFocus:b,onBlur:x,onKeyDown:S,"aria-label":C,className:E,"data-testid":`settings-okignore-row-input`}),t[16]=s,t[17]=E,t[18]=x,t[19]=C,t[20]=D):D=t[20];let O;t[21]===p?O=t[22]:(O=(0,$.jsx)(er,{warnings:p}),t[21]=p,t[22]=O);let k;t[23]!==D||t[24]!==O?(k=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[D,O]}),t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]===m?A=t[27]:(A=(0,$.jsx)(ur,{count:m}),t[26]=m,t[27]=A);let j;return t[28]!==k||t[29]!==A?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[k,A]}),t[28]=k,t[29]=A,t[30]=j):j=t[30],j}function $n(e){let t=(0,Z.c)(34),{onAdd:n,placeholder:r,rejectionFlashKey:i,filePaths:a}=e,{_:o}=y(),[s,c]=(0,Q.useState)(``),l=cr(s),u=lr(s,a),d=gr(i),f;t[0]!==n||t[1]!==s?(f=()=>{let e=s.trim();e.length!==0&&(n(e),c(``))},t[0]=n,t[1]=s,t[2]=f):f=t[2];let p=f,m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>c(e.target.value),t[3]=m):m=t[3];let h;t[4]===p?h=t[5]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),p())},t[4]=p,t[5]=h);let g;t[6]===o?g=t[7]:(g=o({id:`p9sdCy`}),t[6]=o,t[7]=g);let _=d?`border-destructive ring-2 ring-destructive/30 focus-visible:ring-destructive/50`:l.length>0?`border-amber-500/60 focus-visible:ring-amber-500/40`:``,b;t[8]===_?b=t[9]:(b=w(`h-8 text-sm`,_),t[8]=_,t[9]=b);let x=d?`true`:void 0,C;t[10]!==s||t[11]!==r||t[12]!==h||t[13]!==g||t[14]!==b||t[15]!==x?(C=(0,$.jsx)(Bt,{value:s,onChange:m,onKeyDown:h,placeholder:r,"aria-label":g,className:b,"data-testid":`settings-okignore-add-input`,"data-rejection-flashing":x}),t[10]=s,t[11]=r,t[12]=h,t[13]=g,t[14]=b,t[15]=x,t[16]=C):C=t[16];let T;t[17]===l?T=t[18]:(T=(0,$.jsx)(er,{warnings:l}),t[17]=l,t[18]=T);let E;t[19]===s?E=t[20]:(E=s.trim(),t[19]=s,t[20]=E);let D=E.length===0,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(v,{id:`BY-g4_`}),t[21]=O):O=t[21];let k;t[22]!==p||t[23]!==D?(k=(0,$.jsx)(S,{size:`sm`,onClick:p,disabled:D,"data-testid":`settings-okignore-add-button`,children:O}),t[22]=p,t[23]=D,t[24]=k):k=t[24];let A;t[25]!==k||t[26]!==C||t[27]!==T?(A=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,T,k]}),t[25]=k,t[26]=C,t[27]=T,t[28]=A):A=t[28];let j;t[29]===u?j=t[30]:(j=(0,$.jsx)(ur,{count:u}),t[29]=u,t[30]=j);let M;return t[31]!==A||t[32]!==j?(M=(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,"data-testid":`settings-okignore-add`,children:[A,j]}),t[31]=A,t[32]=j,t[33]=M):M=t[33],M}function er(e){let t=(0,Z.c)(31),{warnings:n}=e,{_:r}=y();if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`flex w-4 shrink-0 justify-center`,"data-testid":`settings-okignore-warning-indicator`,"data-warnings":`0`}),t[0]=e):e=t[0],e}let i,a,o,s,c,l,u;t[1]!==r||t[2]!==n?(o=n.map(nr).join(` `),a=D,i=T,u=!0,s=`status`,c=`polite`,l=r({id:`NORKZU`,values:{summary:o}}),t[1]=r,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u):(i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9]);let d=String(n.length),f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(Rt,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=f):f=t[10];let p;t[11]===o?p=t[12]:(p=(0,$.jsx)(`span`,{className:`sr-only`,children:o}),t[11]=o,t[12]=p);let m;t[13]!==s||t[14]!==c||t[15]!==l||t[16]!==d||t[17]!==p?(m=(0,$.jsxs)(`span`,{role:s,"aria-live":c,"aria-label":l,className:`flex w-4 shrink-0 cursor-help justify-center text-amber-500`,"data-testid":`settings-okignore-warning-indicator`,"data-warnings":d,children:[f,p]}),t[13]=s,t[14]=c,t[15]=l,t[16]=d,t[17]=p,t[18]=m):m=t[18];let h;t[19]!==i||t[20]!==u||t[21]!==m?(h=(0,$.jsx)(i,{asChild:u,children:m}),t[19]=i,t[20]=u,t[21]=m,t[22]=h):h=t[22];let g;t[23]===n?g=t[24]:(g=n.map(tr),t[23]=n,t[24]=g);let _;t[25]===g?_=t[26]:(_=(0,$.jsx)(E,{side:`top`,className:`max-w-xs`,children:(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-4`,children:g})}),t[25]=g,t[26]=_);let v;return t[27]!==a||t[28]!==_||t[29]!==h?(v=(0,$.jsxs)(a,{children:[h,_]}),t[27]=a,t[28]=_,t[29]=h,t[30]=v):v=t[30],v}function tr(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function nr(e){return e.message}function rr(e){let t=(0,Z.c)(4),{visible:n}=e,r;t[0]===n?r=t[1]:(r=n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(it,{"aria-hidden":`true`,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`idD8Ev`})})]}):null,t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`flex w-4 shrink-0 justify-center text-emerald-600`,"data-testid":`settings-okignore-saved-indicator`,children:r}),t[2]=r,t[3]=i),i}function ir(e){return`okignore-pattern-${e}`}function ar(e){let t=e.match(/^okignore-pattern-(\d+)$/);if(!t)return-1;let n=Number.parseInt(t[1]??``,10);return Number.isNaN(n)?-1:n}function or(e,t){return`${t}::${e}`}function sr(e){return!Le(e)||e.code!==`OKIGNORE_INVALID`?null:{detail:e.detail,lineNumber:e.lineNumber}}function cr(e){let t=(0,Z.c)(5),n;t[0]===e?n=t[1]:(n=()=>e.length===0?[]:Mn(e),t[0]=e,t[1]=n);let[r,i]=(0,Q.useState)(n),a,o;return t[2]===e?(a=t[3],o=t[4]):(a=()=>{if(e.length===0){i([]);return}let t=setTimeout(()=>{i(Mn(e))},In);return()=>clearTimeout(t)},o=[e],t[2]=e,t[3]=a,t[4]=o),(0,Q.useEffect)(a,o),r}function lr(e,t){let n=(0,Z.c)(9),r;n[0]===e?r=n[1]:(r=e.trim(),n[0]=e,n[1]=r);let i=r,a;n[2]!==t||n[3]!==i?(a=()=>i.length===0?null:An(i,t),n[2]=t,n[3]=i,n[4]=a):a=n[4];let[o,s]=(0,Q.useState)(a),c,l;return n[5]!==t||n[6]!==i?(c=()=>{if(i.length===0){s(null);return}let e=setTimeout(()=>{s(An(i,t))},Ln);return()=>clearTimeout(e)},l=[i,t],n[5]=t,n[6]=i,n[7]=c,n[8]=l):(c=n[7],l=n[8]),(0,Q.useEffect)(c,l),o}function ur(e){let t=(0,Z.c)(12),{count:n}=e;if(n===null){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`block h-3.5`,"data-testid":`settings-okignore-preview`,"data-preview-state":`hidden`}),t[0]=e):e=t[0],e}let r=n===0,i=String(n),a=r?`text-muted-foreground/70`:`text-muted-foreground`,o;t[1]===a?o=t[2]:(o=w(`block text-xs`,a),t[1]=a,t[2]=o);let s;t[3]===n?s=t[4]:(s=(0,$.jsx)(v,{id:`-3Qbv7`,values:{count:n}}),t[3]=n,t[4]=s);let c;t[5]===r?c=t[6]:(c=r?(0,$.jsx)(`span`,{className:`ml-1 text-muted-foreground/60`,children:(0,$.jsx)(v,{id:`5kWklo`})}):null,t[5]=r,t[6]=c);let l;return t[7]!==i||t[8]!==o||t[9]!==s||t[10]!==c?(l=(0,$.jsxs)(`span`,{role:`status`,"aria-live":`polite`,"data-testid":`settings-okignore-preview`,"data-preview-state":`visible`,"data-preview-count":i,className:o,children:[s,c]}),t[7]=i,t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function dr(e,t,n){let r=[];for(let n of e){let e=t.get(n)?.docExt??`.md`;r.push(n+e)}for(let e of n)r.push(e);return r}function fr(){try{return globalThis.localStorage?.getItem(Vn)===`true`}catch{return!1}}function pr(e){try{globalThis.localStorage?.setItem(Vn,e?`true`:`false`)}catch(e){console.debug(`[OkignoreSection] localStorage unavailable; advanced toggle will not persist:`,e)}}function mr(){let e=(0,Z.c)(3),[t,n]=(0,Q.useState)(hr),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=e=>{n(e),pr(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function hr(){return fr()}function gr(e){let t=(0,Z.c)(3),[n,r]=(0,Q.useState)(!1),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(e===null)return;r(!0);let t=setTimeout(()=>r(!1),zn);return()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function _r(e){return`editor:${e}`}var vr=`skill`;function yr(e){let t=(0,Z.c)(11),{testId:n,children:r}=e,{_:i}=y(),a;t[0]===i?a=t[1]:(a=i({id:`2B6eYX`}),t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Lt,{className:`size-3.5`}),t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==n?(s=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(S,{variant:`ghost`,size:`icon`,className:`mt-1.5 mr-1.5 h-6 w-6 shrink-0 text-muted-foreground opacity-60 hover:opacity-100`,"aria-label":a,"data-testid":n,children:o})}),t[3]=a,t[4]=n,t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=(0,$.jsx)(E,{side:`left`,className:`max-w-sm text-left`,children:(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:r})}),t[6]=r,t[7]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(D,{children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function br(e){let t=(0,Z.c)(5),{followUp:n,testId:r}=e;if(n===`none`)return null;let i;t[0]===n?i=t[1]:(i=n===`approve-once`?(0,$.jsx)(v,{id:`HTW0Zw`,components:{0:(0,$.jsx)(`code`,{className:`inline-code`})}}):n===`enable-manually`?(0,$.jsx)(v,{id:`NNJsn7`}):(0,$.jsx)(v,{id:`n8DwqQ`}),t[0]=n,t[1]=i);let a;return t[2]!==i||t[3]!==r?(a=(0,$.jsx)(`span`,{role:`status`,className:`text-xs text-amber-600 dark:text-amber-400`,"data-testid":r,children:i}),t[2]=i,t[3]=r,t[4]=a):a=t[4],a}function xr(){let e=(0,Z.c)(29),{_:t}=y(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l,u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{if(!n)return;let e=!1;return n.projectIntegrations.status().then(t=>{e||i(t)}).catch(()=>{e||o(!0)}),()=>{e=!0}},u=[n],e[0]=l,e[1]=u):(l=e[0],u=e[1]),(0,Q.useEffect)(l,u);let d;e[2]===t?d=e[3]:(d=async function(e,r){if(n){c(e.kind===`editor`?_r(e.id):vr);try{let t=await n.projectIntegrations.setComponent({component:e,enabled:r});i(t.status),t.ok||X.error(t.error)}catch(e){let n=e;X.error(t({id:`gfdqcY`,values:{0:n instanceof Error?n.message:String(n)}}))}c(null)}},e[2]=t,e[3]=d);let f=d,p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`h3`,{id:`settings-project-ai-tools-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`crqzW5`})}),e[4]=p):p=e[4];let m;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[p,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`ZYtq3m`})})]}),e[5]=m):m=e[5];let h=m;if(!n||a){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-project-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`project-ai-tools-unavailable`,children:(0,$.jsx)(v,{id:`g4WlQK`})})]}),e[6]=t):t=e[6],t}if(r===null){let t;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-project-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`project-ai-tools-loading`,children:[(0,$.jsx)(Y,{className:`h-10 w-full`}),(0,$.jsx)(Y,{className:`h-10 w-full`})]})]}),e[7]=t):t=e[7],t}if(!r.hasProject){let t;return e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-project-ai-tools-title`,className:`space-y-4`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`project-ai-tools-no-project`,children:(0,$.jsx)(v,{id:`yaPGPa`})})]}),e[8]=t):t=e[8],t}let g=s!==null||!r.available,_;e[9]===r.available?_=e[10]:(_=!r.available&&(0,$.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,"data-testid":`project-ai-tools-read-only`,children:(0,$.jsx)(v,{id:`_NX6gG`})}),e[9]=r.available,e[10]=_);let b;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`psfGPX`})}),e[11]=b):b=e[11];let x;if(e[12]!==f||e[13]!==g||e[14]!==r.editors){let t;e[16]!==f||e[17]!==g?(t=e=>(0,$.jsx)(Cr,{editor:e,busy:g,onToggle:t=>void f({kind:`editor`,id:e.id},t)},e.id),e[16]=f,e[17]=g,e[18]=t):t=e[18],x=r.editors.map(t),e[12]=f,e[13]=g,e[14]=r.editors,e[15]=x}else x=e[15];let S;e[19]===x?S=e[20]:(S=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[b,(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:x})]}),e[19]=x,e[20]=S);let C;e[21]!==f||e[22]!==g||e[23]!==r.skill?(C=r.skill!==null&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(v,{id:`LtiJ5c`})}),(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 overflow-hidden`,children:(0,$.jsxs)(`li`,{className:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(U,{htmlFor:`project-ai-tools-skill`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(z,{id:`project-ai-tools-skill`,checked:r.skill.installed,disabled:g,onCheckedChange:()=>void f({kind:`skill`},!r.skill?.installed),className:`mt-0.5`,"data-testid":`project-ai-tools-skill-checkbox`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(`code`,{children:`open-knowledge`})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(v,{id:`khCa4M`})})]})]}),(0,$.jsxs)(yr,{testId:`project-ai-tools-skill-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`HSh8u_`})}),r.skill.paths.map(Sr)]})]})})]}),e[21]=f,e[22]=g,e[23]=r.skill,e[24]=C):C=e[24];let w;return e[25]!==_||e[26]!==S||e[27]!==C?(w=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-project-ai-tools-title`,className:`space-y-4`,children:[h,_,S,C]}),e[25]=_,e[26]=S,e[27]=C,e[28]=w):w=e[28],w}function Sr(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function Cr(e){let t=(0,Z.c)(45),{editor:n,busy:r,onToggle:i}=e,{_:a}=y(),o=n.state===`installed`||n.state===`foreign`,s=r||n.state===`unmanageable`,c;t[0]!==a||t[1]!==n.state?(c=n.state===`installed`?a({id:`eQkgKV`}):n.state===`foreign`?a({id:`AczYxH`}):n.state===`unmanageable`?a({id:`CXTwen`}):null,t[0]=a,t[1]=n.state,t[2]=c):c=t[2];let l=c,u=n.state===`foreign`||n.state===`unmanageable`?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`,d=s?`flex items-start`:`flex items-start hover:bg-accent`,f=`project-ai-tools-editor-${n.id}`,p=s?`flex flex-1 items-start gap-2.5 px-3 py-2.5 font-normal`:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,m=`project-ai-tools-editor-${n.id}`,h;t[3]!==o||t[4]!==i?(h=()=>i(!o),t[3]=o,t[4]=i,t[5]=h):h=t[5];let g=`project-ai-tools-editor-checkbox-${n.id}`,_;t[6]!==o||t[7]!==s||t[8]!==m||t[9]!==h||t[10]!==g?(_=(0,$.jsx)(z,{id:m,checked:o,disabled:s,onCheckedChange:h,className:`mt-0.5`,"data-testid":g}),t[6]=o,t[7]=s,t[8]=m,t[9]=h,t[10]=g,t[11]=_):_=t[11];let b;t[12]===n.label?b=t[13]:(b=(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:n.label}),t[12]=n.label,t[13]=b);let x;t[14]!==n.id||t[15]!==u||t[16]!==l?(x=l!==null&&(0,$.jsx)(`span`,{className:u,"data-testid":`project-ai-tools-editor-status-${n.id}`,children:l}),t[14]=n.id,t[15]=u,t[16]=l,t[17]=x):x=t[17];let S;t[18]!==o||t[19]!==n.followUp||t[20]!==n.id?(S=o&&(0,$.jsx)(br,{followUp:n.followUp,testId:`project-ai-tools-editor-followup-${n.id}`}),t[18]=o,t[19]=n.followUp,t[20]=n.id,t[21]=S):S=t[21];let C;t[22]!==x||t[23]!==S||t[24]!==b?(C=(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[b,x,S]}),t[22]=x,t[23]=S,t[24]=b,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==f||t[28]!==p||t[29]!==_?(w=(0,$.jsxs)(U,{htmlFor:f,className:p,children:[_,C]}),t[26]=C,t[27]=f,t[28]=p,t[29]=_,t[30]=w):w=t[30];let T=`project-ai-tools-editor-info-${n.id}`,E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(v,{id:`J2eKUI`})}),t[31]=E):E=t[31];let D;t[32]===n.configPath?D=t[33]:(D=(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:n.configPath})}),t[32]=n.configPath,t[33]=D);let O;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(`p`,{className:`pt-1 opacity-70`,children:(0,$.jsx)(v,{id:`VIwCaD`})}),t[34]=O):O=t[34];let k;t[35]===n.entryLocator?k=t[36]:(k=(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:n.entryLocator})}),t[35]=n.entryLocator,t[36]=k);let A;t[37]!==T||t[38]!==D||t[39]!==k?(A=(0,$.jsxs)(yr,{testId:T,children:[E,D,O,k]}),t[37]=T,t[38]=D,t[39]=k,t[40]=A):A=t[40];let j;return t[41]!==w||t[42]!==A||t[43]!==d?(j=(0,$.jsxs)(`li`,{className:d,children:[w,A]}),t[41]=w,t[42]=A,t[43]=d,t[44]=j):j=t[44],j}function wr(e){let t=(0,Z.c)(68),{config:n}=e,{state:r,refresh:i}=Ee(``),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=oe(),d;t[0]===l?d=t[1]:(d=function(e,t){Nt(h(e,t)),l.close()},t[0]=l,t[1]=d);let f=d,p,m,g,_,y,b,x,S,C;if(t[2]!==n||t[3]!==s||t[4]!==f||t[5]!==i||t[6]!==r){C=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.status===`ready`?(r.data.folder.templates_available??[]).filter(e=>e.scope===n.scope).sort(Er):[];if(r.status===`error`){let{loadErrorTitle:e}=n,{message:a}=r,o=`settings-${n.testIdPrefix}-section`,l;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(!0),t[16]=l):l=t[16];let u;t[17]===n?u=t[18]:(u=(0,$.jsx)(Dr,{config:n,onNewClick:l}),t[17]=n,t[18]=u);let d;t[19]!==e||t[20]!==a?(d=(0,$.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,$.jsx)(v,{id:`uH_S-u`,values:{loadErrorTitle:e,message:a}})}),t[19]=e,t[20]=a,t[21]=d):d=t[21];let p;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(p=new Set,t[22]=p):p=t[22];let m;t[23]!==f||t[24]!==i?(m=e=>{i(),f(``,e)},t[23]=f,t[24]=i,t[25]=m):m=t[25];let h;t[26]!==s||t[27]!==m?(h=(0,$.jsx)(K,{folderPath:``,existingNames:p,open:s,onOpenChange:c,onCreated:m}),t[26]=s,t[27]=m,t[28]=h):h=t[28];let g;t[29]!==n.settingsId||t[30]!==o||t[31]!==u||t[32]!==d||t[33]!==h?(g=(0,$.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":n.settingsId,"data-testid":o,children:[u,d,h]}),t[29]=n.settingsId,t[30]=o,t[31]=u,t[32]=d,t[33]=h,t[34]=g):g=t[34],C=g;break bb0}if(r.status===`idle`||r.status===`loading`){let e=`settings-${n.testIdPrefix}-section`,r;t[35]===n?r=t[36]:(r=(0,$.jsx)(Dr,{config:n}),t[35]=n,t[36]=r);let i;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`rounded-lg border bg-card p-3 space-y-2`,children:[(0,$.jsx)(Y,{className:`h-12 w-full`}),(0,$.jsx)(Y,{className:`h-12 w-full`})]}),t[37]=i):i=t[37];let a;t[38]!==n.settingsId||t[39]!==e||t[40]!==r?(a=(0,$.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":n.settingsId,"data-testid":e,children:[r,i]}),t[38]=n.settingsId,t[39]=e,t[40]=r,t[41]=a):a=t[41],C=a;break bb0}_=`space-y-3`,y=n.settingsId,b=`settings-${n.testIdPrefix}-section`;let a;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>c(!0),t[42]=a):a=t[42],t[43]===n?x=t[44]:(x=(0,$.jsx)(Dr,{config:n,onNewClick:a}),t[43]=n,t[44]=x);let l=e.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-sm text-muted-foreground`,"data-testid":`settings-${n.testIdPrefix}-empty`,children:n.emptyMessage}):(0,$.jsx)(`ul`,{className:`space-y-1 p-2`,"data-testid":`settings-${n.testIdPrefix}-list`,children:e.map(e=>(0,$.jsx)(ie,{template:e,onEdit:()=>f(e.source_folder,e.name),onDelete:()=>o(e),badge:(0,$.jsx)(u,{variant:n.badge.variant,className:`text-2xs`,children:n.badge.label})},e.name))});t[45]===l?S=t[46]:(S=(0,$.jsx)(`div`,{className:`rounded-lg border bg-card`,children:l}),t[45]=l,t[46]=S),p=K,m=``,g=new Set(e.map(Tr))}t[2]=n,t[3]=s,t[4]=f,t[5]=i,t[6]=r,t[7]=p,t[8]=m,t[9]=g,t[10]=_,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C}else p=t[7],m=t[8],g=t[9],_=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15];if(C!==Symbol.for(`react.early_return_sentinel`))return C;let w;t[47]!==f||t[48]!==i?(w=e=>{i(),f(``,e)},t[47]=f,t[48]=i,t[49]=w):w=t[49];let T;t[50]!==p||t[51]!==s||t[52]!==w||t[53]!==m||t[54]!==g?(T=(0,$.jsx)(p,{folderPath:m,existingNames:g,open:s,onOpenChange:c,onCreated:w}),t[50]=p,t[51]=s,t[52]=w,t[53]=m,t[54]=g,t[55]=T):T=t[55];let E;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||o(null)},t[56]=E):E=t[56];let D;t[57]!==a||t[58]!==i?(D=(0,$.jsx)(ce,{template:a,onOpenChange:E,onDeleted:i}),t[57]=a,t[58]=i,t[59]=D):D=t[59];let O;return t[60]!==T||t[61]!==D||t[62]!==_||t[63]!==y||t[64]!==b||t[65]!==x||t[66]!==S?(O=(0,$.jsxs)(`section`,{className:_,"aria-labelledby":y,"data-testid":b,children:[x,S,T,D]}),t[60]=T,t[61]=D,t[62]=_,t[63]=y,t[64]=b,t[65]=x,t[66]=S,t[67]=O):O=t[67],O}function Tr(e){return e.name}function Er(e,t){return(e.title??e.name).toLowerCase().localeCompare((t.title??t.name).toLowerCase())}function Dr(e){let t=(0,Z.c)(14),{config:n,onNewClick:r}=e,i;t[0]!==n.settingsId||t[1]!==n.title?(i=(0,$.jsx)(`h3`,{id:n.settingsId,className:`text-base font-semibold`,children:n.title}),t[0]=n.settingsId,t[1]=n.title,t[2]=i):i=t[2];let a;t[3]===n.description?a=t[4]:(a=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[3]=n.description,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,$.jsxs)(`div`,{children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7];let s;t[8]!==n.testIdPrefix||t[9]!==r?(s=r?(0,$.jsxs)(S,{variant:`outline`,size:`sm`,className:`font-mono uppercase shrink-0`,onClick:r,"data-testid":`settings-${n.testIdPrefix}-new-button`,children:[(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(v,{id:`G1Gw0v`})]}):null,t[8]=n.testIdPrefix,t[9]=r,t[10]=s):s=t[10];let c;return t[11]!==o||t[12]!==s?(c=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function Or(){let e=(0,Z.c)(16),{_:t}=y(),n;e[0]===t?n=e[1]:(n=t({id:`hBMK4W`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(v,{id:`nft48x`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}}),e[2]=r):r=e[2];let i;e[3]===t?i=e[4]:(i=t({id:`6Pxqwv`}),e[3]=t,e[4]=i);let a;e[5]===t?a=e[6]:(a=t({id:`BD0XSC`}),e[5]=t,e[6]=a);let o;e[7]===t?o=e[8]:(o=t({id:`ysxgu8`}),e[7]=t,e[8]=o);let s;e[9]===o?s=e[10]:(s={label:o,variant:`gray`},e[9]=o,e[10]=s);let c;return e[11]!==n||e[12]!==i||e[13]!==a||e[14]!==s?(c=(0,$.jsx)(wr,{config:{scope:`local`,title:n,description:r,emptyMessage:i,loadErrorTitle:a,badge:s,settingsId:`settings-project-templates-title`,testIdPrefix:`project-templates`}}),e[11]=n,e[12]=i,e[13]=a,e[14]=s,e[15]=c):c=e[15],c}var kr=[2500,5e3];function Ar(){let e=(0,Z.c)(87),{_:t}=y(),{projectLocalConfig:n,projectLocalSynced:r,projectLocalBinding:i}=Jt(),{status:a,refresh:o}=ne(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],e[0]=p):p=e[0];let m=(0,Q.useRef)(p),h,g;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>()=>{for(let e of m.current)clearTimeout(e)},g=[],e[1]=h,e[2]=g):(h=e[1],g=e[2]),(0,Q.useEffect)(h,g);let b=n?.search?.semantic?.baseUrl??`https://api.openai.com/v1`,[x,S]=(0,Q.useState)(b);b!==x&&(S(b),f(!1),u(null));let C=n?.search?.semantic?.enabled??!1,w=r&&i!==null,T;e[3]===o?T=e[4]:(T=function(){for(let e of m.current)clearTimeout(e);m.current=kr.map(e=>setTimeout(o,e))},e[3]=o,e[4]=T);let E=T,D;e[5]!==t||e[6]!==i||e[7]!==o||e[8]!==E?(D=function(e){if(i===null)return X.error(t({id:`YW7Q86`})),!1;let n=i.patch({search:{semantic:{enabled:e}}});if(!n.ok){let r=Ue(n.error);return X.error(t(e?{id:`LYufDw`,values:{detail:r}}:{id:`5mksg0`,values:{detail:r}})),!1}return o(),E(),!0},e[5]=t,e[6]=i,e[7]=o,e[8]=E,e[9]=D):D=e[9];let O=D,k;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(e){return e.trim()||`https://api.openai.com/v1`},e[10]=k):k=e[10];let A=k,j;e[11]!==t||e[12]!==b||e[13]!==i||e[14]!==o||e[15]!==E?(j=function(e){if(i===null)return X.error(t({id:`YW7Q86`})),!1;let n=A(e);if(n===b)return!0;let r=i.patch({search:{semantic:{baseUrl:n}}});if(!r.ok){let e=Ue(r.error);return X.error(t({id:`eLl1VX`,values:{detail:e}})),!1}return o(),E(),!0},e[11]=t,e[12]=b,e[13]=i,e[14]=o,e[15]=E,e[16]=j):j=e[16];let M=j,N;e[17]===O?N=e[18]:(N=function(e){if(e){c(!0);return}O(!1)},e[17]=O,e[18]=N);let P=N,F;e[19]===O?F=e[20]:(F=function(){O(!0)&&c(!1)},e[19]=O,e[20]=F);let I=F,L;e[21]===t?L=e[22]:(L=function(e){let n=e.trim();if(!n)return null;let r=He(n);return r===null?null:t(r===`invalid-url`?{id:`2j1kfc`}:{id:`JM_aq-`})},e[21]=t,e[22]=L);let R=L,z;e[23]!==R||e[24]!==d?(z=function(e){d&&u(R(e))},e[23]=R,e[24]=d,e[25]=z):z=e[25];let B=z,V;e[26]!==R||e[27]!==M?(V=function(e){f(!0);let t=R(e.value);if(u(t),t!==null)return;let n=A(e.value);M(e.value)&&(e.value=n)},e[26]=R,e[27]=M,e[28]=V):V=e[28];let H=V,U=a?.enabled??!1,W=a?.keyPresent??!1,ee=a?.ready??!1,te=a?.capable??!1,re=a?.embedded??0,ie=a?.total??0,ae;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(`h3`,{id:`settings-search-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`3y6XTb`})}),e[29]=ae):ae=e[29];let G;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[ae,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`dUQ7_J`})})]}),e[30]=G):G=e[30];let K;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(`label`,{htmlFor:`settings-search-semantic-toggle`,className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`3y6XTb`})}),e[31]=K):K=e[31];let q;e[32]===C?q=e[33]:(q=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[K,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-search-body`,children:C?(0,$.jsx)(v,{id:`stlgky`}):(0,$.jsx)(v,{id:`kdzzOK`})})]}),e[32]=C,e[33]=q);let oe=!w,se;e[34]!==t||e[35]!==C?(se=t(C?{id:`fNr-MX`}:{id:`Aif3E7`}),e[34]=t,e[35]=C,e[36]=se):se=e[36];let J;e[37]!==C||e[38]!==P||e[39]!==oe||e[40]!==se?(J=(0,$.jsx)(_,{id:`settings-search-semantic-toggle`,checked:C,disabled:oe,onCheckedChange:P,"aria-label":se,"data-testid":`settings-search-semantic-toggle`}),e[37]=C,e[38]=P,e[39]=oe,e[40]=se,e[41]=J):J=e[41];let Y;e[42]!==q||e[43]!==J?(Y=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[q,J]}),e[42]=q,e[43]=J,e[44]=Y):Y=e[44];let ce;e[45]!==te||e[46]!==re||e[47]!==C||e[48]!==W||e[49]!==ee||e[50]!==U||e[51]!==a||e[52]!==ie?(ce=C?(0,$.jsx)(jr,{loaded:a!==null,serverEnabled:U,keyPresent:W,ready:ee,capable:te,embedded:re,total:ie}):null,e[45]=te,e[46]=re,e[47]=C,e[48]=W,e[49]=ee,e[50]=U,e[51]=a,e[52]=ie,e[53]=ce):ce=e[53];let le;e[54]!==Y||e[55]!==ce?(le=(0,$.jsxs)(`div`,{className:`rounded-md border p-3`,children:[Y,ce]}),e[54]=Y,e[55]=ce,e[56]=le):le=e[56];let ue;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(`label`,{htmlFor:`settings-search-base-url`,className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`L1rRuU`})}),e[57]=ue):ue=e[57];let de;e[58]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[ue,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`pmOGtg`})})]}),e[58]=de):de=e[58];let fe;e[59]===B?fe=e[60]:(fe=e=>B(e.currentTarget.value),e[59]=B,e[60]=fe);let pe,me;e[61]===H?(pe=e[62],me=e[63]):(pe=e=>H(e.currentTarget),me=e=>{e.key===`Enter`&&(e.preventDefault(),H(e.currentTarget))},e[61]=H,e[62]=pe,e[63]=me);let he=!w,ge=l!==null,_e;e[64]!==b||e[65]!==fe||e[66]!==pe||e[67]!==me||e[68]!==he||e[69]!==ge?(_e=(0,$.jsx)(Bt,{id:`settings-search-base-url`,defaultValue:b,onChange:fe,onBlur:pe,onKeyDown:me,placeholder:Ie,disabled:he,spellCheck:!1,autoComplete:`off`,"aria-invalid":ge,"aria-describedby":`settings-search-base-url-message`,"data-testid":`settings-search-base-url`,className:`h-8 font-mono text-sm`},b),e[64]=b,e[65]=fe,e[66]=pe,e[67]=me,e[68]=he,e[69]=ge,e[70]=_e):_e=e[70];let ve=l?`text-1sm text-destructive`:`text-muted-foreground text-1sm`,ye=l?`settings-search-base-url-error`:`settings-search-base-url-help`,be;e[71]===l?be=e[72]:(be=l??(0,$.jsx)(v,{id:`lHCR4I`}),e[71]=l,e[72]=be);let xe;e[73]!==ve||e[74]!==ye||e[75]!==be?(xe=(0,$.jsx)(`p`,{id:`settings-search-base-url-message`,"aria-live":`polite`,className:ve,"data-testid":ye,children:be}),e[73]=ve,e[74]=ye,e[75]=be,e[76]=xe):xe=e[76];let Se;e[77]!==_e||e[78]!==xe?(Se=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,children:[de,_e,xe]}),e[77]=_e,e[78]=xe,e[79]=Se):Se=e[79];let Ce;e[80]!==s||e[81]!==I?(Ce=(0,$.jsx)(Mr,{open:s,onOpenChange:c,onConfirm:I}),e[80]=s,e[81]=I,e[82]=Ce):Ce=e[82];let we;return e[83]!==le||e[84]!==Se||e[85]!==Ce?(we=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-search-title`,className:`space-y-3`,"data-testid":`settings-search`,children:[G,le,Se,Ce]}),e[83]=le,e[84]=Se,e[85]=Ce,e[86]=we):we=e[86],we}function jr(e){let t=(0,Z.c)(12),{loaded:n,serverEnabled:r,keyPresent:i,ready:a,capable:o,embedded:s,total:c}=e;if(!n||!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`text-muted-foreground text-1sm mt-2`,"data-testid":`settings-search-settling`,children:(0,$.jsx)(v,{id:`AdcGcG`})}),t[0]=e):e=t[0],e}if(!i){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{role:`alert`,className:`mt-2 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-1sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`settings-search-needs-key`,children:(0,$.jsx)(v,{id:`dN20LW`,components:{0:(0,$.jsx)(`span`,{className:`font-medium`})}})}),t[1]=e):e=t[1],e}if(a&&!o){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{role:`alert`,className:`mt-2 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-1sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`settings-search-provider-error`,children:(0,$.jsx)(v,{id:`oEgEn_`,components:{0:(0,$.jsx)(`span`,{className:`font-medium`})}})}),t[2]=e):e=t[2],e}if(!a){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{role:`status`,className:`text-muted-foreground text-1sm mt-2`,"data-testid":`settings-search-pending`,children:(0,$.jsx)(v,{id:`VZSBXL`})}),t[3]=e):e=t[3],e}let l;t[4]!==s||t[5]!==c?(l=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`lVWEIL`,values:{embedded:s,total:c}})}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===s?u=t[8]:(u=s===0?(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`ku0yLQ`})}):null,t[7]=s,t[8]=u);let d;return t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`mt-2 space-y-0.5`,"data-testid":`settings-search-coverage`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function Mr(e){let t=(0,Z.c)(14),{open:n,onOpenChange:r,onConfirm:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(M,{children:(0,$.jsx)(v,{id:`vhAnzJ`})}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(L,{children:[a,(0,$.jsx)(j,{children:(0,$.jsx)(v,{id:`aENGMB`})})]}),t[1]=o):o=t[1];let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`mb-2 font-medium`,children:(0,$.jsx)(v,{id:`7PNNNs`})}),t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`li`,{children:(0,$.jsx)(v,{id:`UfW9Kr`})}),t[3]=c):c=t[3];let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`li`,{children:(0,$.jsx)(v,{id:`Emz5BG`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-amber-100 px-1 py-0.5 font-mono text-xs dark:bg-amber-900`})}})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(P,{children:(0,$.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,children:[s,(0,$.jsxs)(`ul`,{className:`list-disc space-y-1.5 pl-5`,children:[c,l,(0,$.jsx)(`li`,{children:(0,$.jsx)(v,{id:`o5gfs1`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-amber-100 px-1 py-0.5 font-mono text-xs dark:bg-amber-900`})}})})]})]})}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(S,{variant:`outline`,children:(0,$.jsx)(v,{id:`dEgA5A`})})}),t[6]=d):d=t[6];let f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(v,{id:`iMkWoF`}),t[7]=f):f=t[7];let p;t[8]===i?p=t[9]:(p=(0,$.jsxs)(N,{className:`sm:max-w-lg`,"data-testid":`settings-search-confirm`,children:[o,u,(0,$.jsxs)(F,{children:[d,(0,$.jsx)(S,{onClick:i,"data-testid":`settings-search-confirm-enable`,children:f})]})]}),t[8]=i,t[9]=p);let m;return t[10]!==r||t[11]!==n||t[12]!==p?(m=(0,$.jsx)(R,{open:n,onOpenChange:r,children:p}),t[10]=r,t[11]=n,t[12]=p,t[13]=m):m=t[13],m}function Nr(e){let t=(0,Z.c)(19),{installStates:n,terminalLaunch:r,disabled:i,onPick:a,onLaunchTerminal:o}=e,{_:s}=y(),[c,l]=(0,Q.useState)(``),u;if(t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==c||t[4]!==o||t[5]!==a||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let d=lt.filter(e),f=lt.some(e=>n[e.id]?.installed==null),p=d.length>0,m=r!==null,h=p||m,g=r?mt(r.installedClis):[],_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>l(e.target.value),t[10]=_):_=t[10];let y;t[11]===s?y=t[12]:(y=s({id:`Rah7yq`}),t[11]=s,t[12]=y);let b;t[13]===s?b=t[14]:(b=s({id:`ZBt4rI`}),t[13]=s,t[14]=b);let x;t[15]!==c||t[16]!==y||t[17]!==b?(x=(0,$.jsx)(`div`,{className:`px-2 pt-2 pb-1.5`,children:(0,$.jsx)(Bt,{value:c,onChange:_,placeholder:y,"aria-label":b,"data-testid":`open-in-agent-instruction`})}),t[15]=c,t[16]=y,t[17]=b,t[18]=x):x=t[18],u=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[x,h?(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,$.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,$.jsx)(v,{id:`ALhMYW`})}),g.map(e=>{let{displayName:t}=Xe[e];return(0,$.jsxs)(S,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:i,"data-testid":`open-in-agent-terminal-${e}`,"aria-label":s({id:`QYfQdv`,values:{displayName:t}}),onClick:()=>o(e,c),children:[(0,$.jsx)(ft,{id:ut(e),"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:t})]},e)})]}):null,p?(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsx)(de,{className:`my-1`}):null,(0,$.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,$.jsx)(v,{id:`BBqGS9`})}),d.map(e=>{let{displayName:t}=e;return(0,$.jsxs)(S,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:i,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":s({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>a(e,c),children:[(0,$.jsx)(ft,{id:e.id,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:t})]},e.id)})]})]}):null]}):(0,$.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:f?(0,$.jsx)(v,{id:`EcR0fl`}):(0,$.jsx)(v,{id:`l6OXqI`})})]}),t[0]=s,t[1]=i,t[2]=n,t[3]=c,t[4]=o,t[5]=a,t[6]=r,t[7]=u}else u=t[7];return u}function Pr(e){let t=(0,Z.c)(44),{input:n,open:r,onOpenChange:i}=e,{_:o}=y(),{states:s,refresh:l}=ht(),{dispatch:u}=st(),d=dt(),[f,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(!1),g=St(),_=r??f,b;t[0]===l?b=t[1]:(b=()=>{l()},t[0]=l,t[1]=b);let x=(0,Q.useEffectEvent)(b),C;t[2]!==_||t[3]!==x?(C=()=>{_&&x()},t[2]=_,t[3]=x,t[4]=C):C=t[4];let w;if(t[5]===_?w=t[6]:(w=[_],t[5]=_,t[6]=w),(0,Q.useEffect)(C,w),g)return null;let T=typeof window<`u`&&window.okDesktop!=null,E;t[7]!==i||t[8]!==r?(E=e=>{r===void 0&&m(e),i?.(e)},t[7]=i,t[8]=r,t[9]=E):E=t[9];let D=E,O=n===null,k;t[10]===n?k=t[11]:(k=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=k);let A=k,j;t[12]!==u||t[13]!==D||t[14]!==A?(j=(e,t)=>{let n=A(t);n!==null&&(u(e.id,n),D(!1))},t[12]=u,t[13]=D,t[14]=A,t[15]=j):j=t[15];let M=j,N;t[16]!==D||t[17]!==A||t[18]!==d?(N=(e,t)=>{let n=A(t);n===null||d===null||(d.launchInTerminal(n,e),D(!1))},t[16]=D,t[17]=A,t[18]=d,t[19]=N):N=t[19];let P=N,F;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=T?()=>{h.current=!0}:void 0,t[20]=F):F=t[20];let I;t[21]===D?I=t[22]:(I=T?()=>{if(h.current){h.current=!1;return}D(!0)}:void 0,t[21]=D,t[22]=I);let L,R;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(xt,{className:`size-3.5`,"aria-hidden":`true`}),R=(0,$.jsx)(v,{id:`O7_W_a`}),t[23]=L,t[24]=R):(L=t[23],R=t[24]);let z;t[25]!==I||t[26]!==O?(z=(0,$.jsx)(p,{asChild:!0,children:(0,$.jsxs)(S,{variant:`ghost`,size:`sm`,disabled:O,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:F,onClick:I,children:[L,R]})}),t[25]=I,t[26]=O,t[27]=z):z=t[27];let B;t[28]===o?B=t[29]:(B=o({id:`O7_W_a`}),t[28]=o,t[29]=B);let V=n===null,H;t[30]!==P||t[31]!==M||t[32]!==s||t[33]!==V||t[34]!==d?(H=(0,$.jsx)(Nr,{installStates:s,terminalLaunch:d,disabled:V,onPick:M,onLaunchTerminal:P}),t[30]=P,t[31]=M,t[32]=s,t[33]=V,t[34]=d,t[35]=H):H=t[35];let U;t[36]!==B||t[37]!==H?(U=(0,$.jsx)(c,{align:`end`,className:`p-1`,"aria-label":B,"data-testid":`open-in-agent-menu`,children:H}),t[36]=B,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==D||t[40]!==_||t[41]!==z||t[42]!==U?(W=(0,$.jsxs)(a,{open:_,onOpenChange:D,children:[z,U]}),t[39]=D,t[40]=_,t[41]=z,t[42]=U,t[43]=W):W=t[43],W}function Fr(e){let t=(0,Z.c)(50),{skill:n,onEdit:r,onDelete:i,onInstall:a,onUninstall:o,installing:s}=e,{_:c}=y(),l=vt(),u;t[0]!==n.name||t[1]!==n.scope||t[2]!==l?(u=yt({skillName:n.name,scope:n.scope,workspace:l}),t[0]=n.name,t[1]=n.scope,t[2]=l,t[3]=u):u=t[3];let d=u,f=`skill-row-${n.name}`,p;t[4]===n.name?p=t[5]:(p=(0,$.jsx)(`code`,{className:`truncate font-mono font-medium`,children:n.name}),t[4]=n.name,t[5]=p);let m;t[6]===n.installed?m=t[7]:(m=(0,$.jsx)(fe,{installed:n.installed,className:`text-2xs`}),t[6]=n.installed,t[7]=m);let h;t[8]!==p||t[9]!==m?(h=(0,$.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[p,m]}),t[8]=p,t[9]=m,t[10]=h):h=t[10];let g;t[11]===n.description?g=t[12]:(g=n.description?(0,$.jsx)(`span`,{className:`block w-full truncate text-sm text-muted-foreground`,children:n.description}):(0,$.jsx)(`span`,{className:`block w-full truncate text-sm italic text-muted-foreground`,children:(0,$.jsx)(v,{id:`xnP32l`})}),t[11]=n.description,t[12]=g);let _;t[13]===n.hosts?_=t[14]:(_=n.hosts.length>0?(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1 pt-0.5`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`G_efLf`})}),n.hosts.map(Ir)]}):null,t[13]=n.hosts,t[14]=_);let b;t[15]!==r||t[16]!==h||t[17]!==g||t[18]!==_?(b=(0,$.jsxs)(S,{type:`button`,variant:`ghost`,onClick:r,className:`h-auto min-w-0 flex-1 flex-col items-start gap-0.5 px-1.5 py-1 text-left font-normal hover:bg-transparent`,children:[h,g,_]}),t[15]=r,t[16]=h,t[17]=g,t[18]=_,t[19]=b):b=t[19];let x;t[20]===d?x=t[21]:(x=(0,$.jsx)(`span`,{className:`shrink-0 self-center opacity-0 group-hover:opacity-100 focus-within:opacity-100 data-[state=open]:opacity-100`,children:(0,$.jsx)(Pr,{input:d})}),t[20]=d,t[21]=x);let C=`skill-install-${n.name}`,w;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(ct,{className:`size-3.5`,"aria-hidden":!0}),t[22]=w):w=t[22];let T;t[23]===n.installed?T=t[24]:(T=n.installed?(0,$.jsx)(v,{id:`eQkgKV`}):(0,$.jsx)(v,{id:`TKQ7K-`}),t[23]=n.installed,t[24]=T);let E;t[25]!==s||t[26]!==a||t[27]!==C||t[28]!==T?(E=(0,$.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 self-center font-mono uppercase opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:a,disabled:s,"data-testid":C,children:[w,T]}),t[25]=s,t[26]=a,t[27]=C,t[28]=T,t[29]=E):E=t[29];let D;t[30]!==c||t[31]!==n.name?(D=c({id:`RlLl3G`,values:{0:n.name}}),t[30]=c,t[31]=n.name,t[32]=D):D=t[32];let O;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(be,{className:`size-4`,"aria-hidden":!0}),t[33]=O):O=t[33];let k;t[34]===D?k=t[35]:(k=(0,$.jsx)(B,{asChild:!0,children:(0,$.jsx)(S,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 self-center opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":D,children:O})}),t[34]=D,t[35]=k);let A;t[36]!==i||t[37]!==r||t[38]!==o||t[39]!==n?(A=(0,$.jsx)(V,{align:`end`,className:`min-w-52`,children:(0,$.jsx)(_t,{skill:n,onEdit:r,onUninstall:o,onDelete:i})}),t[36]=i,t[37]=r,t[38]=o,t[39]=n,t[40]=A):A=t[40];let j;t[41]!==k||t[42]!==A?(j=(0,$.jsxs)(H,{children:[k,A]}),t[41]=k,t[42]=A,t[43]=j):j=t[43];let M;return t[44]!==E||t[45]!==j||t[46]!==f||t[47]!==b||t[48]!==x?(M=(0,$.jsxs)(`li`,{className:`group flex items-start gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-muted/50`,"data-testid":f,children:[b,x,E,j]}),t[44]=E,t[45]=j,t[46]=f,t[47]=b,t[48]=x,t[49]=M):M=t[49],M}function Ir(e){return(0,$.jsx)(u,{variant:`gray`,className:`text-2xs`,children:e},e)}function Lr(){let e=(0,Z.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(!1),c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/skill-targets`).then(Vr).then(t=>{if(e)return;let n=Ze.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skill-targets response failed schema validation:`,n.error.issues),r({status:`error`,message:`Server returned an incomplete skill-targets response.`});return}r({status:`ready`,data:n.data})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[1]=c):c=e[1];let l;e[2]===i?l=e[3]:(l=[i],e[2]=i,e[3]=l),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=async e=>{s(!0);let t=await fetch(`/api/skill-targets`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({targets:e})}).catch(Br);if(!t?.ok){s(!1);let e=t?await t.json().catch(zr):null;throw Error(Vt(e)??(t?`HTTP ${t.status}`:`Request failed`))}Ht(),a(Rr),s(!1)},e[4]=u):u=e[4];let d=u,f;return e[5]!==o||e[6]!==n?(f={state:n,save:d,saving:o},e[5]=o,e[6]=n,e[7]=f):f=e[7],f}function Rr(e){return e+1}function zr(){return null}function Br(){return null}async function Vr(e){if(!e.ok){let t=await e.json().catch(Hr);throw Error(Vt(t)??`HTTP ${e.status}`)}return e.json()}function Hr(){return null}function Ur(){let e=(0,Z.c)(21),{_:t}=y(),{state:n,save:r,saving:i}=Lr(),a=Ke,o;e[0]!==n.data||e[1]!==n.status?(o=n.status===`ready`?new Set(n.data.targets):new Set,e[0]=n.data,e[1]=n.status,e[2]=o):o=e[2];let s=o,c;e[3]!==t||e[4]!==r||e[5]!==n.data||e[6]!==n.status?(c=async(e,i)=>{if(n.status!==`ready`)return;let a=new Set(n.data.targets);i?a.add(e):a.delete(e);try{await r([...a])}catch(e){let n=e;X.error(t({id:`XqNHcm`,values:{0:n instanceof Error?n.message:String(n)}}))}},e[3]=t,e[4]=r,e[5]=n.data,e[6]=n.status,e[7]=c):c=e[7];let l=c,u;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(`h4`,{id:`settings-skill-targets-heading`,className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`el312q`})}),e[8]=u):u=e[8];let d;e[9]!==n.data||e[10]!==n.status?(d=(0,$.jsxs)(`div`,{children:[u,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:n.status===`ready`&&!n.data.configured?(0,$.jsx)(v,{id:`4XL6N4`}):(0,$.jsx)(v,{id:`Ea1prf`})})]}),e[9]=n.data,e[10]=n.status,e[11]=d):d=e[11];let f;e[12]!==i||e[13]!==s||e[14]!==n.message||e[15]!==n.status||e[16]!==l?(f=n.status===`error`?(0,$.jsx)(`div`,{className:`text-1sm text-destructive`,role:`alert`,"data-testid":`skill-targets-error`,children:(0,$.jsx)(v,{id:`yitgD9`,values:{0:n.message}})}):n.status===`idle`||n.status===`loading`?(0,$.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,$.jsx)(Y,{className:`h-5 w-40`}),(0,$.jsx)(Y,{className:`h-5 w-40`})]}):(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2 pt-1`,disabled:i,children:[(0,$.jsx)(`legend`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`Sq8lf2`})}),a.map(e=>{let t=`skill-target-${e}`;return(0,$.jsxs)(U,{htmlFor:t,className:`text-sm font-normal`,children:[(0,$.jsx)(z,{id:t,checked:s.has(e),onCheckedChange:t=>l(e,t===!0),disabled:i,"data-testid":`skill-target-${e}`}),(0,$.jsx)(`span`,{children:Ye[e]})]},e)})]}),e[12]=i,e[13]=s,e[14]=n.message,e[15]=n.status,e[16]=l,e[17]=f):f=e[17];let p;return e[18]!==d||e[19]!==f?(p=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-skill-targets-heading`,className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-skill-targets`,children:[d,f]}),e[18]=d,e[19]=f,e[20]=p):p=e[20],p}function Wr(){let e=(0,Z.c)(19),{_:t}=y(),n=Ct(),r=n.global,i;e[0]===t?i=e[1]:(i=t({id:`2bVHbB`}),e[0]=t,e[1]=i);let a;e[2]===t?a=e[3]:(a=t({id:`MmqnGI`}),e[2]=t,e[3]=a);let o;e[4]!==n.global||e[5]!==i||e[6]!==a?(o={title:r,blurb:i,empty:a},e[4]=n.global,e[5]=i,e[6]=a,e[7]=o):o=e[7];let s=n.project,c;e[8]===t?c=e[9]:(c=t({id:`RXNu_r`}),e[8]=t,e[9]=c);let l;e[10]===t?l=e[11]:(l=t({id:`uFOL2y`}),e[10]=t,e[11]=l);let u;e[12]!==n.project||e[13]!==c||e[14]!==l?(u={title:s,blurb:c,empty:l},e[12]=n.project,e[13]=c,e[14]=l,e[15]=u):u=e[15];let d;return e[16]!==o||e[17]!==u?(d={global:o,project:u},e[16]=o,e[17]=u,e[18]=d):d=e[18],d}function Gr(){let e=(0,Z.c)(26),t=pt(),n=Wr(),r=oe(),[i,a]=(0,Q.useState)(!1),o;e[0]===r?o=e[1]:(o=function(e,t){Nt(Be(e,t)),r.close()},e[0]=r,e[1]=o);let s=o,c=gt(),l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`h3`,{id:`settings-skills-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`PCSkw2`})}),e[2]=l):l=e[2];let u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[l,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`wn8EJi`})})]}),e[3]=u):u=e[3];let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>a(!0),e[4]=d):d=e[4];let f,p;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[u,(0,$.jsxs)(S,{variant:`outline`,size:`sm`,className:`shrink-0 font-mono uppercase`,onClick:d,"data-testid":`settings-skills-new-button`,children:[(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(v,{id:`MdpSC1`})]})]}),p=(0,$.jsx)(Ur,{}),e[5]=f,e[6]=p):(f=e[5],p=e[6]);let h;e[7]!==c.install||e[8]!==c.installingName||e[9]!==c.requestDelete||e[10]!==c.uninstall||e[11]!==n||e[12]!==s||e[13]!==t.data||e[14]!==t.message||e[15]!==t.status?(h=t.status===`error`?(0,$.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,"data-testid":`settings-skills-error`,children:(0,$.jsx)(v,{id:`OEu_0l`,values:{0:t.message}})}):t.status===`idle`||t.status===`loading`?(0,$.jsxs)(`div`,{className:`rounded-lg border bg-card p-3 space-y-2`,children:[(0,$.jsx)(Y,{className:`h-12 w-full`}),(0,$.jsx)(Y,{className:`h-12 w-full`})]}):bt.map(e=>{let r=t.data.filter(t=>t.scope===e).sort(Kr);return e===`global`&&r.length===0?null:(0,$.jsx)(qr,{chrome:n[e],scope:e,skills:r,installingName:c.installingName,onEdit:e=>s(e.scope,e.name),onDelete:c.requestDelete,onInstall:c.install,onUninstall:c.uninstall},e)}),e[7]=c.install,e[8]=c.installingName,e[9]=c.requestDelete,e[10]=c.uninstall,e[11]=n,e[12]=s,e[13]=t.data,e[14]=t.message,e[15]=t.status,e[16]=h):h=e[16];let g;e[17]===s?g=e[18]:(g=e=>{let{scope:t,name:n}=e;return s(t,n)},e[17]=s,e[18]=g);let _;e[19]!==i||e[20]!==g?(_=(0,$.jsx)(ye,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:g}),e[19]=i,e[20]=g,e[21]=_):_=e[21];let y;return e[22]!==c.dialogs||e[23]!==h||e[24]!==_?(y=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-skills-title`,className:`space-y-4`,"data-testid":`settings-skills-section`,children:[f,p,h,c.dialogs,_]}),e[22]=c.dialogs,e[23]=h,e[24]=_,e[25]=y):y=e[25],y}function Kr(e,t){return e.name.toLowerCase().localeCompare(t.name.toLowerCase())}function qr(e){let t=(0,Z.c)(22),{chrome:n,scope:r,skills:i,installingName:a,onEdit:o,onDelete:s,onInstall:c,onUninstall:l}=e,u=`settings-skills-${r}-heading`,d=`skills-group-${r}`,f;t[0]!==n.title||t[1]!==u?(f=(0,$.jsx)(`h4`,{id:u,className:`text-sm font-medium`,children:n.title}),t[0]=n.title,t[1]=u,t[2]=f):f=t[2];let p;t[3]===n.blurb?p=t[4]:(p=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:n.blurb}),t[3]=n.blurb,t[4]=p);let m;t[5]!==f||t[6]!==p?(m=(0,$.jsxs)(`div`,{children:[f,p]}),t[5]=f,t[6]=p,t[7]=m):m=t[7];let h;t[8]!==n.empty||t[9]!==a||t[10]!==s||t[11]!==o||t[12]!==c||t[13]!==l||t[14]!==r||t[15]!==i?(h=(0,$.jsx)(`div`,{className:`rounded-lg border bg-card`,children:i.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-sm text-muted-foreground`,"data-testid":`skills-group-${r}-empty`,children:n.empty}):(0,$.jsx)(`ul`,{className:`space-y-1 p-2`,"data-testid":`skills-group-${r}-list`,children:i.map(e=>(0,$.jsx)(Fr,{skill:e,installing:a===e.name,onEdit:()=>o(e),onDelete:()=>s(e),onInstall:()=>c(e),onUninstall:()=>l(e)},e.name))})}),t[8]=n.empty,t[9]=a,t[10]=s,t[11]=o,t[12]=c,t[13]=l,t[14]=r,t[15]=i,t[16]=h):h=t[16];let g;return t[17]!==u||t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,$.jsxs)(`section`,{"aria-labelledby":u,className:`space-y-2`,"data-testid":d,children:[m,h]}),t[17]=u,t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21],g}function Jr(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)]:Jr(r,t)}}function Yr(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 Xr(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 Zr(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}}function Qr(){let e=(0,Z.c)(71),{_:t}=y(),{enabled:n,synced:r}=Oe(),i=je(),a=n!==!1,{userConfig:o,userBinding:s,userSynced:c}=Jt(),l=o?.agents?.autoApproveOkTools!==!1,[u,d]=(0,Q.useState)(!1),f,p;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.terminal.cliPreflight(`codex`).then(e=>{t||d(e.onPath===`present`&&e.okServerConfigured!==!0)}).catch($r),()=>{t=!0}},p=[],e[0]=f,e[1]=p):(f=e[0],p=e[1]),(0,Q.useEffect)(f,p);let m;e[2]!==t||e[3]!==i?(m=function(e){if(i===null){X.error(t({id:`w6sBjd`}));return}let n=i(e);n.ok||X.error(t(e?{id:`jKd3AP`,values:{0:n.error}}:{id:`pajIrl`,values:{0:n.error}}))},e[2]=t,e[3]=i,e[4]=m):m=e[4];let h=m,g;e[5]!==t||e[6]!==s?(g=function(e){if(s===null){X.error(t({id:`fnlBN4`}));return}let n=s.patch({agents:{autoApproveOkTools:e}});if(!n.ok){let e=Ue(n.error);X.error(t({id:`habOU_`,values:{detail:e}}))}},e[5]=t,e[6]=s,e[7]=g):g=e[7];let v=g,b;e[8]===t?b=e[9]:(b=t({id:`ALhMYW`}),e[8]=t,e[9]=b);let x;e[10]===b?x=e[11]:(x=(0,$.jsx)(`h3`,{id:`settings-terminal-title`,className:`text-base font-semibold`,children:b}),e[10]=b,e[11]=x);let S;e[12]===t?S=e[13]:(S=t({id:`FCAcjR`}),e[12]=t,e[13]=S);let C;e[14]===S?C=e[15]:(C=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S}),e[14]=S,e[15]=C);let w;e[16]!==x||e[17]!==C?(w=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[x,C]}),e[16]=x,e[17]=C,e[18]=w):w=e[18];let T;e[19]===t?T=e[20]:(T=t({id:`E4XYYH`}),e[19]=t,e[20]=T);let E;e[21]===T?E=e[22]:(E=(0,$.jsx)(`label`,{htmlFor:`settings-terminal-toggle`,className:`text-sm font-medium`,children:T}),e[21]=T,e[22]=E);let D;e[23]!==t||e[24]!==a?(D=t(a?{id:`AQGtjK`}:{id:`R65q-K`}),e[23]=t,e[24]=a,e[25]=D):D=e[25];let O;e[26]===D?O=e[27]:(O=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-body`,children:D}),e[26]=D,e[27]=O);let k;e[28]!==E||e[29]!==O?(k=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[E,O]}),e[28]=E,e[29]=O,e[30]=k):k=e[30];let A=!r||i===null,j;e[31]===t?j=e[32]:(j=t({id:`E4XYYH`}),e[31]=t,e[32]=j);let M;e[33]!==h||e[34]!==a||e[35]!==A||e[36]!==j?(M=(0,$.jsx)(_,{id:`settings-terminal-toggle`,checked:a,onCheckedChange:h,disabled:A,"aria-label":j,"data-testid":`settings-terminal-toggle`}),e[33]=h,e[34]=a,e[35]=A,e[36]=j,e[37]=M):M=e[37];let N;e[38]!==k||e[39]!==M?(N=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[k,M]}),e[38]=k,e[39]=M,e[40]=N):N=e[40];let P;e[41]===t?P=e[42]:(P=t({id:`ilodsp`}),e[41]=t,e[42]=P);let F;e[43]===P?F=e[44]:(F=(0,$.jsx)(`label`,{htmlFor:`settings-terminal-autoapprove-toggle`,className:`text-sm font-medium`,children:P}),e[43]=P,e[44]=F);let I;e[45]===t?I=e[46]:(I=t({id:`nP76lk`}),e[45]=t,e[46]=I);let L;e[47]===I?L=e[48]:(L=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-autoapprove-body`,children:I}),e[47]=I,e[48]=L);let R;e[49]!==t||e[50]!==l||e[51]!==u?(R=l&&u?(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-autoapprove-codex-note`,children:t({id:`Kr3VPS`})}):null,e[49]=t,e[50]=l,e[51]=u,e[52]=R):R=e[52];let z;e[53]!==F||e[54]!==L||e[55]!==R?(z=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[F,L,R]}),e[53]=F,e[54]=L,e[55]=R,e[56]=z):z=e[56];let B=!c||s===null,V;e[57]===t?V=e[58]:(V=t({id:`ilodsp`}),e[57]=t,e[58]=V);let H;e[59]!==v||e[60]!==l||e[61]!==B||e[62]!==V?(H=(0,$.jsx)(_,{id:`settings-terminal-autoapprove-toggle`,checked:l,onCheckedChange:v,disabled:B,"aria-label":V,"data-testid":`settings-terminal-autoapprove-toggle`}),e[59]=v,e[60]=l,e[61]=B,e[62]=V,e[63]=H):H=e[63];let U;e[64]!==z||e[65]!==H?(U=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[z,H]}),e[64]=z,e[65]=H,e[66]=U):U=e[66];let W;return e[67]!==N||e[68]!==U||e[69]!==w?(W=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-terminal-title`,className:`space-y-3`,children:[w,N,U]}),e[67]=N,e[68]=U,e[69]=w,e[70]=W):W=e[70],W}function $r(){}function ei(e){let t=(0,Z.c)(14),n;t[0]===e?n=t[1]:(n=e.current(),t[0]=e,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i={defaultValues:r,mode:`onBlur`},t[2]=r,t[3]=i);let a=re(i),o,s;t[4]!==e||t[5]!==a?(o=()=>e.subscribe(e=>{ti(a,e)}),s=[e,a],t[4]=e,t[5]=a,t[6]=o,t[7]=s):(o=t[6],s=t[7]),(0,Q.useEffect)(o,s);let c;t[8]!==e||t[9]!==a?(c=t=>ni(a,e,t),t[8]=e,t[9]=a,t[10]=c):c=t[10];let l=c,u;return t[11]!==l||t[12]!==a?(u={form:a,commitField:l},t[11]=l,t[12]=a,t[13]=u):u=t[13],u}function ti(e,t){e.reset(t,{keepDirtyValues:!0,keepDirty:!0,keepTouched:!0})}function ni(e,t,n){let r=e.getValues(n),i=Jr(ai(n),r),a=t.patch(i);if(a.ok)return e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0;if(Le(a.error)&&a.error.code===`SCHEMA_INVALID`&&a.error.issues.length>0){e.clearErrors(n);for(let t of a.error.issues){let r=t.path.length>0?t.path.map(String).join(`.`):n;e.setError(r,{type:`config-binding`,message:t.message})}}else e.setError(n,{type:`config-binding`,message:ri(a.error,n)});return!1}function ri(e,t){if(Le(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>ii(e,t));if(n)return n.message}return Ue(e)}function ii(e,t){return e.path.map(String).join(`.`)===t}function ai(e){return e.split(`.`)}var oi=[{path:[`appearance`,`theme`],label:{id:`FEr96N`},description:{id:`JZ8cO6`},control:`enum-toggle`},{path:[`editor`,`wordWrap`],label:{id:`iKSP5j`},description:{id:`mmpzAq`}},{path:[`appearance`,`preview`,`autoOpen`],label:{id:`2XQ8Ww`},description:{id:`bultyE`}}],si=`data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90`;function ci(e){let t=(0,Z.c)(20),{activeId:n,userBinding:r,okignoreBinding:i,okignoreSynced:a}=e,{_:o}=y();if(n===`preferences`){let e;t[0]!==o||t[1]!==r?(e=r?(0,$.jsx)(mi,{title:o({id:`Q6hhn8`}),description:o({id:`Y_kL7X`}),scope:`user`,binding:r,fields:oi}):(0,$.jsx)(ui,{}),t[0]=o,t[1]=r,t[2]=e):e=t[2];let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Si,{}),t[3]=n):n=t[3];let i;return t[4]===e?i=t[5]:(i=(0,$.jsxs)(`div`,{className:`space-y-8`,children:[e,n]}),t[4]=e,t[5]=i),i}if(n===`hotkeys`){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(fi,{}),t[6]=e):e=t[6],e}if(n===`account`){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{className:`space-y-8`,children:[(0,$.jsx)(mn,{}),(0,$.jsx)(En,{})]}),t[7]=e):e=t[7],e}if(n===`sync`){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(wi,{}),t[8]=e):e=t[8],e}if(n===`search`){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ar,{}),t[9]=e):e=t[9],e}if(n===`terminal`){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Qr,{}),t[10]=e):e=t[10],e}if(n===`project-templates`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Or,{}),t[11]=e):e=t[11],e}if(n===`skills`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Gr,{}),t[12]=e):e=t[12],e}if(n===`sharing`){let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Qt,{}),t[13]=e):e=t[13],e}if(n===`okignore`){let e;return t[14]!==i||t[15]!==a?(e=(0,$.jsx)(Hn,{binding:i,synced:a}),t[14]=i,t[15]=a,t[16]=e):e=t[16],e}if(n===`ai-tools`){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(bn,{}),t[17]=e):e=t[17],e}if(n===`project-ai-tools`){let e;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(xr,{}),t[18]=e):e=t[18],e}if(n===`claude-desktop`){let e;return t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ji,{}),t[19]=e):e=t[19],e}return null}function li(e){if(!Le(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 ui(){let e=(0,Z.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Y,{className:`h-5 w-32`}),n=(0,$.jsx)(Y,{className:`h-4 w-64`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-3`,children:[t,n,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(Y,{className:`h-9 w-full`}),(0,$.jsx)(Y,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function di({binding:e}){return Ut(e).split(` / `).map((e,t)=>t===0?(0,$.jsx)(l,{"aria-label":Kt(e),children:e},`kbd-${e}`):(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`qEue6Q`})}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` / `}),(0,$.jsx)(l,{"aria-label":Kt(e),children:e})]},`or-${e}`))}function fi(){let e=(0,Z.c)(6),{_:t}=y(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`h3`,{id:`settings-hotkeys-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`4KmEoC`})}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[n,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`RaPMZv`})})]}),e[1]=r):r=e[1];let i;e[2]===t?i=e[3]:(i=Gt.map(e=>{let n=qt.filter(t=>t.category===e);return n.length===0?null:(0,$.jsxs)(`section`,{"aria-labelledby":`settings-hotkeys-${e}`,children:[(0,$.jsx)(`h4`,{id:`settings-hotkeys-${e}`,className:`mb-2 font-mono text-muted-foreground text-xs uppercase tracking-wide`,children:t(Wt[e])}),(0,$.jsx)(`ul`,{"aria-labelledby":`settings-hotkeys-${e}`,className:`m-0 list-none overflow-hidden rounded-md border p-0`,children:n.map(e=>{let n=`settings-hotkey-${e.id}-title`,r=`settings-hotkey-${e.id}-description`,i=e.bindings.reduce(pi,0)>4;return(0,$.jsxs)(`li`,{"aria-describedby":r,"aria-labelledby":n,className:w(`grid gap-2 border-border border-b px-3 py-3 last:border-b-0`,i?`sm:grid-cols-1`:`sm:grid-cols-[minmax(0,1fr)_minmax(0,auto)]`),"data-testid":`settings-hotkey-${e.id}`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`font-medium text-sm`,id:n,children:t(e.title)}),(0,$.jsxs)(u,{variant:`gray`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(v,{id:`iXTp5j`})}),t(e.scope)]})]}),(0,$.jsx)(`p`,{className:`text-muted-foreground text-sm`,id:r,children:t(e.description)})]}),(0,$.jsx)(`div`,{className:w(`flex min-w-0 max-w-full self-start content-start flex-wrap items-start gap-1.5`,i?`sm:justify-start`:`sm:max-w-[38rem] sm:justify-end`),children:e.bindings.map(t=>(0,$.jsx)(di,{binding:t},`${e.id}-${t.mac}-${t.windowsLinux}`))})]},e.id)})})]},e)}),e[2]=t,e[3]=i);let a;return e[4]===i?a=e[5]:(a=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-hotkeys-title`,className:`space-y-5`,"data-testid":`settings-hotkeys`,children:[r,(0,$.jsx)(`div`,{className:`space-y-6`,"data-testid":`settings-hotkeys-list`,children:i})]}),e[4]=i,e[5]=a),a}function pi(e,t){return e+Ut(t).split(` / `).length}function mi(e){let t=(0,Z.c)(14),{title:n,description:r,scope:i,binding:a,fields:o}=e,{form:s,commitField:c}=ei(a),[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(null),f,p;t[0]!==s||t[1]!==i?(f=()=>{let e=i===`project`?qe:Ge,t=_e(t=>{if(t.docName!==e)return;X.error(Ue(t.error),{duration:8e3});let n=li(t.error);n&&(s.setError(n,{type:`config-validation-rejected`,message:ri(t.error,n)}),s.setFocus(n),u(n),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u(null),s.clearErrors(n)},600))});return()=>{t(),d.current&&clearTimeout(d.current)}},p=[i,s],t[0]=s,t[1]=i,t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]!==c||t[5]!==r||t[6]!==o||t[7]!==l||t[8]!==i||t[9]!==n?(m=(0,$.jsx)(hi,{title:n,description:r,scope:i,fields:o,commitField:c,flashedPath:l}),t[4]=c,t[5]=r,t[6]=o,t[7]=l,t[8]=i,t[9]=n,t[10]=m):m=t[10];let h;return t[11]!==s||t[12]!==m?(h=(0,$.jsx)(rn,{...s,children:m}),t[11]=s,t[12]=m,t[13]=h):h=t[13],h}function hi(e){let t=(0,Z.c)(23),{title:n,description:r,scope:i,fields:a,commitField:o,flashedPath:s}=e,c=`settings-section-${i}-title`,l;t[0]!==n||t[1]!==c?(l=(0,$.jsx)(`h3`,{id:c,className:`text-base font-semibold`,children:n}),t[0]=n,t[1]=c,t[2]=l):l=t[2];let u;t[3]===r?u=t[4]:(u=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[l,u]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;if(t[8]!==o||t[9]!==a||t[10]!==s||t[11]!==i){let e;t[13]!==o||t[14]!==s||t[15]!==i?(e=e=>(0,$.jsx)(Ti,{field:e,scope:i,commitField:o,isFlashed:s===e.path.join(`.`)},e.path.join(`.`)),t[13]=o,t[14]=s,t[15]=i,t[16]=e):e=t[16],f=a.map(e),t[8]=o,t[9]=a,t[10]=s,t[11]=i,t[12]=f}else f=t[12];let p;t[17]===f?p=t[18]:(p=(0,$.jsx)(`div`,{className:`space-y-10`,children:f}),t[17]=f,t[18]=p);let m;return t[19]!==d||t[20]!==p||t[21]!==c?(m=(0,$.jsxs)(`section`,{"aria-labelledby":c,className:`space-y-3`,children:[d,p]}),t[19]=d,t[20]=p,t[21]=c,t[22]=m):m=t[22],m}var gi=`content.attachmentFolderPath`,_i=`attachments`;function vi(e){let t=Re(e);return t===`./`?`same-folder`:t===`/`?`content-root`:t.startsWith(`./`)?`current-folder-subfolder`:`content-root-folder`}function yi(e){let t=Re(e);return t===`./`||t===`/`?_i:t.startsWith(`./`)?t.slice(2)||_i:t}function bi(e){return e.trim().replace(/^(?:\.\/)+/,``).replace(/\/{2,}/g,`/`).replace(/\/+$/g,``)}function xi(e,t){let n=bi(t)||_i;return e===`same-folder`?`./`:e===`content-root`?`/`:e===`current-folder-subfolder`?`./${n}`:n}function Si(){let e=(0,Z.c)(4),{projectBinding:t,projectConfig:n,projectSynced:r}=Jt();if(!t||!r||!n){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ui,{}),e[0]=t):t=e[0],t}let i=n.content.attachmentFolderPath??`./`,a;return e[1]!==i||e[2]!==t?(a=(0,$.jsx)(Ci,{binding:t,value:i},i),e[1]=i,e[2]=t,e[3]=a):a=e[3],a}function Ci(e){let t=(0,Z.c)(50),{binding:n,value:r}=e,{_:i}=y(),a;t[0]===r?a=t[1]:(a=()=>vi(r),t[0]=r,t[1]=a);let[c,l]=(0,Q.useState)(a),u;t[2]===r?u=t[3]:(u=()=>yi(r),t[2]=r,t[3]=u);let[p,m]=(0,Q.useState)(u),[h,_]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D,O;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{T.current&&clearTimeout(T.current),E.current&&clearTimeout(E.current)},O=[],t[4]=D,t[5]=O):(D=t[4],O=t[5]),(0,Q.useEffect)(D,O);let k,A;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>_e(e=>{if(e.docName!==`__config__/project`||li(e.error)!==gi)return;let t=ri(e.error,gi);X.error(Ue(e.error),{duration:8e3}),_(t),C(!0),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{C(!1),_(null)},600)}),A=[],t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{x(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>x(!1),1200)},t[8]=j):j=t[8];let M=j,N;t[9]!==i||t[10]!==n?(N=e=>{let t=n.patch({content:{attachmentFolderPath:e}});if(t.ok){_(null),M();return}let r=ri(t.error,gi);_(r),X.error(i({id:`eQxm13`,values:{detail:r}}))},t[9]=i,t[10]=n,t[11]=N):N=t[11];let P=N,F;t[12]!==P||t[13]!==p?(F=e=>{if(e!==`same-folder`&&e!==`content-root`&&e!==`current-folder-subfolder`&&e!==`content-root-folder`)return;let t=e,n=t===`current-folder-subfolder`||t===`content-root-folder`?p||_i:p;l(t),m(n),P(xi(t,n))},t[12]=P,t[13]=p,t[14]=F):F=t[14];let I=F,L;t[15]!==P||t[16]!==p||t[17]!==c?(L=()=>{let e=xi(c,p);m(yi(e)),P(e)},t[15]=P,t[16]=p,t[17]=c,t[18]=L):L=t[18];let R=L,z=c===`current-folder-subfolder`||c===`content-root-folder`,B;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(`h3`,{id:`settings-attachments-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`w_Sphq`})}),t[19]=B):B=t[19];let V;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[B,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`Hnl9nT`})})]}),t[20]=V):V=t[20];let H=S&&`animate-settings-flash`,U;t[21]===H?U=t[22]:(U=w(`rounded-md border p-3`,H),t[21]=H,t[22]=U);let W;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(`div`,{className:`text-sm font-medium`,id:`settings-attachments-location-label`,children:(0,$.jsx)(v,{id:`AsqRE_`})}),t[23]=W):W=t[23];let ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[W,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`vppAju`})})]}),t[24]=ee):ee=t[24];let te;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(f,{"aria-labelledby":`settings-attachments-location-label`,"data-testid":`settings-attachments-mode`,size:`sm`,children:(0,$.jsx)(s,{})}),t[25]=te):te=t[25];let ne;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(g,{value:`same-folder`,children:(0,$.jsx)(v,{id:`Q7W-mC`})}),t[26]=ne):ne=t[26];let re;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(g,{value:`content-root`,children:(0,$.jsx)(v,{id:`yWSvcf`})}),t[27]=re):re=t[27];let ie;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(g,{value:`current-folder-subfolder`,children:(0,$.jsx)(v,{id:`0YUS3Q`})}),t[28]=ie):ie=t[28];let ae;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsxs)(o,{children:[ne,re,ie,(0,$.jsx)(g,{value:`content-root-folder`,children:(0,$.jsx)(v,{id:`qAx7xG`})})]}),t[29]=ae):ae=t[29];let G;t[30]!==c||t[31]!==I?(G=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(16rem,18rem)] sm:items-start`,children:[ee,(0,$.jsxs)(d,{value:c,onValueChange:I,children:[te,ae]})]}),t[30]=c,t[31]=I,t[32]=G):G=t[32];let K;t[33]!==i||t[34]!==R||t[35]!==p||t[36]!==z?(K=z?(0,$.jsxs)(`div`,{className:`mt-3 max-w-sm space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:`settings-attachments-folder-input`,children:(0,$.jsx)(v,{id:`kNqMMd`})}),(0,$.jsx)(Bt,{id:`settings-attachments-folder-input`,value:p,placeholder:i({id:`OeAl1e`}),onChange:e=>m(e.target.value),onBlur:R,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),R())},className:`h-8 text-sm`,"data-testid":`settings-attachments-folder`})]}):null,t[33]=i,t[34]=R,t[35]=p,t[36]=z,t[37]=K):K=t[37];let q;t[38]===h?q=t[39]:(q=h?(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,"data-field-error":gi,role:`alert`,children:h}):null,t[38]=h,t[39]=q);let oe;t[40]===b?oe=t[41]:(oe=(0,$.jsx)(Ai,{visible:b}),t[40]=b,t[41]=oe);let se;t[42]!==q||t[43]!==oe?(se=(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center gap-2`,children:[q,oe]}),t[42]=q,t[43]=oe,t[44]=se):se=t[44];let J;return t[45]!==U||t[46]!==G||t[47]!==K||t[48]!==se?(J=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-attachments-title`,className:`space-y-3`,"data-testid":`settings-attachments`,children:[V,(0,$.jsxs)(`div`,{className:U,"data-field":gi,"data-scope":`project`,children:[G,K,se]})]}),t[45]=U,t[46]=G,t[47]=K,t[48]=se,t[49]=J):J=t[49],J}function wi(){let e=(0,Z.c)(75),{_:t}=y(),n=$e(),{projectConfig:r,projectLocalConfig:i,projectLocalSynced:a,projectSynced:o}=Jt(),s=Qe(),c=et(),{confirmOpen:l,setConfirmOpen:u,onToggleRequest:d,onConfirm:f}=tt(s),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1);if(n&&!n.hasRemote&&n.state===`dormant`){let t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:`settings-sync-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`Nu4DdT`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[t,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`AiNMQ7`})})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`3_6U6f`})}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`i92eAT`})})]}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>m(!0),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[i,(0,$.jsx)(S,{onClick:a,"data-testid":`settings-sync-setup`,children:(0,$.jsx)(v,{id:`zkz0Fg`})})]}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(k,{asChild:!0,children:(0,$.jsxs)(S,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,children:[(0,$.jsx)(at,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,$.jsx)(v,{id:`6caB2T`})]})}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(A,{children:[s,(0,$.jsx)(O,{className:`px-1.5 pt-2 text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`44DSl0`,components:{0:(0,$.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),e[7]=c):c=e[7];let l;return e[8]===p?l=e[9]:(l=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-sync-title`,className:`space-y-4`,"data-testid":`settings-sync-empty`,children:[n,o,c,(0,$.jsx)(ke,{open:p,onOpenChange:m})]}),e[8]=p,e[9]=l),l}let b=i?.autoSync?.enabled??!1,x=n?.pushPermission?.checkStatus,C;e[10]!==a||e[11]!==x?(C=se(a,x),e[10]=a,e[11]=x,e[12]=C):C=e[12];let w=C,T=n?.pushPermission?.checkStatus===`denied`||n?.pausedReason===`no-push-permission`,E;e[13]!==T||e[14]!==n?(E=T||!n?.pausedReason?null:Ae(n.pausedReason),e[13]=T,e[14]=n,e[15]=E):E=e[15];let D=E,j=r?.autoSync?.default??null,M=j===!0?`on`:j===!1?`off`:`ask`,N;e[16]!==t||e[17]!==c?(N=function(e){if(e!==`ask`&&e!==`on`&&e!==`off`)return;if(c===null){X.error(t({id:`fiMNLl`}));return}let n=c(e===`on`?!0:e===`off`?!1:null);if(!n.ok){let e=n.error;X.error(t({id:`oAFVKX`,values:{detail:e}}))}},e[16]=t,e[17]=c,e[18]=N):N=e[18];let P=N,F;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(`h3`,{id:`settings-sync-title`,className:`text-base font-semibold`,children:(0,$.jsx)(v,{id:`Nu4DdT`})}),e[19]=F):F=e[19];let I;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[F,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(v,{id:`T67A0Y`})})]}),e[20]=I):I=e[20];let L;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(`label`,{htmlFor:`settings-sync-toggle`,className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`Nx7BWE`})}),e[21]=L):L=e[21];let R;e[22]!==b||e[23]!==T?(R=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-sync-body`,children:T?(0,$.jsx)(v,{id:`l8G3S9`}):b?(0,$.jsx)(v,{id:`-gdcIo`}):(0,$.jsx)(v,{id:`qUB_o_`})}),e[22]=b,e[23]=T,e[24]=R):R=e[24];let z;e[25]!==t||e[26]!==n?(z=n?.remote?(0,$.jsxs)(`p`,{className:`text-muted-foreground text-1sm truncate`,"data-testid":`settings-sync-remote`,children:[(0,$.jsx)(v,{id:`Q8A-U_`}),` `,n.remote.webUrl?(0,$.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-foreground hover:text-primary hover:underline inline-flex items-center gap-0.5`,"aria-label":t({id:`1nke1r`,values:{0:n.remote.label}}),"data-testid":`settings-sync-remote-link`,children:[(0,$.jsx)(`span`,{children:n.remote.label}),(0,$.jsx)(rt,{className:`inline size-3.5`,"aria-hidden":!0})]}):(0,$.jsx)(`span`,{className:`font-medium text-foreground`,"data-testid":`settings-sync-remote-label`,children:n.remote.label})]}):null,e[25]=t,e[26]=n,e[27]=z):z=e[27];let B;e[28]!==R||e[29]!==z?(B=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[L,R,z]}),e[28]=R,e[29]=z,e[30]=B):B=e[30];let V;e[31]!==t||e[32]!==b||e[33]!==n?.pushPermission?.checkStatus?(V=n?.pushPermission?.checkStatus===`denied`?t({id:`FnMkli`}):t(b?{id:`OmHTGj`}:{id:`MKOVhz`}),e[31]=t,e[32]=b,e[33]=n?.pushPermission?.checkStatus,e[34]=V):V=e[34];let H;e[35]!==w||e[36]!==b||e[37]!==d||e[38]!==V?(H=(0,$.jsx)(_,{id:`settings-sync-toggle`,checked:b,disabled:w,onCheckedChange:d,"aria-label":V,"data-testid":`settings-sync-toggle`}),e[35]=w,e[36]=b,e[37]=d,e[38]=V,e[39]=H):H=e[39];let U;e[40]!==H||e[41]!==B?(U=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[B,H]}),e[40]=H,e[41]=B,e[42]=U):U=e[42];let W;e[43]===D?W=e[44]:(W=D!==null&&(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-reason`,children:D}),e[43]=D,e[44]=W);let ee;e[45]===n?.pushPermission?ee=e[46]:(ee=ae(n?.pushPermission)&&(0,$.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-signin-again`,children:[(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,$.jsx)(v,{id:`C_cPoW`})}),(0,$.jsx)(S,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>g(!0),children:(0,$.jsx)(v,{id:`5lWFkC`})})]}),e[45]=n?.pushPermission,e[46]=ee);let te;e[47]!==U||e[48]!==W||e[49]!==ee?(te=(0,$.jsxs)(`div`,{className:`rounded-md border p-3`,children:[U,W,ee]}),e[47]=U,e[48]=W,e[49]=ee,e[50]=te):te=e[50];let ne;e[51]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(v,{id:`j_Z6g7`})}),e[51]=ne):ne=e[51];let re;e[52]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[ne,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(v,{id:`W3Xlpc`})})]}),e[52]=re):re=e[52];let ie=!o,G;e[53]===t?G=e[54]:(G=t({id:`dvGKu2`}),e[53]=t,e[54]=G);let K;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(Ne,{value:`ask`,className:si,"data-testid":`settings-sync-default-ask`,children:(0,$.jsx)(v,{id:`EdQY6l`})}),e[55]=K):K=e[55];let q;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(Ne,{value:`on`,className:si,"data-testid":`settings-sync-default-on`,children:(0,$.jsx)(v,{id:`Z5HWHd`})}),e[56]=q):q=e[56];let oe;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(Ne,{value:`off`,className:si,"data-testid":`settings-sync-default-off`,children:(0,$.jsx)(v,{id:`az8lvo`})}),e[57]=oe):oe=e[57];let J;e[58]!==M||e[59]!==P||e[60]!==ie||e[61]!==G?(J=(0,$.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,"data-testid":`settings-sync-default`,children:[re,(0,$.jsxs)(Pe,{type:`single`,variant:`outline`,spacing:2,value:M,onValueChange:P,disabled:ie,"aria-label":G,"data-testid":`settings-sync-default-toggle`,children:[K,q,oe]})]}),e[58]=M,e[59]=P,e[60]=ie,e[61]=G,e[62]=J):J=e[62];let Y;e[63]!==l||e[64]!==f||e[65]!==u?(Y=(0,$.jsx)(nt,{open:l,onOpenChange:u,onConfirm:f}),e[63]=l,e[64]=f,e[65]=u,e[66]=Y):Y=e[66];let ce;e[67]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>g(!1),e[67]=ce):ce=e[67];let ue;e[68]===h?ue=e[69]:(ue=(0,$.jsx)(le,{open:h,onOpenChange:g,onSuccess:ce}),e[68]=h,e[69]=ue);let de;return e[70]!==te||e[71]!==J||e[72]!==Y||e[73]!==ue?(de=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-sync-title`,className:`space-y-3`,children:[I,te,J,Y,ue]}),e[70]=te,e[71]=J,e[72]=Y,e[73]=ue,e[74]=de):de=e[74],de}function Ti({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=y(),a=ve(),o=We(ze,e.path),s=o?Xr(o):void 0,c=o?Yr(o):void 0,l=o?Zr(o):void 0,u=o?Ve(o):void 0,d=u?.scope===`project`&&t!==`project`||u?.scope===`user`&&t!==`user`,f=e.path.join(`.`),p=i(e.label),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let _=()=>{h(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(!1),1200)},b=()=>{let e=n(f);return e&&_(),e},x=()=>a.getFieldState(f).isDirty?b():!0,C=()=>{let e=c===void 0?null:c;a.setValue(f,e,{shouldDirty:!1}),b()},O=w(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(on,{control:a.control,name:f,render:({field:n})=>{let r=!d&&(c!==void 0||n.value!==void 0);return(0,$.jsxs)(ln,{className:O,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(un,{className:`text-sm font-medium`,children:p}),r?(0,$.jsxs)(D,{children:[(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(S,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:C,"aria-label":i({id:`lhjq3G`,values:{labelText:p}}),children:(0,$.jsx)(Xt,{className:`size-3.5`})})}),(0,$.jsx)(E,{children:(0,$.jsx)(v,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(fn,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(dn,{children:(0,$.jsx)(Ei,{field:e,ctl:n,typeTag:s,enumOptions:l,onCommit:x})}),(0,$.jsx)(Ai,{visible:m})]}),(0,$.jsx)(pn,{"data-field-error":e.path.join(`.`)})]})}})}function Ei({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,...a}){"use no memo";let{_:o}=y(),{setTheme:s}=b();if(n===`boolean`)return(0,$.jsx)(_,{...a,checked:!!t.value,ref:t.ref,onCheckedChange:e=>{t.onChange(e),i()},onBlur:t.onBlur});if(n===`enum`&&r&&r.length>0&&(e.control===`enum-toggle`||r.length<=4)){let{id:n,...c}=a,l=e.path[0]===`appearance`&&e.path[1]===`theme`;return(0,$.jsx)(Pe,{...c,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{e&&(l&&s(e),t.onChange(e),i())},onBlur:t.onBlur,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":o(e.label),children:r.map((e,t)=>(0,$.jsx)(Ne,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(Oi,{ctl:t,onCommit:i,...a}):n===`array`?(0,$.jsx)(ki,{ctl:t,onCommit:i,...a}):(0,$.jsx)(Di,{ctl:t,onCommit:i,...a})}function Di({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(Bt,{...n,value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),t()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t())},className:`h-8 text-sm`})}function Oi({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,Q.useState)(e.value===void 0?``:String(e.value)),a=(0,Q.useRef)(e.value);(0,Q.useEffect)(()=>{a.current!==e.value&&(i(e.value===void 0?``:String(e.value)),a.current=e.value)},[e.value]);let o=()=>{let n=Number(r);if(!Number.isFinite(n)){e.onChange(r),t();return}e.onChange(n),t(),a.current=n};return(0,$.jsx)(Bt,{...n,type:`number`,value:r,ref:e.ref,onChange:e=>i(e.target.value),onBlur:()=>{e.onBlur(),o()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},className:`h-8 w-28 text-sm tabular-nums`})}function ki({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
3
3
  `):``,[i,a]=(0,Q.useState)(r),o=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{let t=Array.isArray(e.value)?e.value.join(`
4
4
  `):``;t!==o.current&&(a(t),o.current=t)},[e.value]);let s=()=>{let n=i.split(`
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{n as o}from"./createLucideIcon-BPhNPfG7.js";import{a as ee,c as te,i as ne,n as re,o as ie,s as ae,t as oe}from"./dialog-CZK_GJbX.js";import{n as se,t as s}from"./git-branch-Bb5seqP3.js";import{t as c}from"./loader-circle-Cu01Ckhe.js";import{n as ce,t as le}from"./miss-dialog-store-DxVemLe3.js";import{n as l}from"./dist-K3kyyBcW.js";import{t as u}from"./desktop-bridge-types-DUvVV0tT.js";import{n as d}from"./worktree-store-CLuGV1SL.js";import{a as f,n as ue}from"./receive-store-vDvyLF_T.js";import{t as de}from"./share-metadata-rows-VY-5eTfA.js";var p=e(t(),1),fe=r();function pe(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function me(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function m(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var he={phase:`loading`};function ge(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function _e(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ve(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ye(e){return pe(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function be(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function xe(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function Se(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=m(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function Ce(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason}}:{state:e}}var h=n();function we(e){return e!==null&&e.kind===`project-branch-switch`}function g(e){let t=(0,fe.c)(218),{bridge:n,store:r}=e,m=r===void 0?ue:r,{_:g}=a(),_=(0,p.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[v,y]=(0,p.useState)(he),Me=(0,p.useRef)(!1),Ne=(0,p.useRef)(!1),Pe=(0,p.useRef)(!1),Fe=(0,p.useRef)(null),Ie;t[0]===_?Ie=t[1]:(Ie=we(_)?_:null,t[0]=_,t[1]=Ie);let b=Ie,Le;t[2]!==g||t[3]!==b?.share.target.kind?(Le=b?.share.target.kind===`folder`?g({id:`ugoTXs`}):g({id:`XH30C4`}),t[2]=g,t[3]=b?.share.target.kind,t[4]=Le):Le=t[4];let x=Le,Re;t[5]===b?Re=t[6]:(Re=()=>{y(he),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=b},t[5]=b,t[6]=Re);let ze;t[7]===_?ze=t[8]:(ze=[_],t[7]=_,t[8]=ze),(0,p.useEffect)(Re,ze);let Be;t[9]!==b||t[10]!==n?(Be=()=>{if(!b||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{e||y(e=>ge(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),y(Ae))}),()=>{e=!0}},t[9]=b,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===b?Ve=t[13]:(Ve=[b],t[12]=b,t[13]=Ve),(0,p.useEffect)(Be,Ve);let He;t[14]!==b||t[15]!==v.info||t[16]!==v.phase||t[17]!==n?(He=()=>{if(!b||v.phase!==`ready`||Pe.current||!ye(v.info))return;Pe.current=!0,y(be);let e=b;n.project.fetchTargetStatus({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{Fe.current===e&&y(e=>xe(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),y(ke))})},t[14]=b,t[15]=v.info,t[16]=v.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==b||t[20]!==v.phase?(Ue=[v.phase,b],t[19]=b,t[20]=v.phase,t[21]=Ue):Ue=t[21],(0,p.useEffect)(He,Ue);let We;t[22]!==b||t[23]!==v.phase||t[24]!==v.resolution||t[25]!==m?(We=()=>{if(v.phase!==`verdict`)return;let{kind:e}=v.resolution;e!==`deleted`&&e!==`never-on-branch`||b&&(le.arm({kind:b.share.target.kind,path:u(b.share.target),branch:b.share.branch}),m.dismiss())},t[22]=b,t[23]=v.phase,t[24]=v.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==b||t[28]!==v||t[29]!==m?(Ge=[v,b,m],t[27]=b,t[28]=v,t[29]=m,t[30]=Ge):Ge=t[30],(0,p.useEffect)(We,Ge);let Ke;t[31]!==v.phase||t[32]!==v.resolution?(Ke=()=>{v.phase===`verdict`&&console.log(f({verdict_cell:v.resolution.kind}))},t[31]=v.phase,t[32]=v.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===v?qe=t[35]:(qe=[v],t[34]=v,t[35]=qe),(0,p.useEffect)(Ke,qe);let Je;t[36]!==g||t[37]!==b||t[38]!==v.pendingDoc||t[39]!==v.phase||t[40]!==n||t[41]!==m||t[42]!==x?(Je=()=>{if(v.phase!==`awaiting-cc1-recycle`||!b)return;let e=b.share.branch,t=v.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:b.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(f({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:b.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:b.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),l.error(g({id:`gQV-9w`,values:{targetNoun:x}}))}),m.dismiss();return}console.log(f({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(g({id:`LBwUR6`,values:{targetNoun:x}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(g({id:`Jw6EC4`,values:{targetNoun:x}})),m.dismiss())}),()=>{r=!0}},t[36]=g,t[37]=b,t[38]=v.pendingDoc,t[39]=v.phase,t[40]=n,t[41]=m,t[42]=x,t[43]=Je):Je=t[43];let Ye;if(t[44]!==b||t[45]!==v.phase?(Ye=[v.phase,b],t[44]=b,t[45]=v.phase,t[46]=Ye):Ye=t[46],(0,p.useEffect)(Je,Ye),!b)return null;let{share:S,projectPath:C,currentBranch:w}=b,T=S.branch,Xe;t[47]!==g||t[48]!==n.project||t[49]!==C||t[50]!==T||t[51]!==m?(Xe=function(e,t,r){console.log(f({branch_dialog_action:`switch`,branch_action:`switch`,branch:T,verdict_cell:r})),y(t=>_e(t,e)),n.project.runCheckout(t?{projectPath:C,branch:T,fastForward:!0}:{projectPath:C,branch:T}).then(e=>{let t=null,n=!1;y(r=>{let{state:i,sideEffect:a}=Se(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?l.error(g({id:`NJyQi_`,values:{shareBranch:T}})):t===`fetch-failed`?l.error(g({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&l.error(g({id:`c863eW`,values:{shareBranch:T}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),y(Oe),l.error(g({id:`c863eW`,values:{shareBranch:T}}))})},t[47]=g,t[48]=n.project,t[49]=C,t[50]=T,t[51]=m,t[52]=Xe):Xe=t[52];let E=Xe,Ze;t[53]!==v.info||t[54]!==v.phase||t[55]!==E||t[56]!==S.target?(Ze=function(){v.phase===`ready`&&pe(v.info).switchEnabled&&E(u(S.target),!1)},t[53]=v.info,t[54]=v.phase,t[55]=E,t[56]=S.target,t[57]=Ze):Ze=t[57];let Qe=Ze,$e;t[58]!==v.phase||t[59]!==v.resolution||t[60]!==E||t[61]!==S.target?($e=function(){v.phase===`verdict`&&E(u(S.target),!0,v.resolution.kind)},t[58]=v.phase,t[59]=v.resolution,t[60]=E,t[61]=S.target,t[62]=$e):$e=t[62];let et=$e,tt;t[63]!==v.phase||t[64]!==v.resolution||t[65]!==E?(tt=function(){v.phase===`verdict`&&v.resolution.kind===`renamed`&&E(v.resolution.renamedTo,!0,v.resolution.kind)},t[63]=v.phase,t[64]=v.resolution,t[65]=E,t[66]=tt):tt=t[66];let nt=tt,rt;t[67]!==v.phase||t[68]!==v.resolution||t[69]!==E||t[70]!==S.target?(rt=function(){v.phase===`verdict`&&E(u(S.target),!1,v.resolution.kind)},t[67]=v.phase,t[68]=v.resolution,t[69]=E,t[70]=S.target,t[71]=rt):rt=t[71];let it=rt,at;t[72]!==g||t[73]!==n.project||t[74]!==C||t[75]!==S.target||t[76]!==T||t[77]!==m||t[78]!==x?(at=function(){console.log(f({branch_dialog_action:`open-current`,branch:T})),n.project.open({path:C,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),l.error(g({id:`b5aNbi`,values:{targetNoun:x}}))}),m.dismiss()},t[72]=g,t[73]=n.project,t[74]=C,t[75]=S.target,t[76]=T,t[77]=m,t[78]=x,t[79]=at):at=t[79];let ot=at,st;t[80]!==g||t[81]!==T?(st=function(e){switch(e){case`branch-not-found`:l.error(g({id:`NJyQi_`,values:{shareBranch:T}}));return;case`fetch-failed`:l.error(g({id:`bWLmRK`}));return;case`already-checked-out`:l.error(g({id:`ljHjfg`}));return;case`branch-exists`:l.error(g({id:`h3QZcB`,values:{shareBranch:T}}));return;case`path-exists`:l.error(g({id:`cN1Gcp`,values:{shareBranch:T}}));return;case`no-git`:l.error(g({id:`CFnavk`}));return;case`invalid-branch`:l.error(g({id:`JfPuv7`,values:{shareBranch:T}}));return;case`proxy-null`:case`error`:l.error(g({id:`e8zYa8`,values:{shareBranch:T}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=g,t[81]=T,t[82]=st):st=t[82];let ct=st,lt;t[83]!==g||t[84]!==n.project||t[85]!==S.target||t[86]!==T||t[87]!==ct||t[88]!==m?(lt=function(e){let t=null,r=!1,i=null;if(y(n=>{let{state:a,sideEffect:o}=Ce(n,e);return o&&(t=o.reason,r=a.phase===`dismissed`),a.phase===`opening-worktree`&&(i=a.path),a}),t!==null&&(console.log(f({branch_dialog_action:`open-worktree-failed:${t}`,branch:T})),ct(t)),i!==null){d();let e=i;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}r&&m.dismiss()},t[83]=g,t[84]=n.project,t[85]=S.target,t[86]=T,t[87]=ct,t[88]=m,t[89]=lt):lt=t[89];let ut=lt,dt;t[90]!==ut||t[91]!==v.phase||t[92]!==n.worktree||t[93]!==T?(dt=function(){v.phase===`ready`&&(console.log(f({branch_dialog_action:`open-worktree`,branch:T})),y(ve),n.worktree.checkout({branch:T}).then(e=>{ut(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ut(null)}))},t[90]=ut,t[91]=v.phase,t[92]=n.worktree,t[93]=T,t[94]=dt):dt=t[94];let ft=dt,pt;t[95]!==g||t[96]!==v.otherWorktreePath||t[97]!==v.phase||t[98]!==n.project||t[99]!==S.target||t[100]!==T||t[101]!==m?(pt=function(){if(v.phase!==`branch-in-other-worktree`)return;let e=v.otherWorktreePath;console.log(f({branch_dialog_action:`pivot-to-other-worktree`,branch:T})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=g,t[96]=v.otherWorktreePath,t[97]=v.phase,t[98]=n.project,t[99]=S.target,t[100]=T,t[101]=m,t[102]=pt):pt=t[102];let mt=pt,ht;t[103]!==v.phase||t[104]!==v.resolution||t[105]!==m?(ht=function(){console.log(f({branch_dialog_action:`cancel`,verdict_cell:v.phase===`verdict`?v.resolution.kind:void 0})),m.dismiss()},t[103]=v.phase,t[104]=v.resolution,t[105]=m,t[106]=ht):ht=t[106];let D=ht,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K;if(t[107]!==g||t[108]!==v.info||t[109]!==v.otherWorktreePath||t[110]!==v.phase||t[111]!==v.resolution||t[112]!==D||t[113]!==w||t[114]!==S.branch||t[115]!==S.owner||t[116]!==S.repo||t[117]!==S.target||t[118]!==T||t[119]!==x){G=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?pe(v.info):null;let e;t[139]!==v.info||t[140]!==v.phase||t[141]!==w?(e=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?me(v.info):w??`HEAD`,t[139]=v.info,t[140]=v.phase,t[141]=w,t[142]=e):e=t[142];let n=e;P=v.phase===`switching`||v.phase===`awaiting-cc1-recycle`,j=v.phase===`creating-worktree`;let r;t[143]===g?r=t[144]:(r=g({id:`OuY8t9`}),t[143]=g,t[144]=r),M=r;let a;t[145]!==g||t[146]!==T?(a=g({id:`WALN45`,values:{shareBranch:T}}),t[145]=g,t[146]=T,t[147]=a):a=t[147],N=a;let o;t[148]===g?o=t[149]:(o=g({id:`VTulZj`}),t[148]=g,t[149]=o),K=o;let ie=v.phase===`loading`,se=v.phase===`error`;A=oe,U=!0,t[150]===D?W=t[151]:(W=e=>{e||D()},t[150]=D,t[151]=W),k=ne,R=`sm:max-w-xl`,z=`share-branch-switch-dialog`,B=De,V=Ee;let s;t[152]===x?s=t[153]:(s=(0,h.jsx)(te,{children:(0,h.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:x}})}),t[152]=x,t[153]=s);let ce=S.owner,le=S.repo,l;t[154]===S.target?l=t[155]:(l=u(S.target),t[154]=S.target,t[155]=l);let d;t[156]!==S.owner||t[157]!==S.repo||t[158]!==l?(d=(0,h.jsx)(ee,{className:`sr-only`,children:(0,h.jsx)(i,{id:`f8jU-L`,values:{0:ce,1:le,2:l}})}),t[156]=S.owner,t[157]=S.repo,t[158]=l,t[159]=d):d=t[159],t[160]!==s||t[161]!==d?(H=(0,h.jsxs)(ae,{children:[s,d]}),t[160]=s,t[161]=d,t[162]=H):H=t[162],O=re;let f=S.owner,ue=S.repo,p;t[163]===S.target?p=t[164]:(p=u(S.target),t[163]=S.target,t[164]=p),t[165]!==S.branch||t[166]!==S.owner||t[167]!==S.repo||t[168]!==S.target.kind||t[169]!==p?(F=(0,h.jsx)(`div`,{className:`mb-4`,children:(0,h.jsx)(de,{owner:f,repo:ue,path:p,kind:S.target.kind,branch:S.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[165]=S.branch,t[166]=S.owner,t[167]=S.repo,t[168]=S.target.kind,t[169]=p,t[170]=F):F=t[170],I=v.phase===`branch-in-other-worktree`?(0,h.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,h.jsx)(`p`,{className:`leading-6`,children:(0,h.jsx)(i,{id:`yjExfe`,values:{shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,h.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:v.otherWorktreePath})]}):v.phase===`verdict-pending`?(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`c8jBgX`})]}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,h.jsx)(i,{id:`Uay5NL`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`renamed`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,h.jsx)(i,{id:`P0HC30`,values:{0:v.resolution.renamedTo,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`diverged`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,h.jsx)(i,{id:`kLv8d3`,values:{shareBranch:T,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`c8jBgX`})]}):ie?(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`jerqF0`})]}):se?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,h.jsx)(i,{id:`w4hMYl`})}):G?.kind===`D`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`DTI-fp`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):G?.kind===`B`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`sZ2IOu`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`_902BE`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),L=G&&!G.switchEnabled&&G.conflictingFiles.length>0?(0,h.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,h.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,h.jsx)(i,{id:`n2lRue`})}),(0,h.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:G.conflictingFiles.map(Te)})]}):null,t[107]=g,t[108]=v.info,t[109]=v.otherWorktreePath,t[110]=v.phase,t[111]=v.resolution,t[112]=D,t[113]=w,t[114]=S.branch,t[115]=S.owner,t[116]=S.repo,t[117]=S.target,t[118]=T,t[119]=x,t[120]=O,t[121]=k,t[122]=A,t[123]=j,t[124]=M,t[125]=N,t[126]=P,t[127]=F,t[128]=I,t[129]=L,t[130]=R,t[131]=z,t[132]=B,t[133]=V,t[134]=H,t[135]=U,t[136]=W,t[137]=G,t[138]=K}else O=t[120],k=t[121],A=t[122],j=t[123],M=t[124],N=t[125],P=t[126],F=t[127],I=t[128],L=t[129],R=t[130],z=t[131],B=t[132],V=t[133],H=t[134],U=t[135],W=t[136],G=t[137],K=t[138];let q;t[171]===P?q=t[172]:(q=P?(0,h.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`CU3AiE`})]}):null,t[171]=P,t[172]=q);let J;t[173]===j?J=t[174]:(J=j?(0,h.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`PZtgO0`})]}):null,t[173]=j,t[174]=J);let Y;t[175]!==O||t[176]!==F||t[177]!==I||t[178]!==L||t[179]!==q||t[180]!==J?(Y=(0,h.jsxs)(O,{children:[F,I,L,q,J]}),t[175]=O,t[176]=F,t[177]=I,t[178]=L,t[179]=q,t[180]=J,t[181]=Y):Y=t[181];let gt;t[182]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,h.jsx)(i,{id:`dEgA5A`}),t[182]=gt):gt=t[182];let X;t[183]===D?X=t[184]:(X=(0,h.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:D,"data-testid":`share-branch-switch-cancel`,children:gt}),t[183]=D,t[184]=X);let Z;t[185]!==v.phase||t[186]!==v.resolution||t[187]!==j||t[188]!==ot||t[189]!==nt||t[190]!==ft||t[191]!==mt||t[192]!==it||t[193]!==Qe||t[194]!==et||t[195]!==M||t[196]!==N||t[197]!==P||t[198]!==G||t[199]!==K?(Z=v.phase===`branch-in-other-worktree`?(0,h.jsx)(o,{onClick:mt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,h.jsx)(i,{id:`hyCxJY`})}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsxs)(o,{onClick:et,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(i,{id:`uA_jXp`})]}):v.resolution.kind===`renamed`?(0,h.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(i,{id:`AItsE5`})]}):v.resolution.kind===`diverged`?(0,h.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]}):null:(0,h.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[G?.openCurrentEnabled?(0,h.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ot,disabled:P||j,"data-testid":`share-branch-switch-open-current`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),M]}):null,(0,h.jsx)(o,{variant:`outline`,onClick:Qe,disabled:!G?.switchEnabled||P||j,"aria-disabled":!G?.switchEnabled||P||j,"aria-describedby":G&&!G.switchEnabled&&G.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:P?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),N]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]})}),(0,h.jsx)(o,{onClick:ft,disabled:!G||P||j,"data-testid":`share-branch-switch-worktree`,children:j?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),K]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),K]})})]}),t[185]=v.phase,t[186]=v.resolution,t[187]=j,t[188]=ot,t[189]=nt,t[190]=ft,t[191]=mt,t[192]=it,t[193]=Qe,t[194]=et,t[195]=M,t[196]=N,t[197]=P,t[198]=G,t[199]=K,t[200]=Z):Z=t[200];let Q;t[201]!==X||t[202]!==Z?(Q=(0,h.jsxs)(ie,{className:`sm:justify-between`,children:[X,Z]}),t[201]=X,t[202]=Z,t[203]=Q):Q=t[203];let $;t[204]!==k||t[205]!==R||t[206]!==z||t[207]!==B||t[208]!==V||t[209]!==H||t[210]!==Y||t[211]!==Q?($=(0,h.jsxs)(k,{className:R,"data-testid":z,onInteractOutside:B,onPointerDownOutside:V,children:[H,Y,Q]}),t[204]=k,t[205]=R,t[206]=z,t[207]=B,t[208]=V,t[209]=H,t[210]=Y,t[211]=Q,t[212]=$):$=t[212];let _t;return t[213]!==A||t[214]!==U||t[215]!==W||t[216]!==$?(_t=(0,h.jsx)(A,{open:U,onOpenChange:W,children:$}),t[213]=A,t[214]=U,t[215]=W,t[216]=$,t[217]=_t):_t=t[217],_t}function Te(e){return(0,h.jsx)(`li`,{children:(0,h.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Ee(e){e.preventDefault()}function De(e){e.preventDefault()}function Oe(e){return Se(e,null).state}function ke(e){return xe(e,null)}function Ae(e){return ge(e,null)}function je(){return null}export{g as ShareBranchSwitchDialog};
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{n as o}from"./createLucideIcon-BPhNPfG7.js";import{a as ee,c as te,i as ne,n as re,o as ie,s as ae,t as oe}from"./dialog-CZK_GJbX.js";import{n as se,t as s}from"./git-branch-Bb5seqP3.js";import{t as c}from"./loader-circle-Cu01Ckhe.js";import{n as ce,t as le}from"./miss-dialog-store-DxVemLe3.js";import{n as l}from"./dist-K3kyyBcW.js";import{t as u}from"./desktop-bridge-types-DUvVV0tT.js";import{n as d}from"./worktree-store-CLuGV1SL.js";import{a as f,n as ue}from"./receive-store-DIQKaDkz.js";import{t as de}from"./share-metadata-rows-VY-5eTfA.js";var p=e(t(),1),fe=r();function pe(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function me(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function m(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var he={phase:`loading`};function ge(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function _e(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ve(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ye(e){return pe(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function be(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function xe(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function Se(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=m(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function Ce(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason}}:{state:e}}var h=n();function we(e){return e!==null&&e.kind===`project-branch-switch`}function g(e){let t=(0,fe.c)(217),{bridge:n,store:r}=e,m=r===void 0?ue:r,{_:g}=a(),_=(0,p.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[v,y]=(0,p.useState)(he),Me=(0,p.useRef)(!1),Ne=(0,p.useRef)(!1),Pe=(0,p.useRef)(!1),Fe=(0,p.useRef)(null),Ie;t[0]===_?Ie=t[1]:(Ie=we(_)?_:null,t[0]=_,t[1]=Ie);let b=Ie,Le;t[2]!==g||t[3]!==b?.share.target.kind?(Le=b?.share.target.kind===`folder`?g({id:`ugoTXs`}):g({id:`XH30C4`}),t[2]=g,t[3]=b?.share.target.kind,t[4]=Le):Le=t[4];let x=Le,Re;t[5]===b?Re=t[6]:(Re=()=>{y(he),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=b},t[5]=b,t[6]=Re);let ze;t[7]===_?ze=t[8]:(ze=[_],t[7]=_,t[8]=ze),(0,p.useEffect)(Re,ze);let Be;t[9]!==b||t[10]!==n?(Be=()=>{if(!b||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{e||y(e=>ge(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),y(Ae))}),()=>{e=!0}},t[9]=b,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===b?Ve=t[13]:(Ve=[b],t[12]=b,t[13]=Ve),(0,p.useEffect)(Be,Ve);let He;t[14]!==b||t[15]!==v.info||t[16]!==v.phase||t[17]!==n?(He=()=>{if(!b||v.phase!==`ready`||Pe.current||!ye(v.info))return;Pe.current=!0,y(be);let e=b;n.project.fetchTargetStatus({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{Fe.current===e&&y(e=>xe(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),y(ke))})},t[14]=b,t[15]=v.info,t[16]=v.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==b||t[20]!==v.phase?(Ue=[v.phase,b],t[19]=b,t[20]=v.phase,t[21]=Ue):Ue=t[21],(0,p.useEffect)(He,Ue);let We;t[22]!==b||t[23]!==v.phase||t[24]!==v.resolution||t[25]!==m?(We=()=>{if(v.phase!==`verdict`)return;let{kind:e}=v.resolution;e!==`deleted`&&e!==`never-on-branch`||b&&(le.arm({kind:b.share.target.kind,path:u(b.share.target),branch:b.share.branch}),m.dismiss())},t[22]=b,t[23]=v.phase,t[24]=v.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==b||t[28]!==v||t[29]!==m?(Ge=[v,b,m],t[27]=b,t[28]=v,t[29]=m,t[30]=Ge):Ge=t[30],(0,p.useEffect)(We,Ge);let Ke;t[31]!==v.phase||t[32]!==v.resolution?(Ke=()=>{v.phase===`verdict`&&console.log(f({verdict_cell:v.resolution.kind}))},t[31]=v.phase,t[32]=v.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===v?qe=t[35]:(qe=[v],t[34]=v,t[35]=qe),(0,p.useEffect)(Ke,qe);let Je;t[36]!==g||t[37]!==b||t[38]!==v.pendingDoc||t[39]!==v.phase||t[40]!==n||t[41]!==m||t[42]!==x?(Je=()=>{if(v.phase!==`awaiting-cc1-recycle`||!b)return;let e=b.share.branch,t=v.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:b.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(f({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:b.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:b.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),l.error(g({id:`gQV-9w`,values:{targetNoun:x}}))}),m.dismiss();return}console.log(f({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(g({id:`LBwUR6`,values:{targetNoun:x}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(g({id:`Jw6EC4`,values:{targetNoun:x}})),m.dismiss())}),()=>{r=!0}},t[36]=g,t[37]=b,t[38]=v.pendingDoc,t[39]=v.phase,t[40]=n,t[41]=m,t[42]=x,t[43]=Je):Je=t[43];let Ye;if(t[44]!==b||t[45]!==v.phase?(Ye=[v.phase,b],t[44]=b,t[45]=v.phase,t[46]=Ye):Ye=t[46],(0,p.useEffect)(Je,Ye),!b)return null;let{share:S,projectPath:C,currentBranch:w}=b,T=S.branch,Xe;t[47]!==g||t[48]!==n.project||t[49]!==C||t[50]!==T||t[51]!==m?(Xe=function(e,t,r){console.log(f({branch_dialog_action:`switch`,branch_action:`switch`,branch:T,verdict_cell:r})),y(t=>_e(t,e)),n.project.runCheckout(t?{projectPath:C,branch:T,fastForward:!0}:{projectPath:C,branch:T}).then(e=>{let t=null,n=!1;y(r=>{let{state:i,sideEffect:a}=Se(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?l.error(g({id:`NJyQi_`,values:{shareBranch:T}})):t===`fetch-failed`?l.error(g({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&l.error(g({id:`c863eW`,values:{shareBranch:T}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),y(Oe),l.error(g({id:`c863eW`,values:{shareBranch:T}}))})},t[47]=g,t[48]=n.project,t[49]=C,t[50]=T,t[51]=m,t[52]=Xe):Xe=t[52];let E=Xe,Ze;t[53]!==v.info||t[54]!==v.phase||t[55]!==E||t[56]!==S.target?(Ze=function(){v.phase===`ready`&&pe(v.info).switchEnabled&&E(u(S.target),!1)},t[53]=v.info,t[54]=v.phase,t[55]=E,t[56]=S.target,t[57]=Ze):Ze=t[57];let Qe=Ze,$e;t[58]!==v.phase||t[59]!==v.resolution||t[60]!==E||t[61]!==S.target?($e=function(){v.phase===`verdict`&&E(u(S.target),!0,v.resolution.kind)},t[58]=v.phase,t[59]=v.resolution,t[60]=E,t[61]=S.target,t[62]=$e):$e=t[62];let et=$e,tt;t[63]!==v.phase||t[64]!==v.resolution||t[65]!==E?(tt=function(){v.phase===`verdict`&&v.resolution.kind===`renamed`&&E(v.resolution.renamedTo,!0,v.resolution.kind)},t[63]=v.phase,t[64]=v.resolution,t[65]=E,t[66]=tt):tt=t[66];let nt=tt,rt;t[67]!==v.phase||t[68]!==v.resolution||t[69]!==E||t[70]!==S.target?(rt=function(){v.phase===`verdict`&&E(u(S.target),!1,v.resolution.kind)},t[67]=v.phase,t[68]=v.resolution,t[69]=E,t[70]=S.target,t[71]=rt):rt=t[71];let it=rt,at;t[72]!==g||t[73]!==n.project||t[74]!==C||t[75]!==S.target||t[76]!==T||t[77]!==m||t[78]!==x?(at=function(){console.log(f({branch_dialog_action:`open-current`,branch:T})),n.project.open({path:C,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),l.error(g({id:`b5aNbi`,values:{targetNoun:x}}))}),m.dismiss()},t[72]=g,t[73]=n.project,t[74]=C,t[75]=S.target,t[76]=T,t[77]=m,t[78]=x,t[79]=at):at=t[79];let ot=at,st;t[80]!==g||t[81]!==T?(st=function(e){switch(e){case`branch-not-found`:l.error(g({id:`NJyQi_`,values:{shareBranch:T}}));return;case`fetch-failed`:l.error(g({id:`bWLmRK`}));return;case`already-checked-out`:l.error(g({id:`ljHjfg`}));return;case`branch-exists`:l.error(g({id:`h3QZcB`,values:{shareBranch:T}}));return;case`path-exists`:l.error(g({id:`cN1Gcp`,values:{shareBranch:T}}));return;case`no-git`:l.error(g({id:`CFnavk`}));return;case`invalid-branch`:l.error(g({id:`JfPuv7`,values:{shareBranch:T}}));return;case`proxy-null`:case`error`:l.error(g({id:`e8zYa8`,values:{shareBranch:T}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=g,t[81]=T,t[82]=st):st=t[82];let ct=st,lt;t[83]!==g||t[84]!==n.project||t[85]!==S.target||t[86]!==T||t[87]!==ct||t[88]!==m?(lt=function(e){let t=null,r=!1,i=null;if(y(n=>{let{state:a,sideEffect:o}=Ce(n,e);return o&&(t=o.reason,r=a.phase===`dismissed`),a.phase===`opening-worktree`&&(i=a.path),a}),t!==null&&(console.log(f({branch_dialog_action:`open-worktree-failed:${t}`,branch:T})),ct(t)),i!==null){d();let e=i;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}r&&m.dismiss()},t[83]=g,t[84]=n.project,t[85]=S.target,t[86]=T,t[87]=ct,t[88]=m,t[89]=lt):lt=t[89];let ut=lt,dt;t[90]!==ut||t[91]!==v.phase||t[92]!==n.worktree||t[93]!==T?(dt=function(){v.phase===`ready`&&(console.log(f({branch_dialog_action:`open-worktree`,branch:T})),y(ve),n.worktree.checkout({branch:T}).then(e=>{ut(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ut(null)}))},t[90]=ut,t[91]=v.phase,t[92]=n.worktree,t[93]=T,t[94]=dt):dt=t[94];let ft=dt,pt;t[95]!==g||t[96]!==v.otherWorktreePath||t[97]!==v.phase||t[98]!==n.project||t[99]!==S.target||t[100]!==T||t[101]!==m?(pt=function(){if(v.phase!==`branch-in-other-worktree`)return;let e=v.otherWorktreePath;console.log(f({branch_dialog_action:`pivot-to-other-worktree`,branch:T})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=g,t[96]=v.otherWorktreePath,t[97]=v.phase,t[98]=n.project,t[99]=S.target,t[100]=T,t[101]=m,t[102]=pt):pt=t[102];let mt=pt,ht;t[103]!==v.phase||t[104]!==v.resolution||t[105]!==m?(ht=function(){console.log(f({branch_dialog_action:`cancel`,verdict_cell:v.phase===`verdict`?v.resolution.kind:void 0})),m.dismiss()},t[103]=v.phase,t[104]=v.resolution,t[105]=m,t[106]=ht):ht=t[106];let D=ht,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K;if(t[107]!==g||t[108]!==v.info||t[109]!==v.otherWorktreePath||t[110]!==v.phase||t[111]!==v.resolution||t[112]!==D||t[113]!==w||t[114]!==S.branch||t[115]!==S.owner||t[116]!==S.repo||t[117]!==S.target||t[118]!==T||t[119]!==x){G=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?pe(v.info):null;let e;t[139]!==v.info||t[140]!==v.phase||t[141]!==w?(e=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?me(v.info):w??`HEAD`,t[139]=v.info,t[140]=v.phase,t[141]=w,t[142]=e):e=t[142];let n=e;P=v.phase===`switching`||v.phase===`awaiting-cc1-recycle`,j=v.phase===`creating-worktree`;let r;t[143]===g?r=t[144]:(r=g({id:`OuY8t9`}),t[143]=g,t[144]=r),M=r;let a;t[145]===g?a=t[146]:(a=g({id:`XZkdtg`}),t[145]=g,t[146]=a),N=a;let o;t[147]===g?o=t[148]:(o=g({id:`VTulZj`}),t[147]=g,t[148]=o),K=o;let ie=v.phase===`loading`,se=v.phase===`error`;A=oe,U=!0,t[149]===D?W=t[150]:(W=e=>{e||D()},t[149]=D,t[150]=W),k=ne,R=`sm:max-w-xl`,z=`share-branch-switch-dialog`,B=De,V=Ee;let s;t[151]===x?s=t[152]:(s=(0,h.jsx)(te,{children:(0,h.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:x}})}),t[151]=x,t[152]=s);let ce=S.owner,le=S.repo,l;t[153]===S.target?l=t[154]:(l=u(S.target),t[153]=S.target,t[154]=l);let d;t[155]!==S.owner||t[156]!==S.repo||t[157]!==l?(d=(0,h.jsx)(ee,{className:`sr-only`,children:(0,h.jsx)(i,{id:`f8jU-L`,values:{0:ce,1:le,2:l}})}),t[155]=S.owner,t[156]=S.repo,t[157]=l,t[158]=d):d=t[158],t[159]!==s||t[160]!==d?(H=(0,h.jsxs)(ae,{children:[s,d]}),t[159]=s,t[160]=d,t[161]=H):H=t[161],O=re;let f=S.owner,ue=S.repo,p;t[162]===S.target?p=t[163]:(p=u(S.target),t[162]=S.target,t[163]=p),t[164]!==S.branch||t[165]!==S.owner||t[166]!==S.repo||t[167]!==S.target.kind||t[168]!==p?(F=(0,h.jsx)(`div`,{className:`mb-4`,children:(0,h.jsx)(de,{owner:f,repo:ue,path:p,kind:S.target.kind,branch:S.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=S.branch,t[165]=S.owner,t[166]=S.repo,t[167]=S.target.kind,t[168]=p,t[169]=F):F=t[169],I=v.phase===`branch-in-other-worktree`?(0,h.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,h.jsx)(`p`,{className:`leading-6`,children:(0,h.jsx)(i,{id:`yjExfe`,values:{shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,h.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:v.otherWorktreePath})]}):v.phase===`verdict-pending`?(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`c8jBgX`})]}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,h.jsx)(i,{id:`Uay5NL`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`renamed`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,h.jsx)(i,{id:`P0HC30`,values:{0:v.resolution.renamedTo,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`diverged`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,h.jsx)(i,{id:`kLv8d3`,values:{shareBranch:T,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`c8jBgX`})]}):ie?(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`jerqF0`})]}):se?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,h.jsx)(i,{id:`w4hMYl`})}):G?.kind===`D`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`DTI-fp`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):G?.kind===`B`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`sZ2IOu`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`_902BE`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),L=G&&!G.switchEnabled&&G.conflictingFiles.length>0?(0,h.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,h.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,h.jsx)(i,{id:`n2lRue`})}),(0,h.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:G.conflictingFiles.map(Te)})]}):null,t[107]=g,t[108]=v.info,t[109]=v.otherWorktreePath,t[110]=v.phase,t[111]=v.resolution,t[112]=D,t[113]=w,t[114]=S.branch,t[115]=S.owner,t[116]=S.repo,t[117]=S.target,t[118]=T,t[119]=x,t[120]=O,t[121]=k,t[122]=A,t[123]=j,t[124]=M,t[125]=N,t[126]=P,t[127]=F,t[128]=I,t[129]=L,t[130]=R,t[131]=z,t[132]=B,t[133]=V,t[134]=H,t[135]=U,t[136]=W,t[137]=G,t[138]=K}else O=t[120],k=t[121],A=t[122],j=t[123],M=t[124],N=t[125],P=t[126],F=t[127],I=t[128],L=t[129],R=t[130],z=t[131],B=t[132],V=t[133],H=t[134],U=t[135],W=t[136],G=t[137],K=t[138];let q;t[170]===P?q=t[171]:(q=P?(0,h.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`CU3AiE`})]}):null,t[170]=P,t[171]=q);let J;t[172]===j?J=t[173]:(J=j?(0,h.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`PZtgO0`})]}):null,t[172]=j,t[173]=J);let Y;t[174]!==O||t[175]!==F||t[176]!==I||t[177]!==L||t[178]!==q||t[179]!==J?(Y=(0,h.jsxs)(O,{children:[F,I,L,q,J]}),t[174]=O,t[175]=F,t[176]=I,t[177]=L,t[178]=q,t[179]=J,t[180]=Y):Y=t[180];let gt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,h.jsx)(i,{id:`dEgA5A`}),t[181]=gt):gt=t[181];let X;t[182]===D?X=t[183]:(X=(0,h.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:D,"data-testid":`share-branch-switch-cancel`,children:gt}),t[182]=D,t[183]=X);let Z;t[184]!==v.phase||t[185]!==v.resolution||t[186]!==j||t[187]!==ot||t[188]!==nt||t[189]!==ft||t[190]!==mt||t[191]!==it||t[192]!==Qe||t[193]!==et||t[194]!==M||t[195]!==N||t[196]!==P||t[197]!==G||t[198]!==K?(Z=v.phase===`branch-in-other-worktree`?(0,h.jsx)(o,{onClick:mt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,h.jsx)(i,{id:`hyCxJY`})}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsxs)(o,{onClick:et,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(i,{id:`uA_jXp`})]}):v.resolution.kind===`renamed`?(0,h.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(i,{id:`AItsE5`})]}):v.resolution.kind===`diverged`?(0,h.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]}):null:(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[G?.openCurrentEnabled?(0,h.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ot,disabled:P||j,"data-testid":`share-branch-switch-open-current`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),M]}):null,(0,h.jsx)(o,{variant:`outline`,onClick:Qe,disabled:!G?.switchEnabled||P||j,"aria-disabled":!G?.switchEnabled||P||j,"aria-describedby":G&&!G.switchEnabled&&G.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:P?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),N]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]})}),(0,h.jsx)(o,{onClick:ft,disabled:!G||P||j,"data-testid":`share-branch-switch-worktree`,children:j?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),K]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),K]})})]}),t[184]=v.phase,t[185]=v.resolution,t[186]=j,t[187]=ot,t[188]=nt,t[189]=ft,t[190]=mt,t[191]=it,t[192]=Qe,t[193]=et,t[194]=M,t[195]=N,t[196]=P,t[197]=G,t[198]=K,t[199]=Z):Z=t[199];let Q;t[200]!==X||t[201]!==Z?(Q=(0,h.jsxs)(ie,{className:`sm:justify-between`,children:[X,Z]}),t[200]=X,t[201]=Z,t[202]=Q):Q=t[202];let $;t[203]!==k||t[204]!==R||t[205]!==z||t[206]!==B||t[207]!==V||t[208]!==H||t[209]!==Y||t[210]!==Q?($=(0,h.jsxs)(k,{className:R,"data-testid":z,onInteractOutside:B,onPointerDownOutside:V,children:[H,Y,Q]}),t[203]=k,t[204]=R,t[205]=z,t[206]=B,t[207]=V,t[208]=H,t[209]=Y,t[210]=Q,t[211]=$):$=t[211];let _t;return t[212]!==A||t[213]!==U||t[214]!==W||t[215]!==$?(_t=(0,h.jsx)(A,{open:U,onOpenChange:W,children:$}),t[212]=A,t[213]=U,t[214]=W,t[215]=$,t[216]=_t):_t=t[216],_t}function Te(e){return(0,h.jsx)(`li`,{children:(0,h.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Ee(e){e.preventDefault()}function De(e){e.preventDefault()}function Oe(e){return Se(e,null).state}function ke(e){return xe(e,null)}function Ae(e){return ge(e,null)}function je(){return null}export{g as ShareBranchSwitchDialog};